
Fig 1. Business Object
Fig 2. Delegated nodes
Fig 3. Delegated object at Runtime
Fig 4. Dependent Object
DATA : lr_tran_mgr TYPE REF TO /bobf/if_tra_transaction_mgr,
lr_serv_mgr TYPE REF TO /bobf/if_tra_service_manager,
lr_bo_conf TYPE REF TO /bobf/if_frw_configuration.
*-- Transaction Manager Reference
lr_tran_mgr = /bobf/cl_tra_trans_mgr_factory=>get_transaction_manager( ).
*-- Service Manager Reference
*--Export the Business Object Key of the Node
lr_serv_mgr = /bobf/cl_tra_serv_mgr_factory=>get_service_manager(
iv_bo_key = /cpd/if_mp_pws_bo_c=>sc_bo_key ).
*-- Configuration Reference
*--Export the Business Object Key of the Node
lr_bo_conf = /bobf/cl_frw_factory=>get_configuration(
iv_bo_key = /cpd/if_mp_pws_bo_c=>sc_bo_key ).
*-- Node Key of TEXT node
lv_txt_key = lr_frw_conf->get_content_key_mapping(
iv_content_cat = /bobf/if_conf_c=>sc_content_nod
iv_do_content_key = /bobf/if_txc_c=>sc_node-text
iv_do_root_node_key = /cpd/if_pfp_bo_plan_hdr_c=>sc_node-plan_header_long_text ).
*-- Association Key of ROOT->TEXT
lv_txt_assoc = lr_frw_conf->get_content_key_mapping(
iv_content_cat = /bobf/if_conf_c=>sc_content_ass
iv_do_content_key = /bobf/if_txc_c=>sc_association-root-text
iv_do_root_node_key = /cpd/if_pfp_bo_plan_hdr_c=>sc_node-plan_header_long_text ).
*-- Association Key of TEXT->TEXT_CONTENT
lv_cont_assoc = lr_frw_conf->get_content_key_mapping(
iv_content_cat = /bobf/if_conf_c=>sc_content_ass
iv_do_content_key = /bobf/if_txc_c=>sc_association-text-text_content
iv_do_root_node_key = /cpd/if_pfp_bo_plan_hdr_c=>sc_node-plan_header_long_text ).
*-- LV_KEY is the GUID of any Financial Plan
*-- Details of Dependent Object ROOT Node
" Generate New Key
lw_root-key = /bobf/cl_frw_factory=>get_new_key( ).
lw_root-parent_key = lv_key.
lw_root-root_key = lv_key.
lw_root-host_bo_key = /cpd/if_pfp_bo_plan_hdr_c=>sc_bo_key.
lw_root-host_node_key = /cpd/if_pfp_bo_plan_hdr_c=>sc_node-plan_header.
lw_root-host_key = lv_key.
lw_root-text_schema_id = 'DEMO'.
lw_root-text_exists_ind = abap_true.
GET REFERENCE OF lw_root INTO lr_root.
*-- The ROOT node and PLAN_HEADER_LONG_TEXT are one and the same.
*-- So the Plan Header will act as Source Node as well as Root Node.
lw_mod-key = lr_root->key.
lw_mod-source_key = lv_key.
lw_mod-source_node = /cpd/if_pfp_bo_plan_hdr_c=>sc_node-plan_header.
lw_mod-root_key = lv_key.
lw_mod-node = /cpd/if_pfp_bo_plan_hdr_c=>sc_node-plan_header_long_text.
lw_mod-association = /cpd/if_pfp_bo_plan_hdr_c=>sc_association-plan_header-plan_header_long_text.
lw_mod-change_mode = /bobf/if_frw_c=>sc_modify_create.
lw_mod-data = lr_root.
APPEND lw_mod TO lt_mod.
*-- Details of Dependent Object TEXT Node
lw_text-key = /bobf/cl_frw_factory=>get_new_key( ).
lw_text-root_key = lw_root-key.
lw_text-parent_key = lw_root-key.
lw_text-user_id_ch = sy-uname.
lw_text-language_code = 'EN'.
lw_text-text_type = 'DEMO'.
lw_text-datetime_ch = sy-datum.
lw_text-datetime_cr = sy-datum.
GET REFERENCE OF lw_text INTO lr_text.
lw_mod-key = lr_text->key.
lw_mod-source_key = lw_root-key.
lw_mod-source_node = /cpd/if_pfp_bo_plan_hdr_c=>sc_node-plan_header_long_text.
lw_mod-root_key = lw_root-key.
lw_mod-node = lv_txt_key. “ TEXT Node Key
lw_mod-association = lv_txt_assoc. “ ROOT -> TEXT Node Association
lw_mod-change_mode = /bobf/if_frw_c=>sc_modify_create.
lw_mod-data = lr_text.
APPEND lw_mod TO lt_mod.
*-- Details of Dependent Object TEXT_CONTENT Node
lw_cont-key = /bobf/cl_frw_factory=>get_new_key( ).
lw_cont-parent_key = lw_text-key.
lw_cont-root_key = lw_root-key.
lw_cont-text = 'TEXT_CREATE'.
GET REFERENCE OF lw_cont INTO lr_cont.
lw_mod-key = lr_cont->key.
lw_mod-source_key = lw_text-key.
lw_mod-source_node = lv_txt_key.
lw_mod-root_key = lw_root-key.
lw_mod-node = lv_cont_key. " TEXT_CONTENT Node Key
lw_mod-association = lv_cont_assoc. “ TEXT –> TEXT_CONTENT Association
lw_mod-change_mode = /bobf/if_frw_c=>sc_modify_create.
lw_mod-data = lr_cont.
APPEND lw_mod TO lt_mod.
*-- Create BO Instance for /BOBF/TEXT_COLLECTION
lr_serv_mgr->modify(
EXPORTING
it_modification = lt_mod
IMPORTING
eo_change = lr_change
eo_message = lr_message
).
*-- Save the Transaction to get reflected in DB
CLEAR : lr_change, lr_message.
lr_tran_mgr->save(
IMPORTING
eo_change = lr_change
eo_message = lr_message
).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.