Passing values from one WebDynpro application to another WebDynpro application

By Pritam Ghosh, YASH Technologies

Summary: Simple example of calling and passing value from one Webdynpro Application to another Webdynpro Application. We will Create two Applications by name ‘ZZ_CALLING_APPLICATION’ and ‘ZZ_CALLED_APPLICATION’. In first Application that is ‘ZZ_CALLING_APPLICATION’ we will create an input parameter where user will enter a date & on clicking on a button it will show all header details of Purchase Order for that particular date and on lead selection of a Purchase Order details it will call our second Application that is ‘ZZ_CALLING_APPLICATION’ and show the item details for that particular PO which we have selected in our first Application means we will call and pass the Purchase Order Number from first to second Application.  

1.            Go to transaction SE80 and select “WebDynpro Comp./Intf” and create a new WebDynpro component by the name ZZ_CALLING_APPLICATION (as shown below), give window name as MAIN_WINDOW and view as FIRST_VIEW.  Save the Web Dynpro Application as local object as shown below:

2.            Now go to the Component Controller Context tab and create one node as shown  below with the name ‘EKKO_NODE’ and take the Dictionary structure as EKKO with Cardinality ‘0..n’ and Selection ‘0..1’. Now select the ‘Add Attribute from Structure’ and select the fields you want in your table. 

 

 

3.            Now save your Application and go to view context and map the node ‘EKKO_NODE’ from Component Controller Context to view context by drag and drop as shown below.

 

4.            Create one attribute with name DATE under the View Controller Context tab with type DATUM. 

 

5.            Now go to the Layout and create an element with name LABEL type label, INPUT as type Input Field. In element LABEL maintain its property ‘LabelFor’ as INPUT and in ‘Text’ write ‘Enter a date’. Now bind the property value of element INPUT with attribute date as shown below: 

 

6.            Create an element type Button with name SHOW and make the text property as ‘Show PO’ and create an action as SHOW_PO as shown below: 


7.            Now create a table with name TABLE, change the property ‘Layout Data‘ as ‘MatrixHeadData’, give the text as ‘Header data’ in the text property of CAPTION. 

 

8.            Right click on the table and create the binding as shown below, chose the context node as EKKO_NODE, make the Standard Cell Editor property as ‘TextView’ and click on ‘Confirm Entry’ as shown below:                

9.            Now double click in the Action SHOW_PO and write the below piece of code in the method ONACTIONSHOW_PO. 

  DATA:
    lo_el_context 
TYPE REF TO if_wd_context_element,
    ls_context    
TYPE wd_this->element_context,
    lv_date       
LIKE ls_context-date.

 
* get element via lead selection
    lo_el_context = wd_context->get_element(  ).

 
* get single attribute
    lo_el_context->get_attribute(
     
EXPORTING
        name =  
`DATE`
      
IMPORTING
        
value = lv_date ).

 
Data:
    fs_ekko 
type ekko.

 
Data:
    t_ekko 
like standard table of fs_ekko.

 
select *
   
from ekko
    
into table t_ekko
   
where bedat EQ lv_date.

 
DATA:
    lo_nd_ekko_node 
TYPE REF TO if_wd_context_node,
    lo_el_ekko_node 
TYPE REF TO if_wd_context_element,
    ls_ekko_node    
TYPE wd_this->element_ekko_node.

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

 
CALL METHOD lo_nd_ekko_node->bind_table
   
EXPORTING
      new_items            = t_ekko.
 

10.        Create one more WebDynpro component by the name ZZ_CALLIED_APPLICATION, give window name as MAIN_WINDOW and view as FIRST_VIEW.  Save the Web Dynpro Application as local object. Now go to the Component Controller Context tab and create one node with the name ‘EKPO_NODE’ and take the Dictionary structure as EKPO with Cardinality ‘0..n’ and Selection ‘0..1’. Now select the ‘Add Attribute from Structure’ and select the fields you want in your table as you have done in step 2 and save you application.  

Click here to continue....

 

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