on 2023 Mar 13 11:38 AM
Hi there,
I know that I am able to retrieve a document flow of a TOR object using the `/SCMTMS/CL_TOR_DOC_FLOW` object and executing the `GET_DOC_FLOW` method on it (blog: SAP TM- Get the document flow of Freight Order/Freight Unit/ FSD in Code). Taking some random freight unit as an example, it gives me freight order, sales order and outbound delivery as the documents that belong to the flow.
I want to do something similar but the other way round. I have the Sales Order ID and I want to retrieve the ID of a Freight Unit to which it is assigned. I am not able to do this using the same solution as Sales Order does not have a key in the form of the GUID which could be provided as an input to the `GET_DOC_FLOW` method - this is even visible in the document flow for a Freight Unit which we receive as key fields have simple integer values starting from 1.
Is there a similar and suitable solution to achieve what I've described? Thank you.
Request clarification before answering.
Hello szelbi
Why don't you use the cl_tms_docflow_data class?
DATA:
lo_tms_docflow TYPE REF TO cl_tms_docflow_data,
lt_flow TYPE tms_t_doc_flow_scr.
CREATE OBJECT lo_tms_docflow
EXPORTING
iv_doc_type = '00' "sales order
iv_doc_nr = <sales order number>.
CALL METHOD lo_tms_docflow->get_data_for_display
EXPORTING
iv_display_type = if_tms_docflow_c=>view_erp
* iv_doc_item =
IMPORTING
et_docflow = lt_flow
That will get you the entire sales order TM document flow as it is displayed in VA03.
Best regards
Dominik Tylczynski
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I've also found an alternative solution using the BOBF. There is a query that allows us to search for a freight unit using the sales document.
DATA lt_selpar TYPE /bobf/t_frw_query_selparam.
DATA lt_requested_attributes TYPE /bobf/t_frw_name.
DATA lo_message TYPE REF TO /bobf/if_frw_message.
DATA ls_query_info TYPE /bobf/s_frw_query_info.
DATA lt_tor_q_fu_r TYPE /scmtms/t_tor_q_fu_r.
DATA lt_key TYPE /bobf/t_frw_key.
DATA(lo_srv_tor) = /bobf/cl_tra_serv_mgr_factory=>get_service_manager( /scmtms/if_tor_c=>sc_bo_key ).
INSERT VALUE /bobf/s_frw_query_selparam(
attribute_name = /scmtms/if_tor_c=>sc_query_attribute-root-fu_data_by_attr-sales_document
option = 'EQ'
sign = 'I'
low = 000 " Enter a Sales Order ID here.
) INTO TABLE lt_selpar.
INSERT /scmtms/if_tor_c=>sc_query_result_type_attribute-root-fu_data_by_attr-db_key
INTO TABLE lt_requested_attributes.
lo_srv_tor->query(
EXPORTING
iv_query_key = /scmtms/if_tor_c=>sc_query-root-fu_data_by_attr
it_selection_parameters = lt_selpar
it_requested_attributes = lt_requested_attributes
IMPORTING
eo_message = lo_message
es_query_info = ls_query_info
et_data = lt_tor_q_fu_r
et_key = lt_key ).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
7 | |
4 | |
4 | |
3 | |
2 | |
2 | |
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.