Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Using submit statement

Former Member
0 Likes
769

Hi Experts,

how can i submit the report using ranges for select-option,

please give the example code for the same....

thanks,

Fyroza.....

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
717

Hi Fyroza,

Below is the sample code ...refer code, it may be helpfull....

  • Define range for ltak-tanum

RANGES: r_tanum FOR ltak-tanum.

  • Read values from database tabel into the range

  • These values are later used for select-options in the report

SELECT * FROM ltak

WHERE lgnum = w_lgnum AND "Warehouse number/complex

vbeln = w_screen1000-io_vbeln. "Transfer order number

MOVE ltak-tanum TO r_tanum-low.

MOVE 'I' TO r_tanum-sign.

MOVE 'EQ' TO r_tanum-option.

APPEND r_tanum.

ENDSELECT.

  • Submit report with range

SUBMIT zmm00100 WITH p_tanum IN r_tanum.

6 REPLIES 6
Read only

Former Member
0 Likes
717

Hi ,

for ex:

REPORT report2.

DATA: text TYPE c LENGTH 10,

rspar_tab TYPE TABLE OF rsparams,

rspar_line LIKE LINE OF rspar_tab,

range_tab LIKE RANGE OF text,

range_line LIKE LINE OF range_tab.

rspar_line-selname = 'SELCRIT1'.

rspar_line-kind = 'S'.

rspar_line-sign = 'I'.

rspar_line-option = 'EQ'.

rspar_line-low = 'ABAP'.

APPEND rspar_line TO rspar_tab.

range_line-sign = 'E'.

range_line-option = 'EQ'.

range_line-low = 'H'.

APPEND range_line TO range_tab.

range_line-sign = 'E'.

range_line-option = 'EQ'.

range_line-low = 'K'.

APPEND range_line TO range_tab.

SUBMIT report1 USING SELECTION-SCREEN '1100'

WITH SELECTION-TABLE rspar_tab

WITH selcrit2 BETWEEN 'H' AND 'K'

WITH selcrit2 IN range_tab

AND RETURN.

regards,

gowri.

Read only

Former Member
0 Likes
718

Hi Fyroza,

Below is the sample code ...refer code, it may be helpfull....

  • Define range for ltak-tanum

RANGES: r_tanum FOR ltak-tanum.

  • Read values from database tabel into the range

  • These values are later used for select-options in the report

SELECT * FROM ltak

WHERE lgnum = w_lgnum AND "Warehouse number/complex

vbeln = w_screen1000-io_vbeln. "Transfer order number

MOVE ltak-tanum TO r_tanum-low.

MOVE 'I' TO r_tanum-sign.

MOVE 'EQ' TO r_tanum-option.

APPEND r_tanum.

ENDSELECT.

  • Submit report with range

SUBMIT zmm00100 WITH p_tanum IN r_tanum.

Read only

Former Member
0 Likes
717

F1 help on SUBMIT will give u ex from SAP help. Check belew ex from help.

DATA: SELTAB     TYPE TABLE OF RSPARAMS, 
      SELTAB_WA  LIKE LINE OF SELTAB. 

MOVE: 'LANGU'  TO SELTAB_WA-SELNAME, 
      'S'      TO SELTAB_WA-KIND,      " SELECT-OPTION 
      'I'      TO SELTAB_WA-SIGN, 
      'BT'     TO SELTAB_WA-OPTION, 
      'D'      TO SELTAB_WA-LOW, 
      'I'      TO SELTAB_WA-HIGH. 
APPEND SELTAB_WA TO SELTAB. 

MOVE: 'E'      TO SELTAB_WA-SIGN, 
      'EQ'     TO SELTAB_WA-OPTION, 
      'F'      TO SELTAB_WA-LOW, 
      SPACE    TO SELTAB_WA-HIGH. 
APPEND SELTAB_WA TO SELTAB. 

CLEAR SELTAB_WA. 
MOVE: 'ARBGB' TO SELTAB_WA-SELNAME, 
      'P'     TO SELTAB_WA-KIND,      " PARAMETER 
      'XX'    TO SELTAB_WA-LOW. 
APPEND SELTAB_WA TO SELTAB. 


SUBMIT REPORT00 
       USING SELECTION-SET 'VARIANT1' 
       WITH  ARBGB CP 'A*' 
       WITH  SELECTION-TABLE SELTAB 
       AND RETURN.

Read only

Former Member
0 Likes
717

Hi,

You can use a code similar to this..

submit rsbdcsub using selection-screen '1000'

with selection-table y_i_seltable

user sy-uname

via job y_k_jobname number y_lv_jobcount

and return.

Here the selection table Y_I_SELTABLE is of type rsparams and it is filled with all the select-options and parameters value as follows.

  • Session

y_wa_seltable-selname = 'MAPPE'.

y_wa_seltable-kind = 'P'.

y_wa_seltable-low = 'YMDMCT*'.

append y_wa_seltable to y_pr_seltable.

  • From Date

y_wa_seltable-selname = 'VON'.

y_wa_seltable-kind = 'P'.

y_wa_seltable-low = y_p_from.

append y_wa_seltable to y_pr_seltable.

  • To Date

y_wa_seltable-selname = 'BIS'.

y_wa_seltable-kind = 'P'.

y_wa_seltable-low = y_p_to.

append y_wa_seltable to y_pr_seltable.

  • New Sessions

y_wa_seltable-selname = 'Z_VERARB'.

y_wa_seltable-kind = 'P'.

y_wa_seltable-low = 'X'.

append y_wa_seltable to y_pr_seltable.

  • Incorrect sessions

y_wa_seltable-selname = 'FEHLER'.

y_wa_seltable-kind = 'P'.

y_wa_seltable-low = ' '.

append y_wa_seltable to y_pr_seltable.

I hope this helps you.

Regards,

Ankur Parab

Read only

Former Member
0 Likes
717

Hi,

You can use a code similar to this..

submit rsbdcsub using selection-screen '1000'

with selection-table y_i_seltable

user sy-uname

via job y_k_jobname number y_lv_jobcount

and return.

Here the selection table Y_I_SELTABLE is of type rsparams and it is filled with all the select-options and parameters value as follows.

  • Session

y_wa_seltable-selname = 'MAPPE'.

y_wa_seltable-kind = 'P'.

y_wa_seltable-low = 'YMDMCT*'.

append y_wa_seltable to y_pr_seltable.

  • From Date

y_wa_seltable-selname = 'VON'.

y_wa_seltable-kind = 'P'.

y_wa_seltable-low = y_p_from.

append y_wa_seltable to y_pr_seltable.

  • To Date

y_wa_seltable-selname = 'BIS'.

y_wa_seltable-kind = 'P'.

y_wa_seltable-low = y_p_to.

append y_wa_seltable to y_pr_seltable.

  • New Sessions

y_wa_seltable-selname = 'Z_VERARB'.

y_wa_seltable-kind = 'P'.

y_wa_seltable-low = 'X'.

append y_wa_seltable to y_pr_seltable.

  • Incorrect sessions

y_wa_seltable-selname = 'FEHLER'.

y_wa_seltable-kind = 'P'.

y_wa_seltable-low = ' '.

append y_wa_seltable to y_pr_seltable.

I hope this helps you.

Regards,

Ankur Parab

Read only

jaideepsharma
Active Contributor
0 Likes
717

Hi,

You can call function module RS_REPORTSELECTIONS_INFO to fetch all the selection screen variables names of report you want to submit in your program. Populate them and call submit report as shown in example below.


DATA: RANGE_LANGU    TYPE RANGE OF SY-LANGU, 
          RANGE_LANGU_WA LIKE lINE OF RANGE_LANGU. 

PARAMETERS: MSG_FR LIKE T100-MSGNR, 
            MSG_TO LIKE T100-MSGNR. 

MOVE: 'I'  TO RANGE_LANGU_WA-SIGN, 
      'BT' TO RANGE_LANGU_WA-OPTION, 
      'D'  TO RANGE_LANGU_WA-LOW, 
      'I'  TO RANGE_LANGU_WA-HIGH. 
APPEND RANGE_LANGU_WA TO RANGE_LANGU. 

MOVE: 'EQ'  TO RANGE_LANGU_WA-OPTION, 
      'E'   TO RANGE_LANGU_WA-LOW. 
APPEND RANGE_LANGU_WA TO RANGE_LANGU. 

SUBMIT REPORT00 
       USING SELECTION-SET 'VARIANT1' 
       WITH  MSG   BETWEEN MSG_FR AND MSG_TO 
       WITH  LANGU IN RANGE_LANGU

or



DATA: SELTAB     TYPE TABLE OF RSPARAMS, 
      SELTAB_WA  LIKE LINE OF SELTAB. 

MOVE: 'LANGU'  TO SELTAB_WA-SELNAME, 
      'S'      TO SELTAB_WA-KIND,      " SELECT-OPTION 
      'I'      TO SELTAB_WA-SIGN, 
      'BT'     TO SELTAB_WA-OPTION, 
      'D'      TO SELTAB_WA-LOW, 
      'I'      TO SELTAB_WA-HIGH. 
APPEND SELTAB_WA TO SELTAB. 

MOVE: 'E'      TO SELTAB_WA-SIGN, 
      'EQ'     TO SELTAB_WA-OPTION, 
      'F'      TO SELTAB_WA-LOW, 
      SPACE    TO SELTAB_WA-HIGH. 
APPEND SELTAB_WA TO SELTAB. 

CLEAR SELTAB_WA. 
MOVE: 'ARBGB' TO SELTAB_WA-SELNAME, 
      'P'     TO SELTAB_WA-KIND,      " PARAMETER 
      'XX'    TO SELTAB_WA-LOW. 
APPEND SELTAB_WA TO SELTAB. 


SUBMIT REPORT00 
       USING SELECTION-SET 'VARIANT1' 
       WITH  ARBGB CP 'A*' 
       WITH  SELECTION-TABLE SELTAB 
       AND RETURN.