判定生产订单状态的方法

1.可以通过函数'STATUS_TEXT_EDIT' 。
CALL FUNCTION 'STATUS_TEXT_EDIT'
EXPORTING
objnr = object_tab-objnr
spras = sy-langu
flg_user_stat = 'X'
IMPORTING
line = object_tab-sttxt
user_line = object_tab-ustxt
EXCEPTIONS
object_not_found = 01.

函数不能直接用工单号码作输入参数,需使用工单的OBJNR栏位,可以通过用工单号码从视图VSAUFK中取得。 TMP_LINE就是返回的工单状态记录,如: TECO DLV PRC MANC RESA RMWB SETC


2.可以通过直接在JEST表中通过状态判定读取。

SELECT SINGLE * FROM aufk WHERE aufnr = readrec-aufnr.

** 检查工单种类
* IF aufk-auart(1) <> 'A'.
* CONTINUE.
* ENDIF.

** 判定工单状态
CLEAR: jest.
SELECT SINGLE * FROM jest
WHERE objnr = aufk-objnr
AND ( stat = 'I0045' OR " TECO
stat = 'I0013' OR " DELETE
stat = 'I0076' OR " DELETE FLAG
stat = 'I0046' OR " CLSD
stat = 'I0012 ') "DLV
AND inact = space.
IF sy-subrc = 0.
CONTINUE.
ENDIF.
*
** 判定工单是否 RELASE
CLEAR: jest.
SELECT SINGLE * FROM jest
WHERE objnr = aufk-objnr
AND ( stat = 'I0002' OR " RELEASE
stat = 'I0042') " Partial RELEASE
AND inact = space.
IF sy-subrc <> 0.
CONTINUE.
ENDIF.


** 检查此笔作业是否需要 ( 必需 RELEASE)
** 判定作业是否 RELASE
CLEAR: afvc.
SELECT SINGLE * FROM afvc WHERE aufpl = readrec-aufpl
AND aplzl = readrec-aplzl.

CLEAR: jest.
SELECT SINGLE * FROM jest
WHERE objnr = afvc-objnr
AND stat = 'I0002' . " RELEASE
IF sy-subrc <> 0.
CONTINUE.
ENDIF.

你可能感兴趣的:(职场,休闲,判定生产订单状态的方法)