Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Modification in BOPF Root object Data

Former Member
0 Kudos

Hello Experts,

I have created a BOPF Application with one root and one Dependent. I have created some root data and now want to edit that.

I am consuming my BOPF Application from SE38 report. I am not able to update the values for Root object.

Following steps i am following to Lock the Root and then edit the values of it.

I am getting dump when locking the Root. Some more data i have missed passing to the Modify method.

TRY.

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

     lo_serv_mgr    = /bobf/cl_tra_serv_mgr_factory=>get_service_manager( zif_may1_trq1_c=>sc_bo_key ).

     lo_bo_config   = /bobf/cl_frw_factory=>get_configuration( zif_may1_trq1_c=>sc_bo_key ).

   CATCH /bobf/cx_frw INTO lx_bopf.

     lv_error = lx_bopf->get_text( ).

     ASSERT CONDITION 1 = 2.

ENDTRY.

**** Get the details of the Root before modifying.

SELECT *

   FROM zmay1_d_root

   INTO TABLE lt_root_tab.

READ TABLE lt_root_tab INTO ls_root_wa INDEX 1.

IF sy-subrc EQ 0.

   ls_key-key = ls_root_wa-db_key.

   APPEND ls_key TO lt_key.

ENDIF.

CLEAR : lt_modification, ls_modification.

***** Lock the Root.

ls_modification-node = zif_may1_trq1_c=>sc_node-root.

ls_modification-root_key = ls_root_wa-db_key.

ls_modification-change_mode = 'E'.

APPEND ls_modification TO lt_modification.

CALL METHOD lo_serv_mgr->modify                      -  Getting Dump at this point.

   EXPORTING

     it_modification = lt_modification

   IMPORTING

     eo_change       = lr_chnge

     eo_message      = lr_message.

CLEAR : lt_modification, ls_modification.

CREATE DATA lr_data.

CHECK lr_data IS BOUND.

lr_data->trq_id = '200'.

lr_data->trq_desc = 'CHG'.

lr_data->src_loc = 'CHG'.

lr_data->des_loc = 'CHG'.

ls_modification-node = zif_may1_trq1_c=>sc_node-root.

ls_modification-change_mode = 'U'.

ls_modification-data = lr_data.

ls_modification-root_key = ls_root_wa-db_key.

APPEND ls_modification TO lt_modification.

CALL METHOD lo_serv_mgr->modify

   EXPORTING

     it_modification = lt_modification

   IMPORTING

     eo_change       = lr_chnge

     eo_message      = lr_message.

lo_txn_manager->save(

EXPORTING

   iv_transaction_pattern = /bobf/if_tra_c=>gc_tp_save_and_continue    " Data element for a transaction pattern

IMPORTING

   ev_rejected            =   lv_rejected          " Data element for domain BOOLE: TRUE (='X') and FALSE (=' ')

   eo_change              =   lr_eo_change         " Interface for transaction change objects

   eo_message             =   lr_eo_message        " Interface of Message Object

   et_rejecting_bo_key    =   lt_rejecting_bo_key  " Key table

).



BR,

Nikhil Kulkarni

2 REPLIES 2

laxmikant_soni
Explorer

HI Nikhil ,

first you can use service manage method  retrieve the node data from db.

and you are getting because  you are not passing any data to lt_modification table

in your case it should be

ls_modification- data = ................. here you have to pass your data .

one more thing if  you are modifying  only one field then add that field to

ls_modification-changed_field.

ohterwise   it set all other field to its initial value .



Regards

LK

0 Kudos

Thanks for the tip on adding the fields to 'Changed_field'.