[函数]如何取得生产订单下的工序(operation)-[PM_ORDER_DATA_READ]
1, 前台操作
在前台可以通过tcode:CO03查看生产订单工序。
选择order entered 选项,输入生产订单
进入到工序的详细屏幕:
2, 例子代码
可以通过函数 PM_ORDER_DATA_READ来读取生产订单下的工序(operation),包括子工序(sub-operation),值得注意的是在调用函数 PM_ORDER_DATA_READ之前要先调用 CO_IT_SET_FLG_ITAB_NEW来reset一些内表。
下面例子读取了1中订单 ‘000100003145’下的工序和子工序。
REPORT ztest_get_operation. DATA: lit_afvgd TYPE afvgd_t, lwa_afvgd LIKE LINE OF lit_afvgd. * Reset data before calling to PM_ORDER_DATA_READ CALL FUNCTION 'CO_IT_SET_FLG_ITAB_NEW' . * Get operations CALL FUNCTION 'PM_ORDER_DATA_READ' EXPORTING order_number = '000100003145' * CALL_FROM_NOTIF = * IMPORTING * WCAUFVD = * WILOA = * WRIWO1 = TABLES * IAFFHD = iafvgd = lit_afvgd * IRESBD = * IRIPW0 = * OP_PRINT_TAB = * IHPAD_TAB = * IHSG_TAB = * IHGNS_TAB = * KBEDP_TAB = EXCEPTIONS order_not_found = 1 OTHERS = 2. IF sy-subrc = 0. LOOP AT lit_afvgd INTO lwa_afvgd. WRITE:/ lwa_afvgd-vornr, "operation lwa_afvgd-uvorn. "sub-operation ENDLOOP. ENDIF.
运行结果与CO03中的结果一致。
以上。