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: 

About Field Symbols

former_member532868
Participant
0 Kudos

Hi Experts,

In standard program used fieldsymbols.

example

loop at <f> into <h>.

i need to put conditions here only like as

IF <h>-lgart = '9M10'.

I moove to some value.Please send me to solution as early as possible.very urgent requirement.

ENDIF.

endloop.

9 REPLIES 9

Former Member
0 Kudos

You need to assign component LGART of <h> to a temporary field and then use that field in yuo IF condition. Check the help on Field Symbols and Assign for more information.

Gareth.

0 Kudos

can you please send with one example because i dontknow about field symbols. still i havnt use field-symbols.

0 Kudos

Then press F1 on your keyboard and read the help - if that doesn't sort your problem then SEARCH these forums as there are loads of questions about field-symbols.

Former Member
0 Kudos

Hi,

Check these :

&----


*& Using Field Symbols for components of a structure

&----


REPORT CHAP2403.

  • Table work area for later use

TABLES CUSTOMERS.

  • Defining a Field Symbol

FIELD-SYMBOLS <OUTPUT>.

  • Displaying all fields of all table entries

SELECT * FROM CUSTOMERS.

NEW-LINE.

DO.

ASSIGN COMPONENT SY-INDEX OF STRUCTURE CUSTOMERS TO <OUTPUT>.

IF SY-SUBRC <> 0.

EXIT.

ENDIF.

WRITE <OUTPUT>.

ENDDO.

ENDSELECT.

&----


*& Using Field Symbols for variable parts of fields

&----


REPORT CHAP2402.

DATA: EXTERNAL_RECORD(4000),

POSITION TYPE I,

LENGTH TYPE N.

FIELD-SYMBOLS <ENTRY>.

EXTERNAL_RECORD = '0005Smith0007Edwards0005Young'.

DO.

LENGTH = EXTERNAL_RECORD+POSITION(4).

IF LENGTH = 0.

EXIT.

ENDIF.

ADD 4 TO POSITION.

ASSIGN EXTERNAL_RECORD+POSITION(LENGTH) TO <ENTRY>.

WRITE <ENTRY>.

ADD LENGTH TO POSITION.

IF POSITION >= 4000.

EXIT.

ENDIF.

ENDDO.

Thanks,

Keerthi

0 Kudos

HI Experts,

by using field symbols actual requirement is

FIELD-SYMBOLS: <fs_itab> TYPE ANY TABLE,

<fs_wa> TYPE ANY,

<fs_field> TYPE ANY.

actually my requirement is

read table <f> with key lgart = '9M10'.

if sy-subrc = 0.

<f>-lgart = '/414'.

<f>-betrg = <f>-betrg.

append <f>.

endif.

this is very urgent requirement.

0 Kudos

Hi,

You've been given lots of information here on how to work with field-symbols, there are lots and lots and lots of other questions about them on SDN if you bother to search, there is information in the help with examples.

Other than someone actually supplying the exact code for you, what more do you want?! Why not try to figure it out using the information you've been given and try to write the code yourself? That way you will learn all about field symbols and be able to use them no problem in the future.

Gareth.

Former Member
0 Kudos

Hello Harihara

use like this :

loop at <f> into <h> where 'FIELD1' = 'whatever'.

endloop.

Bye

Former Member
0 Kudos

Try this below.

FIELD-SYMBOLS: <fs_itab> TYPE ANY TABLE,

<fs_wa> TYPE ANY,

<fs_field> TYPE ANY.

LOOP AT <fs_itab> ASSIGNING <fs_wa>.

ASSIGN COMPONENT 'LGART' OF STRUCTURE <fs_wa> TO <fs_field>.

IF SY-SUBRC = 0.

<fs_field> = '9M10'.

ENDIF.

ENDLOOP.

In the above the <fs_field> will have the new value and will be modified the internal table.

Hope it help. <REMOVED BY MODERATOR>

Thanks,

Srinivas

Edited by: Alvaro Tejada Galindo on Jun 9, 2008 3:17 PM

Former Member
0 Kudos

This message was moderated.