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: 

VL216 error message when delivery is cancelled and changed

Former Member
0 Kudos

Hi,

I want to cancel the outbound delivery,goods movements status is C; then modify delivery

quantity; then re-PGI.Those steps are executed in one Z-program.

After cancelling delivery by FM 'WS_REVERSE_GOODS_ISSUE',I change the delivery item qty

by using BAPI 'BAPI_OUTB_DELIVERY_CHANGE' without leaving the current Z-program.BAPI

return error message VL216 'Item & does not exist' ,but the item is existent.

Between the FM(VL09) and BAPI(VL02N),if I exit the Z-program,this is no problem.

Can someone tell me what the matter is?

Thanks and Regards

Binary

15 REPLIES 15

Former Member
0 Kudos

I think while executing the bapi, the delivery is currently locked. Use "commit and wait " before executing the BAPI

Regards

Vinod

0 Kudos

hi Vinod,

I have 'commit and wait' before executing BAPI, it doesn't work.

IF I use BDC to cancel delivery instead of FM 'WS_REVERSE_GOODS_ISSUE',then execute BAPI, this is no problem.

0 Kudos

I still think there is a problem with locking, can u try the bapi "BAPI_GOODSMVT_CANCEL" instead of "'WS_REVERSE_GOODS_ISSUE'

After COMMIT WORK AND WAIT , check what is the value of SY-SUBRC.

Regards

Vinod

0 Kudos

hi Vinod, BAPI 'BAPI_GOODSMVT_CANCEL' cann't be used to cancel delivery, it throw error message M7 130 'Material document cannot be processed'.

0 Kudos

Hi try the below code. This worked correctly for me.

PARAMETERS : del_num TYPE likp-vbeln.
MOVE del_num TO header_data-deliv_numb.
MOVE del_num TO header_control-deliv_numb.

MOVE del_num TO item_dt_wa-deliv_numb.
MOVE '000010' TO item_dt_wa-deliv_item.
MOVE 2 TO item_dt_wa-dlv_qty.
APPEND item_dt_wa TO item_data.

MOVE del_num TO item_cnt_wa-deliv_numb.
MOVE '000010' TO item_cnt_wa-deliv_item.
MOVE 'X' TO item_cnt_wa-chg_delqty.
APPEND item_cnt_wa TO item_control.

CALL FUNCTION 'WS_REVERSE_GOODS_ISSUE'
  EXPORTING
    i_vbeln                   = del_num
    i_budat                   = '20100331'
    i_count                   = 01
    i_mblnr                   = ''
    i_tcode                   = 'VL09'
    i_vbtyp                   = 'J'
  TABLES
    t_mesg                    = xmesg
  EXCEPTIONS
    error_reverse_goods_issue = 1
    OTHERS                    = 2.

IF sy-subrc EQ 0.
  COMMIT WORK AND WAIT.
  write 😕 sy-subrc.
ENDIF.

CALL FUNCTION 'BAPI_OUTB_DELIVERY_CHANGE'
  EXPORTING
    header_data               = header_data
    header_control            = header_control
    delivery                  = del_num
  TABLES
   item_data                 = item_data
   item_control              = item_control
    return                    = return
          .
IF sy-subrc EQ 0.
  COMMIT work.
ENDIF.

0 Kudos

Hi i run your code in my system,but it doesn't work.

There are tow questions:

1. If i don't set value to field bapiobdlvitemcon-fact_unit_nom, bapiobdlvitemcon-sales_unit and bapiobdlvitemcon-fact_unit_denom, BAPI 'BAPI_OUTB_DELIVERY_CHANGE' will throw a error message VLBAPI 004 'Error in document &1 item &2 (quantity consistency check)'.

2. I have set value to the above field,the error message VL216 is existent still.

Former Member
0 Kudos

Solved

0 Kudos

please tell me how to solve it.

thanks.

0 Kudos

Please let me know how this error "Item 00010 doesnot exist" got resolved.

Thanks,

Phani.

0 Kudos

You need to use BAPI for change delivery as foolows:

call function 'BAPI_OUTB_DELIVERY_CHANGE' destination 'NONE'

EXPORTING

header_data = ls_header_data

header_control = ls_header_control

delivery = lv_delivery

TABLES

item_data = lt_item_data

item_control = lt_item_control

return = return.

Good luck.

0 Kudos

Hi,

Please let me know how it solved ?

I am facing the same problem exactly.

Regards

Pinaki Mukherjee

0 Kudos

Hi,

Me, too

I'm facing the same issue.

let me know how to solve it.

Thanks,

yuki

0 Kudos

Hi,

Run the BAPI,Put the break point on the below FM SHP_UPDATE_MOVEMENT_STATUS and check the reason .

loop at it_upd_items assigning <ls_upd_items>.

     read table ilips with key posnr = <ls_upd_items>-item
                      binary search.
     if sy-subrc ne 0.
       message a216 with <ls_upd_items>-item.
     endif.
     read table xlips index ilips-tabix.
     if sy-subrc ne 0.
       message a216 with <ls_upd_items>-item.
     endif.
     slips-tabix = ilips-tabix.

     perform lips_bearbeiten_vorbereiten(sapfv50p).

0 Kudos

Hi,

Thank you for your reply.

However they don't stop at the debug point which you mentioned.

Now I'm developing the function module which includes 'WS_REVERSE_GOODS_ISSUE' and 'BAPI_OUTB_DELIVERY_CHANGE'.

Procedure is as below.

If they execute Call Function 'BAPI_OUTB_DELIVERY_CHANGE' after cancelling PGI manually, it's success.

But if they execute at one time, it's failed with error message VL 216.

Do you have any advice regarding this situation?

Call Function 'WS_REVERSE_GOODS_ISSUE'.

     Exporting

          i_vbeln     =     Delivery No.

          i_budat     =     Sy-datum

          i_tcode     =     VL09

          i_vbtyp     =     'J'

     Tables

          t_mesg

IF Sy-subrc = 0.

     Call Function 'BAPI_TRANSACTION_COMMIT'.

ENDIF.

Call Function 'BAPI_OUTB_DELIVERY_CHANGE'

     Exporting

          header_data

          header_control

          delivery

     Tables

          item_data

          item_control

          return.

Thanks,

yuki

Former Member
0 Kudos

Hey bro... how did u solve this issue ... i m having the same issue..

Asif