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

Reading Selection Screen Values

Former Member
0 Likes
9,127

Hi Gurus,

I have a requirement of restricting the data based on some selection screen parameters. I have these parameters on Report WS_MONITOR_OUTB_DEL_FREE.

Now this report calls the Function module WS_DELIVERY_MONITOR which performs the processing. This Function module does not have the selection parameters which I have added. So I tried to get my added parameters using FM  RS_LIST_SELECTION_TABLE, but this FM is not working.

Reason being sy-repid is not having the program value. So I am passing the program value manually i.e. WS_MONITOR_OUTB_DEL_FREE, but not found anything.

Please give me your valuable suggestions on this.

Thanks in advance,

Sumit

6 REPLIES 6
Read only

Former Member
0 Likes
3,542

Hi,

You can enhance the function module to add the selection parameters in its interface and change the logic as required.

PS:While changing interface always mark the added parameters as OPTIONAL.

regards,

Ashish Rawat

Read only

0 Likes
3,541

Thanks Ashish!!!

This is the last option I would do, changing the interface of FM. Is there any other way to read those Selection screen parameters in that FM????

Please suggest.

Read only

0 Likes
3,541

Yes, from your selection screen you can pass the values to ABAP memory using EXPORT TO MEMORY statement and read it back in FM using IMPORT TO MEMORY.

Another way is to set parameter IDs for the fields and pass the value to SAP Memory and read it back in the FM.

Or you can use FM DYNP_VALUES_READ as mentioned by Nabheet madan.

In any case, to process those additional fields you will have to enhance the logic of the FM.

regards,

Ashish Rawat

Read only

nabheetscn
SAP Champion
SAP Champion
0 Likes
3,541

what about DYNP_VALUES_READ

Read only

Former Member
0 Likes
3,541

Hi,

Use the below link,

http://scn.sap.com/thread/3286128

Or you can try my code.


REPORT  XXXXXXXX.
Tables : tvko.
Data : int_vkorg TYPE TABLE OF tvko-vkorg.
PARAMETERS : p_bukrs TYPE tvko-bukrs,
                           p_vkorg TYPE tvko-vkorg.

Data t_ft TYPE TABLE OF dfies,
        x_ft TYPE dfies,
        t_dd TYPE TABLE OF dselc,
        x_dd TYPE dselc,
        t_tvko TYPE TABLE OF tvko,
        x_tvko TYPE tvko.

At SELECTION-SCREEN On VALUE-REQUEST FOR p_vkorg.

DATA : lt_dynfld TYPE STANDARD TABLE OF dynpread,
       ls_dynfld TYPE dynpread.

ls_dynfld-fieldname = 'P_BUKRS'.
APPEND ls_dynfld to lt_dynfld.

Refresh t_ft.
x_ft-tabname = 'TVKO'.
x_ft-fieldname = 'BUKRS'.
APPEND x_ft To t_ft.


REFRESH t_ft.
x_ft-tabname = 'TVKO'.
x_ft-fieldname = 'VKORG'.
Append x_ft To t_ft.


CALL FUNCTION 'DYNP_VALUES_READ'
  EXPORTING
    dyname                               = sy-repid
    dynumb                               = sy-dynnr
  TABLES
    dynpfields                           = lt_dynfld
EXCEPTIONS
   INVALID_ABAPWORKAREA                 = 1
   INVALID_DYNPROFIELD                  = 2
   INVALID_DYNPRONAME                   = 3
   INVALID_DYNPRONUMMER                 = 4
   INVALID_REQUEST                      = 5
   NO_FIELDDESCRIPTION                  = 6
   INVALID_PARAMETER                    = 7
   UNDEFIND_ERROR                       = 8
   DOUBLE_CONVERSION                    = 9
   STEPL_NOT_FOUND                      = 10
   OTHERS                               = 11
          .

READ TABLE lt_dynfld INTO ls_dynfld WITH Key fieldname = 'P_BUKRS'.
If sy-subrc eq 0.
  p_bukrs = ls_dynfld-fieldvalue.
ENDIF.


  SELECT vkorg
    FROM tvko INTO TABLE int_vkorg
    WHERE bukrs = p_bukrs.

    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
      EXPORTING        retfield               = 'VKORG'
       DYNPPROG               = SY-REPID
       DYNPNR                 = SY-DYNNR
       DYNPROFIELD            = 'P_BUKRS'
       VALUE_ORG              = 'C'
      tables
        value_tab              = int_vkorg
       FIELD_TAB               = t_ft
     EXCEPTIONS
       PARAMETER_ERROR        = 1
       NO_VALUES_FOUND        = 2
       OTHERS                 = 3
              .

START-OF-SELECTION .
SELECT * from tvko INTO TABLE t_tvko WHERE bukrs = p_bukrs and vkorg = p_vkorg.
  If sy-subrc eq 0.
    WRITE : 'Success' .
  ENDIF.

Hope this helps.

Regards.

Read only

Former Member
0 Likes
3,541

Hi,

DYNP_VALUES_READ can only read the values that are visible on the screen i.e. if I amusing SELECT-OPTIONS with intervals then values entered in multiple selection will not be made available using this FM.

Thanks guys for all your suggestion. I have used Global stack to acheive the solution.

Cheers,

Sumit