cancel
Showing results for 
Search instead for 
Did you mean: 

Changes to TOR - BO are not carried over to Frieght Order Screen

Former Member
0 Kudos

Hi Everyone,

My requirement is to change the 'Means of Transport' field value of a Freight Order from a program. I notice that with the below code i am able to change the field value of Means of Transport for a given freight order as both /bobf/test_ui and the underlying database table reflect my new value in this field.

However when i open the same freight order in NWBC the screen values stil retain the old Means of Transport value. Am i missing something here how does one reflect changed values in the BO to the screen as well, please help:

Code :

FIELD-SYMBOLS: <ls_root> TYPE /scmtms/s_tor_root_k,

               <ls_tor_qdb> TYPE /scmtms/s_tor_q_result.

DATA: lo_srv_tor TYPE REF TO /bobf/if_tra_service_manager,

      lt_mod TYPE /bobf/t_frw_modification,

      ls_mod TYPE /bobf/s_frw_modification,

      lv_tor_new_key TYPE /bobf/conf_key,

      lo_chg TYPE REF TO /bobf/if_tra_change,

      lo_message TYPE REF TO /bobf/if_frw_message,

      lo_msg_all TYPE REF TO /bobf/if_frw_message,

      lo_tra TYPE REF TO /bobf/if_tra_transaction_mgr,

      lv_rejected TYPE abap_bool,

      lt_rej_bo_key TYPE /bobf/t_frw_key2,

      ls_selpar TYPE /bobf/s_frw_query_selparam,

      lt_selpar TYPE /bobf/t_frw_query_selparam,

      lt_tor_qdb TYPE /scmtms/t_tor_q_result,

*      lo_tra TYPE REF TO /bobf/if_tra_transaction_mgr,

      lt_messages TYPE TABLE OF bapiret2.

* Get instance of service manager for tor

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

*--- Update the new instance with a Means of Transport ID ---*

CLEAR lt_mod.

ls_mod-node = /scmtms/if_tor_c=>sc_node-root.

ls_mod-key = lv_mod_key.

ls_mod-change_mode = /bobf/if_frw_c=>sc_modify_update.

CREATE DATA ls_mod-data TYPE /scmtms/s_tor_root_k.

ASSIGN ls_mod-data->* TO <ls_root>.

<ls_root>-mtr = lv_mtr.

APPEND /scmtms/if_tor_c=>sc_node_attribute-root-mtr TO ls_mod-changed_fields.

APPEND ls_mod TO lt_mod.

TRY.

    lo_srv_tor->modify(

    EXPORTING

    it_modification = lt_mod

    IMPORTING

    eo_change  = lo_chg

    eo_message = lo_message ).

  CATCH /bobf/cx_frw .

ENDTRY.

* Save transaction to get data persisted (NO COMMIT WORK!)

lo_tra = /bobf/cl_tra_trans_mgr_factory=>get_transaction_manager( ).

lo_tra->save(

IMPORTING

ev_rejected = lv_rejected

eo_change = lo_chg

eo_message = lo_message

et_rejecting_bo_key = lt_rej_bo_key ).

After this is executed /bobf/test_ui shows the new value in the variable lv_mtr , but the freight order screen in NWBC still is unchanged for this field.

Regards,

Vijay Chaitanya

Accepted Solutions (1)

Accepted Solutions (1)

former_member186607
Active Contributor
0 Kudos

Hi Vijay,

to change the means of transport of a freight order, technically you have to change the Mtr in the main item of the TOR (field MTR in node ITEM_TR, you can retrieve the main item via association ROOT->ITEM_TR_MAIN). This is the leading value for the means of transport and the one that is displayed on the UI. By changing the MTr in the main item the value in the root should also get adjusted automatically, I think.

Cheers, Daniel

Answers (1)

Answers (1)

Former Member
0 Kudos

Thanks for that perfect answer it works for me now the new value is shown on the UI screen, just one last question how does one know to which attribute in the *TOR* BO a particular field on the UI screen is mapped to.

Thanks Again...

Vijay

former_member186607
Active Contributor
0 Kudos

Hi Vijay,

I have created a document that describes how to find out which UI field relates to which BO field. Check out http://scn.sap.com/docs/DOC-35848 .

I hope, this helps.

Best regards, Daniel

Former Member
0 Kudos

Thanks for all your effort , a very well made doc. Appreciate it.

Regards,

Vijay