Etiqueta > i18n
Supported by

Change selection screen texts without hard coding them

Even though many ABAP programmers tend to forget this, the less texts you hard code in your program the simpler it will be to translate it.

Here’s a simple but rather obscure way to manipulate selection screen texts while still being able to translate then. This way you can, for example, prefix them with icons.

Ler o resto do artigo! »

SAP helps you translate to any language

Every once in a while I find yet another hidden SAP virtue. I just found out that there is a transaction which, for a given word in a given language, will help you translate it to another language by showing you which other translations already exist for that same word.

How cool is that? Ok, it’s not Google Translate, but it’s a nice help.

Oh, I almost forgot. The transaction is called STERM.

Thank you Sérgio Fraga for the tip.

Greetings from Abapinho.

Abapinho Dev Tools: Translator

Nuno Morais has developed another very useful tool to help simplify mass translations of most SAP objects.

The toold is not for automatic translation between two languages. Instead, it has the following features:

  • Export an Excel file with texts
  • Import an Excel file with texts
  • Copy texts from one language into one or more languages
  • Create a transport order with the changed texts
  • Find object dependencies which lack translations
  • Provides a nicer browsing interface to help on manual translation

Abapinho will be its official repository.

Code in GitHub.

Soon, an instruction manual. Until then, go on and try it. If you like it or have any suggestion please leave a comment here.

Thank you Nuno for having developed this and for sharing it with the world in Abapinho.

Greetings from Abapinho.

Best practices
Thou shalt use readily translatable explicit literals in programs

In reports, instead of WRITE TEXT-001, use WRITE ‘bla bla bla’(001). This way a default text will always be there and besides the readability of the program is improved.

Multilingual programs that know what they are talking about

Best practices
Thou shalt not REPLACE ‘.’ with ‘,’ just like that

If you need to adapt the content of a file with amounts, always take into consideration the user settings (USR01-DSCFM).
If you need to convert a string to a number use FM MOVE_CHAR_TO_NUM.
If you need to convert a number to a string use WRITE curr TO str [CURRENCY waers].

Read the texts of a program

An easy way of programmatically accessing the texts of any program:

DATA: t_textos TYPE TABLE OF textpool. 
READ TEXTPOOL sy-repid INTO t_textos 
  LANGUAGE sy-langu STATE 'A’. 

Now, you have all of the texts available in the internal table T_TEXTOS.

As if this were not enough, you can also change the texts programmatically with the following commands:

INSERT TEXTPOOL sy-repid FROM t_textos LANGUAGE sy-langu. 

According to SAP, these last two commands are for internal use only. You can use them, but at your own risk. I’ll have nothing to do with it. Unless they force me otherwise, I’ll stick to “READ” only.

Thanks to Miguel Durão for the tip.

Greetings from Abapinho.

Decimal to alphanumeric without depending on the user

When reading a file with numeric values to an internal table or vice versa, the success of the conversion depends on whether the user has defined the dot or comma as the decimal separator. It is customary to then go and read the user setting and then adjust the values from the file with a dot or a comma as required.

But this is unfortunate and rather inelegant. There should be a way of not making this depend on the user.

And there is.

Ler o resto do artigo! »

Insert variables in standard texts

Everyone uses standard texts. But did you know that standard texts can have dynamic fields in the middle? SAP calls them “text symbols”. The way to do it is identical to that of the old forms of the harmful SE71, in other words wrapping them in the & symbol. Thus: &KNA1-NAME1&. It’s really handy. I’ll show you how it’s done.

Ler o resto do artigo! »

Automating the ALV field catalogue

Sometimes I ask myself what percentage of the world’s ABAP code is unnecessary. A paradigmatic example of how time can be wasted writing code which is of no use to anyone and only creates problems is the ALV’s all-too-common field description definition sitting directly in ABAP.

Ler o resto do artigo! »

Multilingual programs that know what they are talking about

SAP is multilingual. But ABAP not always. ABAP does have some ability to learn and speak a few languages, but sometimes the programmers do not let it.

A lot of programmers whack literal texts directly into the program, leaving it forever unable to communicate in multiple languages. I can think of two reasons for shackling a program to just one language:

  • Laziness, the main reason for doing things badly;
  • Legibility. In fact the way to make an ABAP program localizable is to pack it full of text references, like TEXT-001, which can get a bit illegible.

So here is a tip to get the best of both worlds: a localizable program that does not lose legibility:

Instead of being lazy and doing this:

WRITE: 'I want to see the aurora borealis'.

And instead of being obscure and doing this:


Be smart and do this:

WRITE: 'I want to see the aurora borealis'(001).


If the text TEXT-001 is defined in the language in which the program is running, this TEXT-001 will be used. Otherwise, the literal text written directly in the program will be used. Thus the code’s legibility is retained, the texts can be translated freely, AND we can be sure that where some text is untranslated, the text stored in the program will appear.

Thanks to Sérgio Lopes for the tip.
(And thanks to doug88888 for the photo.)

Greetings from Abapinho.

(Português) Transacção I18N = Internacionalização

Sorry, this entry is only available in European Portuguese. For the sake of viewer convenience, the content is shown below in the alternative language. You may click the link to switch the active language.

Os americanos são tão bons como os tibetanos a arranjar mnemónicas e abreviaturas para tornar as coisas fáceis de decorar.

Internationalization é uma palavra inglesa com 20 letras. Então, a abreviatura adoptada foi I18N, constituida pela primeira e última letras entremeadas por um 18 que representa as 18 letras do meio. Meio maluco mas giro e a verdade é que pegou.

Pegou tanto que o SAP tem uma transacção chamada I18N. E é lá que se pode encontrar tudo relacionado com internacionalização, codepages, línguas, tradução, etc.

Aproveitando o assunto da dica dou a conhecer a classe CL_I18N_LANGUAGES que tem uma série de métodos para conversão entre os vários códigos de língua. Entre o código SAP e o código ISO 639-1 por exemplo.

O Abapinho saúda-vos.

About Abapinho
Abapinho runs on WordPress
Articles (RSS) e Comments (RSS).