on 06-25-2010 7:47 PM
Hi Experts,
Could anybody explain, how to define global datas ?
For example, I have a node called sales_header in which I have 10 fields from VBAK tables.
When I am defining any attribute in the component controller like GT_HEADER TYPE ELEMENTS_SALES_HEADER, I am not able to acess in the methods.
The only way is defile local tables inside the methods.
Any example will be highlt apprciated.
Thanks
Sanjaya
Hi Sanjaya,
there is check box field (Public) for the component controller attribute, check that... you will be able to access the attribute now in the methods.
Reg,
Rajesh.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
saw the title of your post and felt compelled to respond...
Global Data Declarations ... are bad!
there are (in my opinion) very limited cases where using globally accessable variable is good coding practice.
If you insist on using variable that can be accessed throughout the controller method - you can use attributes of the controller - defined on attributes tab and referenced using wd_this->attribute_name.
I perfer to hold persistant references like this either 1) in the context if they are relevant to the display of the data. Or 2) as a private instance attribute of an assistance class where it can be used in the processing of the data.
The only time I tend to hold component attributes is when I have a flag/reference that I need to share which is used in the display of the data but is not data or meta data - for example a reference to the window of a popup window.
But I'm a bit extreme... you might be fine with just using the component attributes for your global tables.
Good luck whatever approach you take,
Chris
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Chris,
Thanks for the reply.
WD_this>attribute_name works fine when that is a variable. However I am more concerned about strctures and tables.
However when I have a structure ot table defined in the context.
For e.g. say my structure in the context is node_vbak with some five fields.
And in the attributes i define GS_VBAK type element_node_vbak.
then in the method I get the chid node and the all the instantiaion for that node .
After that is I want to access WD_THIS->GS_VBAK-VBELN it gives error the component VBELn does not exits.
so the way left for me is declare a local work area ls_vbak in each methoh and then access the fields.
Is there any way to have a global parameter and use it across.
Thanks
Sanjaya
User | Count |
---|---|
88 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
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.