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: 

finding text symbols

Former Member
0 Kudos
191

hi,

In a given code i want the o/p as a list of all the text symbols used .

Also what is the range of text symbols which can be assigned to any nos of literals in given pgm.

Thanks.

2 REPLIES 2

Former Member
0 Kudos
71

Hi,

You can search for the char <fs> or just < > you will know where they are used in the program.

go through the doc.

Syntax

FIELD-SYMBOLS <fs> { typing | STRUCTURE struc DEFAULT dobj }.

Extras:

1. ... typing

2. ... STRUCTURE struc DEFAULT dobj

Effect

The FIELD-SYMBOLS statement declares a field symbol <fs>. The naming conventions apply to the name fs. The angle brackets of the field symbols indicate the difference to data objects and are obligatory. You can declare field symbols in any procedure and in the global declaration section of an ABAP program, but not in the declaration section of a class or an interface. You can use a field symbol in any operand position in which it is visible and which match the typing defined using typing.

After its declaration, a field symbol is initial - that is, it does not reference a memory area. You have to assign a memory area to it (normally using the ASSIGN statement) before you can use it as an operand. Otherwise an exception will be triggered.

Addition 1

... typing

Effect

You can use the addition typing to type the field symbol. The syntax of typing is described under Syntax of Typing. The typing specifies which memory areas can be assigned to the field symbol (see Checking the Typing) and in which operand positions it can be used.

Note

You can omit the addition typing outside of methods. In this case, the field symbol has the complete generic type any and is implicitly assigned the predefined constant space during the declaration.

Addition 2

... STRUCTURE struc DEFAULT dobj

Effect

If you specify the addition STRUCTURE instead of typing for a field symbol, and struc is a local program structure (a data object, not a data type) or a flat structure from the ABAP Dictionary, this structure is cast for the field symbol <fs>. You have to specify a data object dobj that is initially assigned to the field symbol.

The field symbol copies the technical attributes of structure struc as if it were completely typed. When you assign a data object using the addition DEFAULT, or later using ASSIGN, its complete data type is not checked in non- Unicode programs. Instead, the system merely checks whether it has at least the length of the structure and its alignment.

In Unicode programs, we differentiate between structured and elementary data objects. For a structured data object dobj, its Unicode fragment view has to match the one of struc. In the case of an elementary data object, the object must be character-type and flat, and struc must be purely character-type. The same applies to assignments of data objects to field symbols typed using STRUCTURE when using the ASSIGN statement.

Note

Field symbols declared using the addition STRUCTURE are a mixture of typed field symbols and a utility for casting structured data types. You should use the additions TYPE or LIKE for the FIELD-SYMBOLS statement to type field symbols, while the addition CASTING of the ASSIGN statement is used for casting.

Example

The first example shows the obsolete usage of the addition STRUCTURE.

DATA wa1 TYPE c LENGTH 512.

FIELD-SYMBOLS <scarr1> STRUCTURE scarr DEFAULT wa1.

<scarr1>-carrid = '...'.

The second example shows the replacement of STRUCTURE with the additions TYPE and CASTING.

DATA wa2 TYPE c LENGTH 512.

FIELD-SYMBOLS <scarr2> TYPE scarr.

ASSIGN wa2 TO <scarr2> CASTING.

<scarr2>-carrid = '...'.

reward if useful

regards,

ANJI

Former Member
0 Kudos
71

Hi..

first get all the code into an internal table using...

READ REPORT <prog> INTO itab.

describe table itab lines w_num.

now let us assume that the text symbols were written as ..text-001...

do w_num times.

SEARCH itab FOR 'text-' AND MARK.

WRITE: / '''Text symbol'' found at line', (1) sy-tabix,

'with offset', (1) sy-fdpos.

SKIP.

READ TABLE itab INTO wa INDEX sy-tabix.

WRITE: / line-index, line-text.

enddo.

try this code....

DELETE itab INDEX sy-tabix.