Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Update the User status E0005 to E0022 of work order in sap.

former_member288488
Participant
0 Kudos
906

Hi,

I have a requiremnmet where for certain work order which are not partially confirmed and confirmed i need to update the user status E0005 and E0007 to E0022 in SAP.

User will enter the multiple work order in select option in selection screen from which I need to first fillter all the active orders and then I need to filter the work order which are not confirmed and partially confirmed.

Now the work order which are left after this filteration I have to figure out the work order for which the user status is E0005 and E0007 and then update it to E0022 in SAP.

Please let me know if there is any program for refrence or any suitable BAPI to do this in SAP.

Thanks,

jai

2 REPLIES 2

Former Member
0 Kudos
317

You can use function module STATUS_READ to get all statussen for an object.

DATA: lta_afzb_status      TYPE ttjstat,
      lwa_afzb_status      TYPE jstat,
      lst_afzb_stsma       TYPE j_stsma,
      lwa_afzb_estat       TYPE j_status.

* Retrieve all active statusses (Internal and External):
CALL FUNCTION 'STATUS_READ'
  EXPORTING
    objnr            = vbak-objnr
    only_active      = 'X'
  IMPORTING
    stsma            = lst_afzb_stsma
  TABLES
    status           = lta_afzb_status
  EXCEPTIONS
    object_not_found = 0
    OTHERS           = 0.

IF lst_afzb_stsma IS NOT INITIAL.
  CASE lst_afzb_stsma.                                       "Status Profile
    WHEN '...depends...'.
*     Get Active User status (Extern = E<xxxx>):
*     There can be only one status active for Internal (System) status
*     and one for the External(User) status.
      LOOP AT lta_afzb_status INTO lwa_afzb_status WHERE stat(1) = 'E'.
        EXIT.
      ENDLOOP.
      CASE lwa_afzb_status-stat.
        WHEN 'E0005' OR 'E0007'.

        WHEN OTHERS.

      ENDCASE.
  ENDCASE.
ENDIF.

You can use function module STATUS_UPDATE to change the status.

former_member288488
Participant
0 Kudos
317

your comments were very helpful