• April 7, 2026
  • Kishore Thutaram
  • 0

Goods Receipt Creation – Update the correct inbound delivery number when multiple exist using the enhancement

Business Requirement – While creating the goods movement, update the correct Inbound delivery number when there are multiple deliveries exist for the same PO

Steps: Exit Name: EXIT_SAPLLMDE_002

Include: ZXLIDU10

Implement the logic below


CONSTANTS:
lc_c TYPE gbstk VALUE ‘C’,
lc_a TYPE gbstk VALUE ‘A’.

 SELECT e~ebeln,m~ebelp,e~vbeln,l~gbstk FROM ekes AS e
        INNER JOIN mseg AS m  "mseg is an input parameter to the exit
        ON e~ebeln = m~ebeln AND e~ebelp = m~ebelp
        INNER JOIN likp AS l
        ON e~vbeln = l~vbeln
        INTO TABLE @DATA(lt_inbdel_dat).
if sy-subrc eq 0.

LOOP AT mseg ASSIGNING FIELD-SYMBOL().
“Check if multiple IBDs are available for same PO
“if one is already GRN completed (C), fetch next one which status A : Not yet processed
IF line_exists( lt_inbdel_dat[ ebeln = -ebeln ebelp = -ebelp gbstk = lc_c ] ) AND
line_exists( lt_inbdel_dat[ ebeln = -ebeln ebelp = -ebelp gbstk = lc_a ] ).
-vlief_avis = VALUE #( lt_inbdel_dat[ ebeln = -ebeln ebelp = -ebelp gbstk = lc_a ]-vbeln OPTIONAL ).
ENDIF.
ENDLOOP.

endif.
   
    

Kishore Thutaram

SAP Solution Architect | 16+ Years' Experience in SAP | Sharing Practical SAP Knowledge | Engineering Graduate with Expertise in SAP Architecture

https://fiowelt.com