Query about field symbol
Hi,
Can we write a query like this using field symbol.
<FS> is a field symbol mapped onto an internal table.
select * from dbtab into corresponding field of internal_tab for all entries in <FS>
where field1 = <FS>-field1.
It gives a syntax error when I check this query. Even if I turn field1 into a field symbol <FS1> to hold the field name, it gives an error.
Could anyone advice in this context.
Thanks for the help in advance.
Regards,
Vijay
Vijay,
Its not a limitation.
You would have declared your table like this, right?
FIELD-SYMBOLS : <FT> TYPE TABLE.
Now, unless you assign this to table, the field symbols will not have a structure, right. This assignment happens only at runtime. So, there is no way that the system can identify <FT>-field1 at design time and compile the same, right?
However, the question is if you know the structure at design time, why do you want to use a field symbols for the table?
Regards,
Ravi
Note : Please mark the helpful answers
Similar Messages
-
Can any one explain me about Field symbols in Genral Reports?
Can any one explain me about Field symbols in Genral Reports?
If possible, plz explain me with the code to explain me about the field symbols.
Regards,
Krishna ChaitanyaSyntax
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 = '...'.
Also,
Field Symbols
Field symbols are placeholders or symbolic names for other fields. They do not physically reserve space for a field, but point to its contents. A field symbol cam point to any data object. The data object to which a field symbol points is assigned to it after it has been declared in the program.
Whenever you address a field symbol in a program, you are addressing the field that is assigned to the field symbol. After successful assignment, there is no difference in ABAP whether you reference the field symbol or the field itself. You must assign a field to each field symbol before you can address the latter in programs.
Field symbols are similar to dereferenced pointers in C (that is, pointers to which the content operator * is applied). However, the only real equivalent of pointers in ABAP, that is, variables that contain a memory address (reference) and that can be used without the contents operator, are reference variables in ABAP Objects.
All operations programmed with field symbols are applied to the field assigned to it. For example, a MOVE statement between two field symbols moves the contents of the field assigned to the first field symbol to the field assigned to the second field symbol. The field symbols themselves point to the same fields after the MOVE statement as they did before.
You can create field symbols either without or with type specifications. If you do not specify a type, the field symbol inherits all of the technical attributes of the field assigned to it. If you do specify a type, the system checks the compatibility of the field symbol and the field you are assigning to it during the ASSIGN statement.
Field symbols provide greater flexibility when you address data objects:
If you want to process sections of fields, you can specify the offset and length of the field dynamically.
You can assign one field symbol to another, which allows you to address parts of fields.
Assignments to field symbols may extend beyond field boundaries. This allows you to address regular sequences of fields in memory efficiently.
You can also force a field symbol to take different technical attributes from those of the field assigned to it.
The flexibility of field symbols provides elegant solutions to certain problems. On the other hand, it does mean that errors can easily occur. Since fields are not assigned to field symbols until runtime, the effectiveness of syntax and security checks is very limited for operations involving field symbols. This can lead to runtime errors or incorrect data assignments.
While runtime errors indicate an obvious problem, incorrect data assignments are dangerous because they can be very difficult to detect. For this reason, you should only use field symbols if you cannot achieve the same result using other ABAP statements.
For example, you may want to process part of a string where the offset and length depend on the contents of the field. You could use field symbols in this case. However, since the MOVE statement also supports variable offset and length specifications, you should use it instead. The MOVE statement (with your own auxiliary variables if required) is much safer than using field symbols, since it cannot address memory beyond the boundary of a field. However, field symbols may improve performance in some cases.
check the below links u will get the answers for your questions
http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3860358411d1829f0000e829fbfe/content.htm
http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/field_sy.htm
http://searchsap.techtarget.com/tip/1,289483,sid21_gci920484,00.html
Syntax Diagram
FIELD-SYMBOLS
Basic form
FIELD-SYMBOLS <fs>.
Extras:
1. ... TYPE type
2. ... TYPE REF TO cif
3. ... TYPE REF TO DATA
4. ... TYPE LINE OF type
5. ... LIKE s
6. ... LIKE LINE OF s
7. ... TYPE tabkind
8. ... STRUCTURE s DEFAULT wa
The syntax check performed in an ABAP Objects context is stricter than in other ABAP areas. See Cannot Use Untyped Field Symbols ad Cannot Use Field Symbols as Components of Classes.
Effect
This statement declares a symbolic field called <fs>. At runtime, you can assign a concrete field to the field symbol using ASSIGN. All operations performed with the field symbol then directly affect the field assigned to it.
You can only use one of the additions.
Example
Output aircraft type from the table SFLIGHT using a field symbol:
FIELD-SYMBOLS <PT> TYPE ANY.
DATA SFLIGHT_WA TYPE SFLIGHT.
ASSIGN SFLIGHT_WA-PLANETYPE TO <PT>.
WRITE <PT>.
Addition 1
... TYPE type
Addition 2
... TYPE REF TO cif
Addition 3
... TYPE REF TO DATA
Addition 4
... TYPE LINE OF type
Addition 5
... LIKE s
Addition 6
... LIKE LINE OF s
Addition 7
... TYPE tabkind
Effect
You can define the type of the field symbol using additions 2 to 7 (just as you can for FORM parameters (compare Defining the Type of Subroutine Parameters). When you use the ASSIGN statement, the system carries out the same type checks as for USING parameters of FORMs.
This addition is not allowed in an ABAP Objects context. See Cannot Use Obsolete Casting for FIELD SYMBOLS.
In some cases, the syntax rules that apply to Unicode programs are different than those for non-Unicode programs. See Defining Types Using STRUCTURE.
Effect
Assigns any (internal) field string or structure to the field symbol from the ABAP Dictionary (s). All fields of the structure can be addressed by name: <fs>-fieldname. The structured field symbol points initially to the work area wa specified after DEFAULT.
The work area wa must be at least as long as the structure s. If s contains fields of the type I or F, wa should have the structure s or at least begin in that way, since otherwise alignment problems may occur.
Example
Address components of the flight bookings table SBOOK using a field symbol:
DATA SBOOK_WA LIKE SBOOK.
FIELD-SYMBOLS <SB> STRUCTURE SBOOK
DEFAULT SBOOK_WA.
WRITE: <SB>-BOOKID, <SB>-FLDATE.
Related
ASSIGN, DATA
Additional help
Declaring Field Symbols -
Where is error about field-symbols?
I wrote a short program about field-symbols , but when I build it, I had issues with "WA is too short for <F1>." I don't know what is happen.
REPORT ZSKY061901.
data : wa(100) value '0123456789'.
data : begin of line1,
co1(6),
co2(4),
co3(5),
end of line1.
data : begin of line2,
co1 type i value 1,
co2 type i value 2,
end of line2.
data line3 like line2.
data itab like line2 occurs 10 with header line.
line3-co1 = 11.
line3-co2 = 22.
field-symbols:
<F1> structure sbook default wa,
<F2> structure line1 default wa,
<F3> structure itab default line3.
write: / <F1>-mandt,<F1>-carrid,<F1>-connid,<F1>-fldate,
/ <F2>-co1,<F2>-co2,<F2>-co3,
/ <F3>-co1,<F3>-co2.Hi,
field-symbols:
<F1> structure sbook default wa,
<F2> structure line1 default wa,
<F3> structure itab default line3.
Lets take <F1>, here the Structure is SBOOK, so SBOOK will have some fields in it, count the total length of the fields in the SBOOK, it may come around 200 lenght, then the WA length should be 200....
Regards
Sudheer -
Hi All,
Can anyone explain fully about field symbols in ABAP.
please provide with examples how to use in programming.
Thanks in advance.
Naba.Field Symbols
Field symbols are placeholders or symbolic names for other fields. They do not physically reserve space for a field, but point to its contents. A field symbol cam point to any data object. The data object to which a field symbol points is assigned to it after it has been declared in the program.
Whenever you address a field symbol in a program, you are addressing the field that is assigned to the field symbol. After successful assignment, there is no difference in ABAP whether you reference the field symbol or the field itself. You must assign a field to a field symbol before you can address it in a program.
Field symbols are similar to de-referenced pointers in the C programming language (that is, pointers to which the content operator * is applied). In ABAP, data references represent a real equivalent to pointers in the sense of variables that contain a memory address and can be used without the contents operator.
All operations programmed with field symbols are applied to the field assigned to it. A MOVE statement between two field symbols, for example, assigns the contents of the field assigned to another source field symbol to the field assigned to the target field symbol. The field symbols themselves point to the same fields after the MOVE statement as they did before the MOVEstatement.
You can create field symbols either without or with type specifications. If you do not specify a type, the field symbol inherits all of the technical attributes of the field assigned to it. If you do specify a type, the system checks during the field assignment whether the assigned field matches the type of field symbol.
Field symbols provide greater flexibility when you address data objects:
· You can assign one field symbol to another, which allows you to address subfields.
· Assignments to field symbols may extend beyond field boundaries. This allows you to address regular sequences of fields in memory efficiently.
· You can also force a field symbol to take different technical properties than those of the field assigned to it (casting).
The flexibility of field symbols provides elegant solutions to certain problems. On the other hand, it does mean that errors can easily occur. Since fields are not assigned to field symbols until runtime, the effectiveness of syntax and security checks is very limited for operations involving field symbols. This can lead to runtime errors or incorrect data assignments.
While runtime errors indicate an obvious problem, incorrect data assignments are dangerous because they can be very difficult to detect. For this reason, you should only use field symbols if you cannot achieve the same result using other ABAP statements.
For example, you may want to process part of a string where the offset and length depend on the contents of the field. You could use field symbols in this case. The MOVE statement (with your own auxiliary variables, if required) is much safer than using field symbols, since it cannot address memory beyond the boundary of a field. However, field symbols may improve performance in some cases.
*& Chapter 24: Working with Field Symbols
REPORT CHAP2401.
Defining a Field Symbol
FIELD-SYMBOLS .
Variable for later use
DATA FIELD VALUE 'X'.
Assigning a field to a Field Symbol
ASSIGN FIELD TO .
Using a Field Symbol which has an assigned field
WRITE . -
hi experts,
can any one send me the concept of the following topics,
1. FIELD SYMBOLS
2. SUBROUTINES
3. CONDENSE.
please send me some material about this topics with example programs.
thankshi,
<b>FIELD-SYMBOLS</b>
Check the below links
http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3860358411d1829f0000e829fbfe/content.htm
Basic form
FIELD-SYMBOLS <fs>.
Additions
1. ... STRUCTURE s DEFAULT wa
2. ... TYPE t
3. ... TYPE LINE OF t
4. ... LIKE s
5. ... LIKE LINE OF s
Effect
This statement declares a symbolic field called <fs>. At runtime, you can assign a concrete field to the field symbol using ASSIGN . All operations performed with the field symbol then directly affect the field assigned to it.
You can only use one of the additions.
Example
Output aircraft type from the table SFLIGHT using a field symbol:
FIELD-SYMBOLS <PT>.
TABLES SFLIGHT.
ASSIGN SFLIGHT-PLANETYPE TO <PT>.
WRITE <PT>.
Addition 1
... STRUCTURE s DEFAULT wa
Effect
Assigns any (internal) field string or structure to the field symbol from the ABAP/4 Dictionary ( s ). All fields of the structure can be addressed by name: <fs>-fieldname . The structured field symbol points initially to the work area wa specified after DEFAULT .
The work area wa must be at least as long as the structure s . If s contains fields of the type I or F, wa should have the structure s or at least begin in that way, since otherwise alignment problems may occur.
Example
Address components of the flight bookings table SBOOK using a field symbol:
DATA SBOOK_WA LIKE SBOOK.
FIELD-SYMBOLS <SB> STRUCTURE SBOOK
DEFAULT SBOOK_WA.
WRITE: <SB>-BOOKID, <SB>-FLDATE.
Addition 2
... TYPE t
Addition 3
... TYPE LINE OF t
Addition 4
... LIKE s
Addition 5
... LIKE LINE OF s
Effect
You can use additions 2 to 5 to type field symbols in the same way as FORM parameters (see also Type assignment of subroutine parameters). ASSIGN performs the same type checks as with USING parameters of FORM s. .
<b>condense</b>
*Code to demonstrate CONDENSE command
DATA: ld_field(50) type c.
p_field = 'Welcome to SAPDev'.
CONDENSE p_field NO-GAPS. "P_field must be of type character
*Result of p_field would be: 'WelcometoSAPDev'
or
SHIFT ld_field RIGHT DELETING TRAILING SPACE.
SHIFT ld_field LEFT DELETING LEADING SPACE.
DATA: ld_field(50) type c.
P_field type ld_field.
p_field = ' Welcome To SAP '.
ld_field = p_field.
SHIFT ld_field RIGHT DELETING TRAILING SPACE.
SHIFT ld_field LEFT DELETING LEADING SPACE.
write ld_field .
Rgds
Anver -
hi
i know what is a field symbol. but i am confused in which case i should use field symbol.
suppose i am modifying a standard internal table XITAB . then is it a good practice(or neccessary) to use field symbol instead of local work area or local internal table??Hi,
Field Symbols
Field symbols are placeholders or symbolic names for other fields. They do not physically reserve space for a field, but point to its contents. A field symbol cam point to any data object. The data object to which a field symbol points is assigned to it after it has been declared in the program.
Whenever you address a field symbol in a program, you are addressing the field that is assigned to the field symbol. After successful assignment, there is no difference in ABAP whether you reference the field symbol or the field itself. You must assign a field to each field symbol before you can address the latter in programs.
Field symbols are similar to dereferenced pointers in C (that is, pointers to which the content operator * is applied). However, the only real equivalent of pointers in ABAP, that is, variables that contain a memory address (reference) and that can be used without the contents operator, are reference variables in ABAP Objects. (For more information, see Data References).
All operations programmed with field symbols are applied to the field assigned to it. For example, a MOVE statement between two field symbols moves the contents of the field assigned to the first field symbol to the field assigned to the second field symbol. The field symbols themselves point to the same fields after the MOVE statement as they did before.
You can create field symbols either without or with type specifications. If you do not specify a type, the field symbol inherits all of the technical attributes of the field assigned to it. If you do specify a type, the system checks the compatibility of the field symbol and the field you are assigning to it during the ASSIGN statement.
Field symbols provide greater flexibility when you address data objects:
If you want to process sections of fields, you can specify the offset and length of the field dynamically.
You can assign one field symbol to another, which allows you to address parts of fields.
Assignments to field symbols may extend beyond field boundaries. This allows you to address regular sequences of fields in memory efficiently.
You can also force a field symbol to take different technical attributes from those of the field assigned to it.
The flexibility of field symbols provides elegant solutions to certain problems. On the other hand, it does mean that errors can easily occur. Since fields are not assigned to field symbols until runtime, the effectiveness of syntax and security checks is very limited for operations involving field symbols. This can lead to runtime errors or incorrect data assignments.
While runtime errors indicate an obvious problem, incorrect data assignments are dangerous because they can be very difficult to detect. For this reason, you should only use field symbols if you cannot achieve the same result using other ABAP statements.
For example, you may want to process part of a string where the offset and length depend on the contents of the field. You could use field symbols in this case. However, since the MOVE statement also supports variable offset and length specifications, you should use it instead. The MOVE statement (with your own auxiliary variables if required) is much safer than using field symbols, since it cannot address memory beyond the boundary of a field. However, field symbols may improve performance in some cases.
Reward If Helpful
Jagadish. -
Query about field manipulation in forms
Hi,
I have a form printing an invoice having
1) VAT amount (A)
2)Total invoice amount including VAT (B)
I want to add one more field to it, which will also print the amount without VAT (C).
I.e. c = b - a.
how can i do that in the FORM or my print program ? If i create a local variable in the print program and populate it, how do i call that from the FORM ? Please help.
Thanks & Regards
HrishiHere is the program::
*& Report ZTEST_PRG3
report ztest_prg3.
*WRITE: 'This is the Submitted Program'.
data: w_lgort type lgort_d,
w_werks type werks_d.
parameters: p_matnr type matnr obligatory.
select single lgort werks from mard
into (w_lgort, w_werks)
where matnr = p_matnr.
check sy-subrc = 0.
call function 'OPEN_FORM'
exporting
application = 'TX'
device = 'PRINTER'
form = 'ZZTEST_FORM1'
language = sy-langu
* OPTIONS =
* MAIL_SENDER =
* MAIL_RECIPIENT =
* MAIL_APPL_OBJECT =
* RAW_DATA_INTERFACE = '*'
* SPONUMIV =
* IMPORTING
* LANGUAGE =
* NEW_ARCHIVE_PARAMS =
* RESULT =
* EXCEPTIONS
* CANCELED = 1
* DEVICE = 2
* FORM = 3
* OPTIONS = 4
* UNCLOSED = 5
* MAIL_OPTIONS = 6
* ARCHIVE_ERROR = 7
* INVALID_FAX_NUMBER = 8
* MORE_PARAMS_NEEDED_IN_BATCH = 9
* SPOOL_ERROR = 10
* CODEPAGE = 11
* OTHERS = 12
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
call function 'WRITE_FORM'
exporting
element = 'ADDR'
function = 'SET'
type = 'BODY'
window = 'MAIN'
* IMPORTING
* PENDING_LINES =
* EXCEPTIONS
* ELEMENT = 1
* FUNCTION = 2
* TYPE = 3
* UNOPENED = 4
* UNSTARTED = 5
* WINDOW = 6
* BAD_PAGEFORMAT_FOR_PRINT = 7
* SPOOL_ERROR = 8
* CODEPAGE = 9
* OTHERS = 10
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
call function 'CLOSE_FORM'
* IMPORTING
* RESULT =
* RDI_RESULT =
* TABLES
* OTFDATA =
* EXCEPTIONS
* UNOPENED = 1
* BAD_PAGEFORMAT_FOR_PRINT = 2
* SEND_ERROR = 3
* SPOOL_ERROR = 4
* CODEPAGE = 5
* OTHERS = 6
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
*& Form ZTEST_CALC
* text
* -->INTAB text
* -->OUTTAB text
form ztest_calc tables intab structure itcsy
outtab structure itcsy.
data: w_werks type werks_d,
w_lgort type lgort_d,
w_lgobe type lgobe.
** READ THE INTAB.
read table intab with key name = 'W_WERKS'.
if sy-subrc = 0.
w_werks = intab-value.
read table intab with key name = 'W_LGORT'.
if sy-subrc = 0.
w_lgort = intab-value.
select single lgobe from t001l into w_lgobe
where werks = w_werks
and lgort = w_lgort.
if sy-subrc = 0.
outtab-value = w_lgobe.
modify outtab index 1 transporting value.
endif.
endif.
endif.
endform. "ZTEST_CALC
and here is what i wroye inside the Form routine:
DEFINE &W_LGOBE& = &MARD-LGOBE&.
BOX WIDTH '17.5' CM HEIGHT '10' CM FRAME 10 TW INTENSITY 15
PERFORM ZTEST_CALC IN PROGRAM ZTEST_PRG3
USING &W_WERKS&
USING &W_LGORT&
CHANGING &W_LGOBE&
ENDPERFORM.
&W_LGOBE&
Hope That Helps
Anirban M. -
Hi all,
one basic question.
I tried to find it but could not get.
This is is to declare an internal table .
data : lr_ref TYPE REF TO data.
how do we similarly declare a work area?
Regards,
Harshit RungtaHi Harshit,
We can modify them same as we update the static tables.
For eg -
<ls_ecamiopracc_mid>-vkont = lv_account
<ls_ecamiopracc_mid>-xaccexist = lc_x.
Hope this resolves your query.
Regards,
Manish -
Error while trying to run Bex Query -------- Field symbol is not assigned.
Hello Every body,
I am facing the following error after giving some value in Selection screen and trying to run the Bex Query
ERROR : Field symbol is not assigned.
Thanks in advance,
Praveencan u plz give details of variables, what it is build on and the value u r inputing,
also is thr any dump.
double click on the error message it shows u. it will give u the detailed error message. post that too -
Problem using field symbols in Query...
Hi,
I am fetching the name of the table and field which I will be using in the query using field symbols. But it gives syntax error...
select single OBJECTTABLE OBJECTFIELD into help_numtab from Zobjectname
where OBJECTNAME = P_OBJECT.
field-symbols : <number> type any.
field-symbols : <module> type any.
ASSIGN help_numtab-OBjectfield to <number>.
ASSIGN help_numtab-OBjecttable to <module>.
/* Here <number> = MATNR and <module> = MARA.
select <NUMBER> into table help_item
from <MODULE>
where ERNAM = SY-UNAME.
This gives a syntax error which says <module> is not defined in ABAP DDIC.instead of field symbols, you ccan try this..
select (help_numtab-OBjectfield) into table help_item
from (help_numtab-OBjecttable)
where ERNAM = SY-UNAME.
~Suresh -
Hi all,
I want to declare a field symbol <fs> in a class, & to use it in different methods of the same class.
But in attributes of the class, how i declare field symbol in a class.
I m not able to do this...
<b>Pleas assist me..& have ur points.</b>
Regards,
pradeep phogatPradeep,
See this thread. It gives details about field symbol used in a standard class. This should give you some idea.
Re: Field Symbol
ashish -
Field Symbols - two explanations.
Hi,
Reading the documentation about field symbols, I find two explanations where I want to get to the bottom of it. More exactly:
1) During the assignment of field symbols which have a structure imposed (definition with structure), the system checks in non-Unicode programs whether the assigned data object has the same length.
2) (syntax) ASSIGN mem_area TO casting_spec range_spec.
The assigned memory area mem_area must be at least as long as the data type specified in casting_spec and must have the same alignment. If the data type determined in casting_spec is deep, the assigned memory area must have deep components of the same type at the same position.
Any exaple (ABAP code) will be well appreciated.
Thanks in advance for your kind help.
Regards,
Giovanni
Edited by: Giovanni B on Feb 25, 2008 7:40 PMHi,
check this link
http://help.sap.com/saphelp_47x200/helpdata/en/fc/eb3860358411d1829f0000e829fbfe/frameset.htm
DATA: wa(10) VALUE '0123456789'.
DATA: BEGIN OF line1,
col1(3),
col2(2),
col3(5),
END OF line1.
DATA: BEGIN OF line2,
COL1(2),
COL2 LIKE sy-datum,
END OF line2.
FIELD-SYMBOLS: <f1> LIKE line1.
ASSIGN wa TO <f1> CASTING.
FIELD-SYMBOLS: <f2> LIKE line2.
ASSIGN wa TO <f2> CASTING.
WRITE: / <f1>-col1, <F1>-col2, <F1>-col3,
/ <f2>-col1, <F2>-col2.
the list appears as follows:
012 34 56789
01 2345/67/89
Regards -
FIELD-SYMBOLS validation with MARA Table values
Hi,
FIELD-SYMBOLS: <itab> TYPE STANDARD TABLE.
I want to validate mara-matnr with <itab>. The values in <itab> is coming at runtime, so i want to validate first field values in <itab> for all the records with mara-matnr.
The values which are coming at runtime in <itab> is matnr, bukrs, lgort. I want to validate only matnr with mara-matnr.
I don't know about field-symbols validations?
anybody has an idea?
Thanks in advance,
FractalHi,
use ASSIGN COMPONENT OF STRUCTURE.
Example.
LOOP AT <FS> ASSIGNING <FS_STRUCT>.
<b> ASSIGN COMPONENT 'MATNR' OF STRUCTURE <FS_STRUCT>
TO <FS_RESULT>.</b>
IF SY-SUBRC = 0.
SELECT SINGLE * FROM MARA WHERE MATNR = <FS_RESULT>.
CHECK SY-SUBRC = 0.
ENDIF.
ENDLOOP.
Thanks,
Naren -
How to use Field-symbol with dynamic select query
Can anybody tell me, how to use field-symbols in the dynamic select query.
FIELD-SYMBOLS <fs> { typing | STRUCTURE struc DEFAULT dobj }.
1. ... typing
2. ... STRUCTURE struc DEFAULT dobj
The FIELD-SYMBOLS statement declares a field symbol <fs>. The name 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.
eg.
FIELD-SYMBOLS <fs> TYPE ANY.
DATA: BEGIN OF line,
string1(10) VALUE '0123456789',
string2(10) VALUE 'abcdefghij',
END OF line.
WRITE / line-string1+5.
ASSIGN line-string1+5(*) TO <fs>.
WRITE / <fs>.
output:
56789
56789
reward if helpful
anju -
Hi to all,
My query is how to access a internal tables's field through field symbol.
What is the syntax and different methods to do this.
Also tell me the use of field synbol in real time.
Thanks..hi,
check these..
http://help.sap.com/saphelp_nw2004s/helpdata/en/fc/eb3860358411d1829f0000e829fbfe/frameset.htm
http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/field_sy.htm
Maybe you are looking for
-
after getting the glass replaced, my shutter wont open on the Camera App. Whatttsss happppeeening???
-
Can the FrontendCallback.seq be located in another directory?
Hi, The normal location for the (customized)FrontendCallback.seq is \Components\User\Callbacks\FrontEnd. If you want to make a modification and place it in another directory, how you configure TestStand to look at this modified FrontendCallback.seq (
-
Macbook Pro restart after waking from sleep
Hi all, Since I've installed Mountain Lion (10.8.2) on my 13" Late 2011 Macbook Pro I've been experiencing a quite annoying problem. The computer, which is connected to an external monitor through Thunderbolt to HDMI will restart (Sometimes to a gray
-
Hi All, Our coorperate firewall is blocking the Adobe Stdrd 8 to register the license and activate. If we whitelist swupmf.adobe.com will this allow any other Adobe updtaes to passthrough? Many Thanks, Harjot
-
Unable to update to iOS 6.0
Neither iPad or iPhone can be updated to iOS 6.0. Says that i am not connected to the internet though I am. What's the problem?