on 03-13-2023 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.
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 |
---|---|
11 | |
2 | |
1 | |
1 | |
1 | |
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.