Home ABAP Tutorials Dynamic Programming Programming using Field symbols
Programming using Field symbols PDF Print E-mail
User Rating: / 2
PoorBest 
ABAP Tutorials - Dynamic Programming
Written by Varun Verma   
Monday, 18 August 2008 18:11

Programming using the field symbols is quiet easy. Once the field symbol is assigned correctly, it can be used just like any other variable in ABAP program. Below are shown some simple field symbol usages in different scenarios.

Loop on internal tables using field symbols:

DATA : <fs_wa> TYPE ANY.

LOOP AT itab ASSIGNING <fs_wa>.

** Do Processing **

ENDLOOP.

Read on internal tables using field symbols:

READ TABLE itab ASSIGNING <fs_wa> INDEX i.

Important Note: Remember - that field symbols point to the memory area. So this could be used to modify contents of internal tables while looping on them without actually writing a modify statement. Isn't that cool.. So how does it work ?

When we loop or read a internal table assigning the field symbol, the field symbol points to the memory area that contains the data in work area. So once you modify any field using field symbol like this : <fs_wa>-field_1 = value_1 the contents of the internal tables are modified instantaneously. This is because we have updated the memory directly. So in this case we need not write the explicit MODIFY statement.

Thus it is fast (in terms of performance)  and the code also looks quiet elegant.

Comments
Add New Search
Write comment
Name:
Email:
 
Title:
UBBCode:
[b] [i] [u] [url] [quote] [code] [img] 
 
 
:angry::0:confused::cheer:B):evil::silly::dry::lol::kiss::D:pinch:
:(:shock::X:side::):P:unsure::woohoo::huh::whistle:;):s
:!::?::idea::arrow:
 
Please input the anti-spam code that you can read in the image.

3.26 Copyright (C) 2008 Compojoom.com / Copyright (C) 2007 Alain Georgette / Copyright (C) 2006 Frantisek Hliva. All rights reserved."

 

Advertisement

 

Google Search

Advertisement