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: 

using text symbols

former_member474221
Participant
0 Kudos

Hi

Wanted to use text symbols in my report and was planning to use as under -

write : text-000.

However i came across some other reports where they are using the below way -

write : ' stock order status' ( xyz )

what is the advantage of doing it this way  over text-xyz

11 REPLIES 11

Former Member
0 Kudos

Using text symbols allows you to use translations as you wish (and as you define).

The second system, uses message class, in which you can define certain messages and call them either with the string (like you did) or with the serial number of that message (like write 000(xyz)).

HOWEVER, the second method is usually used for information or error messages. In order to print something to the screen, text symbols are usually used.

matt
Active Contributor
0 Kudos

Not correct. The second method is also a way of expressing text symbols. The advantage is that you can get some sense of the text without having to go to text-element maintenance.

rosenberg_eitan
Active Contributor
0 Kudos

Hi,

Look like different usage.

Regards.

From sap help:

http://help.sap.com/saphelp_nw04/helpdata/EN/1e/401ad6ee3c11d1951d0000e8353423/content.htm

You can also address text symbols as follows:

... '<textliteral>'(<idt>) ...

If  the text symbol <idt> exists in the text pool for the logon  language, this is the same as using TEXT-<idt>. Otherwise, the  literal '<textliteral>' is used as the contents of the text  symbol.  This is only possible at positions in the program where a  variable can occur.  You can create a text symbol for any text literal  by double-clicking the literal in the ABAP Editor and replacing the  literal with the text symbol.

You should use text symbols in your program whenever they need to be language-specific - for example, in a WRITE statement.

If  you program a list whose layout depends on field lengths, you should be  careful,  since the field length of text symbols will be different in  different languages.  You should therefore set the maximum field length  of the field symbol so that there is enough space to translate it into  other languages.  For example, the English word 'program' has seven  letters, but its equivalent German translation 'Programm' has eight.

Example

The following example shows the use of text symbols in WRITE statements.

SET BLANK LINES ON.

WRITE:   text-010,
       / text-aaa,
       / text-020,
       / 'Default Text 030'(030),
       / 'Default Text 040'(040).

If the text symbols of the above screen shots are linked to this program, the output looks as follows:

This graphic is explained in the accompanying text

Text  symbols 020 and 040 have no text symbols. For text symbol 020, the  system displays a space.  This is only displayed in this case because  the blank line suppression has been turned off (see Creating Blank Lines). For text symbol 040, the literal specified in the program code is displayed.

arindam_m
Active Contributor
0 Kudos

Hi,

It does the same thing. But the following is recommended more due to translation reasons. Its easier when its like this. 

write : text-000.

Also extended checks i think will show the following as issues to be resolved

write : ' stock order status' ( xyz )

Cheers,

Arindam

matt
Active Contributor
0 Kudos

I entirely disagree.

write : ' stock order status' ( xyz )

is equivalent to:

* Stock order status

write : text-000.

But - the first doesn't need to be kept in sync. The "compare" option in text element maintenance will update it. And it doesn't show up in "extended checks".

You should use "write : ' stock order status' ( xyz )" where-ever possible. In my projects, to use text-nnn without a very good reason is a review fail.

arindam_m
Active Contributor
0 Kudos

Yup your right sir..

former_member209120
Active Contributor
0 Kudos

Hi Hema S

See this links

http://help.sap.com/saphelp_nw04/helpdata/en/e3/960a0eeb0711d194d100a0c94260a5/content.htm

http://help.sap.com/saphelp_nw73/helpdata/en/e3/960a14eb0711d194d100a0c94260a5/content.htm

Analyzing Text Symbols

Use

When you enter text symbols in the source code of your program, they are not automatically included in the text pool. The analyzing function allows you to:

● Delete obsolete text symbols from the text pool

● Adopt new text symbols in the text pool

● Maintain text symbols that are used in the program but not yet included in the text pool

● Compare text symbols with the program code

Prerequisites

No text symbols have yet been maintained in the following program:

PROGRAM TEXT_ELEMENTS_4.

WRITE: TEXT-010,

/'Default Text'(020),

/TEXT-030.

Procedure

1. In the Object Navigator (transaction SE80), open the program you want to edit.

2. In menu bar, choose Goto Text Elements Text Symbols.

The ABAP Text Elements screen appears.

3. In the application toolbar, choose  with the quick info text Compare Text Symbols.

The ABAP Text Symbol Analysis (Display) screen appears. If the list of text symbols is empty, the option Text symbols that need to be added to the text pool is selected by default.

4. Choose the Edit pushbutton.

5. Select the text symbols you want to include in the text pool.

6. In the application toolbar, choose Insert text symbol.

The selected text symbols are marked for transfer into the text pool.

7. To review the changes, choose the Log pushbutton.

8. You can adopt the changes by choosing Enter, or cancel them by choosing Undo

Result

If you choose Enter in the example, the system inserts the text symbols 010, 020, and 030 in the text pool. No texts are assigned to symbols 010 or 030 but the text literal defined in the program is assigned to symbol 020.

Other Functions

You can slightly change the above program to use other analysis functions.

PROGRAM TEXT_ELEMENTS_4.

WRITE: TEXT-010,

/'Default Text'(020),

/'Test_Symbol'(030).

Comparing Text Symbols with the Source Code

You can compare texts that are defined differently in the program and in the text pool as follows:

1. On the ABAP Text Symbol Analysis (Display) screen, select the Text symbols defined repeatedly/differently in program radio button.

2. Choose Edit.

You can replace the empty text from text symbol 030 in the text pool with the program text "test_symbol". The third column indicates whether the text is defined in the text pool (T) or in the program (P).

3. Choose Replace.

4. Save your entries.

Deleting Text Symbols from the Text Pool

Before deleting a text symbol, check the where-used list.

1. On the ABAP Text Symbol Analysis (Display) screen, select the option Text symbols which can be deleted from the text pool.

2. Choose Edit.

If text symbol 020 is no longer needed in the program, you can delete it.

3. Choose Delete.

0 Kudos

Hi hema s,

After you are done with writting and executing your report successfully you can still go for extended check to  to perform static checks, which are too time consuming for the normal syntax check. So execute your program faster you can use

write : ' stock order status' ( xyz )

above syntax.

For Extended check Goto "Program->Check->Extended Program Check" . Select all the check button for a full check.

With Regards

D Amarnath.

former_member220538
Active Participant
0 Kudos

This message was moderated.

former_member220538
Active Participant
0 Kudos

Hi Hema,

Text Symbols  used for language specific text in programs.

  'Text'(001)  allows for translation but 'text-001' doesnt.

See this Links

http://scn.sap.com/community/abap/blog/2013/06/28/dont-get-lost-in-translation

http://scn.sap.com/thread/3382356

Regards,

Jeffin

0 Kudos

While

'Text'(001) is to be preferred, text-001 most definitely does allow for translation.