cancel
Showing results for 
Search instead for 
Did you mean: 

Hard Coding in program.

Former Member
0 Kudos

Hi Guys,

Just i am a beginner.

if we do hard coding in program like.

<b>write : 'program successful'.</b>

is it necessary to put this statement in a text elment?

like <b>write: text-001.</b>

Is this mandatory?

IF we use text element what is the advantage?

Thanks for ur help in advance.

RAJA.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

not mandatory...

but it is recommended that you use text-symbols...

reason being SAP programs can be run on different languages other than english...so when u choose a different language...you might need a translation of the text appearing on screens....

if you dont use text elements, there will be no translation while in text elements you can translate text elements for different languages.

rgds,

PJ

Answers (4)

Answers (4)

former_member221770
Contributor
0 Kudos

Raja,

In the example you have given, it is more suitable to use a Text Element (for the reasons that everyone has told you). However, if you are going to hard code something for a SELECT statement, it is bretter to use a constant:

eg.


SELECT matnr werks
       from marc
       where matnr = '12345' and
             werks = 'ABCD'.

should be written as:



constants: c_matnr like mara-matnr value '12345',
           c_werks like marc-werks value 'ABCD'.

SELECT matnr werks
       from marc
       where matnr = c_matnr and
             werks = c_werks.

This is better practice because if you latwer want to change these constants they are all located in the one spot. Imagine having dozens of SELECT statements, and all of a sudden instead of hittingplant 'ABCD' you need them to hit plant 'EFGH'.

Hope this helps.

Cheers,

Pat.

Former Member
0 Kudos

Hi Raja,

It is not mandatory to use text element.

Text elements allow you to create language-independent programs. Any text that the program sends to the screen can be stored as a text element in a text pool. Different text pools can be created for different languages. When a text element is changed or translated, there is no need to change the actual program code. Text elements in an ABAP program are stored in the ABAP Editor.

Regards,

Sriram.

Message was edited by: sriram Ponna

Former Member
0 Kudos

hi,

eventhough it's not mandatory , it is always advisable by using text-001

when you define the string using text element it can be easy for translating ( suppose you want to translate to germen lanuage for the same text ) then it will take care by translate procedure

cheers,

sasi

Former Member
0 Kudos

Which TXN is to be used to do the translation work?

Former Member
0 Kudos

u should have opened a new thread for this....

translated text can be specified in the text elements screen itself...

from the program goto->text elements -> text symbols...

from text symbols...goto->translation...

enter the original and target language and proceed...

Former Member
0 Kudos

HY,

IT'S NOT MANDATORY TOO USE TEXT ELEMENTS,

BUT WHEN U DO EXTENDED CHECK AT TAHT TIME, HTE HARD CODED COMES IN PICTURE.

SO BETTER USE TEXT ELEMENTS.

REGARDS,

KARTIKEY.