Get SAP Process Order Status

SAP Process Order

How to Get SAP Process Order Status ?

This post will explain how to retrieve SAP PO user Status including SAP Tables for Status and BAPIs to read SAP PO Status the easiest way.

SAP Process Order System Status Values

Let first starts with the different Status the SAP Process Order can have. ( the whole list check the section SAP PO Status table bellowing)

Here a short list of Status in Process Orders in SAP,

STATTEXT04DESCRIPTION
I0001CRTDCreated
I0004MSPTMaterial shortage
I0016PRCPre-costed
I0028SETCSettlement rule created
I0055RELRRelease rejected
I0115CSERError in cost calculation
I0118NTUPDates are not updated
I0215SSAPObject created
I0340MACMMaterial committed
I0361NEWQNew quantity calculation
I0369BCRQOrder to be handled in batches
I0383BNASBatch not assigned
I0420MANCMat.availability not checked

For the whole list of Process Order Status in SAP, check this System Status in Process Orders .

SAP Process Order Status Tables

The main SAP Table for Status is JEST.
For SAP Process Order, the link to SAP JEST Status table is the Object Number (OBJNR).

Check bellowing how to calculate the PO Object Number.
A sample join to retrieve all SAP Process Order Status can be AUFK-OBJNR = JEST-OBJNR.

The Status field is JEST-STAT.

The Descriptions of Status are language-dependent and stored in SAP Table TJ02T.

The join between JEST and TJ02T can be TJ02T-ISTAT = JEST-STAT
The Full Status descripntion is TJ02T-TXT30 and the short Status Text is TJ02T-TXT04.

SAP Process Order Status BAPI

Read SAP PO Status with BAPI STATUS_READ

The Standard BAPI STATUS_READ can retrieve any SAP Transaction Status. It reads Status from JEST table.

The input should the OBJNR of SAP PO.

For SAP Process Order, the Object Number (OBJNR) is the concatenation of ‘OR’ with the SAP PO number (AUFNR).

An alternative way to find the SAP PO Object Number is to query the AUFK table with AFKO-AUFNR = AUFK-AUFNR.

Here an ABAP sample code to read SAP PO Status using the STATUS_READ.

" Build OBJNR from SAP PO Number  
 concatenate 'OR' AFKO-AUFNR into LV_OBJNR.

" Alternative for OBJNR 
SELECT SINGLE OBJNR FROM AUFK 
  INTO LV_OBJNR
  WHERE AUFNR = AFKO-AUFNR. 

" Read SAP PO Status with STATUS_READ
  call function 'STATUS_READ'     
    exporting
      OBJNR            = LV_OBJNR
      ONLY_ACTIVE      = 'X' " Read only Active status
    tables
      STATUS           = LT_JEST
    exceptions
      OBJECT_NOT_FOUND = 1
      others           = 2.
  if SY-SUBRC <> 0.
  endif.

" IF you need SAP PO Status's Text 
IF IT_JEST[] is NOT INITIAL.
    SELECT ISTAT TXT04 from TJ02T
    INTO TABLE LT_TJ02T
    FOR ALL ENTRIES in LT_JEST
    WHERE ISTAT = LT_JEST-STAT
      AND SPRAS = SY-LANGU.
ENDIF.