I want to show the functionality of an SAP program (transaction) as a BAPI. I need to call the report and feed range filters to exclude the GUI.
Does anyone have a working example of a SUBMIT ... WITH ... ABAP construct or other suggestions on how to accomplish what I need to do?
Here is a working example:
SUBMIT SAPF140 TO SAP-SPOOL "optional" SPOOL PARAMETERS print_parameters "optional" WITHOUT SPOOL DYNPRO "optional (hides the spool pop-up)" VIA JOB jobname NUMBER l_number "optional" AND RETURN "optional - returns to the calling prog" WITH EVENT = REVENT WITH BUKRS IN RBUKRS WITH BELNR IN lRBELNR WITH GJAHR IN RGJAHR WITH USNAM = SY-UNAME WITH DATUM = SAVE_DATUM WITH UZEIT = SAVE_UZEIT WITH DELDAYS = RDELDAYS WITH KAUTO = 'X' WITH RPDEST = SAVE_PDEST WITH TITLE = TITLE.
All "WITH" statements refer to selection fields in the called program, where I use = this is the PARAMETER statement (single field), where I use IN, this is the SELECT_OPTIONS statement (range)
Here is a simple example of how to fill a range:
REFRESH lrbelnr. lrbelnr-sign = 'I'. lrbelnr-option = 'EQ'. lrbelnr-low = HBKORM-belnr. CLEAR lrbelnr-high. append lrbelnr.
BAPI, (RFC). RFC. , , ABAP, RFC. , . , , BAPI . SAP, , . , SAP , . . , , , RFC.
. , . , , - "" RFC, RFC-. , , , , BAPI. , , RFC . . , , , RFC- , , . .
, , , , .
You can use the built-in BAPIs also just write βRangeβ and press F4.
You can wrap your report in a BATCH INPUT session and execute it inside a function. The only drawback is that you need to rewrite BATCH INPUT every time you change the report.