Automatically populating the search help values into different fields on the selection screen by using search help exit

By Krishna Chaitanya Gogineni, Deloitte Consulting

Requirement overview:

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.

 

Please send us your feedback/suggestions at webmaster@SAPTechnical.COM 

HomeContribute About Us Privacy Terms Of Use • Disclaimer • SafeCompanies: Advertise on SAPTechnical.COM | Post JobContact Us  

Graphic Design by Round the Bend Wizards

footer image footer image