on 08-24-2011 12:31 PM
Hello all,
I want to use the assistance class of a component to pass parameters.
For instance:
- component CA calls component CB
- I want to pass parameters from CA to CB (or use CB-assist-methods within CA to set the parameters)
- (parameters are stored as attributes of CB-assist)
Is this possible?
If yes, how can I access the assistance class of CB out of CA?
Thanks a lot...
Hello,
This is possible but better solution would be to go for a separate global class and move the methods from the CB's assistance class to the global class. Then instantiate the global class instance and share the instance between the components.
Coming back to the solution for your question.
1. In the CB, create an interface method and return the referencce of the WD_ASSIST variable
2. in CA, call the interface method to get the reference of CB's assistance class and set the parameters.
BR, Saravanan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks a lot for your replies.
I used successfully the solution with returning a reference to wd_assist from an interface method.
Regards
i.Durmaz
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If both components use same Assistance class then it is possible to use the
IF_WD_COMPONENT_USAGE=>create_component method by passing the wd_assist object. This will make sure that you have one instance of the assistance class among the 2 components.
Thus your component CA passes the WD_ASSIST object to CB.
Another solution is to get rid of assistance class and use a Singleton class. use getter and setter methods to mutate. You are free to use this class where ever you wish.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You just create a reference to it in your application, like for any other class. Personally, I'd create this reference in the attributes list of the assistance class for application A. That way, assistance class CA would be able to instantiate and use assistance class CB.
From within any method in your application A, you would then invoke it as follows:
call method assistance_class_a->lcl_assistance_class_b->method1( )...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.