2011 Dec 27 6:58 AM
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
2011 Dec 27 7:30 AM
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.
2012 Jan 02 9:49 AM