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: 

Simple text elements language handling

Former Member
0 Kudos

<b>Hi All!</b>

My question is simple: Is it possible to read text element value in diffrent than logon language during runtime ?

I'm asking about <b><u>simpler way</u></b> than copying all text elements from program textpool with specified language into local textpool and reading it later with key.

I've tried to change SY-LANGU before reading a text element but it didn't help - values i was receiving were stil in logon language.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hii Tomasz ,

if you want more info on READ_TEXT func module..

Firstly

Standard texts are read using the ‘READ_TEXT’ function module which takes a number of Inputs and returns the texts into an internal table. The main inputs for the FM are Text name, Language, Text ID and Text object and can be located using the following procedure.

Step 1 : Display the desired text with transaction (i.e. ME23)

Step 2 Show long text for a particular text (i.e. Deliver To)

Step 3 Select ‘Header’ from the Goto menu (Goto->Header). The following screen should appear displaying info needed to retrieve text using the ‘READ_TEXT’ function module (Text name, Language, Text ID, Text object)

The following code shows the syntax of the FM 'READ_TEXT'. You pass it the Text Identification Details and it will retrieve the texts into the internal table (IT_TEXTS).

*Internal table to store standard texts

DATA: IT_TEXTS like T_LINE occurs o with header line.

CALL FUNCTION 'READ_TEXT'

EXPORTING

  • CLIENT = SY-MANDT

id = "Text ID

language = "Laguage

name = "Text name

object = "text object

  • ARCHIVE_HANDLE = 0

  • IMPORTING

  • HEADER =

tables

lines = IT_TEXTS "Internal table

  • EXCEPTIONS

  • ID = 1

  • LANGUAGE = 2

  • NAME = 3

  • NOT_FOUND = 4

  • OBJECT = 5

  • REFERENCE_CHECK = 6

  • WRONG_ACCESS_TO_ARCHIVE = 7

  • OTHERS = 8

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Regards

Naresh

10 REPLIES 10

former_member181962
Active Contributor
0 Kudos

Try using the Function MOdule <b>read_text</b> by passing whichever language you want to the language key parameter

0 Kudos

Hi !

Is it some kind of "bult-in" function or you're telling me to create my own function module which would return a text element value getting as a parameters report id and destination language?

If it's about creating a function module - I thought about it earlier but i'm looking for something simpler !

0 Kudos

Hi Tomasz,

If you are talking about the report text elements that you create, then there is a existing function module:

WB2B_GET_REPORT_TEXTELEMENT

YOu have to pass the Program ID(Report name) and the language) to get the entries.

Regards,

Ravi

Former Member
0 Kudos

Hii

Hii

use read_text functuion module

*Internal table to store standard texts

DATA: IT_TEXTS like T_LINE occurs o with header line.

<b>CALL FUNCTION 'READ_TEXT'</b>     

EXPORTING
*         CLIENT                  = SY-MANDT
          id                      =       "Text ID
          <b>language                =       "Laguage</b>        
           name                    =       "Text name
          object                  =       "text object
*         ARCHIVE_HANDLE          = 0
*    IMPORTING
*         HEADER                  =
     tables
          lines                   = IT_TEXTS   "Internal table
*    EXCEPTIONS
*         ID                      = 1
*         LANGUAGE                = 2
*         NAME                    = 3
*         NOT_FOUND               = 4
*         OBJECT                  = 5
*         REFERENCE_CHECK         = 6
*         WRONG_ACCESS_TO_ARCHIVE = 7
*         OTHERS                  = 8
          .
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

other wise...if its in the script you can change it by using

<b>/: SET COUNTRY <COUNTRY KEY></b>

Reward points if helpful

Regards

Naresh

Former Member
0 Kudos

hi

try this FM

<b>READ_FORM_ELEMENTS</b>

Former Member
0 Kudos

hi tomasz,

CALL FUNCTION 'READ_TEXT'

EXPORTING

  • CLIENT = SY-MANDT

ID = WK_ID

LANGUAGE = 'en'

NAME = WK_NAME

OBJECT = WK_OBJECT

  • ARCHIVE_HANDLE = 0

  • LOCAL_CAT = ' '

IMPORTING

HEADER = THEAD

TABLES

LINES = ITAB_TXT EXCEPTIONS

ID = 1

LANGUAGE = 2

NAME = 3

NOT_FOUND = 4

OBJECT = 5

REFERENCE_CHECK = 6

WRONG_ACCESS_TO_ARCHIVE = 7

OTHERS = 8.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

HOPE THIS HELPS,

PRIYA.

Clemenss
Active Contributor
0 Kudos

Hi,

READ TEXTPOOL abap statement. See online documentation for details.

Regards,

Clemens

Former Member
0 Kudos

To Clemens Li !!

Man !! Read the question before answering them !!!!

To helpful people !!

I forgot to add that i'm fresh at ABAP (my second week) and please - be a bit more specific. If Yor're sugest using some function - tell me if it nescessary to add some includes or how to call it.

Excuse me for being so newbie !!

Clemenss
Active Contributor
0 Kudos

Hi Thomas,

sorry I did not know you are new to ABAP. After having read the answer with the function module 'READ_TEXT' I knew that this is definitely not useful at all.

If you need text element values in other than logon language there is definetly no better was than reading the whole textpool in the language you want because the textes are stored in the database in a way they can not be read separately. At report load time, all text elements are loaded in logon language. Text elements not existing in logon language will be retrieved either from program source language or system-defined fallback language. Make sure your text elements exist in the languages you need (Abap-editor: Goto translation).

You will definitely not need any function or include.

READ TEXTPOOL sy-repid INTO t-text LANGUAGE [language].

will retrieve all text-elements specified for the actual report in the specified language. Do this once per required language. Read the table to get the text element's value.

Man!! There is no simpler way than this.

Regards,

Clemens

Former Member
0 Kudos

Hii Tomasz ,

if you want more info on READ_TEXT func module..

Firstly

Standard texts are read using the ‘READ_TEXT’ function module which takes a number of Inputs and returns the texts into an internal table. The main inputs for the FM are Text name, Language, Text ID and Text object and can be located using the following procedure.

Step 1 : Display the desired text with transaction (i.e. ME23)

Step 2 Show long text for a particular text (i.e. Deliver To)

Step 3 Select ‘Header’ from the Goto menu (Goto->Header). The following screen should appear displaying info needed to retrieve text using the ‘READ_TEXT’ function module (Text name, Language, Text ID, Text object)

The following code shows the syntax of the FM 'READ_TEXT'. You pass it the Text Identification Details and it will retrieve the texts into the internal table (IT_TEXTS).

*Internal table to store standard texts

DATA: IT_TEXTS like T_LINE occurs o with header line.

CALL FUNCTION 'READ_TEXT'

EXPORTING

  • CLIENT = SY-MANDT

id = "Text ID

language = "Laguage

name = "Text name

object = "text object

  • ARCHIVE_HANDLE = 0

  • IMPORTING

  • HEADER =

tables

lines = IT_TEXTS "Internal table

  • EXCEPTIONS

  • ID = 1

  • LANGUAGE = 2

  • NAME = 3

  • NOT_FOUND = 4

  • OBJECT = 5

  • REFERENCE_CHECK = 6

  • WRONG_ACCESS_TO_ARCHIVE = 7

  • OTHERS = 8

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Regards

Naresh