Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 


I have demonstrated how to create a delegate node (Text Collection in our case), also have created a test report program to demonstrate usage of helper class and retrieve by associations to retrieve the text contents, going further we are consuming the Dependent BO in FPM.

 

Here we are embedding the Dependent Object /BOBF/TEXT_COLLECTION in our BO.



Right click Root node → Select Delegate node.
Provide node name, node prefix, under “Cross BO Relationship” select “Ref. Business Object” as /BOBF/TEXT_COLLECTION.


We can choose from the available Dependent Objects:



Node Prefix: The node prefix is used by BOPF at runtime in order to identify the Dependent Object which is called by the consumer.



When you create the Delegated Node as described above BOPF automatically creates the required association to the root node of the Dependent Object.



This is possible since the Text Collection Dependent Object supports a standard linkage to a hosting Business Object. The standard linkage is supported for each Dependent Object that fulfils the following requirement:


The embedded Dependent Object must have an alternative key on its root node that uses /BOBF/S_LIB_K_DELEGATION as DATA_TYPE and /BOBF/T_LIB_K_DELEGATION as DATA_TABLE_TYPE. The Alternative Key must be set to "Not-unique" to enable one-to-many usages of it.


We can see that in the Dependent BO for Text Collection.



Activate and regenerate the BOPF constant interface.


 

 

Adding Delegate Node instance using T-code BOBT:

 

Select the BO and provide query select all. Select the Root node and click edit button.



Navigate to ROOT_LONG_TEXT.



Click Create node instance, we may get the error.



Provide with the Test Schema ID as “DEFAULT” and “TEXT_EXISTS_IND” = “X” and click check. Save.


Now Opening the ROOT_LONG_TEXT we see:



Under “TEXT” create node instance and provide “TEXT_TYPE” and “”LANGUAGE_CODE”. I have added as:



Now Select the TEXT_CONTENT and create instance. Provide the Text “Demo Text”. Save. The records are now saved.



 


 


Testing the BO to get the Text available in TEXT_CONTENT:


The structure and table types used in our program are from ROOT and ITEM nodes:




Add the below code:


*Association to a Delegated node.
DATA: lt_mod TYPE /bobf/t_frw_modification,
      ls_mod TYPE /bobf/s_frw_modification,
      lo_message TYPE REF TO /bobf/if_frw_message,
      lo_chg TYPE REF TO /bobf/if_tra_change,
      lr_srv_mgr TYPE REF TO /bobf/if_tra_service_manager,
      lt_key TYPE /bobf/t_frw_key,
      lt_target_key TYPE /bobf/t_frw_key.

DATA: lv_text_node_key TYPE /bobf/conf_key,
      lv_content_node_key TYPE /bobf/conf_key,
      lv_text_assoc_key  TYPE /bobf/obm_assoc_key,
      lt_txc_text_key TYPE /bobf/t_frw_key,
      lv_content_assoc_key TYPE /bobf/obm_assoc_key,
      lt_txc_content TYPE /bobf/t_txc_con_k.

DATA: lt_root_data TYPE zmay1_t_root,
      ls_root_data TYPE zmay1_s_root,
      lt_item_data TYPE zmay1_t_item,
      ls_item_data TYPE zmay1_s_item.


*Get dependent object keys for retrieve by association calling helper method
*Helper method  = /scmtms/cl_common_helper=>get_do_keys_4_rba
*/bobf/if_txc_c = Interface of Dependent BO= /BOBF/TEXT_COLLECTION
*zif_may1_trq_c = Interface of our BO= ZMAY1_TRQ



*Flow:
*ZMAY1_TRQ ->ROOT -> ROOT_LONG_TEXT -> TEXT -> TEXT_CONTENT
*/BOBF/TEXT_COLLECTION -> ROOT -> TEXT -> TEXT_CONTENT

*Helper method to fetch node and keys
/scmtms/cl_common_helper=>get_do_keys_4_rba(
  EXPORTING
    iv_host_bo_key      =    zif_may1_trq_c=>sc_bo_key
    iv_host_do_node_key =    zif_may1_trq_c=>sc_node-root_long_text
    iv_do_node_key      =    /bobf/if_txc_c=>sc_node-text
    iv_do_assoc_key     =    /bobf/if_txc_c=>sc_association-root-text
  IMPORTING
    ev_node_key         =    lv_text_node_key
    ev_assoc_key        =    lv_text_assoc_key
).



/scmtms/cl_common_helper=>get_do_keys_4_rba(
  EXPORTING
    iv_host_bo_key      =    zif_may1_trq_c=>sc_bo_key
    iv_host_do_node_key =    zif_may1_trq_c=>sc_node-root_long_text
    iv_do_node_key      =    /bobf/if_txc_c=>sc_node-text_content
    iv_do_assoc_key     =    /bobf/if_txc_c=>sc_association-text-text_content
  IMPORTING
    ev_node_key         =    lv_content_node_key
    ev_assoc_key        =    lv_content_assoc_key ).


 

*Get Service Manager Instance

IF ( lr_srv_mgr IS NOT BOUND ).
  lr_srv_mgr = /bobf/cl_tra_serv_mgr_factory=>get_service_manager(
  zif_may1_trq_c=>sc_bo_key ).
ENDIF.

lr_srv_mgr->query(
  EXPORTING
    iv_query_key            =    zif_may1_trq_c=>sc_query-root-select_all
    iv_fill_data            =    abap_true     

  IMPORTING
    et_data                 =    lt_root_data    
    et_key                  =    lt_key 
).


 

*RETRIEVE_BY_ASSOCIATION - 1.  ROOT to ROOT_LONG_TEXT
lr_srv_mgr->retrieve_by_association(
  EXPORTING
    iv_node_key             =    zif_may1_trq_c=>sc_node-root
    it_key                  =    lt_key " Key Table
    iv_association          =    zif_may1_trq_c=>sc_association-root-root_long_text
  IMPORTING
    et_target_key           =    lt_target_key  "Retrieved key of root_long_text
).

*RETRIEVE_BY_ASSOCIATION - 2.  ROOT_LONG_TEXT to TEXT
lr_srv_mgr->retrieve_by_association(
  EXPORTING
    iv_node_key             =    zif_may1_trq_c=>sc_node-root_long_text
    it_key                  =    lt_target_key " ROOT_LONG_TEXT key
    iv_association          =    lv_text_assoc_key
  IMPORTING
    et_target_key           =    lt_txc_text_key ).

*RETRIEVE_BY_ASSOCIATION - 3.  TEXT to TEXT_CONTENT
lr_srv_mgr->retrieve_by_association(
  EXPORTING
    iv_node_key             =    lv_text_node_key
    it_key                  =    lt_txc_text_key
    iv_association          =    lv_content_assoc_key
    iv_fill_data            =    abap_true
  IMPORTING
    et_data                 =    lt_txc_content ).

BREAK-POINT.

 


The Output in Debugger with the text “Demo Text”:


 

 

Consuming the Dependent BO in FPM:

 

Pre-requisite: Please follow the link to get started with FPM BOPF Integration.


http://scn.sap.com/docs/DOC-45726


Enter T-code: FPM_WB to open the FPM Workbench and proceed with your application.


Create a Tabbed UIBB component.



Search for the Text Collection Config ID and add /BOFU/TEXT_COLLECTION_TAB.



Select the Wire Schema Tab and add a new wire with the below details.


Save and Test the application.


 

 

Testing the Delegate Node:

 

Entering the TRQ ID and click continue.



On the Next screen we see the Text Collection delegate node with the text content.



Thank you..



11 Comments