if EX_TABLE-matnr is not initial and EX_TABLE-KUNDE is not initial.
wa_rspar-selname = ‘MATNR‘.
wa_rspar-kind = ‘S‘.
wa_rspar-sign = ‘I‘.
wa_rspar-option = ‘EQ‘.
wa_rspar-low = EX_TABLE-matnr.
APPEND wa_rspar TO rspar.
clear wa_rspar.
wa_rspar-selname = ‘KUNNR‘.
wa_rspar-kind = ‘S‘.
wa_rspar-sign = ‘I‘.
wa_rspar-option = ‘EQ‘.
wa_rspar-low = EX_TABLE-KUNDE.
APPEND wa_rspar TO rspar.
clear wa_rspar.
wa_rspar-selname = ‘ERDAT‘.
wa_rspar-kind = ‘S‘.
wa_rspar-sign = ‘I‘.
wa_rspar-option = ‘EQ‘.
wa_rspar-low = ‘‘.
APPEND wa_rspar TO rspar.
clear wa_rspar.
CALL FUNCTION ‘JOB_OPEN‘
EXPORTING
jobname = name
IMPORTING
jobcount = number
EXCEPTIONS
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
OTHERS = 4.
IF sy-subrc = 0.
EXPORT ITAB TO MEMORY ID ‘itab‘.
SUBMIT ZSDR0011 TO SAP-SPOOL
SPOOL PARAMETERS print_parameters
WITHOUT SPOOL DYNPRO
VIA JOB name NUMBER number
with SELECTION-TABLE rspar
AND RETURN.
IMPORT ITAB FROM MEMORY ID ‘itab‘.
IF sy-subrc = 0.
CALL FUNCTION ‘JOB_CLOSE‘
EXPORTING
jobcount = number
jobname = name
strtimmed = ‘X‘
EXCEPTIONS
cant_start_immediate = 1
invalid_startdate = 2
jobname_missing = 3
job_close_failed = 4
job_nosteps = 5
job_notex = 6
lock_failed = 7
OTHERS = 8.
endif.
endif.