10-07-2008 2:37 PM
I use this bapi to do the delivery. The bapi create the objet (delivery) but the commit work don't commit: the report return the number of delivery but it doesn't exist on database (LIKP).
The code is:
call function 'BAPI_OUTB_DELIVERY_CREATE_SLS'
DESTINATION logsys
EXPORTING
SHIP_POINT = 'MD01'
DUE_DATE = sy-datum
DEBUG_FLG = 'X'
importing
delivery = lf_vbeln
num_deliveries = lf_num
tables
sales_order_items = lt_order
extension_in = lt_extin
deliveries = lt_deli
created_items = lt_itm
extension_out = lt_extout
return = lt_return
.
write: / 'Delivery:', lf_vbeln,
/ 'NumDeliveries:', lf_num,
/ 'Deliveries:'.
loop at lt_deli into ls_deli.
write ls_deli-deliv_numb.
endloop.
if not lt_itm[] is initial.
write: / 'CreatedItems:'.
loop at lt_itm into ls_itm.
write: / ls_itm-ref_doc,
ls_itm-ref_item,
ls_itm-deliv_numb,
ls_itm-deliv_item,
ls_itm-material,
ls_itm-dlv_qty,
ls_itm-sales_unit,
ls_itm-sales_unit_iso.
endloop.
endif.
if not lt_return[] is initial.
write: / 'Return:'.
loop at lt_return into ls_ret.
write: / ls_ret-type, ls_ret-id, ls_ret-number,
ls_ret-message,
/.
endloop.
endif.
if not lt_extout[] is initial.
write: / 'ExtensionOut:'.
loop at lt_extout into ls_ext.
write: / ls_ext.
endloop.
endif.
if not lf_vbeln is initial.
commit work.
endif.
Someone can help me?
Thanks
10-07-2008 2:47 PM
10-07-2008 3:23 PM
Return 2 row:
- S VL 311 2083608861 has been saved
- S BAPI 000 OutboundDelivery 2083608861 has been created. External reference:
10-07-2008 3:25 PM
10-07-2008 4:16 PM
No, none mail dovument.
The total output of the program is:
Delivery: 2083608864
NumDeliveries: 0001
Deliveries: 2083608864
CreatedItems:
2083310227 000010 2083608864 000010 3004426 1,000 ST PCE
2083310227 000020 2083608864 000020 3004426 1,000 ST PCE
Return:
S VL 311
2083608864 has been saved
S BAPI 000
OutboundDelivery 2083608864 has been created. External reference:
10-07-2008 4:23 PM
Instead of:
IF NOT lf_vbeln IS INITIAL.
COMMIT WORK.
ENDIF.
Try:
IF NOT lf_vbeln IS INITIAL.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X''
IMPORTING
RETURN = lt_return.
ENDIF.
Rob
10-08-2008 7:55 AM
I try the function CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' but not work.
I noticed that while the program runs (or when it stopped at the output page) if I'm going in vl02n and i try to see the the delivery sap marks it as blocked by the user, but when the program ends sap write that the delivery didn't exist.
10-07-2008 5:37 PM
Hi,
I am not sure whether this going to help.....
Sometimes the Document number returned by BAPI miss the LEFT PADDED ZERO's and when we try to read the Database Table with the same, it gives an error.
In this case We can use a Conversion_exit....
Please ignore if u already checked the created delivery manually in the Delivery Txn....