Batch modify work order date BAPI

1. Get the order status
by STATUS_READ. Use the object number of the order (OR+4-digit leading 0+order number) to get the field STAT INACT from the table JEST, and then go to the table TJ02T to view the corresponding description of STAT.
Direction
DATA: objnr TYPE aufk-objnr.
objnr ='OR000010104580'. The work order needs to be filled with leading 0
DATA: t_status TYPE TABLE OF jstat WITH HEADER LINE. The
result is stored in the STATUS table
CALL FUNCTION'STATUS_READ'
EXPORTING
client = sy-mandt
objnr = objnr
TABLES
status = t_status
EXCEPTIONS
object_not_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
LOOP AT t_status.
IF t_status = 'I0046'.
WRITE:'Order has been closed'.
EXIT.
ENDIF.
ENDLOOP.

Guess you like

Origin blog.csdn.net/Kudcon/article/details/114092163