How to make the SAP system fit for report execution

Published in sap

How to make the SAP system fit for report execution

December 15, 2022 3 mins read

Peakboard supports a lot of different object types that you can access in SAP. Besides RFC function modules, queries, tables, and MDX commands, it is also possible to execute and process ABAP reports. In order to do so, it’s necessary to install a small, generic function module in the SAP system. This article explains how to do this.

First, log in to SAP with a user who has development rights and who can install ABAP code. During the process, you will need to provide a development class, and eventually, a transport request to put your new objects in. If you don’t know how to do this, please ask a coworker or Google.

Feel free to adjust the name of the function module or the name of the DDIC structure as needed (e.g. according to a company’s namespace).

Setting up the DDIC structure

First, go to transaction SE11. Create a new DDIC structure with the name ZTAB1024, and with one component, as shown in the screenshot. Save and activate the object.

image

Setting up the function module

In transaction SE37 or transaction SE80, create a new function module with the name Z_XTRACT_IS_REMOTE_REPORT. Make sure that it has RFC enabled.

image

Here are the import parameters to be added. Feel free to just copy and paste them. There may be a warning saying that it is not recommended to use LIKE parameters. Just ignore this warning and hit Enter.

PROGRAM_NAME	LIKE	RPY_PROG-PROGNAME	                     
ACTIONID	LIKE	RPY_PROG-PROG_TYPE	'0'
VARIANT	LIKE	AQADEF-VARI	                     
JOBNAME	LIKE	TBTCJOB-JOBNAME	'XTRACT'
SPOOLID	LIKE	TSP01-RQIDENT	                     
JOBCOUNT	LIKE	TBTCP-JOBCOUNT	                     
SPOOLDESTINATION	LIKE	PRI_PARAMS-PDEST	'LOCL'`

image

Here are the export parameters:

JOBNUMBER	LIKE	TBTCJOB-JOBCOUNT
JOBSPOOLID	LIKE	TBTCP-LISTIDENT
JOBSTATUS	LIKE	TBTCO-STATUS`

image

And here are the tables. Please note that the second parameter refers to the new DDIC structure.

SELECTION_TABLE	LIKE	RSPARAMS
LIST_OUTPUT	LIKE	ZTAB1024
TEXTELEMENTS	LIKE	TEXTPOOL`

image

And here are the exceptions:

REPORT_NOT_FOUND
LIST_FROM_MEMORY_NOT_FOUND
LIST_FROM_MEMORY_OTHERS
LIST_TO_ASCI_EMPTY
LIST_TO_ASCT_INDEX_INVALID
LIST_TO_ASCT_OTHERS
REFRESH_FROM_SELECTOPTIONS
RPY_PROGRAM_READ_FAILURE
NOT_AUTHORIZED
JOB_CLOSE_EXCEPTION
JOB_OPEN_EXCEPTION
JOBID_NOT_FOUND_EXCEPTION
JOBSTATUS_NOT_FOUND_EXCEPTION`

image

For the source code, please refer to this file.

image

Finally, make sure to save and activate the function module.

Use the RFC function in XQL

Now that you’ve successfully installed the function module, you can use it in your XQL statements. This example shows how you can call a simple report with a variant.

EXECUTE REPORT 'RLT10010' USING 'VAR01'

image

If you chose to use your own name or namespace, just add the With-Options extension, as shown in this example:

EXECUTE REPORT 'RQMELL10' USING 'OFFEN'
With-Options (CustomFunction = 'Z_MY_REPORT_FUNCTION')