Application Development and Automation 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: 
Read only

Create a outbond delivery with BAPI_DELIVERYPROCESSING_EXE

Former Member
0 Likes
875

Hi,

I was trying to create delivery from a report using the BAPI BAPI_DELIVERYPROCESSING_EXEC.

I was wondering if it is possible to create a delivery from several preceding-documents (sales orders), having in mind that the shipment should be the same.

As stated here it looks like it can be done:

http://wiki.sdn.sap.com/wiki/display/ERPSCM/BAPI_DELIVERYPROCESSING_EXEC

At the time of running the BAPI it creates me two deliveries, one for each sales order. Have you ever tried to do so? Here is the relevant part of the code. wa_order contains the sales order structure obtained from an ALV.

LOOP AT it_order INTO wa_order WHERE mark = 'X'.

             t_request-document_numb = wa_order-vbeln.

             t_request-document_item = wa_order-posnr.

             t_request-quantity_sales_uom = wa_order-kwmeng.

             t_request-quantity_base__uom  = wa_order-kwmeng.

             t_request-id = 1.

             t_request-document_type = 'A'.

             t_request-delivery_date      = sy-datum.

             t_request-material = wa_order-matnr.

             t_request-plant = wa_order-werks.

             t_request-date = sy-datum.

             t_request-goods_issue_date = sy-datum.

             t_request-goods_issue_time = sy-uzeit.

APPEND t_request.

ENDLOOP.

CALL FUNCTION 'BAPI_DELIVERYPROCESSING_EXEC'

TABLES

             request      = t_request

             createditems = t_created

return       = t_return.

READ TABLE t_return WITH KEY type = 'E'.

IF sy-subrc = 0.

MESSAGE e208(00) WITH text-016.

ENDIF.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

wait = 'X'.

Thanks,

Salva.

Hi,

I was trying to create delivery from a report using the BAPI BAPI_DELIVERYPROCESSING_EXEC.

I was wondering if it is possible to create a delivery from several preceding-documents (sales orders), having in mind that the shipment should be the same.

As stated here it looks like it can be done:

http://wiki.sdn.sap.com/wiki/display/ERPSCM/BAPI_DELIVERYPROCESSING_EXEC

At the time of running the BAPI it creates me two deliveries, one for each sales order. Have you ever tried to do so? Here is the relevant part of the code. wa_order contains the sales order structure obtained from an ALV.

LOOP AT it_order INTO wa_order WHERE mark = 'X'.

             t_request-document_numb = wa_order-vbeln.

             t_request-document_item = wa_order-posnr.

             t_request-quantity_sales_uom = wa_order-kwmeng.

             t_request-quantity_base__uom  = wa_order-kwmeng.

             t_request-id = 1.

             t_request-document_type = 'A'.

             t_request-delivery_date      = sy-datum.

             t_request-material = wa_order-matnr.

             t_request-plant = wa_order-werks.

             t_request-date = sy-datum.

             t_request-goods_issue_date = sy-datum.

             t_request-goods_issue_time = sy-uzeit.

APPEND t_request.

ENDLOOP.

CALL FUNCTION 'BAPI_DELIVERYPROCESSING_EXEC'

TABLES

             request      = t_request

             createditems = t_created

return       = t_return.

READ TABLE t_return WITH KEY type = 'E'.

IF sy-subrc = 0.

MESSAGE e208(00) WITH text-016.

ENDIF.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

wait = 'X'.

Thanks,

Salva.

2 REPLIES 2
Read only

FredericGirod
Active Contributor
0 Likes
713

Hi Salvador,

did you have check the customizing ?

did you have check the difference between the two sales orders ?  customer / plant / delivery date / ... everything that could split the delivery ?

Regards

Fred

Read only

0 Likes
713

NOTE: Already solved, I used BAPI BAPI_OUTB_DELIVERY_CREATE_SLS and worked fine the first time simply specifying sales order num and items_num.

Hi Fréderic,

I checked the little about I know about customizing on sales orders saw nothing. As far as I read the requirements for creating a delivery from two sales orders are that both have the same:

Ship-to-party

Delivery date

Shipping point

Incoterms

Route

I created two identical sales orders with different material and simulated the process correctly with transactions VL10A and VL10C, both worked fine.

There must be some missing/extra parameter (delivery date can't be current date, etc). I'll check the required fields since on the above transactions I simply select order positions and click on Background button.

Regards,

Salva.