获取生产订单状态

相关表:AUFK~OBJNR, JEST-OBJNR,TJ02-TXT04

 

***排除已删除的订单
  data:lt_status like jstat occurs 0 with header line.
  loop at gt_out where objnr <> ''.
    clear:lt_status,lt_status[].
    call function 'STATUS_READ'
      exporting
        client           = sy-mandt
        objnr            = gt_out-objnr
*       ONLY_ACTIVE      = ' '
*         IMPORTING
*       OBTYP            =
*       STSMA            =
*       STONR            =
      tables
        status           = lt_status
      exceptions
        object_not_found = 1
        others           = 2.

    read table lt_status with key inact = ''  stat = 'I0076'. "stat看系统实际的对象状态
    if sy-subrc = 0.
      delete gt_out.
    endif.
  endloop.

 

posted @ 2021-04-22 14:47  肆意点  阅读(96)  评论(0编辑  收藏  举报