传入采购订单项目建交货单
Posted rainysblog
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了传入采购订单项目建交货单相关的知识,希望对你有一定的参考价值。
*"---------------------------------------------------------------------- *"*"本地接口: *" EXPORTING *" REFERENCE(O_RETURN) TYPE ZMMS0021 *" TABLES *" IT_ITEM STRUCTURE ZMMS0106 *"---------------------------------------------------------------------- DATA:lt_stock_items TYPE TABLE OF bapidlvreftosto. DATA:ls_stock_items TYPE bapidlvreftosto. DATA:lt_created_items TYPE TABLE OF bapidlvitemcreated. DATA:ls_created_items TYPE bapidlvitemcreated. DATA:lv_delivery TYPE bapishpdelivnumb-deliv_numb. DATA:lv_vstel TYPE vstel. DATA:lv_ledat TYPE ledat. DATA:lt_return TYPE TABLE OF bapiret2. LOOP AT it_item INTO DATA(ls_item). ls_stock_items-ref_doc = ls_item-ebeln."参考凭证 ls_stock_items-ref_item = ls_item-ebelp."参考项 * ls_stock_items-dlv_qty = ls_item-menge."数量 APPEND ls_stock_items TO lt_stock_items. ls_created_items-ref_doc = ls_item-ebeln."参考凭证 ls_created_items-ref_item = ls_item-ebelp."参考项 ls_created_items-material = ls_item-matnr."物料编号 ls_created_items-material_long = ls_item-matnr."物料编号 * ls_created_items-dlv_qty = ls_item-menge."数量 APPEND ls_created_items TO lt_created_items. ENDLOOP. CALL FUNCTION ‘BAPI_OUTB_DELIVERY_CREATE_STO‘ EXPORTING ship_point = lv_vstel due_date = lv_ledat IMPORTING delivery = lv_delivery TABLES stock_trans_items = lt_stock_items created_items = lt_created_items return = lt_return. FREE MEMORY ID ‘ZPOS_LGORT_FLAG‘. DELETE lt_return WHERE type = ‘E‘ AND id = ‘BAPI‘ AND number = ‘001‘. LOOP AT lt_return INTO DATA(ls_return) WHERE type = ‘E‘. CONCATENATE o_return-message ls_return-message INTO o_return-message SEPARATED BY ‘/‘. ENDLOOP. IF sy-subrc = 0. "创建失败 CALL FUNCTION ‘BAPI_TRANSACTION_ROLLBACK‘. o_return-type = ‘E‘. CONCATENATE ‘交货单创建失败:‘ o_return-message INTO o_return-message. ELSE. "创建成功 CALL FUNCTION ‘BAPI_TRANSACTION_COMMIT‘ EXPORTING wait = ‘X‘. o_return-zdjh = lv_delivery."交货单 o_return-type = ‘S‘. o_return-message = ‘交货单创建成功‘. ENDIF.
以上是关于传入采购订单项目建交货单的主要内容,如果未能解决你的问题,请参考以下文章
SAP系统中怎样将采购申请和采购订单中的“采购组”设置为必输项和选输项?谢谢!