Skip to Content
0
Nov 05, 2007 at 09:27 PM

Create and delete delivery back to back not working!

223 Views

Hi guys, I'm trying to delete an outbound delivery and I have a short dump.

First, I create the delivery then for some cases, I have to delete the delivery just after, in the same execution.

Let assume we have 2 programs, one that create an oubound delivery and one that delete it. If I run these 2 programs back to back it will works. But If I'm putting my code in one program I'm having a short dump. Maybe something has not been posted correctly.

This is the code to create the outbound delivery

This is the code to delete the outbound delivery

data: l_header_data type bapiobdlvhdrchg,

l_header_control type bapiobdlvhdrctrlchg.

l_header_data-deliv_numb = ls_createditems-document_numb.

l_header_control-deliv_numb = ls_createditems-document_numb.

l_header_control-dlv_del = abap_true.

call function 'BAPI_OUTB_DELIVERY_CHANGE'

exporting

header_data = l_header_data

header_control = l_header_control

delivery = ls_createditems-document_numb

tables

return = lt_return.

if lt_return is initial.

call function 'BAPI_TRANSACTION_COMMIT'

exporting

wait = abap_true.

endif.

any idea???

The short dump occurs in program LEINSF2U line 178, the variable vert_menge should be 0, but when I'm creating the delivery and deleting after in the same run, that field has the value of my line item. If I clear that variable in debug the delete will work, also if I delete the delivery after in a second run, it will work because that variable will be iniital.

Alex