Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use BAPISDORDER_GETDETAILEDLIST to create an Outbound Delivery for S/4HANA

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article will explain in detail how to use BAPISDORDER_GETDETAILEDLIST to create the Outbound Delivery of S/4HANA. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.

To create an Outbound Delivery in S/4HANA, you first need to have a sales order with an ID of 376, which is viewed by the transaction code VA03.

It takes only 61 lines of code to create a corresponding outbound delivery based on this Sales Order:

REPORT zcreate_dn.DATA:lv_ship_point TYPE bapidlvcreateheader-ship_point VALUE '0001, lv_due_date TYPE datum VALUE' 20181205, lv_delivery TYPE bapishpdelivnumb-deliv_numb, lt_so_items LIKE TABLE OF bapidlvreftosalesorder, ls_so_items LIKE LINE OF lt_so_items, lt_return TYPE TABLE OF bapiret2 Ls_read TYPE order_view, lt_item TYPE TABLE OF bapisdit, lt_order_headers_out TYPE TABLE OF bapisdhd, lt_header TYPE TABLE OF sales_key, lt_bapisdtehd TYPE TABLE OF bapisdtehd, lt_bapitextli TYPE TABLE OF bapitextli Lt_bapiret2 LIKE bapiret2 OCCURS 0 WITH HEADER LINE.APPEND INITIAL LINE TO lt_header ASSIGNING FIELD-SYMBOL (). Ls_read-item = 'X'.-vbeln =' 0000000376'.CALL FUNCTION 'BAPISDORDER_GETDETAILEDLIST' EXPORTING i_bapi_view = ls_read TABLES sales_documents = lt_header order_items_out = lt_item.LOOP AT lt_item ASSIGNING FIELD-SYMBOL (). APPEND INITIAL LINE TO lt_so_items ASSIGNING FIELD-SYMBOL (). -ref_doc =-doc_number. -ref_item =-itm_number. -dlv_qty =-req_qty. -sales_unit = 'EA'.ENDLOOP.CALL FUNCTION' BAPI_OUTB_DELIVERY_CREATE_SLS' EXPORTING ship_point = lv_ship_point due_date = lv_due_date IMPORTING delivery = lv_delivery TABLES sales_order_items = lt_so_items return = lt_return.LOOP AT lt_return ASSIGNING FIELD-SYMBOL (). WRITE:/ | Type: {- type}: {- message} | COLOR COL_NEGATIVE.ENDLOOP.CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' EXPORTING wait =' X' IMPORTING return = lt_bapiret2.LOOP AT lt_bapiret2 ASSIGNING. WRITE:/ 'Message:',-message COLOR COL_POSITIVE.ENDLOOP.

The idea is to first use the function BAPISDORDER_GETDETAILEDLIST to read the line item details of the sales order, and then use BAPI_OUTB_DELIVERY_CREATE_SLS to create the outbound delivery.

Execute report to show that Outbound Delivery 80000205 was successfully created:

Use the transaction code VL03N to view:

This is the end of this article on "how to use BAPISDORDER_GETDETAILEDLIST to create the Outbound Delivery of S/4HANA". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it out for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report