on 2019 Jan 19 11:17 AM
Hi Experts,
I'm relatively new to SAP TM and have a requirement to create Freight order via Z-report for sales orders.
We have successfully create basic freight order using /scmtms/cl_tor_factory=>create_tor_fo method and it is creating following items:
1) Root node
2) Two stop nodes ( 1 for outbound and 1 for inbound)
3) One item node
4) One Stop successor node
Here i wanted to create an association /scmtms/if_tor_c=>sc_association-stop_successor-stop_succ_docreference node for sales orders.
Below is the code
/scmtms/cl_tor_factory=>create_tor_fo(
EXPORTING
iv_do_modify = abap_true
iv_creation_type = /scmtms/if_tor_const=>sc_creation_type-manual
iv_tor_type = iv_tor_type
is_fo_info = ls_tor_info
is_tor_item_cont_ref = is_tor_item_cont_ref
IMPORTING
es_tor_root = ls_tor_root
et_mod = DATA(lt_mod)
et_tor_stop_succ = DATA(lt_tor_stop_succ)
et_failed_key = lt_failed_key
CHANGING
co_message = lo_message ).INSERT ls_tor_root INTO TABLE lt_tor_root.
READ TABLE lt_tor_stop_succ ASSIGNING FIELD-SYMBOL(<lfs_stop_suc>) INDEX 1.
ls_fu_docref-key = /bobf/cl_frw_factory=>get_new_key( ).
ls_fu_docref-parent_key = <lfs_stop_suc>-key.
ls_fu_docref-root_key = ls_tor_root-key.
ls_fu_docref-btd_tco = '114'.
ls_fu_docref-btd_id = '3921'.
ls_fu_docref-btditem_tco = '28'.
ls_fu_docref-btditem_id = '10'.
APPEND ls_fu_docref TO lt_fu_docref.
DATA: et_mod TYPE /BOBF/T_FRW_MODIFICATION.
CALL METHOD /scmtms/cl_mod_helper=>mod_create_multi
EXPORTING
it_data = lt_fu_docref
iv_node = /scmtms/if_tor_c=>sc_node-stop_successor
iv_source_node = /scmtms/if_tor_c=>sc_node-stop
iv_association = /scmtms/if_tor_c=>sc_association-stop_successor-stop_succ_docreference
iv_do_sorting = abap_true
CHANGING
ct_mod = et_mod.
APPEND LINES OF et_mod TO lt_mod.
lo_txn = /bobf/cl_tra_trans_mgr_factory=>get_transaction_manager( ).
/bobf/cl_tra_serv_mgr_factory=>get_service_manager( /scmtms/if_tor_c=>sc_bo_key )->modify( lt_mod ).
lo_txn->save( EXPORTING
iv_transaction_pattern = /bobf/if_tra_c=>gc_tp_save_and_continue
IMPORTING
eo_message = lo_message
eo_change = DATA(lo_change)
ev_rejected = lv_rejected ).
Not able to create data for Document Reference node.
Thanks in advance,
Br,
Ramesh
Request clarification before answering.
| User | Count |
|---|---|
| 17 | |
| 16 | |
| 5 | |
| 3 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.