Select Freight Order TOR object

  DATA lo_svc_mngr TYPE REF TO /bobf/if_tra_service_manager.
  DATA lo_txn_mngr TYPE REF TO /bobf/if_tra_transaction_mgr.

  DATA: lt_root    TYPE /scmtms/t_tor_root_k,
        lt_party   TYPE /scmtms/t_tor_party_k,
        lt_item_tr TYPE /scmtms/t_tor_item_tr_k,
        lt_stages  TYPE /scmtms/t_pln_stage,
        lt_stops   TYPE /scmtms/t_tor_stop_k.

  DATA: lt_key TYPE /bobf/t_frw_key,
        lt_sel TYPE /bobf/t_frw_query_selparam.

  CALL METHOD /bobf/cl_tra_serv_mgr_factory=>get_service_manager
    EXPORTING
      iv_bo_key          = /scmtms/if_tor_c=>sc_bo_key  " Business Object
    RECEIVING
      eo_service_manager = lo_svc_mngr.   " Interface for (Proxy) Service Manager


  CALL METHOD /bobf/cl_tra_trans_mgr_factory=>get_transaction_manager
    RECEIVING
      eo_transaction_manager = lo_txn_mngr.    " Standalone Transaction Manager Instance

  APPEND INITIAL LINE TO lt_sel ASSIGNING FIELD-SYMBOL(<sparam>).
  <sparam>-attribute_name = 'TOR_ID'.
  <sparam>-sign           = 'I'.
  <sparam>-option         = 'EQ'.
  <sparam>-low            = '1000000000'.
  "<fs_sparam>-HIGH

  CALL METHOD lo_svc_mngr->query
    EXPORTING
      iv_query_key            = /scmtms/if_tor_c=>sc_query-root-root_elements
      it_selection_parameters = lt_sel
      iv_fill_data            = abap_true
    IMPORTING
      et_data                 = lt_root
      et_key                  = lt_key.

  lo_svc_mngr->query(
     EXPORTING
       iv_query_key            = /scmtms/if_tor_c=>sc_query-root-tor_key_by_pln_attr  " fo_data_by_attr "  fu_data_by_attr   "if_resource_c=>sc_query-root-qu_by_attributes  " QU_BY_ATTRIBUTES_ALL                " Query
*      IT_FILTER_KEY           =                  " Key Table
       it_selection_parameters = lt_sel                " Query Selection Parameters
*      IS_QUERY_OPTIONS        =                  " Query Options
       iv_fill_data            = abap_true       " Data element for domain BOOLE: TRUE (='X') and FALSE (=' ')
*      IT_REQUESTED_ATTRIBUTES =                  " List of Names (e.g. Fieldnames)
     IMPORTING
*      EO_MESSAGE              =                  " Message Object
*      ES_QUERY_INFO           =                  " Query Information
       et_data                 = lt_root
       et_key                  = lt_key
   ).

  CALL METHOD /scmtms/cl_print_helper=>get_tor_nodes
    EXPORTING
      it_key     = lt_key
    IMPORTING
      et_root    = lt_root
      et_item_tr = lt_item_tr
      et_party   = lt_party
      et_stages  = lt_stages
      et_stop    = lt_stops.
  IF lt_root[] IS INITIAL.
    RETURN.
  ENDIF.

Leave a Comment

Your email address will not be published. Required fields are marked *