Passing Data across Components through Component Controller between Two Value Nodes Applies to: SAP CRM WEBCLIENT UI 2007. For more information, visit the Customer Relationship Management homepage Summary This guide is intended to demonstrate how to pass data across component through component controller binding with value nodes of views. Author: Pooja Agarwal Company: Tata Consultancy Services (TCS) Created on: 21 June 2011 Author Bio Pooja Agarwal has been working on SAP Webclient UI for last 2 years. 2011 SAP AG 1
Table of Contents Prerequisite:... 3 Step 1..... 3 Step 2.... 4 Step 3.... 5 Step 4... 7 Step 5... 9 Step 6... 9 Related Content... 11 Disclaimer and Liability Notice... 12 2011 SAP AG 2
Prerequisite: Basic knowledge of CRM Webclient UI, Component and view creation. Step 1 Go to Transaction BSP_WD_CMPWB Create two components ZCOMP_NEW_OLD and ZCOMP_NEW_NEW with one view and one oviewpage in each. The structure of the context node should be same for both the views. 2011 SAP AG 3
Now we will traverse from component ZCOMP_NEW_OLD to ZCOMP_NEW_NEW and transfer the data. Step 2 Create button on view of the first component ( ZCOMP_NEW_OLD) and corresponding event for that button. Write the following code in the method DO_PREPARE_OUTPUT of the implementation class of the view. 2011 SAP AG 4
Create an event GO by right clicking on Event Handler. Step 3 Create a context node CITYCOMP in the component controller of both the components with the same structure as views. And do the context node binding by writing code in the create_context_node_name method of the context class(ctxt) of the view. 2011 SAP AG 5
OWNER->DO_CONTEXT_NODE_BINDING( PE_COMPONENT IV_CONTROLLER_TYPE = CL_BSP_WD_CONTROLLER=>CO_TY IV_TARGET_NODE_NAME = 'CITYCOMP' IV_NODE_2_BIND = VIEW1 ). After successful binding you will get the notification line. 2011 SAP AG 6
Step 4 Add the component interface in the component to which we want to traverse. In our case ZCOMP_NEW_NEW. Select window from the value help. 2011 SAP AG 7
Now add context node in the component interface. Create component Usage in the first component (ZCOMP_NEW_OLD ). 2011 SAP AG 8
Step 5 On the event of eh_ongo write the code to open the second component in pop up. method EH_ONGO. DATA: lv_title TYPE string. DATA num_dec_popup TYPE REF TO if_bsp_wd_popup. lv_title = 'New component'. num_dec_popup = comp_controller->window_manager->create_popup( iv_interface_view_name = 'ZCOMP_NEW_NEW/MainWindow' iv_usage_name = 'TOZCOMPNEWNEW' iv_title = lv_title ). *Open the pop up num_dec_popup->set_on_close_event( iv_event_name = ' ' iv_view = me ). num_dec_popup->set_window_height( 900 ). num_dec_popup->set_window_width( 900 ). num_dec_popup->open( ). endmethod. Step 6 In the implementation class of the first component ZCOMP_NEW_OLD redefine the method WD_USAGE_INITIALIZE to bind the nodes of component controller. 2011 SAP AG 9
method WD_USAGE_INITIALIZE. super->wd_usage_initialize( iv_usage ). CHECK iv_usage IS BOUND. IF IV_USAGE->USAGE_NAME = 'TOZCOMPNEWNEW'. name of component usage iv_usage->bind_context_node( iv_controller_type = cl_bsp_wd_controller=>co_type_component *iv_name = iv_usage->usage_name iv_target_node_name = 'CITYCOMP' iv_node_2_bind = 'CITYCOMP' ). ENDIF. endmethod. Now test the first component and click on the button Go. A new pop will be opened with the values entered in the previous screen. Output First Screen Second component in pop up with values fetched from the previous component. 2011 SAP AG 10
Related Content Techskills Dynamic Component Usages in CRM WebClient UI For more information, visit the Customer Relationship Management homepage 2011 SAP AG 11
Disclaimer and Liability Notice This document may discuss sample coding or other information that does not include SAP official interfaces and therefore is not supported by SAP. Changes made based on this information are not supported and can be overwritten during an upgrade. SAP will not be held liable for any damages caused by using or misusing the information, code or methods suggested in this document, and anyone using these methods does so at his/her own risk. SAP offers no guarantees and assumes no responsibility or liability of any type with respect to the content of this technical article or code sample, including any liability resulting from incompatibility between the content within this document and the materials and services offered by SAP. You agree that you will not hold, or seek to hold, SAP responsible or liable with respect to the content of this document. 2011 SAP AG 12