ABAP 生产订单的创建与修改函数转自http://www.cnblogs.com/aBaoRong/archive/2012/04/11/2441946.html
如果生产订单过多,可以批量创建生产订单,例如通过上传excel文件来批量创建,系统也有相应BAPI,否则BDC又很慢。
创建生产订单:
'BAPI_PRODORD_CREATE‘
CALL FUNCTION 'BAPI_PRODORD_CREATE'
EXPORTING
ORDERDATA = I_ORDDATA
IMPORTING
RETURN = I_RETURN
ORDER_NUMBER = I_ORDER_NUMBER
ORDER_TYPE = I_ORDER_TYPE.
输入参数主要看orderdata,填入生产订单所需信息,order_number 是输出信息,return 中保留了出错信息,如果有E类型的消息的话。
修改生产订单:
'BAPI_PRODORD_CHANGE'
CALL FUNCTION 'BAPI_PRODORD_CHANGE' "BAPI: Change Production Order
EXPORTING
number = " bapi_order_key-order_number Production Order Number
orderdata = " bapi_pp_order_change Transfer Structure for Changing Production Orders
orderdatax = " bapi_pp_order_changex Transfer Structure for Changing Production Orders
IMPORTING
return = " bapiret2 Return Parameters
order_type = " bapi_order_copy-order_type Order Type
order_status = " bapi_order_status Order Status Indicator
master_data_read = " bapiflag-bapiflag Indicator: Master Data Read
. " BAPI_PRODORD_CHANGE
number是输入的生产订单号,orderdata中输入要修改那些参数,注意orderdatax 参数如果要修改那些参数,要相应的再这个结构标记X。这个参数设计的很好,不然的话还得先把生产订单所有状态读出来,在修改赋值,有了这个参数就方便很多。