您好,登錄后才能下訂單哦!
這篇文章將為大家詳細(xì)講解有關(guān)如何使用BAPISDORDER_GETDETAILEDLIST創(chuàng)建S/4HANA的Outbound Delivery,小編覺得挺實(shí)用的,因此分享給大家做個(gè)參考,希望大家閱讀完這篇文章后可以有所收獲。
要在S/4HANA里創(chuàng)建Outbound Delivery,首先要具有一個(gè)銷售訂單,ID為376,通過事務(wù)碼VA03查看。
只用61行代碼就能實(shí)現(xiàn)基于這個(gè)Sales Order去創(chuàng)建對應(yīng)的outbound delivery:
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(<header>). ls_read-item = 'X'. <header>-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(<item>). APPEND INITIAL LINE TO lt_so_items ASSIGNING FIELD-SYMBOL(<fill>). <fill>-ref_doc = <item>-doc_number. <fill>-ref_item = <item>-itm_number. <fill>-dlv_qty = <item>-req_qty. <fill>-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(<return>). WRITE:/ | Type: { <return>-type }: { <return>-message } | COLOR COL_NEGATIVE. ENDLOOP. CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' EXPORTING wait = 'X' IMPORTING return = lt_bapiret2. LOOP AT lt_bapiret2 ASSIGNING <return>. WRITE:/ 'Message:', <return>-message COLOR COL_POSITIVE. ENDLOOP.
思路就是首先用函數(shù)BAPISDORDER_GETDETAILEDLIST把銷售訂單的行項(xiàng)目明細(xì)讀取出來,然后用BAPI_OUTB_DELIVERY_CREATE_SLS進(jìn)行outbound delivery的創(chuàng)建。
執(zhí)行report,顯示Outbound Delivery 80000205成功創(chuàng)建:
使用事務(wù)碼VL03N查看:
關(guān)于“如何使用BAPISDORDER_GETDETAILEDLIST創(chuàng)建S/4HANA的Outbound Delivery”這篇文章就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,使各位可以學(xué)到更多知識,如果覺得文章不錯,請把它分享出去讓更多的人看到。
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。