Friday, August 7, 2015

Bypassing Buffer in Select

One of an important feature of open SQL is that it fetches the data records from the buffer of SAP system. Now fetching records directly from database may take time. Hence performance will go down. That’s why SQL fetches data from buffer.

Now if the database table changes frequently (table like transaction table) then it will be a problem to select updated data which will not be present in buffer. To avoid this problem SAP system has introduced the BYPASSING BUFFER clause in the select statement after from clause. This statement ensures that the records are updated data records fetched from the database.

REPORT  zabap_gui.

TABLES: kna1.

* Local structure for local internal table
* and work area
TYPES:
       BEGIN OF ty_kna1,
         kunnr TYPE kna1-kunnr,
         land1 TYPE kna1-land1,
         name1 TYPE kna1-name1,
         ort01 TYPE kna1-ort01,
         pstlz TYPE kna1-pstlz,
         regio TYPE kna1-regio,
       END OF ty_kna1.

* Local internal table & work area
DATA:
      it_kna1 TYPE TABLE OF ty_kna1,
      wa_kna1 TYPE ty_kna1.

* Selection range by select option internal table
SELECT-OPTIONS: s_kunnr FOR kna1-kunnr.

START-OF-SELECTION.

* Selection of the specific fields
  SELECT kunnr land1 name1 ort01 pstlz regio
    INTO TABLE it_kna1 FROM kna1
    BYPASSING BUFFER "it ensures that the system fetches
                     "data directly from the database
                     "not from the buffer
    WHERE kunnr IN s_kunnr.

  IF sy-subrc = 0.
    WRITE:
           /5 'Customer No',
           14 'Country',
           24 'Name',
           60 'City',
          100 'Postal',
          112 'Region'.
    ULINE.
    SKIP.

    LOOP AT it_kna1 INTO wa_kna1.
      WRITE:
              /5 wa_kna1-kunnr,
              14 wa_kna1-land1,
              24 wa_kna1-name1,
              60 wa_kna1-ort01,
             100 wa_kna1-pstlz,
             112 wa_kna1-regio.
    ENDLOOP.
  ENDIF.

Here is the output.













3 comments:

Anonymous said...

SAP Success Factors Real Time Hands on Training in Chennai...

Don't always Depend on Training Institute Alone and so please aware of Best Trainers too..

http://thecreatingexperts.com/sap-successfactors-training-in-chennai/

If You need a Best Trainer over SAP Success Factors Means??? Please ready for an DEMO From the Trainer MR.Karthick
CONTACT:8122241286

Both Classroom/Online Training is Available!!!!!!

kavi kalyan said...

Best SAP Success Factor Training in Chennai

http://thecreatingexperts.com/sap-training-in-chennai/
http://thecreatingexperts.com/sap-successfactors-training-in-chennai/
http://thecreatingexperts.com/sap-mm-training-in-chennai/
http://thecreatingexperts.com/sap-fico-training-in-chennai/

Anonymous said...

Informative Blog...For a long time I was craving for a career growth in programming and then I came to know that THE CREATING EXPERTS is the one who provide training with hands on training and real time scenarios

http://thecreatingexperts.com/sap-abap-training-in-chennai/

contact 8122241286