I have a selection screen with some fields. For scheduling agreement field I have given the F4 help by using search help exit.

When user clicks on F4 for scheduling agreement, in the search results along with the scheduling agreement I’m giving Item, date, and some other fields.

Now, the requirement is when ever user selects a scheduling agreement from F4 help I need to populate the corresponding item automatically from the search help on to the Item field on the selection screen.
Solution:
In the above screen shot if I select 30000018 and click enter, corresponding item (000020) should get populated into the Item field on the selection screen.
After displaying the search help values, when CALLCONTROL-STEP = ‘RETURN’ we need to call the function module ‘DYNP_UPDATE_FIELDS’.
IF callcontrol-step = 'RETURN'.
DATA : i_dynp TYPE STANDARD TABLE OF dynpread.
DATA : w_dynp TYPE dynpread.
w_dynp-fieldname = 'S_POSNR-LOW'.
w_dynp-fieldvalue = gv_posnr.
APPEND w_dynp TO i_dynp.
CLEAR : w_dynp.
CALL FUNCTION 'DYNP_UPDATE_FIELDS'
EXPORTING
dyname = 'SAPMZKLIM_HUREPORT'
dynumb = '0300'
request = 'A'
TABLES
dynpfields = i_dynp
EXCEPTIONS
invalid_abapworkarea = 1
invalid_dynprofield = 2
invalid_dynproname = 3
invalid_dynpronummer = 4
invalid_request = 5
no_fielddescription = 6
undefind_error = 7
OTHERS = 8.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
EXIT.
ENDIF.
Result:
When I select the agreement, corresponding item (20) will get populate into item field in the selection screen.


No comments:
Post a Comment