10-29-2007 5:04 PM
Hi experts,
I have the doubt about class constructor.
I write the code in Class constructor like,
DATA : ZCURRSTR TYPE IHTTPNVP,
ZCURRTTYPE TYPE TIHTTPNVP.
ZCURRSTR-NAME = 'INDIA'.
ZCURRSTR-VALUE = 'RS'.
APPEND ZCURRSTR TO ZCURRTTYPE.
Now I want to call this Table ZCURRTTYPE in One of the method of Same class.
Any one help me on this issue.
Thanks in Advance,
Points Assured for all suggestions.
10-29-2007 5:40 PM
Hi Jasmine,
I think i gave you an example on this in ABAP forums.
<i>Please reward if that helps you and close both the forums.</i>
Thanks,
Sreekanth
10-29-2007 5:40 PM
Hi Jasmine,
I think i gave you an example on this in ABAP forums.
<i>Please reward if that helps you and close both the forums.</i>
Thanks,
Sreekanth
10-29-2007 8:16 PM
Hello Jasmine
The class constructor is executed <i>once </i>for all instances of your class within your application. Since you can always access static attributes from within any instance method simply code within your instance method:
METHOD my_instance_method.
* define local data
DATA:
ls_zcurrstr TYPE ihttpnvp.
READ TABLE zcurrttype INTO ls_zcurrstr INDEX 1. " read first entry in static itab
...
ENDMETHOD.
Regards
Uwe
10-29-2007 9:42 PM
Hi Jassy,
the table ZCURRTTYPE must be defined as a class attribute so it is available from all methods.
Cheers
Graham Robbo