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

include program variable

Former Member
0 Likes
1,924

hi all,

i have a report in which i have 2 include programs so can i use the variable of 1 include prog. into other and if yes then how can i ??

thanxx.....

8 REPLIES 8
Read only

Former Member
0 Likes
1,501

yes this can be done.

if the variable is a global variable inside the include which is called first, then it can be used in the next include.

hope it helps...

Read only

0 Likes
1,501

>

> yes this can be done.

>

> if the variable is a global variable inside the include which is called first, then it can be used in the next include.

>

> hope it helps...

please can u show me that in brief how i can do it??

thanx...

Read only

0 Likes
1,501

Hi Nilesh,

Eg :

report main_program.

include inc_1.

include inc_2.

now suppose the incluce inc_1 has a variable defined in it. You can use the same in inc_2.

You might say it is not getting the variable in inc_2. That might happen when the firs include is in inactive state.

ry chking out and still if facing any issue, do get back.

best regards

Read only

0 Likes
1,501

>

> Hi Nilesh,

>

> Eg :

>

> report main_program.

>

> include inc_1.

>

> include inc_2.

>

>

>

>

> now suppose the incluce inc_1 has a variable defined in it. You can use the same in inc_2.

>

> You might say it is not getting the variable in inc_2. That might happen when the firs include is in inactive state.

>

> ry chking out and still if facing any issue, do get back.

>

> best regards

thanx now i got that i can use it in 2nd include but can u plzzz be more clear like give me a simple example or so.

like main prog.

incl 1.

var1

incl 2.

i want to use this var1 in incl 2.

thanx...

Read only

Former Member
0 Likes
1,501

hi

ya u can

for eg : this is ur main program

PROGRAM TITLE : Main Program

here u use

INCLUDE: second Program.

this is ur second program

PROGRAM TITLE : second Program

here u declare one variable globally as below

DATA: V_DATE1(8) TYPE c,

now this variable can be used in Main Program wrvr u need....

Regards

Smitha

Read only

Former Member
0 Likes
1,501

Yes it can be done...Just right the Include name into the other program.

Ex:

INCLUDE INC1.
Data: W_char(10) type c Value 'TEST'.

Program1:

Report NAME1.

INCLUDE INC1.
Write : W_CHAR.

Program2:

Report NAME2.

INCLUDE INC1.
Write : W_CHAR.

Read only

Former Member
0 Likes
1,501

Hello,

If the variables are global then it is used in all the includes.

if is external subroutine then we cannot use it directly.

example

PERFORM y_f_convert_decimals IN PROGRAM ZINCLUDE

USING y_v_kbetr

y_v_waers1

y_lv_currdec

CHANGING y_v_fcurr1.

Read only

Former Member
0 Likes
1,501

ok