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: 

Using WS_DELIVERY_UPDATE_2 to Post a Partial Goods Receipt on a Inbound Delivery

Former Member
0 Kudos

Hi Folks,

I am trying to use WS_DELIVERY_UPDATE_2 to post a Partial PGR on an Inbound Delivery. I have seen a lot of posts and forums about this topic but none clearly say how they achieved it. I have also searched SAP Portal and debuged the code all to no avail.

In this example 1800003517 has one line of 10 bags, I have packed 5 bags and want to do the goods receipt for just those 5 bags.

Here is how I am calling the code, if someone has gotten this to work I would be more than greatful.

   DATA: ls_vbkok  LIKE  vbkok,
      lt_vbpok_tab TYPE TABLE OF vbpok,
      ls_vbpok_tab TYPE vbpok,
      gs_lips TYPE lips.

ls_vbkok-vbeln_vl = '1800003517'.
ls_vbkok-wabuc = 'X'.
ls_vbkok-spe_auto_gr = 'X'.
ls_vbkok-kzebu = 'X'.

  ls_vbpok_tab-vbeln_vl = gs_lips-vbeln.

ls_vbpok_tab-posnr_vl = gs_lips-posnr.

ls_vbpok_tab-matnr = gs_lips-matnr.

ls_vbpok_tab-charg = gs_lips-charg.

ls_vbpok_tab-lichn = gs_lips-lichn.

ls_vbpok_tab-vfdat = gs_lips-vfdat.

Ls_vbpok_tab-lgmng = ls_vbpok_tab-lfimg = gs_lips-lfimg.
ls_vbpok_tab-umvkz = gs_lips-umvkz.
ls_vbpok_tab-umvkn = gs_lips-umvkn.
APPEND ls_vbpok_tab TO lt_vbpok_tab.

   CALL FUNCTION 'WS_DELIVERY_UPDATE_2'
  EXPORTING
    vbkok_wa                           = ls_vbkok
   synchron                           = 'X'
   commit                             = 'X'
    delivery                           = '1800003517'
   if_error_messages_send             = ''
   if_no_remote_chg_1                 = '1'
TABLES
   VBPOK_TAB                          = lt_vbpok_tab.

1 ACCEPTED SOLUTION

Former Member

I have struggled with this same issue too. Only way you can do is update the delivery amount with function BAPI_OUTB_DELIVERY_CHANGE before calling WS_DELIVERY_UPDATE_2.

You would have to do the same as well if you were using VL02N.

Simo

4 REPLIES 4

Former Member

I have struggled with this same issue too. Only way you can do is update the delivery amount with function BAPI_OUTB_DELIVERY_CHANGE before calling WS_DELIVERY_UPDATE_2.

You would have to do the same as well if you were using VL02N.

Simo

0 Kudos

Hi,

I FINALLY got this to work, I had to debug the FM a number of times before I found out the problem but this code works. The ebumg_bme variable stores the qty you want to partially PGR and the WABUC, SPE_AUTO_GR and KZEBU flags are required to tell the FM you are doing a Partial PGR. Give me a like if you find this useful.

Colm.

      ls_vbkok-vbeln_vl = gv_vbeln.

      ls_vbkok-wabuc = 'X'.
      ls_vbkok-spe_auto_gr = 'X'.
      ls_vbkok-kzebu = 'X'.

      LOOP AT gt_lips INTO gs_lips WHERE venum IS NOT INITIAL.
        CLEAR ls_vbpok_tab.
        ls_vbpok_tab-vbeln_vl = gs_lips-vbeln.
        ls_vbpok_tab-posnr_vl = gs_lips-posnr.
        LOOP AT lt_vepo
        INTO ls_vepo
        WHERE vbeln = gs_lips-vbeln
        AND posnr = gs_lips-posnr.
          ls_vbpok_tab-ebumg_bme = ls_vbpok_tab-ebumg_bme + ls_vepo-vemng.
        ENDLOOP.
        APPEND ls_vbpok_tab TO lt_vbpok_tab.
      ENDLOOP.
      CALL FUNCTION 'WS_DELIVERY_UPDATE_2'
        EXPORTING
          vbkok_wa               = ls_vbkok
          synchron               = 'X'
          commit                 = 'X'
          delivery               = gv_vbeln
          if_error_messages_send = ''
          if_no_remote_chg_1     = '1'
        TABLES
          vbpok_tab              = lt_vbpok_tab.

0 Kudos

Hi Gavin

Thanks very much for the solution. It works like a gem !

Nagaraj Ashwath

0 Kudos

Hello Gavin,

I was looking for solution from last two days.

Thanks a Lot.

It works Great!!

Regards,

Gaurav Thakkar