wa_status type jstat.
*Teco Complete
refresh lt_methods.
clear ls_methods.
ls_methods-refnumber = 1. "Reference number
ls_methods-method = 'TECHNICALCOMPLETE'. "Method
ls_methods-objecttype = 'HEADER'. "Object type
ls_methods-objectkey = g_aufnr.
append ls_methods to lt_methods..
clear ls_methods.
ls_methods-refnumber = 1. " <--- This has changed
ls_methods-method = 'SAVE'. "Method
ls_methods-objectkey = g_aufnr.
append ls_methods to lt_methods.
refresh lt_header[].
clear ls_header.
ls_header-orderid = g_aufnr.
ls_header-order_type = g_ord_type.
ls_header-planplant = '2000'.
ls_header-bus_area = g_bus_area.
ls_header-mn_wk_ctr = g_wrkctr.
append ls_header to lt_header.
refresh lt_return[].
call function 'BAPI_ALM_ORDER_MAINTAIN'
tables
it_methods = lt_methods
it_header = lt_header
return = lt_return.
call function 'BAPI_TRANSACTION_COMMIT'
exporting
wait = 'X'.
wait up to 1 seconds.
********************************************************************
* Bloc.
clear objnr.
concatenate 'OR' g_aufnr into objnr.
clear wa_status.
refresh it_status.
wa_status-stat = 'E0018'.
wa_status-inact = 'X'.
append wa_status to it_status.
wa_status-stat = 'E0021'.
wa_status-inact = 'X'.
append wa_status to it_status.
wa_status-stat = 'E0020'.
wa_status-inact = ''.
append wa_status to it_status.
loop at it_status into wa_status.
call function 'STATUS_CHANGE_EXTERN'
exporting
client = sy-mandt
objnr = objnr
user_status = wa_status-stat
set_inact = wa_status-inact
importing
stonr = t_stone
* EXCEPTIONS
* OBJECT_NOT_FOUND = 1
* STATUS_INCONSISTENT = 2
* STATUS_NOT_ALLOWED = 3
* OTHERS = 4
.
endloop.
call function 'BAPI_TRANSACTION_COMMIT'
exporting
wait = 'X'.
wait up to 1 seconds.
No comments:
Post a Comment