Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Global valiable

Former Member
0 Likes
901

Hello Experts.

I'm beginner of ABAP.

I think valiable declared on the top of program is global valiable

and those declared under subroutain are local valiable.

is it right?

And

If a valiable is declared under event line such as START-OF-SELECTION, AT SELECTION-SCREEN,

which group is this valiable?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
812

>data decla with in subrotine are local variable only.

-


>data dec in top are global variable..

-


> data declared in events is also global

Hello Experts.

I'm beginner of ABAP.

I think valiable declared on the top of program is global valiable

and those declared under subroutain are local valiable.

is it right?

And

If a valiable is declared under event line such as START-OF-SELECTION, AT SELECTION-SCREEN,

which group is this valiable?

4 REPLIES 4
Read only

Former Member
0 Likes
813

>data decla with in subrotine are local variable only.

-


>data dec in top are global variable..

-


> data declared in events is also global

Read only

Former Member
0 Likes
812

Hi Kim,

It is also global. One of the best practise is to create an include. This will separate all the global variables that you declare. Its the common practise. 😃 Hope this will help you.

Rewards if useful.

Regards,

Mark

Read only

Former Member
0 Likes
812

Thank you all.

Now I see. I need to study more about INCLUDE

Read only

former_member206377
Active Contributor
0 Likes
812

Hi Kim,

- A variable declared in subroutine is a local variable . it s value will not be accessible outside the subroutine.

-Whereas a variable declared anywhere in the main program is global can be accessed even with the subroutine.

example:

- if a variable say 'z_abc' is declared in main program (global variable) then it can be acessed in the subroutine too.

Regards,

Vasuki