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

Hard Code Text - Constant vs Text Element

Former Member
0 Likes
2,123

Hi Friends,

In the below code u2018INTu2019 is a hard coded text. Whether this need to be modified as u2018CONSTANTu2019 or u2018Text Elementu2019.

What is the difference between those?

SUBMIT rsconn01 WITH mode = 'INT'

WITH output = ' '

AND RETURN.

Regards,

Viji.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,137

Hi,

Keep it as a constant and not a text element.

This is because if your program is translated in some language then the text element value will change for that language and will not remain same as INT.

Although in this case INT does not have any specific meaning so it might remain the same in all langugages.

So declare it as a constant only.

Regards,

Ankur Parab

5 REPLIES 5
Read only

Former Member
0 Likes
1,138

Hi,

Keep it as a constant and not a text element.

This is because if your program is translated in some language then the text element value will change for that language and will not remain same as INT.

Although in this case INT does not have any specific meaning so it might remain the same in all langugages.

So declare it as a constant only.

Regards,

Ankur Parab

Read only

former_member585060
Active Contributor
0 Likes
1,137

Hi,

It should be CONSTANT, as the value will remain same in all the languages.

Text elements are needed if it transported to other system with different language or executed in other language.

Regards

Bala Krishna

Read only

Former Member
0 Likes
1,137

Hi Viji,

Typically, constants will be a safe bet for you in this case.

Constants can be declared in your main program, and all includes / subroutines will automatically get access to the same.

On the other hand, text-elements will typically be accessed from within the main program and won't be accessible from the include programs.

Secondly, constants will remain the same irrespective of the system language, while the text elements will be vulnerable to any language changes.

Hope this is clear! Do revert back if you need anything else!!

Cheers,

Shailesh.

Always provide feedback for helpful answers!

Read only

Former Member
0 Likes
1,137

hai ,

constant is a constant value for the program

where as if u maintian as text elements u can translate in other languages where as onstants cannot , so maintian as constant and use it

m.a

Read only

Former Member
0 Likes
1,137

HI Viji,

when ever you are using FM or Submit.

the Import paramater field type should match to passing field types other wise the PGm goes dump.

to skip dump we use constants or Text elemets ..

TExt elements are replicate of SY-TITLE..

while doing Code inspector the Consatnts or Hard code values show as errors.

Prabhudas