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

Generate text dinamically - several languages

Former Member
0 Likes
484

Hi Guys , I have the following question, my client has a program that create programs dinamically,it means a program number 1 that generate other programs number 'X' everytime you run program number 1 , like any other program this program number 'X' has errors, warning , etc messages to inform the user during the flow, my problem is I have to work in several languages , so I can´t hardcode the text in the program, I cant use text elements in program number 1 like 'text-001' to generate program number 'X' because the text elements in the new program will be created again.

have you ever face something like that before. do you have any suggestion ?

Hi Guys , I have the following question, my client has a program that create programs dinamically,it means a program number 1 that generate other programs number 'X' everytime you run program number 1 , like any other program this program number 'X' has errors, warning , etc messages to inform the user during the flow, my problem is I have to work in several languages , so I can´t hardcode the text in the program, I cant use text elements in program number 1 like 'text-001' to generate program number 'X' because the text elements in the new program will be created again.

have you ever face something like that before. do you have any suggestion ?

2 REPLIES 2
Read only

arseni_gallardo
Active Participant
0 Likes
427

I would use the "INSERT TEXTPOOL" statement just after creating the program, once for each language.

Here you have an example


FORM create_textpool.
  DATA: lt_textpool TYPE STANDARD TABLE OF textpool,
        ls_textpool TYPE textpool.

  DEFINE _macro_textpool.
    ls_textpool-id = &1.                                    "#EC NOTEXT
    ls_textpool-key = &2.                                   "#EC NOTEXT
    ls_textpool-entry = &3.                                 "#EC NOTEXT
    ls_textpool-length = strlen( &3 ).
    append ls_textpool to lt_textpool.
  END-OF-DEFINITION.
  READ TEXTPOOL sy-cprog INTO lt_textpool LANGUAGE sy-langu.
  IF lt_textpool IS INITIAL.
    _macro_textpool: 'I' '001'      'Exportar/Importar orden de transporte', "#EC NOTEXT
                     'I' '002'      'Download',             "#EC NOTEXT
                     'I' '003'      '   Error:',            "#EC NOTEXT
                     'I' '004'      'Ok',                   "#EC NOTEXT
                     'I' '005'      'Error: nombre demasiado largo', "#EC NOTEXT
                     'I' '006'      'Upload',               "#EC NOTEXT
                     'I' '007'      'Adding',               "#EC NOTEXT
                     'I' '008'      'to transport queue:',  "#EC NOTEXT
                     'R' ''         'Exportar/Importar orden de transporte', "#EC NOTEXT
                     'S' 'P_EXPORT' '        Exportar',     "#EC NOTEXT
                     'S' 'P_IMPORT' '        Importar',     "#EC NOTEXT
                     'S' 'P_IMPADD' '        Importar y añadir a cola', "#EC NOTEXT
                     'S' 'P_LOCCOF' '        Fichero cofile local', "#EC NOTEXT
                     'S' 'P_LOCDAT' '        Fichero data local', "#EC NOTEXT
                     'S' 'P_LOCDIR' '        Directorio local', "#EC NOTEXT
                     'S' 'P_TRCOFI' '        Fichero cofile remoto', "#EC NOTEXT
                     'S' 'P_TRDATA' '        Fichero data remoto', "#EC NOTEXT
                     'S' 'P_TRDIR'  '        Directorio de transportes', "#EC NOTEXT
                     'S' 'P_XEDIT'  '        Editar rutas', "#EC NOTEXT
                     'S' 'P_TRKORR' 'D       .' .           "#EC NOTEXT
    INSERT TEXTPOOL sy-cprog FROM lt_textpool LANGUAGE sy-langu.
    MESSAGE 'Textos de programa creados. Vuelva ejecutar' TYPE 'I'.
    LEAVE PROGRAM.
  ENDIF.
ENDFORM.                    "create_Text_pool

Edited by: Arseni Gallardo on Mar 6, 2012 5:04 PM

Read only

janisar_munshi
Participant
0 Likes
427

HI,

The best practice is to maintain a message class in SE91 and use these messages to display messages. Here you can also maintain the translations in different language. based on the log in language you can show messages.

Hope this helps,

Janisar

Edited by: janisar.munshi on Mar 7, 2012 4:49 PM