on 05-23-2011 8:04 PM
Hi Experts,
I am trying to use componentization in WD ABAP.
I have one Business logic componet WD_BLC (BLC) and it contains following context node that differnet views will use and a Method CALCULATE_SUM sum that sums the values.*
Context A
value1
value2
sum
I have three WD components specifically that contain views.
First WD comp has two input fileds which are mapped from interface component context.
WD_VIEW_INPUT - WD component
View_input - WD View
Value 1 - Mapped from Interface Node
Value 2 - Mapped from Interface Node
Second WD Comp has one output filed which is mapped from interface component context.
WD_VIEW_OUTPUT - WD component -
View_output - WD View
Output - Mapped from Interface Node
This third WD component uses View_input from WD component WD_VIEW_INPUT and View_output from WD_VIEW_OUTPUT component using component usages for these views.This wd component also has a button that calls calculate_sum method in WD_BLC.
WD_VIEW_MAIN - WD Component
View_main - WD View
Now it calls the method in the BLC and sums the two values that I put in View_input. but sum value does not get set
in the View_output of component WD_VIEW_OUTPUT. While if I see the same ouput value in View_input using context mapping
I get the sum value.
Binding is done properly also only interface node property is checked for Context A in the WD_BLC.
Please suggest where am I making mistake?
Umang
Edited by: Umang Mathur on May 24, 2011 12:35 AM
Edited by: Umang Mathur on May 24, 2011 12:38 AM
Edited by: Umang Mathur on May 24, 2011 12:40 AM
Edited by: Umang Mathur on May 24, 2011 12:42 AM
What you miss is the following.
WD_VIEW_INPUT and WD_VIEW_OUTPUT uses their own instance of the WD_BLC. Meaning that the WD_BLC instance is not the same for using components.
What i would do in your case is create a WD_BLC in Third component and pass this instance via inerface a method (comp1,comp2). In this method use the component_usage method enter_referencing mode to set this instance to the usage of
WD_BLC in comp1 and comp2.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Bhaskaran,
Thanks for a quick reply. I have WD_BLC as a separate component. Can you please specify as to how to pass its instance to the other two components.
Currently I am using one of the context of interface controller and this context is mapped to these two components, now when I set the value in the common node this does not get reflected in the other component.
Can you please elaborate?
Thanks
Umang
Edited by: Umang Mathur on May 24, 2011 1:50 AM
You have WD_BLC as used component in comp1 and comp2 right ? otherwise you would not have the interface node mapped.
You use comp-3 to embed comp_1 and comp_2 to display. My solution is
1. in comp1,comp2 create a insterface method set_blc_usage with importing parameter type if_wd_component_usage
In this method implement the if_wd_component_usage method ENTER_REFERENCING_MODE.
Any other coding creating blc_usage should be deleted.
2. in comp_3 ,create the component usage of the wdc_blc in the component do_init method.
You may have the coding for the creating the usages of comp_1 and comp_2. If you do not have that then i would advice you to do that as well in the doinit method.
Now you can safely call the set_blc_usage of the comp-1 and comp_2 passing the component usage as exporting parameter.
This will make sure that you have only one instance of the wdc_blc among the 3 components.
Your current scenario suggests me that you have 2 instances of wdc_blc component at runtime.
Hi Bhaskaran,
Thanks for a quick reply....
My case is like this one.
I have a BLC component that takes care of RFC call so it has all the nodes. I have three one component with three.
WD_Overview, WD_Review, WD_Confirmation views. I navigate between these component using FPM implementation.
But as you said when I navigate from WD_overview which is my first comp and here I call the interface RFC method to populate the methods , WD_Review context is empty. I dont want to call the RFC again now.
Can you share with me as to how create a if_wd_component_usage method ENTER_REFERENCING_MODE.Basically When I call RFC method i want all these usage be declared in the three components.
Thanks....
Edited by: Umang Mathur on May 24, 2011 2:29 AM
Edited by: Umang Mathur on May 24, 2011 3:49 AM
User | Count |
---|---|
95 | |
11 | |
11 | |
10 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.