‎2007 Feb 05 10:17 AM
hi,
I am fresher. I want sample program(code) for field symbol.
‎2007 Feb 05 10:21 AM
Hi,
Check the following code :
DATA NAME(4) VALUE 'JOHN'.
FIELD-SYMBOLS <F> TYPE ANY.
ASSIGN NAME TO <F>.
WRITE <F>. Erwan
‎2007 Feb 05 10:28 AM
REPORT ZGILL_FS line-size 250
line-count 65 .
data: name like p0002-vorna.
*
parameter pernr like pernr-pernr.
*
field-symbols <fs_name> type any.
*
start-of-selection .
*
assign name to <fs_name>.
*
select single vorna into name from pa0002
where pernr = pernr.
*
write: 'Name: ' ,<fs_name> .
‎2007 Feb 05 10:22 AM
http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/field_sy.htm
TYPES: BEGIN OF line,
col1 TYPE c,
col2 TYPE c,
END OF line.
DATA: wa TYPE line,
itab TYPE HASHED TABLE OF line WITH UNIQUE KEY col1,
key(4) TYPE c VALUE 'COL1'.
FIELD-SYMBOLS <fs> TYPE ANY TABLE.
ASSIGN itab TO <fs>.
READ TABLE <fs> WITH TABLE KEY (key) = 'X' INTO wa.The internal table ITAB is assigned to the generic field symbol <FS>, after which it is possible to address the table key of the field symbol dynamically. However, the static address
READ TABLE <fs> WITH TABLE KEY col1 = 'X' INTO wa.
is not possible syntactically, since the field symbol does not adopt the key of table ITAB until runtime. In the program, the type specification ANY TABLE only indicates that <FS> is a table. If the type had been ANY (or no type had been specified at all), even the specific internal table statement READ TABLE <FS> would not have been possible.
http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb387a358411d1829f0000e829fbfe/content.htm
http://help.sap.com/saphelp_nw2004s/helpdata/en/fc/eb387a358411d1829f0000e829fbfe/content.htm
‎2007 Feb 05 10:24 AM
Hi Poonam,
Please check the below code:
field-symbols: <mgv_poitemx> type bapimepoitemx.
loop at poitemx assigning <mgv_poitemx>
where not ( material_external is initial and
material_version is initial and
material_guid is initial ).
<mgv_poitemx>-material = 'X'.
endloop.
loop at poitemx assigning <mgv_poitemx>
where not ( ematerial_external is initial and
ematerial_version is initial and
ematerial_guid is initial ).
<mgv_poitemx>-ematerial = 'X'.
endloop.
Regards
Kannaiah
‎2007 Feb 05 10:45 AM
HI,
REPORT demo_field_symbols_type.
DATA: BEGIN OF line,
col1(1) TYPE c,
col2(1) TYPE c VALUE 'X',
END OF line.
FIELD-SYMBOLS <fs> LIKE line.
ASSIGN line TO <fs>.
MOVE <fs>-col2 TO <fs>-col1.
Thanks,
Shankar