Application Development 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: 

Writing ABAP for Translating - Best Practice

Former Member
0 Kudos

Hi Folks,

I want to setup some guidelines in my team for writing good code\forms to allow for translations as our project rolls on to non-English speaking countries.

I am looking for a document that gives good examples for best coding practice when it comes to translations, for example, when writing messages to the screen use:

'This is the text'(001) or text-001 instead of just writing 'This is the text'

I have searched the net but I can't see any quick useful guides that I could hand to my team. Does anyone know of any guides that might be worthwhile?

Thanks,

Colm

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Colm,

As SAP is geared towards multiple language support most objects cope with this without additional considerations.  From my experience I would offer the following;

Use Text Symbols for language specific text in programs (in the format Kamesh mentions above in point 2) and set the Maximum length to 10% to 15% longer than the English version.

Don't use text symbols for anything other than text.  For example if you program uses a function code 'SAVE' store this as a literal or a constant, if it's stored as a text symbol and gets translated things will stop working.

Always use numbered placeholders in messages (SE91) as the word order in the translated text may be different to English.  For example, Document &1 is locked by user &2.

If you've defined your own config tables containing a value and a description these need to be defined as two linked tables, one with the value and one a language dependent description.  For example T003 and T003T.

In terms of transports, the report mentioned by Kamesh in point 4 is useful if you plan to transport the languages separate from the development.  If I have an object locked in a transport all translations for it will get moved when the transport is released, irrespective of the developer's logon language.

Regards,

Nick

11 REPLIES 11

kamesh_g
Contributor
0 Kudos

Hi .

I can give the list which i have faced during my developements.

1. When you have common text messages use &&&& in the message class and use text symbols .

2. Don't use 'This is text'(001) also because even though this will not give error in Extended syntax ,when we change text again again we have overwrite existing. always use text-001.

3. And text elements can have translations when we are using multiple languages ex: french and spain

4. Make sure that translations are included in Transport to move it to further systems .

you can use program .‘RS_LXE_RECORD_TORDER’ for this .

matt
Active Contributor

I always insisted on using

'this is text'(001)

since it is self-documenting, and allows for translation. If you use the text comparison tool (in the place where you can edit texts), then changes to the text are not onerous.

text-001 is to me a magic number and therefore BAD programming.

Former Member
0 Kudos

Hi,

I would also recommend adding all objects to be translated in a separated package. This will allow you to use the translation workbench from SAP where you can select all objects by package. That is, the system will generate a list of things to translate so you don't have to go object by object.

For example, if you have package ZMYNEWAPP, create ZMYNEWAPP_TL.

  

What to add in this package? Reports, Data elements, Message class, etc.

What not to add? Structure, Tables, etc.   

Regards,

David.

Former Member
0 Kudos

Hi Colm,

This may fall out of place but

Whenever maintaining selection texts etc give the length almost one and a half times more because the character sets of various languages(scripts) are different.

BR.

Former Member
0 Kudos

Hi Colm,

As SAP is geared towards multiple language support most objects cope with this without additional considerations.  From my experience I would offer the following;

Use Text Symbols for language specific text in programs (in the format Kamesh mentions above in point 2) and set the Maximum length to 10% to 15% longer than the English version.

Don't use text symbols for anything other than text.  For example if you program uses a function code 'SAVE' store this as a literal or a constant, if it's stored as a text symbol and gets translated things will stop working.

Always use numbered placeholders in messages (SE91) as the word order in the translated text may be different to English.  For example, Document &1 is locked by user &2.

If you've defined your own config tables containing a value and a description these need to be defined as two linked tables, one with the value and one a language dependent description.  For example T003 and T003T.

In terms of transports, the report mentioned by Kamesh in point 4 is useful if you plan to transport the languages separate from the development.  If I have an object locked in a transport all translations for it will get moved when the transport is released, irrespective of the developer's logon language.

Regards,

Nick

0 Kudos

I've taken my reply and expanded it into a blog;

I don't however tackle the controversial topic of 'This is a text'(001) vs. text-001.

former_member206575
Participant

I actually prefer to use 'This is a text'(001).

Reason for this is that it is much easier for developers to 'see' what message will be displayed.

Texts will not change often.

But in the end it is a matter of preference.

Anyway, what definitely should NOT happen is that there are hard-coded texts, relevant for translation, used without the (nnn) or not defined as TEXT-001. These will not be translated.

You should only use this if the text is NOT relevant for translation. In any other case, use TEXT-001, or 'SomeText'(nnn).

0 Kudos

I'm not sure it is a matter of preference. I think it is approaching bad programming to use text-001.

In later versions of ABAP (7.30), you can use pipe and ampersand to construct not-to-be translated texts, which is a useful differentiation.

0 Kudos

This message was moderated.

anilkumar_kalkivai
Active Participant
0 Kudos

This message was moderated.

Former Member
0 Kudos

Many thanks to all of you for your responses. Feel free to continue the discussion if any of you would find it useful.