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: 

BAPI to update delivery note

Former Member
0 Kudos
654

hi all,

Is there any BAPI available with which we can update a delivery note and also if possible do PGI using it.

In case there are separate BAPI's for both the processes that will do for me.

Kindly help

Regards

Varun

9 REPLIES 9

Former Member
0 Kudos
223

Hi,

Check the fm 'RV_DELIVERY_POST_GI_VIEW', this might be of help,

Rgds,

0 Kudos
223

Hi

Do you know any other FM for this

Thanks

Varun

Former Member
0 Kudos
223

Have a look at function group V50R_CREA.

Rob

0 Kudos
223

Hi,

Thanks for this information Rob.

However, do you have any idea how the FM "BAPI_DELIVERYPROCESSING_EXEC" works.

If anyone know how this FM works please let me know

Thanks

Varun

0 Kudos
223

Have a look at the documentation. If that doesn't help, let us know.

Rob

Former Member
0 Kudos
223

Hi Varun,

You can use <b>WS_DELIVERY_UPDATE</b> or <b>WS_DELIVERY_UPDATE_2</b> ..

Following sample code works for Automatic PGI of an existing delivery. Use this as a basis and code for your requirement.

 
  DATA: ls_vbkok LIKE vbkok,
        lv_error_pgi TYPE xfeld,
        lt_prot LIKE prott OCCURS 0 WITH HEADER LINE,
        lwa_prot like prott.

  ls_vbkok-vbeln_vl = <your Delivery Note number>.
  ls_vbkok-wabuc = c_true.

  CALL FUNCTION 'WS_DELIVERY_UPDATE'
    EXPORTING
      vbkok_wa                           = ls_vbkok
      synchron                           = c_true
*         NO_MESSAGES_UPDATE                 = ' '
      commit                             = c_true
      delivery                           = <your Delivery Note number>
*         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               = ' '
*         IF_NO_MES_UPD_PACK                 = ' '
*       IMPORTING
*         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          = lv_error_pgi
*         EF_ERROR_IN_FINAL_CHECK_0          =
   TABLES
*         VBPOK_TAB                          =
     prot                               = lt_prot[]
*         VERKO_TAB                          =
*         VERPO_TAB                          =
*         VBSUPCON_TAB                       =
*         IT_VERPO_SERNR                     =
*         IT_PACKING                         =
*         IT_PACKING_SERNR                   =
*         IT_REPACK                          =
*         IT_HANDLING_UNITS                  =
*         ET_CREATED_HUS                     =
            .

  IF NOT lt_prot[] IS INITIAL.
    READ TABLE lt_prot WITH KEY msgty = 'E'.
    IF sy-subrc EQ 0.
****Errors Exist 
***      Goods Issue Failed
    ENDIF.
  ELSE.
***    Goods Issue posted sucessfully
  ENDIF.

Hope this helps..

Sri

Message was edited by: Srikanth Pinnamaneni

0 Kudos
223

Hi Shrikanth,

Do u have any idea if I will be able to update tne header of a delivery note for which the PGI has already been done. I want to replace a BDC program and want the following operations:

1) PGI a delivery if not PGIed

2) Update the header information

3)do not do PGI on those which have been PGIed

0 Kudos
223

Hi Varun,

Yes you can as long as the field is available in the structure VBKOK. See ls_vbkok in my eariler post.

Whatever is available in VBKOK you can change.

Also, You can determine whether a delivery is PGIed or not by looking at LIKP-WADAT_IST and then set WABUC in VBKOK structure accordingly..

****Read delivery header first

SELECT SINGLE * FROM likp WHERE vbeln EQ <your del. number>.

CHECK sy-subrc EQ 0.

****Check whether delivery is PGIed or not and set for automatic PGI

IF likp-wadat_ist IS INITIAL.

ls_vbkok-wabuc = 'X'.

ENDIF.

****Set all header fields you want to change

ls_vbkok-<fieldname> = ...

ls_vbkok-<fieldname> = ...

****Finally call WS_DELIVERY_UPDATE_2

Hope this helps..

<b>Varun, Please do not forget to award points to helpful answers and close the post if the problem has been solved.

Thanks,</b>

Sri

Message was edited by: Srikanth Pinnamaneni

0 Kudos
223

Hi Srikanth

Thanks for your help. Your suggestion has given me a lead and I will try to fit this logic in my program.

Thanks once again

Varun