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

select-options: at selection-screen on value-request

former_member192818
Active Participant
0 Likes
2,680

Hi Everybody,

I have two select-options fields, S_WERKS, S_AUFNR such that the values of one field is dependent on the values of the other field in the select-options.

I am using the "at selection-screen on value-request event on" to populate the select-options field, S_AUFNR, that is dependent on the other field, S_WERKS.

Here is the code I am using.



SELECT-OPTIONS: S_WERKS FOR RESB-WERKS,
                S_AUFNR FOR RESB-AUFNR.

at selection-screen on value-request for s_aufnr-low.
  data: begin of ihelp_proc_ord occurs 0,
        AUFNR like resb-aufnr,
        WERKS  like aufk-werks,
        end of ihelp_proc_ord.


  select DISTINCT aufnr werks
  into corresponding fields of table ihelp_proc_ord
  from RESB 
  where WERKS IN S_WERKS.

  call function 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
      retfield    = 'AUFNR'
      dynprofield = 'S_AUFNR'
      dynpprog    = sy-cprog
      dynpnr      = sy-dynnr
      value_org   = 'S'
    TABLES
      value_tab   = ihelp_proc_ord.

Somehow the VALUE-REQUEST for 'S_AUFNR' does not work with the above code. The above code returns all the values in the table and does not limit the selection criterion by 'S_WERKS'.

The issue is for some reason the value S_WERKS, which is the criterion based on which I have to do the select clause, is always blank, even though I have entered values for this field in the select-options field.

Would anybody have a snippet of code that is already working for the case where the values in one field are dependent on the values entered in another field of the select-options.

Thank you for the help.

Sumit.

1 ACCEPTED SOLUTION
Read only

Former Member
1,351

Try this:


    MOVE: 'S_WERKS-LOW' TO T_DYNFIELDTAB-FIELDNAME.
    APPEND T_DYNFIELDTAB.

    CALL FUNCTION 'DYNP_VALUES_READ'
      EXPORTING
        DYNAME                         = SY-REPID
        DYNUMB                         = SY-DYNNR
      TABLES
        DYNPFIELDS                     = T_DYNFIELDTAB
      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
              .

6 REPLIES 6
Read only

Former Member
1,352

Try this:


    MOVE: 'S_WERKS-LOW' TO T_DYNFIELDTAB-FIELDNAME.
    APPEND T_DYNFIELDTAB.

    CALL FUNCTION 'DYNP_VALUES_READ'
      EXPORTING
        DYNAME                         = SY-REPID
        DYNUMB                         = SY-DYNNR
      TABLES
        DYNPFIELDS                     = T_DYNFIELDTAB
      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 only

0 Likes
1,351

Thanks Michael.

Read only

Former Member
0 Likes
1,351

Hi,

I believe you have to hit enter before pressing F4 on S_AUFNR..

Thanks,

Naren

Read only

0 Likes
1,351

hi check this code...

reward if it helps..

tables: mara, makt.

data: begin of itab occurs 0,

matnr like mara-matnr,

end of itab.

data : begin of btab occurs 0,

maktx like makt-maktx,

end of btab.

DATA : return like ddshretval occurs 0 with header line.

parameters: p_matnr like mara-matnr,

p_maktx like makt-maktx.

Initialization.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_matnr.

REFRESH ITAB.

SELECT matnr FROM mara INTO TABLE ITAB.

call function 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'MATNR '

dynprofield = 'P_MATNR '

dynpprog = sy-REPID

dynpnr = sy-dynnr

value_org = 'S'

TABLES

value_tab = ITAB

return_tab = return.

p_matnr = return-fieldval.

refresh return.

clear return.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_maktx.

select maktx from makt into table btab where matnr = p_matnr.

call function 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'MAKTX'

dynprofield = 'P_MAKTX'

dynpprog = sy-REPID

dynpnr = sy-dynnr

value_org = 'S'

TABLES

value_tab = BTAB

return_tab = return.

p_maktx = return-fieldval.

Read only

0 Likes
1,351

Thanks Narendran, that does work, but I have decided to use the other pieces of code as well.

Read only

0 Likes
1,351

Thanks Srinu.

Sumit.