Нашел ФМ CLOI_CHANGES_UPL_31. С его помощью мне удалось изменить рабочее место производственного заказа, но не удалось изменить управляющий ключ.
Ниже пример для данного ФМ.
Code:
* 1. Create a production order.
data: t_cloi_ord_exp type standard table of cloiord,
lw_cloi_ord_exp type cloiord,
lt_cloi_msg_obj_log_exp type standard table of cloimoblog,
lt_cloi_methods_exp type standard table of cloimetlog,
t_cloi_messages_exp type standard table of cloimsglog,
lw_cloi_messages_exp type cloimsglog,
ls_cloi_if_par_v2 like cloiifpar.
data: lt_cloi_ordu type standard table of cloiordu,
lw_cloi_ordu type cloiordu,
lt_cloi_ordi type standard table of cloiordi,
lw_cloi_ordi type cloiordi,
lt_cloi_ord_opru type standard table of CLOIOPERU,
lw_cloi_ord_opru type CLOIOPERU.
data:
lf_date like sy-datum,
lf_date2 like sy-datum,
f_flag(1) type c,
f_aufnr like aufk-aufnr.
data: f_act_sess like sm04dic-counter,
f_max_sess like sm04dic-counter.
lf_date = sy-datum + 7. "let's try to schedule it next week
lf_date2 = sy-datum + 14.
clear: ls_cloi_if_par_v2.
* those fields below are described in SAP help, but nevermind...
ls_cloi_if_par_v2-commitflg = 'C'.
ls_cloi_if_par_v2-r3_version = '40'.
ls_cloi_if_par_v2-metlog_req = 'X'.
ls_cloi_if_par_v2-msglog_req = 'X'.
ls_cloi_if_par_v2-msgobj_req = 'X'.
ls_cloi_if_par_v2-ord_req = 'X'.
ls_cloi_if_par_v2-ordseq_req = 'X'.
ls_cloi_if_par_v2-ordopr_req = 'X'.
* in case if we have external number range,
* we have to provide the future order number
lw_cloi_ordi-extaufnr = '1234567890'.
* material
lw_cloi_ordi-field = 'MATNR'.
lw_cloi_ordi-value = 'MATNUM1'.
append lw_cloi_ordi to lt_cloi_ordi.
* plant
lw_cloi_ordi-field = 'WERKS'.
lw_cloi_ordi-value = 'W001'.
append lw_cloi_ordi to lt_cloi_ordi.
* order type
lw_cloi_ordi-field = 'AUART'.
lw_cloi_ordi-value = 'PP01'.
append lw_cloi_ordi to lt_cloi_ordi.
* quantity
lw_cloi_ordi-field = 'BDMNG'.
lw_cloi_ordi-value = '100'.
append lw_cloi_ordi to lt_cloi_ordi.
lw_cloi_ordi-field = 'GLTRP'. "finish date
lw_cloi_ordi-value = lf_date2.
append lw_cloi_ordi to lt_cloi_ordi.
lw_cloi_ordi-field = 'GSTRP'. "start date
lw_cloi_ordi-value = lf_date.
append lw_cloi_ordi to lt_cloi_ordi.
* now check if we have one free session
call function 'TH_USER_INFO'
importing
act_sessions = f_act_sess
max_sessions = f_max_sess
exceptions
others = 1.
if sy-subrc 0 or f_act_sess >= f_max_sess.
message e208(00) with 'No more free sessions'.
endif.
* and finally, let it happen!
clear: f_flag.
call function 'CLOI_CHANGES_UPL_31'
starting new task 'CLOI_TEST'
performing receive_res on end of task
exporting
cloi_if_par = ls_cloi_if_par_v2
tables
cloi_ordi_imp = lt_cloi_ordi
cloi_method_log_exp = lt_cloi_methods_exp
cloi_message_log_exp = t_cloi_messages_exp
cloi_msg_obj_log_exp = lt_cloi_msg_obj_log_exp
cloi_ord_exp = t_cloi_ord_exp.
* wait till the global variable will be set by our form
wait until f_flag = 'X'.
Изменение рабочего места с помощью данного ФМ.
Code:
clear: lt_cloi_ord_opru.
clear: lw_cloi_ord_opru.
lw_cloi_ord_opru-aufnr = f_aufnr.
lw_cloi_ord_opru-aplfl = 0.
lw_cloi_ord_opru-vornr = '0010'.
lw_cloi_ord_opru-field = 'ARBID'.
* note that this is the internal ID of workcenter!
lw_cloi_ord_opru-value = '10000001'.
append lw_cloi_ord_opru to lt_cloi_ord_opru.
clear: lt_cloi_methods_exp, t_cloi_messages_exp,
lt_cloi_msg_obj_log_exp, t_cloi_ord_exp.
clear: f_flag.
call function 'CLOI_CHANGES_UPL_31'
starting new task 'CLOI_TEST'
performing receive_res on end of task
exporting
cloi_if_par = ls_cloi_if_par_v2
tables
cloi_ord_opru_imp = lt_cloi_ord_opru
cloi_method_log_exp = lt_cloi_methods_exp
cloi_message_log_exp = t_cloi_messages_exp
cloi_msg_obj_log_exp = lt_cloi_msg_obj_log_exp
cloi_ord_exp = t_cloi_ord_exp.
wait until f_flag = 'X'.
Добавив еще несколько таких строк попытался изменить управляющий ключ с PP01 на PP02.
Code:
clear: lt_cloi_ord_opru.
clear: lw_cloi_ord_opru.
lw_cloi_ord_opru-aufnr = f_aufnr.
lw_cloi_ord_opru-aplfl = 0.
lw_cloi_ord_opru-vornr = '0010'.
lw_cloi_ord_opru-field = 'STEUS'
.
lw_cloi_ord_opru-value = p_steus. " p_steus = 'PP02'
append lw_cloi_ord_opru to lt_cloi_ord_opru.
clear: lt_cloi_methods_exp, t_cloi_messages_exp,
lt_cloi_msg_obj_log_exp, t_cloi_ord_exp.
clear: f_flag.
call function 'CLOI_CHANGES_UPL_31'
starting new task 'CLOI_TEST'
performing receive_res on end of task
exporting
cloi_if_par = ls_cloi_if_par_v2
tables
cloi_ord_opru_imp = lt_cloi_ord_opru
cloi_method_log_exp = lt_cloi_methods_exp
cloi_message_log_exp = t_cloi_messages_exp
cloi_msg_obj_log_exp = lt_cloi_msg_obj_log_exp
cloi_ord_exp = t_cloi_ord_exp.
wait until f_flag = 'X'.
Изменения не произошли. Может кто знает....как заставить данный ФМ поменять управляющий ключ?