You can add ABAP Code in SAP Query report to enhance your report, Open your infoset via tcode SQ02 and click Extras button toolbar.


You can choose any event depend on your requirement to add your ABAP Code.


These are the explanation for Event in listbox Code Section :

  • DATA Section :

       Global Data Declaration will go under this Event.


As the name suggests it is used to initialize the variable with initial values.


This event is triggered before the display of selection screen.


This event is triggered before starting any database accesses. Usually Data fetching logic goes under it.

  • RECORD Processing :

Corresponds to the GET coding with Info-sets without a logical database. As there is no hierarchical view of the data, all the join tables are addressed.


The END-OF-SELECTION code consists of two parts (Before list output and After list output). The first part is processed before the list is output and the  second  part afterwards. It is the right section to do aggregated calculations and actions that can only be done when data from all the selected records has been extracted.

For Example Case :

Add Variable Declaration in DATA code section event.

<GI00> is the Internal table which contain result data that to be displayed on report. you can modify this internal table.



Incoming search terms:

abap sq02 coding,sap query with abap code,abap sq02 tutorial,adding code to sap queries,query code sap,INSERIRE CODICE ABAP NELLE QUERY SAP,how to write abap in sq02,how to add table in extras in sap query,how to add ABAP code in SAP QUERY,WHERE TO ADD CODES IN QUERY