cancel
Showing results for 
Search instead for 
Did you mean: 

Passing data between two views.

Former Member
0 Kudos

Dear experts!

I created new ZViewKHDS (table view type) and added to standard component BT115H_SLSO. On ZViewKHDS, i added a SAVE button to save data on this view to ZTable. In method EH_ONSAVE, i can get the GUID of transaction type (get from view Details of component BT115H_SLSO, so when i create new transaction type SLSO, i can input data on ZViewKHDS, and save these data to Ztable with key is GUID of new transaction SLSO. In implementation class of ZViewKHDS's context node, i redefined method IF_BSP_MODELINIT to initial view of ZViewKHDS. But when i display the old transaction type SLSO, from method IF_BSP_MODELINIT, i can not get the GUID of transation type SLSO, so i can not fill exactly the data from ZTable belong to the SLSO to the ZViewKHDS. So can you show me how to get the GUID of transaction type SLSO from method IF_BSP_MODEL~INIT of imlementation class of context node in ZViewKHDS.

Thanks you very much!

Longnd_tb.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi longnd,

so first in eh_onsave event get the instance of bt115h_slso , then using get_property_as_string get the guid for that object .

for this

data : lr_cuco type ref to impl class of component,

lr_col type ref to cl_bsp_wd_collection_wrapper.

lr_cuco ?= me->get_custom_controller( controller_id = 'bt1115h_slso/viewname).

lr_col ? = lr_cuco->typed_context->collection_wrapper.

data : lr_contextnode type ref ro if_bol_bo_property_accesss.

lr_contextnode ?= lr_cuco->contextnode->collection_wrapper->get_current().

data : lr_entity type ref to if_bol_bo_property_access.

data : v_guid type guid.

call method lr_contextnode->get_property_as_string

exporting

iv_attr_name = 'guid'

importing

iv_result = v_guid.

Up to here you can get GUID.

Former Member
0 Kudos

Thanks everybody for your answers!

I have just resolved my problem. Before, in method EH_ONSAVE, i can get exactly the GUID of transaction type equivalence to the answer of sadasiva, but my solution has little difference. Your solution: "lr_cuco ?= me->get_custom_controller( controller_id = 'bt1115h_slso/viewname).", in my solution is: "lr_cuco ?= me->get_custom_controller( controller_id = 'CUSTOMER_CONTROLLER)". This CUSTOMER_CONTROLLER controls both view Details and ZViewKHDS. And then, the same code in method IF_BSP_MODEL~INIT of context node's implementation class can get GUID of transaction type from Details view without create new context node using BOL object BTOrder in my view and then bind it to the component controller. Following is my solutions, i share for anyone need:

In EH_ONSAVE method:

  • Get GUID of Transaction type *

DATA: lr_cuco TYPE REF TO CL_BT115H_S_SLSOHCUCO_IMPL.

DATA: lr_entity TYPE REF TO cl_crm_bol_entity,

lv_text TYPE string.

lr_cuco ?= me->get_custom_controller( controller_id = 'BT115H_SLSO/SLSOHCuCo' ).

lr_entity ?= lr_cuco->typed_context->BTAdminH->collection_wrapper->get_current( ).

lv_text = lr_entity->get_property_as_string( iv_attr_name = 'GUID' ).

and in IF_BSP_MODEL~INIT method:

DATA: lv_owner TYPE REF TO ZL_ZBT115H__ZVIEWKHDS_IMPL,

lr_entity TYPE REF TO cl_crm_bol_entity.

DATA: lr_cuco TYPE REF TO CL_BT115H_S_SLSOHCUCO_IMPL.

Data: lr_col type ref to if_bol_bo_col,

lv_text type string.

  • Get owner *

super->if_bsp_model~init( id = id owner = owner ).

lv_owner ?= owner.

  • Get GUID of transaction type *

CHECK lv_owner IS BOUND.

lr_cuco ?= lv_owner->get_custom_controller( controller_id = 'BT115H_SLSO/SLSOHCuCo' ).

lr_entity ?= lr_cuco->typed_context->BTAdminH->collection_wrapper->get_current( ).

lv_text = lr_entity->get_property_as_string( iv_attr_name = 'GUID' ).

lv_text return the value of GUID.

Thank you!

Longnd

Answers (2)

Answers (2)

kavindra_joshi
Active Contributor
0 Kudos

Use a customer controller.Create a new context node in the custom controller whose data you want to pass across views. The binding happens automatically in create_context_nodes( ) of the context class.

Regards

Kavindra

former_member214667
Contributor
0 Kudos

Hi,

You can create a context node using BOL object BTOrder in your view and bind it to the component controller. You then will have the GUID in your view.

Regards,

Shiromani