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,
|I0028||SETC||Settlement rule created|
|I0115||CSER||Error in cost calculation|
|I0118||NTUP||Dates are not updated|
|I0361||NEWQ||New quantity calculation|
|I0369||BCRQ||Order to be handled in batches|
|I0383||BNAS||Batch not assigned|
|I0420||MANC||Mat.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
WHERE AUFNR = AFKO-AUFNR.
" Read SAP PO Status with STATUS_READ
call function 'STATUS_READ'
OBJNR = LV_OBJNR
ONLY_ACTIVE = 'X' " Read only Active status
STATUS = LT_JEST
OBJECT_NOT_FOUND = 1
others = 2.
if SY-SUBRC <> 0.
" 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.