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: 

Not able to delete line items using BAPI_OUTB_DELIVERY_CHANGE

manohar_m
Explorer

Hi,

Not able to delete line items of a delivery using BAPI 'BAPI_OUTB_DELIVERY_CHANGE', with thte below code and even return parameter has zero messages.

I have even checked existing below posting.

https://www.sdn.sap.com/irj/scn/logon?redirect=http%3a%2f%2fforums.sdn.sap.com%2fthread.jspa%3fthrea...

Below is the code that i am using.........

*wa1-deliv_numb = wa_lips-vbeln.

  • wa1-deliv_item = wa_lips-posnr.

  • APPEND wa1 to item_data.

wa-deliv_numb = vbeln_so .

wa-deliv_item = l_item.

wa-del_item = 'X'.

APPEND wa TO item_control.

w_header_data-deliv_numb = vbeln_so .

w_header_control-deliv_numb = vbeln_so .

w_delivery = vbeln_so .

*w_header_control-dlv_del = 'X'. "Delete whole Delivery

CALL FUNCTION 'BAPI_OUTB_DELIVERY_CHANGE'

EXPORTING

header_data = w_header_data

header_control = w_header_control

delivery = w_delivery

TABLES

  • item_data = item_data

item_control = item_control

return = return.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

wait = 'X'.

I have even tried uncommenting item_data parameter but not able to delete line item.....i am able to delete whole delivery but not line items .........can any one of u help me in resolving this issiue plz ???

Regards,

M, Manohar

7 REPLIES 7

Former Member
0 Kudos

wa-deliv_item = l_item.

Can you please check if the item number is passed with the correct format .same number of leading zeroes. Just for testing hard code the item number and then check.

0 Kudos

yes i am converting deliveryno, line item into internal format using below code.......

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = l_item

IMPORTING

output = l_item.

0 Kudos

what is '_so' in "vbeln_so"?

is it select-option or sales_order..

former_member217544
Active Contributor
0 Kudos

Hi,

Check the links provided in the below url as well if it helps:

Regards,

Swarna Munukoti.

0 Kudos

below posting is for deleting entire delivery document, that i am able to do, but here my requirement is to delete one or more line items, not the whole document

Regards,

M, Manohar

vikas_naikdesai
Explorer
0 Kudos

Hi Manohar,

Please pass following fields to delete line item from Delivery

1. deliv_numb = vbeln

2. deliv_item = posnr

3. material = matnr

4. dlv_qty = lfimg

5. dlv_qty_imunit = lfimg

6. fact_unit_nom = umvkz

7. fact_unit_denom = umvkn

8. batch = charg

append above data to line item table.

please reward points if usefull,

Regards

Vikas

former_member206395
Participant
0 Kudos

Kindly use WS_DELIVERY_UPDATE to delete the items

Sample code:

L_VBKOK-VBELN_VL = vbeln_so.

clear l_vbpok.

         refresh l_vbpok.

         l_vbpok-vbeln_vl = vbeln_so

         l_vbpok-posnr_vl = wa_deliv_item.

         l_vbpok-lips_del = c_x.

         append l_vbpok.

         set update task local.

         call function 'WS_DELIVERY_UPDATE'

           exporting

             vbkok_wa = l_vbkok

             commit   = ' '

             delivery = lv_delivery

           tables

             vbpok_tab = l_vbpok

           exceptions

             others   = 0.

         commit work and wait.