05-05-2009 8:15 AM
Hi,
Please give me the example of Field symbols
how Field symbols are assigned and how they are processed with in a loop.
with small code explain using (using two tables mara,marc) tables.
Thanks in advance
Regards,
rakesh
Moderator message - Welcome to SCN.
Moderator message - Unfortunately, this is not the place to ask basic questions. Please ask a specific question - post locked
Edited by: Rob Burbank on May 5, 2009 4:39 PM
05-05-2009 9:31 AM
HI,
You can use Field Symbols for working with internal tables. It is a good practice to use field symbols.
These are the links about general theory behind field symbols, data references and for using field symbols for internal table operations::
[http://help.sap.com/saphelp_46c/helpdata/en/fc/eb3860358411d1829f0000e829fbfe/frameset.htm]
[http://help.sap.com/saphelp_46c/helpdata/en/fc/eb3860358411d1829f0000e829fbfe/frameset.htm]
Hope this will solve your problem.
Thanks & Regards,
Pavan.
05-05-2009 10:53 AM
Hi,
Field symbols are nothing but dynamic memory allocations. so we need to assign field symbols. If we are using field symbols which are not assigned then program will go to dump. we should be very careful while using field symbols. Please go through the following code which will help you in understanding about field symbols
if <fs> is assigned.
unassign <fs>.
endif.
loop at it_marc assigning <fs>.
check <fs> is assigned.
move <fs> to wa_marc.
append wa_marc to it_marc.
clear wa_marc.
endloop.
05-05-2009 3:42 PM
Hi,
Have a look at it.
http://help.sap.com/saphelp_46c/helpdata/en/fc/eb3860358411d1829f0000e829fbfe/frameset.htm
hope it helps.
Preet
05-05-2009 9:27 PM
Hi,
Field symbols are something like pointers which point to the contents of the field/internal table.
Syntax to declare:
FIELD-SYMBOLS <FS> type STRUCTURE .
Assigning field symbol to some field:
ASSIGN var1 TO <fs>.
Changes to field symbol will affect the contents of the field/internal table directly.
For further info:
http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb387a358411d1829f0000e829fbfe/content.htm
You can find the examples on field symbols in TCODE: ABAPDOCU.
under the ABAP Programming Lanuage->Basic Statements.
Thanks & Regards,
Krishna Chaitanya G
Edited by: Krishna Chaitanya G on May 5, 2009 10:27 PM
Edited by: Krishna Chaitanya G on May 5, 2009 10:28 PM
Edited by: Krishna Chaitanya G on May 5, 2009 10:29 PM