Passing values from one WebDynpro application to another WebDynpro application

...Previous

11.        Go to view context and map the node ‘EKPO_NODE’ from Component Controller Context to view context by drag and drop and then go to the layout create a table with name TABLE, give the text as ‘Item data’ in the text property of CAPTION and bind it with the node ‘EKPO_NODE’ as shown below:

     

   

12.        Now save the application and come back to our first application that is ZZ_CALLING_APPLICATION, in that create a Action in the On lead selection event of the table ‘TABLE’ as SHOW_ITEM as shown below:  

13.        Now double click on the event SHOW_ITEM and write the below code in its method ONACTIONSHOW_ITEM. 

 Reading the value of ebeln in lead selection that has to be passed
  
DATA lo_nd_ekko_node TYPE REF TO if_wd_context_node.
  
DATA lo_el_ekko_node TYPE REF TO if_wd_context_element.
  
DATA ls_ekko_node TYPE wd_this->element_ekko_node.
  
DATA lv_ebeln LIKE ls_ekko_node-ebeln.

* navigate from <CONTEXT> to <EKKO_NODE> via lead selection
  lo_nd_ekko_node = wd_context->get_child_node( name = wd_this->wdctx_ekko_node ).

* get element via lead selection
  lo_el_ekko_node = lo_nd_ekko_node->get_element(  ).

* get single attribute
  lo_el_ekko_node->get_attribute(
    
EXPORTING
       name =  
`EBELN`
    
IMPORTING
       
value = lv_ebeln ).

   
DATA:
      w_url   
type string,
      w_value 
type string.

  
* Get the URL of the called application
     
call method cl_wd_utilities=>construct_wd_url
       
exporting
        application_name              = 
'ZZ_CALLED_APPLICATION'
      
importing
        out_absolute_url              = w_url.

 
 * make the Value type compatible that has to be passed with the URL 
  w_value = lv_ebeln.

* Attach the parameters and its value with the URL that 
* have to be passed to the 2nd application
 
call method cl_http_server=>append_field_url
   
exporting
      name  = 
'EBELN'
      
value = w_value
    
changing
      url   = w_url.

* generate a popup window for the 2nd application with the above URL
 
DATA lo_window_manager TYPE REF TO if_wd_window_manager.
 
DATA lo_api_component  TYPE REF TO if_wd_component.
 
DATA lo_window         TYPE REF TO if_wd_window.

  lo_api_component  = wd_comp_controller->wd_get_api( ).
  lo_window_manager = lo_api_component->get_window_manager( ).

  lo_window         = lo_window_manager->create_external_window(

                   url = w_url ).

  lo_window->open( ).
 

14.        Now go to the Controller Initialization Method of the 2nd application that is ‘ZZ_CALLED_APPLICATION’ and write the below piece of code in its WDDOINIT method. 

  DATA:
  lv_param 
type string.   

* get the value for ebeln that has been send for the 1st application
 lv_param = wdr_task=>client_window->get_parameter( 
'EBELN' ).

 
DATA:
   fs_ekpo 
type ekpo,
   t_ekpo 
like table of fs_ekpo.

* get the item deatils for the given ebeln
 
select *
   
from ekpo
   
into table t_ekpo
   
where ebeln eq lv_param.

 
DATA lo_nd_ekpo_node TYPE REF TO if_wd_context_node.
 
DATA lo_el_ekpo_node TYPE REF TO if_wd_context_element.
 
DATA ls_ekpo_node TYPE wd_this->element_ekpo_node.

* navigate from <CONTEXT> to <EKPO_NODE> via lead selection
  lo_nd_ekpo_node = wd_context->get_child_node( name = wd_this- 

                                              >wdctx_ekpo_node ).

* bind the internal table of item details with the display table
 
call method lo_nd_ekpo_node->bind_table
   
exporting
      new_items            = t_ekpo.
 

15.        Now SAVE and Activate both the Application. Test your Application after creating a WebDynpro application as shown below: 

   

 

16.        Now test the first application that is ‘ZZ_CALLING_APPLICATION’ as shown below: 

Final Output: 

Enter a date: 

Click on the button ‘Show PO’. 

Make a lead selection on any of the PO 

Window of the Second Application with the item details for the PO selected in first Application. 

 

Please send us your feedback/suggestions at webmaster@SAPTechnical.COM 

HomeContribute About Us Privacy Terms Of Use • Disclaimer • SafeCompanies: Advertise on SAPTechnical.COM | Post JobContact Us  

Graphic Design by Round the Bend Wizards

footer image footer image