Hi Vinuta,
first of all, I would question why the input of your program is OBJECT NAME and not BO KEY + ROOT NODE KEY...
Anyway, the following code will give you the data (in <lt_root_data>) for IV_ROOT_KEY of the ROOT node of the BO whose name is in IV_BO_NAME:
DATA lc_initial_node_key TYPE /bobf/obm_node_key VALUE IS INITIAL. DATA lr_root_data_table TYPE REF TO data. FIELD-SYMBOLS <lt_root_data> TYPE ANY TABLE. * find the node_key of the ROOT node of the BO whose name is in iv_bo_name: DATA(lv_bo_key) = /bobf/cl_frw_factory=>query_bo( iv_bo_name = iv_bo_name ).
DATA(lo_configuration) = /bobf/cl_frw_factory=>get_configuration( lv_bo_key ).
lo_configuration->get_node_tab( IMPORTING et_node = DATA(lt_nodes) ).
DATA(ls_root_node) = lt_nodes[ parent_node_key = lc_initial_node_key ].
DATA(lv_root_node_key) = ls_root_node-node_key.
* Create a data container for the result of RETRIEVE: CREATE DATA lr_root_data_table TYPE (ls_root_node-data_table_type).
ASSIGN lr_root_data_table->* TO <lt_root_data>.
* Use the service manager to retrieve the data: DATA(lo_service_manager) = /bobf/cl_tra_serv_mgr_factory=>get_service_manager( lv_bo_key ).
lo_service_manager->retrieve(
EXPORTING
iv_node_key = lv_root_node_key
it_key = VALUE #( ( key = iv_root_key ) )
IMPORTING
et_data = <lt_root_data> ).
Kind Regards,
Ivo