Application Development 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: 

How to capture the values from sumit WITH SELECTION-TABLE in my report

Former Member
0 Kudos

Hi ,

I am calling report like

SUBMIT zreport_test

                        WITH SELECTION-TABLE lt_seltab[]

                        VIA JOB lv_jobname NUMBER lv_jobcount

                        AND RETURN..


My query is how to capture the lt_seltab[] values in the report zreport_test.

Searched in scn but no proper solution.

Please suggest me.

thank you.

Regards,

Shivaji.

14 REPLIES 14

yogendra_bhaskar
Contributor
0 Kudos

Hi Shivaji ,

Use below code :

CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'

            EXPORTING

              CURR_REPORT               = 'ZREPORT_TEST'

*         IMPORTING

*           SP                        =

            TABLES

              SELECTION_TABLE           = LT_SELSCREEN

*           SELECTION_TABLE_255       =

*         EXCEPTIONS

*           NOT_FOUND                 = 1

*           NO_REPORT                 = 2

*           OTHERS                    = 3

                    .

          IF SY-SUBRC <> 0.

*             Implement suitable error handling here

          ENDIF.

Regards

Yogendra Bhaskar     

0 Kudos

Hi Bhasakar,

Thank you for your prompt response.

By using RS_REFRESH_FROM_SELECTOPTIONS     this function module  can i get the values of  lt_seltab[] in my report.

As you said LT_SELSCREEN will hold the values of lt_seltab[] in my report ZREPORT_TEST.

Please clarify .

Thank you.

Regards,

Shivaji.

0 Kudos

Hi Shivaji ,

As you are submitting the report , you have to populate the data in lt_selscreen

I was referring for the code as below :

CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'

            EXPORTING

              CURR_REPORT               = 'REPORT_NAME'

*         IMPORTING

*           SP                        =

            TABLES

              SELECTION_TABLE           = lt_seltab

*           SELECTION_TABLE_255       =

*         EXCEPTIONS

*           NOT_FOUND                 = 1

*           NO_REPORT                 = 2

*           OTHERS                    = 3

                    .

          IF SY-SUBRC <> 0.

*             Implement suitable error handling here

          ENDIF.

*****************Populate data in lt_seltab

          LOOP AT lt_seltab INTO LW_seltab.

            CASE lw_seltab-SELNAME.

*              WHEN 'P_LAYOUT'.

*                lw_seltab-LOW = '/TCM'.

**               lw_seltab-high = '1900'.

*                MODIFY LT_SELTAB FROM lw_seltab.

*                CLEAR lw_seltab.

              WHEN 'S_PARA'.

                lw_seltab-SIGN =  'I'.

                lw_seltab-OPTION = 'BT'.

                lw_seltab-LOW = '100'.

                lw_seltab-HIGH = '141'.

                MODIFY LT_SELTAB FROM lw_seltab.

                CLEAR lw_seltab.

          

*          WHEN OTHERS.

            ENDCASE.

          ENDLOOP.

SUBMIT ZREPORT_TEST

                  USING SELECTION-SCREEN 1000

            WITH SELECTION-TABLE LT_SELTAB

            AND RETURN .

Regards

Yogendra Bhaskar

0 Kudos

HI Bhaskar,

I have developed 2 reports ztest_submit and ztest_submit2.

REPORT ztest_submit.

DATA: isel TYPE TABLE OF rsparams.

DATA: xsel TYPE rsparams.

xsel-selname = 'MATNR'.

xsel-kind    = 'S'.

xsel-sign    = 'I'.

xsel-option  = 'EQ'.

xsel-low     = '000000000040000692'.

APPEND xsel TO isel.

xsel-selname = 'BUDAT'.

xsel-kind    = 'S'.

xsel-sign    = 'I'.

xsel-option  = 'EQ'.

xsel-low     = sy-datum.

APPEND xsel TO isel.

SUBMIT ZTEST_SUBMIT2

                 WITH SELECTION-TABLE isel

                           AND RETURN.



REPORT ztest_submit2.

data lt_selscreen TYPE table OF  RSPARAMS.

CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'

   EXPORTING

     curr_report     = 'ZTEST_SUBMIT2'

*         IMPORTING

*   SP              =

   TABLES

     selection_table = lt_selscreen

*   SELECTION_TABLE_255       = lt_selscreen

          EXCEPTIONS

    NOT_FOUND       = 1

    NO_REPORT       = 2

    OTHERS          = 3

   .

IF sy-subrc <> 0.

*             Implement suitable error handling here

ENDIF.

But I am not getting any values into lt_selscreen.

Please check the code where i was doing wrong.

Thank you.

Regards,

Shivaji.

0 Kudos

Hi Shivaji ,

Report ztest_submit2 doesn't contain any selection parameter , thats why you are getting no value in lt_selscreen.


Create selection parameters MATNR and BUDAT in ztest_submit2.


Regards,


Yogendra Bhaskar

Sandra_Rossi
Active Contributor
0 Kudos

The answer is just in the ABAP documentation. Of course.

Former Member
0 Kudos

Hi,

SUBMIT zreport_test

WITH SELECTION-TABLE lt_seltab[]


lt_seltab is not any internal table. It has to have structure RSPARAMS and be use to supply parameters under SELNAME to zreport_test, and these parameters or select-options have to be declared in selection screen of zreport_test.


Refering to documentation.


Regards,


Omar

0 Kudos

Hi OMAR,

Can you provide a small piece of code.

Thank you.

Regards,

Shivaji.

0 Kudos

Hello Shivaji,

Referring to documentation and below is the sample code and it may be helpful to you for your reference.

Calling Program:

DATA: text       TYPE c LENGTH 10,

           rspar_tab  TYPE TABLE OF rsparams,

           rspar_line LIKE LINE OF rspar_tab,

           range_tab  LIKE RANGE OF kna1-kunnr,

           range_line LIKE LINE OF range_tab.

rspar_line-selname = 'S_MATNR'.

rspar_line-kind    = 'S'.

rspar_line-sign    = 'I'.

rspar_line-option  = 'EQ'.

rspar_line-low     = '000000000000008112'.

APPEND rspar_line TO rspar_tab.

rspar_line-selname = 'S_MATNR'.

rspar_line-kind    = 'S'.

rspar_line-sign    = 'I'.

rspar_line-option  = 'EQ'.

rspar_line-low     = '000000000000008136'.

APPEND rspar_line TO rspar_tab.

range_line-sign   = 'E'.

range_line-option = 'EQ'.

range_line-low    = '0000000015'.

APPEND range_line TO range_tab.

range_line-sign   = 'E'.

range_line-option = 'EQ'.

range_line-low    = '0000000300'.

APPEND range_line TO range_tab.

SUBMIT ZTEST

    WITH SELECTION-TABLE rspar_tab

    WITH s_cust IN range_tab

     AND RETURN.

Called Program:

TABLES: kna1,mara.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.

SELECT-OPTIONS: s_matnr FOR mara-matnr,

                              s_cust FOR kna1-kunnr.

SELECTION-SCREEN END OF BLOCK b1.

START-OF-SELECTION.

  DATA: lt_trange TYPE TABLE OF rsparams,

             lt_sp     TYPE syldb_sp,

             lt_255    TYPE  TABLE OF rsparamsl_255.

  CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'

    EXPORTING

      curr_report         = sy-repid

    IMPORTING

      sp                  = lt_sp

    TABLES

      selection_table     = lt_trange

      selection_table_255 = lt_255

    EXCEPTIONS

      not_found           = 1

      no_report           = 2

      OTHERS              = 3.

  IF sy-subrc <> 0.

* Implement suitable error handling here

  ENDIF.

Note:

  • If your internal table passing data in calling program is selection-options field in called program then don't need to use FM RS_REFRESH_FROM_SELECTOPTIONS and it passes values directly into called program.


  • Internal table data is also passed IMPORT/EXPORT TO DATABASE index(xy).

Thanks, Sateesh

0 Kudos

*-----------------------------------------------*

REPORT z_caller.

DATA : wgt_seltab TYPE TABLE OF rsparams,

        wgs_seltab TYPE rsparams.

START-OF-SELECTION.

   CLEAR wgs_seltab.

   wgs_seltab-selname = 'P_PARAM'.

   wgs_seltab-kind = 'P'. "Parameter

   wgs_seltab-low  = 'value_1'.

   APPEND wgs_seltab TO wgt_seltab.

   CLEAR wgs_seltab.

   wgs_seltab-selname = 'S_MATNR'.

   wgs_seltab-kind = 'S'. "Select-option

   wgs_seltab-sign = 'I'.

   wgs_seltab-option = 'EQ'.

   wgs_seltab-low = 'product_1'.

   APPEND wgs_seltab TO wgt_seltab.

   wgs_seltab-low = 'product_2'.

   APPEND wgs_seltab TO wgt_seltab.

   wgs_seltab-low = 'product_3'.

   APPEND wgs_seltab TO wgt_seltab.

   SUBMIT zreport_test WITH SELECTION-TABLE wgt_seltab

     AND RETURN.

   *-----------------------------------------------*



*------------------------------------------------*

REPORT zreport_test.

DATA wgt_mara TYPE TABLE OF mara.

TABLES mara.

PARAMETERS : p_param TYPE string.

SELECT-OPTIONS s_matnr FOR mara-matnr.

START-OF-SELECTION.

   WRITE / p_param.

   SELECT * FROM mara INTO TABLE wgt_mara

     WHERE matnr IN s_matnr.

*------------------------------------------------*

0 Kudos

Hi Omar,

Thank you so much ,very clear explanation.

Can't we pass high value too to the wgs_seltab-high = '  '   f or the S_MATNR in the above example.

I have tried but the high value was not receving in the called program.

Regards,

Shivaji.

0 Kudos

To make "high" relevant you have to use option = 'BT' for example instead of 'EQ'

pranay570708
Active Contributor
0 Kudos

Hi,

While using 'SUBMIT zreport_test WITH SELECTION-TABLE', make sure selection table lt_seltab[], has entries with Parameters/select-options name same as present in called report.


Lets say if report 'zreport_test' has two parameters p_par1 & p_par2. Then the internal table lt_seltab must have entries with fieldname as P_PAR1 & P_PAR2. Do check this in your case.


And values will be passed to the parameters automatically on using selection table.

0 Kudos

Thank you Pranay