‎2009 Dec 03 7:08 AM
Hi Friends ,
I have a requirement where in i need to write a program with a select query and get the data into an internal table and pass this data into the selection screen of a standard report through Submit statement. Can someone give me some tips of how to go about achieving this.
Thanks & Regards,
Balaji.K
‎2009 Dec 03 7:10 AM
scroll down to see how many ways u can use submit statement: [Execute(Submit) ABAP Report|http://www.sapdev.co.uk/reporting/rep_submit.htm]
‎2009 Dec 03 7:11 AM
data:lt_params type table of RSPARAMS.
data:wa like line of lt_params.
parameters:pa1 type sy-datum.
select-options:so1 type sy-dtaum.
wa-SELNAME = 'PA2'. "Seletion screen field name of ZPROG2
wa-KIND = 'P'. "P-Parameter,S-Select-options
wa-SIGN = 'I'. "I-in
wa-OPTION = 'EQ'. "EQ,BT,CP
wa-LOW = pa1. "Selection Option Low,Parameter value
append wa to lt_params.
loop at so1.
wa-SELNAME = 'SO2'. "Seletion screen field name of ZPROG2
wa-KIND = 'S'. "P-Parameter,S-Select-options
wa-SIGN = 'I'. "I-in
wa-OPTION = 'EQ'. "EQ,BT,CP
wa-LOW = so1-low. "Selection Option Low,Parameter value
wa-HIGH = so1-high. "Selection Option Low,Parameter value
append wa to lt_params.
endloop.
CALL FUNCTION 'SUBMIT_REPORT'
EXPORTING
report = 'ZPROG2.' "report name of ur tocde
RET_VIA_LEAVE = '' "IF 'X' returns to the called program after execution
SKIP_SELSCREEN = 'X' "If 'X' selection screen of called program is not displayed
TABLES
SELECTION_TABLE = lt_params "Contains values to the selection screen
EXCEPTIONS
JUST_VIA_VARIANT = 1
NO_SUBMIT_AUTH = 2
OTHERS = 3
‎2009 Dec 04 10:33 AM
Hi Friends ,
I tried out all the possible combinations of the submit statement but getting stuck up at a point. The following is the code i have used to submit.
SUBMIT RELEABL1 VIA SELECTION-SCREEN
USING SELECTION-SET 'PCVM_DOWN_TEST'
WITH ABLEINH IN GT_RANGES
AND RETURN.
where RELEABL1 is the program which i am calling and 'PCVM_DOWN_TEST' is the name of the variant in pgm RELEABL1 which i want to update. The variant 'PCVM_DOWN_TEST' exists in pgm RELEABL1 but on execution the variant is not getting updated with new values for the field ABLEINH. Is there any addition that i can use or is there any work around that i can do . Please advise.
Thanks in advance,
Balaji.K
‎2009 Dec 04 10:40 AM
Hello Balaji,
If you want to SUBMIT the report using data from the internal table why do you want to call the variant?
Can you please elaborate your problem?
BR,
Suhas
‎2009 Dec 04 10:52 AM
Hi Suhas ,
My requirement is to optimize the performance of standard pgm RELEABL1 that takes a long time to complete when scheduled in background,and for that i have created a zpgm with some select queries that optimizes the selection screen inputs to the standard pgm RELEABL1 . The standard pgm RELEABL1 will be scheduled in background with a variant PCVM_DOWN_TEST , through my zpgm i want to pass the inputs to this standard pgm selection screen ( specifically to the variant in the std pgm as this std pgm will be scheduled in background for execution ). While scheduling the steps will be like this
Step 1 : My zpgm will be executed and on execution it will update the variant in the pgm RELEABL1 with new values .
Step 2 : Std pgm RELEABL1 will be executed with the updated variant values .
‎2009 Dec 04 11:01 AM
Hello,
The first thing to note is if you use VIA SELECTION-SCREEN, then the selection-screen will be displayed & i donot think this is a feasible thing to do in BG processing
BR,
Suhas
‎2009 Dec 04 11:17 AM
You need to create the varaint for the scheduled program and pass that variant to FM JOB_SUBMIT in VARIANT parameter.
Use Fm RS_CREATE_VARIANT to create the variant from the report program.
Search the SCN for more help on this FM.
U follow the given code. If u have taken varinat as parameter then ok. other wise u have to pass rs_create_varaint* function module in the program. DATA : v_jobhead LIKE tbtcjob. DATA : v_jobcount LIKE tbtcjob-jobcount. DATA : v_eventparm LIKE tbtcjob-eventparm. DATA : v_flg_released TYPE c. DATA: e_error. DATA: running LIKE tbtcv-run. TYPES: esp1_boolean LIKE boole-boole. CONSTANTS: esp1_false TYPE esp1_boolean VALUE ' ', esp1_true TYPE esp1_boolean VALUE 'X'. CONSTANTS: true TYPE boolean VALUE esp1_true, false TYPE boolean VALUE esp1_false. PARAMETERS: v_jobnam LIKE tbtcjob-jobname, v_report LIKE sy-repid, v_varian LIKE raldb-variant, v_uname LIKE sy-uname. START-OF-SELECTION. CALL FUNCTION 'JOB_OPEN' EXPORTING jobname = v_jobnam IMPORTING jobcount = v_jobcount EXCEPTIONS cant_create_job = 1 invalid_job_data = 2 jobname_missing = 3 OTHERS = 4. IF sy-subrc 0. e_error = true. ELSE. CALL FUNCTION 'JOB_SUBMIT' EXPORTING authcknam = v_uname jobcount = v_jobcount jobname = v_jobnam report = v_report variant = v_varian EXCEPTIONS bad_priparams = 1 bad_xpgflags = 2 invalid_jobdata = 3 jobname_missing = 4 job_notex = 5 job_submit_failed = 6 lock_failed = 7 program_missing = 8 prog_abap_and_extpg_set = 9 OTHERS = 10. IF sy-subrc 0. e_error = true. ELSE. CALL FUNCTION 'JOB_CLOSE' EXPORTING jobcount = v_jobcount jobname = v_jobnam strtimmed = 'X' IMPORTING job_was_released = v_flg_released 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. IF sy-subrc 0. e_error = true. ELSE. DO. CALL FUNCTION 'SHOW_JOBSTATE' EXPORTING jobcount = v_jobcount jobname = v_jobnam EXCEPTIONS jobcount_missing = 1 jobname_missing = 2 job_notex = 3 OTHERS = 4. IF sy-subrc 0. e_error = true. MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. ENDIF. IF running = space. exit. endif. enddo. endif. endif. endif.
I hope before you execute the report, you will be filling the selection-screen data using an existing Variant.
If that's the case, you can pass the Variant name itself to the parameter 'variant' of FM 'JOB_SUBMIT'.
The Variant name with which the Report was executed can be obtained by system variable 'SY-SLSET'.
‎2009 Dec 04 11:06 AM
Submit report using selection screen variant
SUBMIT yreport USING SELECTION-SET 'VARIANT1'.
Submit report and return to current program afterwards
SUBMIT yreport AND RETURN.
Submit report via its own selection screen
SUBMIT yreport VIA SELECTION-SCREEN.
Lets say we have two programs A and B. If we call program B in program A. We call A as Calling program and B as called program.
Try this way to use SUBMIT statement.
REPORT zcalling_program.
DATA: it_rsparams TYPE STANDARD TABLE OF rsparams,
wa_rsparams LIKE LINE OF it_rsparams.
wa_rsparams-selname = 'S_MATNR'. "Screen field name of called program
wa_rsparams-kind = 'S'. "S=Select-options P=Parameters
wa_rsparams-sign = 'I'.
wa_rsparams-option = 'EQ'.
wa_rsparams-low = '11010'.
wa_rsparams-high = space.
SUBMIT zcalled_program VIA SELECTION-SCREEN WITH SELECTION-TABLE it_rsparams AND RETURN.