cancel
Showing results for 
Search instead for 
Did you mean: 

Global constants

Former Member
0 Kudos

HI,

I want to use some constants in my application. I want to know is there is some way to declear those to a class so that we can reuse them throghout in my project. Similar like java class?

Accepted Solutions (1)

Accepted Solutions (1)

Yashpal
Active Contributor
0 Kudos

Hi ,

for webdynpro abap u can create a super class say .. Z_GLOBAL inheriting the CL_WD_COMPONENT_ASSISTANCE . declare the public constant in that ...then for every component's assistance class inherit this global class so that u can use the constants .

Regards

Yashpal

Former Member
0 Kudos

I am using ASSISTANCE calss , but how you will delclear constants there? the only thing you can do is i can crete text elememt.Please tell me the way.

Former Member
0 Kudos

Goto your class in se24. In the "Attributes" tab of the class, declare the constants. When you create a class attribute, you should specify the type as Instance or Static. You can specify the attribute as a constant there.

Regards

Nithya

Yashpal
Active Contributor
0 Kudos

in the class go to the tab "attributes" declare the attribute and its level as constant visibility as public and then at the last tab i.e initial value give the value to the attribute .

regards

Yash

Former Member
0 Kudos

thanks Yashpal,

how to access it, i have to get the value and compare? will u please send a sample code,points will be rewarded.

Former Member
0 Kudos

hi Prosun,

if you declare an assistance class,then you can access it through the instance <b>wd_assist</b> like wd_this and wd_comp_controller.

for example,if the constant named 'Const' is declared in the attribute of the assitant class,then you can call it as <b>wd_assist->const</b> from any where of the component.

i think it will solve your problem.

regards,

subhasis.

reward points if useful.

Yashpal
Active Contributor
0 Kudos

class_name->attribute name .. say class name Z_Global .. attr name abc then

Z_GLOBAL=>abc or wd_assist->abc

Regards

Yash

Answers (0)