cancel
Showing results for 
Search instead for 
Did you mean: 

How to get Value of user status in sales order header?

former_member635273
Participant

Accepted Solutions (0)

Answers (1)

Answers (1)

venkateswaran_k
Active Contributor
0 Kudos

Hi

Look for the field OBJNR in VBAK - table (VBAK-OBJNR)

Go to JSET table to get the description

You can use the FM STATUS_READ to read the sales order status.

former_member635273
Participant
0 Kudos

This my code. but when i debug, I can not get value of vbak-objnr. is it wrong?

DATA : it_status TYPE STANDARD TABLE OF JEST,
       wa_status LIKE LINE OF it_status.
CALL FUNCTION 'STATUS_READ'
  EXPORTING
   CLIENT                 = SY-MANDT
    objnr                 = vbak-objnr
   ONLY_ACTIVE            = ' '
* IMPORTING
*   OBTYP                  =
*   STSMA                  =
*   STONR                  =
 TABLES
   STATUS                 = it_status
 EXCEPTIONS
   OBJECT_NOT_FOUND       = 1
   OTHERS                 = 2
          .
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
venkateswaran_k
Active Contributor
0 Kudos

IN SE11 - open the table VBAK and query for that Sales order

See if OBJNR is populated.

If, so kindly paste the whole code, because what to see how you you get the value before calling this function

OR

Write like this

data : wa_order type vbak-vbeln.

Select single vbeln into wa_vbeln from vbak where vbeln = <your salesorder>

Then pass the wa_vbeln to the function module

Sandra_Rossi
Active Contributor
0 Kudos

JEST, not JSET.

former_member635273
Participant
0 Kudos

why i get worng value in it_status. the value should be in STAT column

like

STAT

E0001X

E0002

I0002

DATA : it_status TYPE STANDARD TABLE OF jest,
       wa_status LIKE LINE OF it_status,
       lv_objnr TYPE vbak-objnr.
SELECT SINGLE objnr FROM vbak INTO lv_objnr WHERE vbeln = vbak-vbeln.
  
CALL FUNCTION 'STATUS_READ'
  EXPORTING
   CLIENT                 = sy-mandt
   objnr                  = lv_objnr
   ONLY_ACTIVE            = ' '
* IMPORTING
*   OBTYP                  =
*   STSMA                  =
*   STONR                  =
 TABLES
   STATUS                 = it_status
 EXCEPTIONS
   OBJECT_NOT_FOUND       = 1
   OTHERS                 = 2
          .
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
BREAK-POINT.
venkateswaran_k
Active Contributor

Change like this

DATA: it_status TYPESTANDARDTABLEOF JSTAT,  <============= correct here
       wa_status LIKELINEOF it_status,
       lv_objnr TYPE vbak-objnr.