Hi ,
In BOPF using OPTIMIZE action in /SCMTMS/TOR object I have to create the Freight Order using multiple Freight Units having the same stages but FO is not created and not populating any errors.
In this FU's are not planned , Here is the sample code I wrote to create the FO
lo_srv_mgr TYPE REF TO /bobf/if_tra_service_manager, " Containing the public service methods of a service manager
&---------------------------------------------------------------------*
* Get an instance of a service manager for FO
*&---------------------------------------------------------------------*
lo_srv_mgr = /bobf/cl_tra_serv_mgr_factory=>get_service_manager( /scmtms/if_tor_c=>sc_bo_key ).
CALL METHOD
lo_srv_mgr->do_action
EXPORTING
iv_act_key = /scmtms/if_tor_c=>sc_action-root-optimize
it_key = lt_key_fu
* is_parameters =
IMPORTING
eo_change = lo_change
eo_message = lo_msg
et_failed_key = lt_failed_key
et_failed_action_key = lt_failed_act_key
.
IF lo_msg IS BOUND .
/scmtms/cl_common_helper=>msg_convert_bopf_2_bapiret2(
EXPORTING
io_message = lo_msg
CHANGING
ct_bapiret2 = lt_bapiret2 ).
endif.
*&---------------------------------------------------------*
* Save the changes on the Freight Order/Freight bookings..
*&---------------------------------------------------------*
lo_tra->save( IMPORTING eo_message = lo_msg ).
IF lo_msg IS BOUND .
/scmtms/cl_common_helper=>msg_convert_bopf_2_bapiret2(
EXPORTING
io_message = lo_msg
CHANGING
ct_bapiret2 = lt_bapiret2 ).
endif.
Please suggest an alternative if it doesn't work this way.
Thanks
Arun