cancel
Showing results for 
Search instead for 
Did you mean: 

How to Read ROOT data at ESR BADI - OutboundDeliveryBulkCreateRequest_Out

Former Member
0 Kudos

Dear TM Experts,

I had enhanced data type OutbDelivCrteReqItm with Z fields at ESR. Now I want to map these fields with standard fields (Carrier, Stages & Freight order No.) of SAP TM to these enhanced Z fields as standard XML structure do not pass these fields to SAP ECC.

I had implemented BADI /SCMTMS/DLVP_SE_ODLV_B and in my Method I am having only Importing parameter as IN with field KEY and value 001F29BCEAEC1ED49EBDEFE286660E05. How to read ROOT data of this processing freight order with this key. I tried to read with this IN value but no values are returned to me.

Please suggest what I am missing. Below is my code:

METHOD /scmtms/if_dlvp_se_odlv_b~outbound_processing.

DATA: lo_srv_tor TYPE REF TO /bobf/if_tra_service_manager,

         lo_message TYPE REF TO /bobf/if_frw_message,

         lo_property TYPE REF TO /bobf/if_frw_property,

         lt_root TYPE /scmtms/t_tor_root_k,

         lt_failed_key TYPE /bobf/t_frw_key.

* Get an instance of a service manager for e.g. BO tor

   lo_srv_tor = /bobf/cl_tra_serv_mgr_factory=>get_service_manager( /scmtms/if_tor_c=>sc_bo_key ).


* Use method RETRIEVE to retrieve ROOT data

   lo_srv_tor->retrieve(

   EXPORTING

     iv_node_key = /scmtms/if_tor_c=>sc_node-root

     it_key = in "it_key

     iv_edit_mode = /bobf/if_conf_c=>sc_edit_read_only

     IMPORTING

       eo_message = lo_message

       et_data = lt_root

       et_failed_key = lt_failed_key ).

ENDMETHOD.


Thanks in advance.


Regards,

Md.Rafi


Accepted Solutions (1)

Accepted Solutions (1)

Dragoș
Employee
Employee
0 Kudos

Hi,

In the Delivery Builder scenario, only the sub-node DLVP might contain useful data (perhaps also FREIGHT_UNITS).

Regards,

Dragos

Answers (1)

Answers (1)

Dragoș
Employee
Employee
0 Kudos

The table IN does not contain freight order key(s). A bit of where-used (of method OUTBOUND_PROCESSING of the BAdi interface) hints that the key contained there is the key of the (transient) planning object /SCMTMS/PLN. This BO has a subnode TORACT which contains references to freight orders currently included in the current planning operation (=delivery creation, in this case).

So you'd need to instantiate a service manager for object /SCMTMS/PLN, then use a Retrieve_By_Association to this node, then use another cross-BO to root node of /SCMTMS/TOR.

But: the planning object may contain more freight orders than are currently send in this message. You need to find a way to identify the relevant freight orders, which are part of this message.

Former Member
0 Kudos

Hi Dragos,

Thanks for the reply.Their is no simpler way to achieve this?

I was trying to test /SCMTMS/PLN using key '001F29BCEAEC1ED49EBDEFE286660E05' in /n/bobf/test_ui But this alway gives me error as No valid Keys entered. For /SCMTMS/PLN their is no option to test with Alternate Key.

Regards,

Md.Rafi

Dragoș
Employee
Employee
0 Kudos

PLN is transient - a new instance is always generated every time (and never persisted). You cannot use it in test tool with a key copied from debugger. You can however create a new instance in test tool, apply the selection profiles (via action FILL_PROFILES) and then investigate the content of subnodes.

A simpler way would be to file a "feature request" ticket for standard development, to enhance the signature of the badi method with more importing parameters. The relevant TM data and/or keys (freight units, freight orders) are kept internally and could be easily provided to the BAdI...

Former Member
0 Kudos

Thanks Dragos,

Your solution looks very helpful for me.

I am trying to achieve with this logic but with this I am not receiving any values in my data table from retrieve_by_association for TORACT

If you can let me know if any thing is missing in my code that will be a great help.

DATA:   lo_srv_pln TYPE REF TO /bobf/if_tra_service_manager,

           lo_message TYPE REF TO /bobf/if_frw_message,

           lo_property TYPE REF TO /bobf/if_frw_property,

           lt_item TYPE /scmtms/t_pln_toract_k,

           lt_link TYPE /bobf/t_frw_key_link,

           lt_item_key TYPE /bobf/t_frw_key,

           lt_root TYPE /scmtms/t_pln_root_k,

           lt_failed_key TYPE /bobf/t_frw_key.

** Use method RETRIEVE to retrieve ROOT data

   lo_srv_pln->retrieve(

   EXPORTING

     iv_node_key = /scmtms/if_pln_c=>sc_node-root

     it_key = in "it_key

     iv_edit_mode = /bobf/if_conf_c=>sc_edit_read_only

     IMPORTING

       eo_message = lo_message

       et_data = lt_root

       et_failed_key = lt_failed_key ).

*** Use method Retrieve by Association to retrieve TORACT node data

   lo_srv_pln->retrieve_by_association(

   EXPORTING

     iv_node_key = /scmtms/if_pln_c=>sc_node-root

     it_key = in "it_key

     iv_association = /scmtms/if_pln_c=>sc_association-root-toract

     iv_fill_data = abap_true

     iv_edit_mode = /bobf/if_conf_c=>sc_edit_read_only

     IMPORTING

       eo_message = lo_message

       et_data = lt_item

       et_key_link = lt_link

       et_target_key = lt_item_key

       et_failed_key = lt_failed_key ).


Thanks in advance.


Regards,

Md.Rafi