In general we use DYNP_VALUES_READ to read data in the screen. It will be very simple to get data from the screen when the required field is declared from parameter.
1. Declaration: Declare data for input and for output DATA: dynfields TYPE TABLE OF dynpread WITH HEADER LINE,
return_tab TYPE TABLE OF ddshretval WITH HEADER LINE.
1. Declaration: Declare data for input and for output DATA: dynfields TYPE TABLE OF dynpread WITH HEADER LINE,
return_tab TYPE TABLE OF ddshretval WITH HEADER LINE.
APPEND dynfields.
3.Get the data from selection screen CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
dyname = sy-cprog
dynumb = sy-dynnr
translate_to_upper = 'X'
TABLES
dynpfields = dynfields
4.Get the data from to the fields from selection to the fields READ TABLE dynfields WITH KEY fieldname = 'P_BUKRS'.
lv_bukrs = dynfields-fieldvalue.
5.Get the data from the required table to display SELECT bukrs branch name
FROM j_1bbranch
INTO CORRESPONDING FIELDS OF TABLE it_j_1bbranch
WHERE bukrs = lv_bukrs.
6.Display the using FM F4IF_INT_TABLE_VALUE_REQUEST CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'BRANCH'
dynprofield = 'S_BRANCH-LOW'
value_org = 'S'
TABLES
value_tab = it_j_1bbranch
return_tab = return_tab.
7.Pass the data to output field READ TABLE return_tab WITH KEY fieldname = 'BRANCH'.
IF lv_shelp_low = 'X'.
s_branch-low = return_tab-fieldval.
ENDIF.
But when to get the data from SELECT-OPTIONS will be challenge, in order to overcome this we need to follow the below procedure in the attached document. Attachement for select options
Thank you very much! It was very helpful.
ReplyDelete