PP篇11 增、改生产订单组件BAPI
增、改生产订单组件BAPI BAPI_ALM_ORDER_MAINTAIN
USE BAPI_ALM_ORDER_MAINTAIN TO CREATE OR CHANGE PM WORK ORDER
最近做一个sap和外部程序的接口,外部应用程序需要创建PM订单,于是我找到了BAPI_ALM_ORDER_MAINTAIN,然后做了一些测试,这是个能够创建、修改PM订单的BAPI。它需要的一些参数如下:
IT_METHODS LIKE BAPI_ALM_ORDER_METHOD
处理方法,必选项,存储CREATE CREATETONOTIF CHANGE DELETE RELEASE TECHNICALCOMPLETE ATPCHECK CALCULATE SCHEDULE DELELTEDSEX ADD SAVE DIALOG TRACE这些处理动作。
IT_HEADER LIKE BAPI_ALM_ORDER_HEADERS_I
订单的header信息
IT_HEADER_UP LIKE BAPI_ALM_ORDER_HEADERS_UP
修改的订单的header信息,如果是对订单header的修改,需要将对应字段置X
IT_HEADER_SRV LIKE BAPI_ALM_ORDER_SRVDAT_E
对象服务信息
IT_HEADER_SRV_UP LIKE BAPI_ALM_ORDER_SRVDAT_UP
IT_USERSTATUS LIKE BAPI_ALM_ORDER_USRSTAT
用户状态信息
IT_PARTNER LIKE BAPI_ALM_ORDER_PARTN_MUL
合作伙伴信息
IT_PARTNER_UP LIKE BAPI_ALM_ORDER_PARTN_MUL_UP
IT_OPERATION LIKE BAPI_ALM_ORDER_OPERATION
工序信息
IT_OPERATION_UP LIKE BAPI_ALM_ORDER_OPERATION_UP
IT_RELATION LIKE BAPI_ALM_ORDER_RELATION
IT_RELATION_UP LIKE BAPI_ALM_ORDER_RELATION_UP
IT_COMPONENT LIKE BAPI_ALM_ORDER_COMPONENT
组件信息
IT_COMPONENT_UP LIKE BAPI_ALM_ORDER_COMPONENT_UP
IT_TEXT LIKE BAPI_ALM_TEXT
IT_TEXT_LINES LIKE BAPI_ALM_TEXT_LINES
EXTENSION_IN LIKE BAPIPAREX
RETURN LIKE BAPIRET2
返回消息
ET_NUMBERS LIKE BAPI_ALM_NUMBERS
返回订单编码信息
1、创建一个带工序的订单 CLEAR IT_METHODS. IT_METHODS-REFNUMBER = '1'.”对应下面header表中相应行的数据 IT_METHODS-OBJECTTYPE = 'HEADER'.”需要操作的对象类型 IT_METHODS-METHOD = 'CREATE'.”相应动作 IT_METHODS-OBJECTKEY = '%00000000001'.”PM订单号,我们用的系统内部给号,此处使用临时编码'%00000000001',bapi结束时,会返回真正的订单号 APPEND IT_METHODS. CLEAR IT_METHODS. IT_METHODS-REFNUMBER = '1'.”对应下面OPERATION表中相应行的数据 IT_METHODS-OBJECTTYPE = 'OPERATION'.”需要操作的对象类型 IT_METHODS-METHOD = 'CREATE'.”相应动作 IT_METHODS-OBJECTKEY = '%00000000001'.”PM订单号,我们用的系统内部给号,此处使用临时编码'%00000000001',bapi结束时,会返回真正的订单号 APPEND IT_METHODS.”多个工序时,要加入多条数据,REFNUMBER 对应OPERATION的行数 CLEAR IT_METHODS. IT_METHODS-METHOD = 'SAVE'.”最后要插入一个save或dialog方法,否则bapi会报错 APPEND IT_METHODS.”IT_METHODS已经填充完毕 "填充header数据 IT_HEADER-ORDERID = '%00000000001'.”临时订单号 IT_HEADER-ORDER_TYPE = 'PM11'..”订单类型 IT_HEADER-EQUIPMENT = ‘JB200101’. IT_HEADER-SHORT_TEXT= 'PM ORDER TEXT'. ......... APPEND IT_HEADER "填充工序数据表 IT_OPERATION-ACTIVITY = ‘0010’.”operation num IT_OPERATION-DESCRIPTION = ‘operation text’. IT_OPERATION-CONTROL_KEY = 'PM01'.”control key APPEND IT_OPERATION."多个工序加入多条,要和IT_method对应。 CALL FUNCTION 'BAPI_ALM_ORDER_MAINTAIN' TABLES IT_METHODS = IT_METHODS IT_HEADER = IT_HEADER * IT_HEADER_UP = * IT_HEADER_SRV = * IT_HEADER_SRV_UP = * IT_USERSTATUS = * IT_PARTNER = * IT_PARTNER_UP = IT_OPERATION = IT_OPERATION * IT_OPERATION_UP = * IT_RELATION = * IT_RELATION_UP = * IT_COMPONENT = * IT_COMPONENT_UP = * IT_TEXT = * IT_TEXT_LINES = * EXTENSION_IN = RETURN = RETURN ET_NUMBERS = ET_NUMBERS