This piece of code updates ‘Actual GR Date’ in inbound delivery using BDC in synchronous update mode. ‘Actual GR Date’ is adopted as posting date by material document created during goods receipt.
*&---------------------------------------------------------------------* *& Form update_grdate *&---------------------------------------------------------------------* * Update GR Date on Inbound delivery *----------------------------------------------------------------------* * -->I_DELIVERY Inbound Delivery Number * -->I_GRDATE Actual GR Date *----------------------------------------------------------------------* FORM update_grdate USING i_delivery TYPE likp-vbeln i_grdate TYPE likp-wadat_ist CHANGING messages TYPE tab_bdcmsgcoll . DEFINE insert_screen. clear ls_bdcdata . ls_bdcdata-program = &1 . ls_bdcdata-dynpro = &2 . ls_bdcdata-dynbegin = 'X' . append ls_bdcdata to li_bdcdata . END-OF-DEFINITION. DEFINE insert_field. clear ls_bdcdata . ls_bdcdata-fnam = &1 . ls_bdcdata-fval = &2 . append ls_bdcdata to li_bdcdata . END-OF-DEFINITION. DATA : ls_bdcdata TYPE bdcdata , li_message TYPE TABLE OF bdcmsgcoll , ls_message TYPE bdcmsgcoll , ls_opt TYPE ctu_params , li_bdcdata TYPE TABLE OF bdcdata , lv_date TYPE char10 . * Fill bdc options , run in backgound mode and with default screen size ls_opt-dismode = 'N' . ls_opt-defsize = 'X' . insert_screen 'SAPMV50A' '0108' . insert_field 'LIKP-VBELN' i_delivery . insert_field 'BDC_OKCODE' '=UELA' . insert_screen 'SAPMV50A' '0270' . WRITE i_grdate TO lv_date . insert_field 'RV50A-WADAT_IST_LA' lv_date . insert_field 'BDC_OKCODE' '=SICH' . CALL TRANSACTION 'VL32' USING li_bdcdata OPTIONS FROM ls_opt MESSAGES INTO li_message . messages = li_message . ENDFORM . "update_grdate