Search code examples
abapbadi

How to know the SAP oubound delivery item is posted in a GR


What tables to look at to check whether the outbound delivery item is posted in a GR?

Or is there any BADI that can provide this information?


Solution

  • In general you can get the delivery (or delivery items) status from tables

    • VBUK (header status)
    • VBUP (items status)

    for example:

    DATA: ls_vbup type vbup.
    
    SELECT SINGLE * FROM VBUP 
     WHERE VBELN = <delivery no> 
       AND POSNR = <delivery item> 
      INTO ls_vbup.
    

    LS_VBUP-WBSTA is the Goods movement status for the delivery. It can contain:

    • C: status goods movement "completed". All the quantity has been posted
    • A: status goods movement "open". No quantity has been posted yet
    • B: status goods moviment "partial".

    Otherwise if you also want to know which GR/GI has been posted for your delivery you could check the SD document flow table VBFA:

    DATA: lt_vbfa TYPE TABLE OF vbfa.
    
    SELECT * FROM VBFA
     WHERE VBELV = <delivery no>
       AND POSNV = <delivery item>
       AND VBTYP_V = 'J'  " J means Delivery
       AND VBTYP_N = 'R'  " R means Goods movement
     INTO TABLE lt_vbfa.
    

    LT_VBFA table contains the GR/GI posted for your delivery