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

Initialising constants using text-element

Former Member
4,914

hiii, I want to initialize the constant data object used in my ABAP program with the value of text element, Can anybody plz tell me how to do so?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,810

I am sorry. You need to specify the value in the statement itself.

Values of text elements are assigned at runtime hence its not allowed to assign with text elements.

You may use :

DATA: text_buffer TYPE string VALUE `Text`, 
      count TYPE i VALUE 1, 
      price TYPE p LENGTH 8 DECIMALS 2 VALUE '1.99'.

9 REPLIES 9
Read only

Former Member
0 Likes
2,810

Hi,

Why do you want to define the constant using a text element..you can directly use the text element

Thanks

Naren

Read only

0 Likes
2,810

Actually in my program I was using some constants data object to hold the description of the field name which will be displayed in ALV list in header. for example,, like this

*Constants for Field Descriptions:

Constants:

c_text1 TYPE descr_40 VALUE 'Material',

c_text2 TYPE descr_40 VALUE 'Description',

c_text3 TYPE descr_40 VALUE 'Phys Inv Doc',

c_text4 TYPE descr_40 VALUE 'Plant'.

Now i want to make these descriptions <u><b>language independent</b></u> hence i tend to use text element like this:-

c_text1 TYPE descr_40 VALUE text-001

but this thing is not working giving some error.

Read only

Former Member
0 Likes
2,810

Hi,

Did you say language dependant or language independant..

If language dependant on your logon language then you can directly use the text elements in your alv..

If language independant which means all the languages should display in english..Then use the constants c_material ...default 'Material'.

Thanks

Naren

Read only

0 Likes
2,810

yaa,, I want to make the descriptions dependent upon login language,,,

for this i want to initialize constants used in program with the value of text element.

So Is it possible to initials the value of constant data object by value of text element. If not then i will be using variable instead of constants like this.

DATA: matnr_desc type descr_40.

matnr_desc = text-001.

Read only

Former Member
0 Likes
2,810
*Constants for Field Descriptions:
Constants:
c_text1 TYPE descr_40 VALUE text-001,
c_text2 TYPE descr_40 VALUE text-002, " 'Description'
c_text3 TYPE descr_40 VALUE text-003, "'Phys Inv Doc'
c_text4 TYPE descr_40 VALUE text-004. "'Plant'.
Read only

2,810

No this thing is giving error,,,

Error is: TEXT is Unknown,

Read only

Former Member
0 Likes
2,810

Have you created the text in text elements ?

Read only

0 Likes
2,810

yaa! text symbols are created,,,

Read only

Former Member
0 Likes
2,811

I am sorry. You need to specify the value in the statement itself.

Values of text elements are assigned at runtime hence its not allowed to assign with text elements.

You may use :

DATA: text_buffer TYPE string VALUE `Text`, 
      count TYPE i VALUE 1, 
      price TYPE p LENGTH 8 DECIMALS 2 VALUE '1.99'.