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 Variables

Former Member
0 Likes
1,051

Hi,

How to create and use global variable?

Advance thanks.

Regards,

V Balaji.

1 ACCEPTED SOLUTION
Read only

nablan_umar
Product and Topic Expert
Product and Topic Expert
0 Likes
760

Hi Balaji,

Do you meant you want to use a variables that can be access by different programs? If you want to use this, you can use parameter id. To create one use transaction SM30 and use table TPARA. You should create parameter id that start with Z. Then in your Abap program you can use SET to save the values into this parameter or use GET statement to retrieve values from this parameter. The values of a parameter id stays as long as you login SAP.

2 REPLIES 2
Read only

ssimsekler
Product and Topic Expert
Product and Topic Expert
0 Likes
760

Hi Balaji

Your question seems about basics of ABAP programming or do I misunderstand?

Hoping not, you can define a global variable in ABAP using especially with <b>DATA</b> statement and you can define so-called field-symbols like dereferenced pointers using <b>FIELD-SYMBOLS</b> statement. To define a constant you can use <b>CONSTANTS</b> statement.

e.g.

DATA gv_date1 TYPE datum .

DATA gv_date2 LIKE sy-datum .

FIELD-SYMBOLS <wa> TYPE subty .

CONSTANTS gv_max_capacity TYPE i VALUE '5' .

For more information you can apply SAPHelp by pressing F1 while on the keyword. And you can have alook to BC400 class.

*--Serdar

Read only

nablan_umar
Product and Topic Expert
Product and Topic Expert
0 Likes
761

Hi Balaji,

Do you meant you want to use a variables that can be access by different programs? If you want to use this, you can use parameter id. To create one use transaction SM30 and use table TPARA. You should create parameter id that start with Z. Then in your Abap program you can use SET to save the values into this parameter or use GET statement to retrieve values from this parameter. The values of a parameter id stays as long as you login SAP.