Skip to Content

PROCESS

Sales transactions are the most omnipresent transactions happening everywhere at any point of time earning revenue for the organisation. To streamline and prevent the undesirable chain of intractable transactions they need to be aligned in proper sequence with judicial controls. One such tool which helps to achieve this objective is the statuses used in the sales transaction at header or item levels.

Order header and item statuses I refer here differ from the normal completion status we are used to. These statuses are classified into system status and user status. While the system status automatically controls the sequence of transactions and comes packaged in SAP, the user statuses are customizable to the business requirement. These statuses are sequenced and tagged to either the execution or prevention of various transactions. This bunch of controls is encapsulated inside a status profile. Finally the status profile is linked either to the document type or item category.

Though it is efficient and effective to manage the process through status profiles, it is not possible to extract reports based on the status of the sales orders or their items. This is due to lack of knowledge on the database tables behind the process and also limited usage of this functionality in a stand alone sales scenario.

This document tries to break this myth and helps to create a simple quick view query to know the status of sales orders or to find the orders of a specific status.

TECHNICAL INFORMATION

The repository of information related to statuses is controlled mainly by the field object number which is updated in every transaction in each possible level. For example this field called object number is available in VBAK for the sales order header and VBAP for the items of the sales order. The field OBJNR in VBAK and VBAP is the key field used to further mine the details of the user and system status.

If the sales order header or item or both are enabled with a status profile, then the VBAK-OBJNR and VBAP-OBJNR will be updated with an automatically generated object number. The value of this field will be used in all further searches to get the desired status of the orders.

The next important table is the table JEST. This table also contains the field OBJNR and thus links either VBAK or VBAP with JEST. For the given object number, the table JEST will give the present user status and system status.  The status codes are presented in the field JEST- STAT. The user statuses always start with E and the system status starts with I. The status codes used in this table will need to be used to further extract the correct status as the user sees. The status codes shown in JEST are only the technical names of the statuses created.

There is also another table called JCDS which also contains the field OBJNR and this table will give the list of status changes the document had gone through. It should be remembered that it is easy to approach this table instead of CDHDR or CDPOS for any status related change documents.

The table JEST has the system and the user status of the document in technical terms. To know the correct description for them, two different tables should be used.

If the user status and its description need to be found out, the table TJ30T should be made use of. This table has got the status profile and the status codes. The status profile is indicated in the field TJ30T- STSMA and the status code is represented by the field TJ30T- ESTAT. As the combination of status profile and the status code are unique keys, both the values need to be provided to get the actual status.  As we already know, the status profile is either configured in the sales document type in table TVAK or at the item category level in the table TVAP.  By giving the status profile in the field TJ30T-STSMA and the status in TJ30T-ESTAT the field TJ30T- TXT04 represents the correct user status and TJ30T- TXT30 indicates the description of the status.

If the system status has to be found out, the status codes from JEST-STAT starting with I should be provided as an input in the table TJ02T- ISTAT along with the language key as EN for example in the field SPRAS. The resultant TJ02T- TXT04 and TJ02T- TXT30 gives the status and its description respectively.

Just to add, the entire logic is not just applicable for only sales order header or sales order items, it is applicable for all transactions in SAP which uses the User status through status profiles. To make matters simple, you can use the function module STATUS_TEXT_EDIT to get the system and user status.

The import parameters are as follows.

FLG_USER_STAT—————-Put X is you want the user status also. If system status alone is sufficient, leave this empty

OBJNR——————————–This is the object number. We discussed about this in detail already.

ONLY_ACTIVE——————— Just put X to get only the active statuses

SPRAS——————————–Put the language code, for example EN for English

BYPASS_BUFFER—————Leave it empty.

In the result, the export parameters LINE and USER_LINE indicate the system and user status respectively. Here the parameter E_STSMA indicates the status profile for the user status.

If there is scope for improvement on this content, it will be done when God gifts me with some more information.

To report this post you need to login first.

10 Comments

You must be Logged on to comment or reply to a post.

  1. Narendra Konnipati

    Hi Krishna ,

    As the capability guy only will be chose to create this type of Blog.This is also Nice one in one of the yous blogs .

    Thanks for sharing here .(Wish U Happy New Year you your Family with more prosperous and Happiness).

    Thanks,

    Naren

    (0) 
  2. Siva kumar Devana

    Hi Krishnan,

    Very nice document.

    As we have used the CDHDR or CDPOS for any status related changes in our ABAP coding.

    Today, by your document i have known that other tables like the above should also be useful.

    keep it up and keep sharing ….

    Regards,

    siva kumar.

    (0) 
  3. Thambi Durai

    Very Nice document.

    What is use of user status and status profile.

    As per my understanding it is used of approval?Anything apart from it.

    (0) 
  4. Jagadish AC

    Very good information.

    I need Function module to change the user status in sales order line item level.

    I am trying to check before sales order save that is in MV45AFZZ-FORM USEREXIT_SAVE_DOCUMENT_PREPARE.

    I have tried Function modules ‘STATUS_UPDATE’ IN UPDATE TASK, ‘I_CHANGE_STATUS’ but status is not getting updated in JEST table.

    Function module is not throwing any exception the sy-subrc is zero. I have used Commit work and wait also.

    I have tried with ‘STATUS_CHANGE_INTERN’ and ‘STATUS_CHANGE_EXTERN’ this 2 FM is throwing as status is not system status.

    Is there any particular Function module to update this status?

     

    (0) 

Leave a Reply