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

give out variable as string on the screen

Former Member
0 Likes
976

hi all

i have define a variable and assign a value. Now i want show the variable as string in screen.

Example:


data lf_vab type i.

lf_vab = 1.

Output is

lf_vab = 1.

I know, i have might define LF_VAB as a constant but i wan't.

Thx abap_begin

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
900

yes, i know, i can definition as string, look this problem


 data lf_vab1 type i .
 data lf_va type string value 'LF_VAB1'.

 lf_vab1 = 3
WRITE:  lf_va, ' = ' , lf_vab1.

Now the output is

LF_VAB1= 3

When i change later the variable name, then the output isn't right.

Example


 data lf_vab type i .
 data lf_va type string value 'LF_VAB1'.

 lf_vab1 = 3
WRITE:  lf_va, ' = ' , lf_vab1. "Now is wrong, because the Variable LF_VAB1 isn't exist

What i want is, get the variable name as string. Is for dynamic programing.....

Thx abap_begin

Edited by: abap_begin on May 6, 2010 10:41 AM

yes, i know, i can definition as string, look this problem


 data lf_vab1 type i .
 data lf_va type string value 'LF_VAB1'.

 lf_vab1 = 3
WRITE:  lf_va, ' = ' , lf_vab1.

Now the output is

LF_VAB1= 3

When i change later the variable name, then the output isn't right.

Example


 data lf_vab type i .
 data lf_va type string value 'LF_VAB1'.

 lf_vab1 = 3
WRITE:  lf_va, ' = ' , lf_vab1. "Now is wrong, because the Variable LF_VAB1 isn't exist

What i want is, get the variable name as string. Is for dynamic programing.....

Thx abap_begin

Edited by: abap_begin on May 6, 2010 10:41 AM

4 REPLIES 4
Read only

Former Member
0 Likes
900

Define it as String ..Thats It.

Read only

Former Member
0 Likes
900

Tried quite hard to understand the question. But couldn't

Read only

Former Member
0 Likes
901

yes, i know, i can definition as string, look this problem


 data lf_vab1 type i .
 data lf_va type string value 'LF_VAB1'.

 lf_vab1 = 3
WRITE:  lf_va, ' = ' , lf_vab1.

Now the output is

LF_VAB1= 3

When i change later the variable name, then the output isn't right.

Example


 data lf_vab type i .
 data lf_va type string value 'LF_VAB1'.

 lf_vab1 = 3
WRITE:  lf_va, ' = ' , lf_vab1. "Now is wrong, because the Variable LF_VAB1 isn't exist

What i want is, get the variable name as string. Is for dynamic programing.....

Thx abap_begin

Edited by: abap_begin on May 6, 2010 10:41 AM

Read only

0 Likes
900
data lf_vab type i .
 data lf_va type string value 'LF_VAB1'.
 
 lf_vab = 3
WRITE:  lf_va, ' = ' , lf_vab. 

if if you change the varible name ten you have to change in all the place.Please check your codings.

you are declared lf_vab but used as lf_vab1