Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to do PGI using FM: WS_DELIVERY_UPDATE

former_member311223
Participant
0 Kudos
1,677

Dear Experts,

I have a requirement where in I have to generate a Delivery number based on PO, and based on that Delivery No I have to do PGI (Post Goods Issue) for those materials (same functionality as in Tcode VL02N).

I am able to generate the Delivery note based on the PO, but for doing the PGI I found a FM:   WS_DELIVERY_UPDATE. My requirement for PGI is to fetch the Picked Qty based on the Delivery Qty automatically. But when I am using this FM I am uanble to generate the PGI. When I execute my Code, it is getting executed successfully i.e. it is not giving any error message.

Plz find the below code and kindly let me know if I am missing out any Field or if I am providing any data in the wrong field.

Kindly help.

Code:-

SELECT VBELN
        POSNR
        MATNR
        WERKS
        LFIMG
        MEINS
        ARKTX
        VGBEL
        VGPOS
        BWART
        FROM LIPS
        INTO CORRESPONDING FIELDS OF TABLE ITAB
        WHERE VBELN EQ P_VBELN.

LOOP AT ITAB.

   VBKOK_WA-VBELN_VL = ITAB-VBELN.
   VBKOK_WA-VBELN    = ITAB-VBELN.

   DELIVERY  = ITAB-VBELN.
*****TABLE DATA

*  VERPO_TAB-VBELN = ITAB-VBELN.
*  VERPO_TAB-POSNR = ITAB-POSNR.
*  VERPO_TAB-TMENG = ITAB-LFIMG.
*  VERPO_TAB-VRKME = 'EA'.
*  VERPO_TAB-MATNR = ITAB-MATNR.
*  VERPO_TAB-LGORT = 'S005'.

*  APPEND VERPO_TAB.

    VBPOK_TAB-VBELN_VL = ITAB-VBELN.
    VBPOK_TAB-POSNR_VL = ITAB-POSNR.
    VBPOK_TAB-VBELN    = ITAB-VBELN.
    VBPOK_TAB-POSNN    = ITAB-POSNR.
    VBPOK_TAB-MATNR    = ITAB-MATNR.
    VBPOK_TAB-WERKS    = ITAB-WERKS.
*   VBPOK_TAB-LIANP    = 'X'.
    VBPOK_TAB-PIKMG    = ITAB-LFIMG.
    VBPOK_TAB-NDIFM    = ITAB-LFIMG.

    VBPOK_TAB-LGORT  = 'S005'.
    APPEND VBPOK_TAB.

*  PROT-VBELN = ITAB-VBELN.
*  PROT-POSNR = ITAB-POSNR.
*  PROT-MATNR = ITAB-MATNR.
*  PROT-ARKTX = ITAB-ARKTX.
*  PROT-LFIMG = ITAB-LFIMG.
*  PROT-VRKME = 'EA'.
*  APPEND PROT.

   CLEAR : EF_ERROR_ANY_0,
           EF_ERROR_IN_ITEM_DELETION_0,
           EF_ERROR_IN_POD_UPDATE_0,
           EF_ERROR_IN_INTERFACE_0,
           EF_ERROR_IN_GOODS_ISSUE_0,
           EF_ERROR_IN_FINAL_CHECK_0,
           EF_ERROR_PARTNER_UPDATE,
           EF_ERROR_SERNR_UPDATE.


   AT END OF VBELN.
     CALL FUNCTION 'WS_DELIVERY_UPDATE'
       EXPORTING
         VBKOK_WA                           = VBKOK_WA
         SYNCHRON                           = 'X'
         NO_MESSAGES_UPDATE     = ' '
*       COMMIT                                = ' '
         DELIVERY                             = DELIVERY
         UPDATE_PICKING                 = ' '
*       NICHT_SPERREN                  = ' '
*       IF_CONFIRM_CENTRAL         = ' '
*       IF_WMPP                              = ' '
*       IF_GET_DELIVERY_BUFFERED           = ' '
*       IF_NO_GENERIC_SYSTEM_SERVICE  = ' '
*       IF_DATABASE_UPDATE                 = '1'
*       IF_NO_INIT                         = ' '
*       IF_NO_READ                         = ' '
         IF_ERROR_MESSAGES_SEND_0           = 'X'
*       IF_NO_BUFFER_REFRESH               = ' '
*       IT_PARTNER_UPDATE                  =
*       IT_SERNR_UPDATE                    =
*       IF_NO_REMOTE_CHG                   = ' '
*       IF_NO_MES_UPD_PACK                 = ' '
*       IF_LATE_DELIVERY_UPD               = ' '


       IMPORTING
         EF_ERROR_ANY_0                     = EF_ERROR_ANY_0
         EF_ERROR_IN_ITEM_DELETION_0        = EF_ERROR_IN_ITEM_DELETION_0
         EF_ERROR_IN_POD_UPDATE_0           = EF_ERROR_IN_POD_UPDATE_0
         EF_ERROR_IN_INTERFACE_0            = EF_ERROR_IN_INTERFACE_0
         EF_ERROR_IN_GOODS_ISSUE_0          = EF_ERROR_IN_GOODS_ISSUE_0
         EF_ERROR_IN_FINAL_CHECK_0          = EF_ERROR_IN_FINAL_CHECK_0
         EF_ERROR_PARTNER_UPDATE            = EF_ERROR_PARTNER_UPDATE
         EF_ERROR_SERNR_UPDATE              = EF_ERROR_SERNR_UPDATE


       TABLES
         VBPOK_TAB                          = VBPOK_TAB
         PROT                                      = PROT
*        VERKO_TAB                          = VERKO_TAB
*        VERPO_TAB                          = VERPO_TAB
*       VBSUPCON_TAB                    =
*       IT_VERPO_SERNR                  =
*       IT_PACKING                            =
*       IT_PACKING_SERNR               =
*       IT_REPACK                             =
*       IT_HANDLING_UNITS                =
*       IT_OBJECTS                             =
*       ET_CREATED_HUS                  =
*       TVPOD_TAB                             =
*       IT_TMSTMP                              =
*       IT_BAPIADDR1                         =
*       IT_TEXTL                                   =
*       IT_TEXTH                                  =
*       IT_AAC_ITEM_BLOCK               =
*       IT_HU_HEADER_EPC                =
*       IT_HU_ITEMS_EPC                    =
               .

     IF EF_ERROR_ANY_0 IS NOT INITIAL OR EF_ERROR_IN_ITEM_DELETION_0 IS NOT INITIAL OR
        EF_ERROR_IN_POD_UPDATE_0 IS NOT INITIAL OR EF_ERROR_IN_INTERFACE_0 IS NOT INITIAL OR
        EF_ERROR_IN_GOODS_ISSUE_0 IS NOT INITIAL OR EF_ERROR_IN_FINAL_CHECK_0 IS NOT INITIAL OR
        EF_ERROR_PARTNER_UPDATE IS NOT INITIAL OR EF_ERROR_SERNR_UPDATE IS NOT INITIAL.

       CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.

     ELSE.

       CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
         WAIT UP TO 5 SECONDS.

     ENDIF.

   ENDAT.

  ENDLOOP.

1 ACCEPTED SOLUTION

former_member189779
Active Contributor
0 Kudos
275

Just quickly looking can you also try adding

commit    = do_commit "X

6 REPLIES 6

former_member189779
Active Contributor
0 Kudos
276

Just quickly looking can you also try adding

commit    = do_commit "X

0 Kudos
275

No sir..still it is not working...

0 Kudos
275

Try

VBKOK-WABUC = X

In item table

VBPOK- KZVFDAT and KZHSDAT = "X"

Also in FM

VALUE(IF_DATABASE_UPDATE) TYPE  LESHP_DATABASE_UPDATE DEFAULT = X

0 Kudos
275

Thanx a lot for your reply.. now the FM is giving the correct value....

But I have one more doubt... now the FM is working correctly when the Delivered qty is same as picked qty, but I have some scenarios where in the picked qty is not same as delivery qty... in those cases I AM GETTING ERROR :  EF_ERROR_IN_GOODS_ISSUE_0 = 'X' and  EF_ERROR_ANY_0 =  'X'.

How can I solve this issue.. for partial Picked Qty

former_member215575
Active Participant
0 Kudos
275

Hi Gopa,

make VBKOK_WA-WABUC = 'X'  and try.

Regards,

SG.

0 Kudos
275

Try Check for VBKOK-KZEBU and VBPOK-LIANP and pass you item quantity.