Category Archives for "ABAP"

ABAP report of pernrs and email output as PDF ABAP

Useful ABAP code example to demonstrate how to display an SAP ALV report and then email the output as a PDF document. The code covers the following SAP ABAP report functionality:

  • Email address input selection screen fields
  • Display ALV report using Objects cl_salv_table
  • Add custom ALV column header
  • Change colour of ALV rows based on user start year
  • Get ALV Spool from background execution
  • Convert Spool to PDF and send as Email
  • Submit an ABAP report in background
  • ABAP report submits itself in background to create spool
  • Pass parameter and select option to report submit
  • Delete SAP spool request


Click here for ABAP code and more info

View SAP Query ABAP program created

When working with SAP queries it is often useful to have a look at the ABAP code it generates. This could be to either use it as a basis for a new report or just to see what is going on. You can also use this information to assign a transaction code to your infoset query. Once you have the ABAP program associated you can assign a t-code in the same way you would assign any transaction code to an ABAP report.

I always used to do this by searching for an ABAP program/report containing the name of your query. This is done by simply adding an asterisk either side of your query name (i.e. *MYQUERY*), entering this into transaction SE38 or SE80 and using the F4 value help option. The name of your query will then appear in the hit list, it will be something like AQL4*======MYQUERY===.

A much better way would be to  view the name via SQ01 using menu option   Query->More functions->Display report name. You can also create the report using menu option Query->More functions->Generate program.


SAP Function Module tables parameter

Using the tables parameter is obsolete and SAP does not really support this any more. You can add a table type parameter to the changing or exporting section which should work fine but this method is not supported by some older versions of some extraction tools such as XtractIS.

Creating a TABLES parameter


Notice the LIKE option is not available from the drop down any more but you can still use it and ZMY_DATASTRUC must not contain a filed of type string otherwise you will get the FL389 error

Compare two ABAP objects using SE39 Split screen editor

Transaction SE39 is useful if you want edit two programs at the same time or if you just want to compare two ABAP objects on one screen. Once you have two objects loaded into the views you can turn compare mode on and it will highlight any differences, which you can step through one at a time.

Step 1 - Select two ABAP objects in SE39

First you simply need to execute t-code SE39 and choose the 2 objects you want to view/edit/compare i.e. I have created a copy of BAPI_EMPATTABS_GETDETAIL called ZBAPI_EMPATTABS_GETDETAIL and entered both of these into the selection screen.


Step 2 - View two ABAP objects alongside each other
On the next screen you will see the two entered objects alongside each other in View/Change mode depending which button you pressed.



Step 3 - Compare mode
In-order to compare the two objects simply click the “Compare On” button and any changes will be highlighted with a red and white not equals sign. As you can see when I copied this function module and changed the language it has slightly altered the signature lines so they arte highlighted as being different. The code its self remains the same so are not highlighted.


Display URL in SAP ABAP report using class method

REPORT  Zdisplay_url. 

    URL          = ''
*    TITLE        =
*    MODAL        = ABAP_TRUE
*    CONTAINER    =

Payroll control record PA03

The payroll information displayed via transaction PA03 is stored within tables T569V, T549A and T549Q. They can also be retrieved using Function module PA03_PCR_READ

Another useful function module could be HR_MX_GET_PAYROLL_PERIOD which retrieves payroll period dates based on current date, irrespective of what is set in SAP transaction PA03.

PAYROLL_AREA         = ld_abkrs
*   DATE                                = SY-DATUM
*   PAYROLL_YEAR         =
PERIOD_BEGIN              = ld_start
PERIOD_END                  = ld_end.