‎2006 Sep 18 9:51 PM
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.
‎2006 Sep 18 10:00 PM
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
.
‎2006 Sep 18 10:00 PM
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
.
‎2006 Sep 18 11:13 PM
‎2006 Sep 18 10:00 PM
Hi,
I believe you have to hit enter before pressing F4 on S_AUFNR..
Thanks,
Naren
‎2006 Sep 18 10:42 PM
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.
‎2006 Sep 18 11:14 PM
Thanks Narendran, that does work, but I have decided to use the other pieces of code as well.
‎2006 Sep 18 11:14 PM