SUBMIT Beispiele
Posted: Tue Jun 18, 2019 3:51 am
Die ABAP-Anweisung SUBMIT wird verwendet, um einen Report oder ein Programm aus Ihrem ABAP-Code heraus auszuführen.
Beispielsweise kann ein Benutzer innerhalb eines ALV-Ausgabeberichts auf eine Schaltfläche klicken oder eine bestimmte Taste drücken. Diese Aktion könnte dann einen zweiten Bericht ausführen, um weitere Details anzuzeigen oder zusätzliche Funktionen auszuführen. Bitte beachten Sie, dass Sie nur Reports vom Typ'1' (d.h. ausführbar) ausführen können
Beispielsweise kann ein Benutzer innerhalb eines ALV-Ausgabeberichts auf eine Schaltfläche klicken oder eine bestimmte Taste drücken. Diese Aktion könnte dann einen zweiten Bericht ausführen, um weitere Details anzuzeigen oder zusätzliche Funktionen auszuführen. Bitte beachten Sie, dass Sie nur Reports vom Typ'1' (d.h. ausführbar) ausführen können
- Code: [Select all] [Expand/Collapse] [Download] (Untitled.txt)
- *Code used to execute a report
- SUBMIT Zreport.
- *Code used to populate 'select-options' & execute report
- seltab_wa like line of seltab.
- seltab_wa-selname = 'PNPPERNR'.
- seltab_wa-sign = 'I'.
- seltab_wa-option = 'EQ'.
- * load each personnel number accessed from the structure into
- * parameters to be used in the report
- loop at pnppernr.
- seltab_wa-low = pnppernr-low.
- SUBMIT zreport with selection-table seltab
- via selection-screen.
- *Code used to populate 'parameters' & execute report
- with p_param2 = 'value'.
- *Submit report via its own selection screen
- *Submit report using selection screen variant
- *Submit report but export resultant list to memory, rather than
- *it being displayed on screen
- * Once report has finished and control has returned to calling
- * program, use function modules LIST_FROM_MEMORY, WRITE_LIST and
- * DISPLAY_LIST to retrieve and display report.
- *Example Code (Retrieving list from memory)
- INCLUDE STRUCTURE abaplist.
- filler1(01) TYPE c,
- field1(06) TYPE c,
- filler(08) TYPE c,
- field2(10) TYPE c,
- filler3(01) TYPE c,
- field3(10) TYPE c,
- filler4(01) TYPE c,
- field4(3) TYPE c,
- filler5(02) TYPE c,
- field5(15) TYPE c,
- filler6(02) TYPE c,
- field6(30) TYPE c,
- filler7(43) TYPE c,
- field7(10) TYPE c,
- END OF vlist.
- CALL FUNCTION 'LIST_FROM_MEMORY'
- listobject = itab_list
- EXCEPTIONS
- not_found = 4
- OTHERS = 8.
- CALL FUNCTION 'LIST_TO_ASCI'
- EXPORTING
- list_index = -1
- listasci = vlist
- listobject = itab_list
- EXCEPTIONS
- empty_list = 1
- list_index_invalid = 2
- OTHERS = 3.
- 'TRANSFER DATA'.
- host like msxxlist-host.
- include structure tbtcstrt.
- * Job open
- call function 'JOB_OPEN'
- exporting
- delanfrep = ' '
- jobgroup = ' '
- jobname = jobname
- sdlstrtdt = sy-datum
- sdlstrttm = sy-uzeit
- importing
- jobcount = jobcount
- exceptions
- cant_create_job = 01
- invalid_job_data = 02
- jobname_missing = 03.
- "error processing
- * Insert process into job
- SUBMIT zreport and return
- with p_param1 = 'value'
- with p_param2 = 'value'
- user sy-uname
- via job jobname
- number jobcount.
- "error processing
- * Close job
- starttime-sdlstrtdt = sy-datum + 1.
- starttime-sdlstrttm = '220000'.
- call function 'JOB_CLOSE'
- exporting
- " event_id = starttime-eventid
- " event_param = starttime-eventparm
- " event_periodic = starttime-periodic
- jobcount = jobcount
- jobname = jobname
- " laststrtdt = starttime-laststrtdt
- " laststrttm = starttime-laststrttm
- " prddays = 1
- " prdhours = 0
- " prdmins = 0
- " prdmonths = 0
- " prdweeks = 0
- " sdlstrtdt = starttime-sdlstrtdt
- " sdlstrttm = starttime-sdlstrttm
- strtimmed = starttimeimmediate
- " targetsystem = host
- exceptions
- cant_start_immediate = 01
- invalid_startdate = 02
- jobname_missing = 03
- job_close_failed = 04
- job_nosteps = 05
- job_notex = 06
- lock_failed = 07
- others = 99.
- "error processing
- host type msxxlist-host.
- print_parameters TYPE pri_params.
- seltab_wa like line of seltab,
- ld_pernr type pernr-pernr.
- seltab_wa-selname = 'SO_PERNR'.
- seltab_wa-sign = 'I'.
- seltab_wa-option = 'EQ'.
- seltab_wa-low = ld_pernr.
- * Job open
- call function 'JOB_OPEN'
- EXPORTING
- delanfrep = ' '
- jobgroup = ' '
- jobname = jobname
- sdlstrtdt = sy-datum
- sdlstrttm = sy-uzeit
- IMPORTING
- jobcount = jobcount
- EXCEPTIONS
- cant_create_job = 01
- invalid_job_data = 02
- jobname_missing = 03.
- *Setup print parameters
- *Only values used in example are to tell it not to print immediately
- *and not display a print dialog box)
- CALL FUNCTION 'GET_PRINT_PARAMETERS'
- EXPORTING
- * ARCHIVE_ID = C_CHAR_UNKNOWN
- * ARCHIVE_INFO = C_CHAR_UNKNOWN
- * ARCHIVE_MODE = C_CHAR_UNKNOWN
- * ARCHIVE_TEXT = C_CHAR_UNKNOWN
- * AR_OBJECT = C_CHAR_UNKNOWN
- * ARCHIVE_REPORT = C_CHAR_UNKNOWN
- * AUTHORITY = C_CHAR_UNKNOWN
- * COPIES = C_NUM3_UNKNOWN
- * COVER_PAGE = C_CHAR_UNKNOWN
- * DATA_SET = C_CHAR_UNKNOWN
- * DEPARTMENT = C_CHAR_UNKNOWN
- * DESTINATION = C_CHAR_UNKNOWN
- * EXPIRATION = C_NUM1_UNKNOWN
- IMMEDIATELY = ' ' " leave blank so is not sent to print
- * IN_ARCHIVE_PARAMETERS = ' '
- * IN_PARAMETERS = ' '
- * LAYOUT = C_CHAR_UNKNOWN
- * LINE_COUNT = C_INT_UNKNOWN
- * LINE_SIZE = C_INT_UNKNOWN
- * LIST_NAME = C_CHAR_UNKNOWN
- * LIST_TEXT = C_CHAR_UNKNOWN
- * MODE = ' '
- * NEW_LIST_ID = C_CHAR_UNKNOWN
- * PROTECT_LIST = C_CHAR_UNKNOWN
- NO_DIALOG = 'X'
- * RECEIVER = C_CHAR_UNKNOWN
- * RELEASE = C_CHAR_UNKNOWN
- * REPORT = C_CHAR_UNKNOWN
- * SAP_COVER_PAGE = C_CHAR_UNKNOWN
- * HOST_COVER_PAGE = C_CHAR_UNKNOWN
- * PRIORITY = C_NUM1_UNKNOWN
- * SAP_OBJECT = C_CHAR_UNKNOWN
- * TYPE = C_CHAR_UNKNOWN
- * USER = SY-UNAME
- * USE_OLD_LAYOUT = ' '
- * UC_DISPLAY_MODE = C_CHAR_UNKNOWN
- * DRAFT = C_CHAR_UNKNOWN
- * ABAP_LIST = ' '
- * USE_ARCHIVENAME_DEF = ' '
- * DEFAULT_SPOOL_SIZE = C_CHAR_UNKNOWN
- * WITH_STRUCTURE = C_CHAR_UNKNOWN
- * SUPPRESS_SHADING = C_CHAR_UNKNOWN
- * PO_FAX_STORE = ' '
- * NO_FRAMES = C_CHAR_UNKNOWN
- IMPORTING
- * OUT_ARCHIVE_PARAMETERS =
- OUT_PARAMETERS = print_parameters
- * VALID =
- * VALID_FOR_SPOOL_CREATION =
- EXCEPTIONS
- ARCHIVE_INFO_NOT_FOUND = 1
- INVALID_PRINT_PARAMS = 2
- INVALID_ARCHIVE_PARAMS = 3
- OTHERS = 4.
- *Execute abap program ZTESTREP in background job storing any output to spool
- with selection-table seltab
- user 'ADMIN' "user name with correct/additional authorisation
- SPOOL PARAMETERS print_parameters
- WITHOUT SPOOL DYNPRO
- via job jobname
- number jobcount.
- * Close job
- call function 'JOB_CLOSE'
- EXPORTING
- jobcount = jobcount
- jobname = jobname
- strtimmed = starttimeimmediate
- EXCEPTIONS
- cant_start_immediate = 01
- invalid_startdate = 02
- jobname_missing = 03
- job_close_failed = 04
- job_nosteps = 05
- job_notex = 06
- lock_failed = 07
- others = 99.
- GeSHi ©