Cast a Field to a Hashtable
Hi all,
I am learning to use the reflection and have a problem which i dont know how to solve.
I am trying to use the getDeclaredFields() to get all the variables defined in my program. I then do a for loop to go to each of the variables i have fetched from the getDeclaredFields() method. My problem is i dont know how to manipulate the data. (in my example below, i am trying to clear all the data in a hashtable) i cannot do a cast for the Field i got into a Hashtable). Is there any other ways that i can make use to change the data from the Fields that i have fetched ?
my codes are as below :
Class thisClass = getClass();
Field[ ] fieldArray = thisClass.getDeclaredFields();
try {
for(int i=0; i < fieldArray.length; i++) {
((Hashtable)thisClass.getDeclaredField(fieldArray.getName())).clear(); // CASTING ERROR !!!!
catch(Exception e) {
e.printStackTrace();
Field[ ] fieldArray = thisClass.getDeclaredFields();Hi,
A field does only describe the actual field in the class. To get the value e.g. the Hashtable object you have to do:
Hashtable table = (Hashtable) fieldArray[0].get(anObjectOfTheClass);If file[0] is the hashtable-field.
So, now you got all info to re-write you example above :)
/Kaj
Similar Messages
-
Wat is the use of casting in field symbols
wat is the use of casting in field symbols?
When you assign a data object to a field symbol, you can cast to any data type. This means that any area of memory can be viewed as having assumed a given type. You can then address parts of fields symbolically without having to use offset/length addressing.
A cast is performed using the CASTINGaddition of the ASSIGN statement. The CASTINGaddition allows you to assign a data object to a field symbol where the type of the data object is incompatible with that of the field symbol. There are two types of casting: casting with an implicit type declaration and casting with an explicit type declaration.
For details please have a look at below link:
[Casting|http://help.sap.com/saphelp_nw70/helpdata/en/fc/eb3930358411d1829f0000e829fbfe/frameset.htm]
I hope it helps.
Thanks,
Vibha
Please mark all the useful answers -
I have for example 2 tables:
table A ( a integer(10), b integer(10))
table B ( a integer(10), x blob,
b integer(10))
and want to do inside a view
an insert from A in B casting
an null to blob like this
( for better understanding of my problem i use the "c"-cast operator)
insert into B select a, (blob) null x, b
from A;
this way i have used because in fact the tables i have to use are a bit big and
typing all the attributes are very lame.
thanks for your answer.Hi Ashish,
I will give a detailed explanation of my requirement. I am working in ICWEB client for utility services, In this case for a particular view in the bsp application CRM_IUFCS_IC/View1.htm i want to add a field but the field is not the context nodes, or any of the related entities in the BOl Model. But its in another root object in the BOL Model. So i would like to know how can i add this field into my layout.
e.g.:let context node in view to be modified is buag and the field to be added is under BuilHeader object. This is the scenario.
Advance Thanks,
Sujith -
Creating a view to cast the field type
Hi All,
I had a table test with 2 fields key and time. time is of type timestamp.
i want to create a view on the table but cast the cast the time field from timestamp to datetime or date which can accomodiate the date and time.
I dont need the milli seconds in the view but require the date, time(hours:minutes:sec)
If anyone dis this earlies, please give some suggestions for me.
Regards,
KKWhen i cast it to date only date "MM/DD/YY" is shown but time is not shown.Where are you looking to see this? A DATE column always has a time component. In order to display a date, however, it needs to be converted to a string. If you do not do an explicit TO_CHAR with an explicit format mask, in SQL*Plus, the conversion of a date to a string is governed by the session's NLS_DATE_FORMAT parameter. Various GUIs also have options to set or change the implicit format mask.
Most tools and databases default to only displaying the date component (the time component is always still there, it's just not displayed).
SQL> select * from vw_ts_to_date;
DT
27-FEB-09
SQL> select to_char( dt, 'DD-MON-YYYY HH24:MI:SS' ) dt_string
2 from vw_ts_to_date;
DT_STRING
27-FEB-2009 16:58:09
SQL> ed
Wrote file afiedt.buf
1* alter session set nls_date_format = 'DD-MON-YYYY HH24:MI:SS'
SQL> /
Session altered.
SQL> select * from vw_ts_to_date;
DT
27-FEB-2009 16:58:39Justin -
Replication of CUSTOMER fields (Z fields) for a material
Hi *,
I have followed a manual to replicate z fields in CRM.
I have just defined :
a Z fm in R/3 , in order to fetch a brand new material created in R/3
then a set type with attributes and I have assigned this set type to this category and hierarchy.
Finally I have implemented the badi PRODUCT_CUSTOMER2.
The Bdoc comes empty, meant that the z fields are not transported from R/3.
I think that the fm in R/3 ,inspite off no errors is badly defined.
I think parameters of FM (export, import, tables, changing) are fine.
Have u got any example of code concerning your Z fm.
My code is the following:
FUNCTION Z_SEND_PROD_TO_CRM.
""Interfase local
*" IMPORTING
*" REFERENCE(I_OBJ_CLASS) LIKE BAPICRMOBJ-OBJCLASS
*" REFERENCE(I_OBJ_NAME) LIKE BAPICRMOBJ-OBJ_NAME
*" REFERENCE(I_BAPICRMDH2) LIKE BAPICRMDH2 STRUCTURE BAPICRMDH2
*" OPTIONAL
*" REFERENCE(I_KEYWORD_IN) LIKE CRM_PARA-KEYWORD_IN
*" REFERENCE(I_CRMRFCPAR) LIKE CRMRFCPAR STRUCTURE CRMRFCPAR
*" EXPORTING
*" REFERENCE(E_DO_NOT_SEND) LIKE CRM_PARA-XFELD
*" TABLES
*" T_INT_TABLES STRUCTURE BAPIMTCS
*" T_BAPISTRUCT STRUCTURE BAPIMTCS
*" T_MESSAGES STRUCTURE BAPICRMMSG
*" T_KEY_INFO STRUCTURE BAPICRMKEY
*" T_BAPIIDLIST STRUCTURE BAPIIDLIST
*" T_OTHER_INFO STRUCTURE BAPIEXTC
*" CHANGING
*" REFERENCE(C_BAPICRMDH2) LIKE BAPICRMDH2 STRUCTURE BAPICRMDH2
*" REFERENCE(C_RFCDEST) LIKE CRMRFCPAR STRUCTURE CRMRFCPAR
*" REFERENCE(C_OBJNAME) LIKE BAPICRMOBJ-OBJ_NAME
DATA: ls_mara TYPE mara.
* ls_marc TYPE marc.
Communication Structure
DATA: BEGIN OF ls_com_key,
struct(20),
matnr(40),
END OF ls_com_key.
Communication structure (additional MARA data)
DATA: BEGIN OF ls_com_data1,
ZZ_AREA_PR LIKE mara-ZZ_AREA_PR,
ZZPROD_EJEC LIKE mara-ZZPROD_EJEC,
ZZ_COD_UER LIKE mara-ZZ_COD_UER,
ZZTIP_PROD LIKE mara-ZZTIP_PROD,
ZZ_EMISION_PROG LIKE mara-ZZ_EMISION_PROG,
ZZ_COD_CONTRATO LIKE mara-ZZ_COD_CONTRATO,
ZZ_CANAL LIKE mara-ZZ_CANAL,
ZZ_NAT_ID LIKE mara-ZZ_NAT_ID,
END OF ls_com_data1.
Communication structure (additional MARC data)
DATA: BEGIN OF ls_com_data2,
mfrgr(8),
ladgr(4),
vbamg(13),
vrvez(7),
vbeaz(7),
END OF ls_com_data2.
Field Symbol for Casting BAPIMTCS
FIELD-SYMBOLS:
<source_x> TYPE x,
<target_x> TYPE x.
Additional Fields used
DATA: lv_matnr TYPE mara-matnr.
DATA: ls_BAPISDCOND TYPE BAPISDCOND.
DATA: ORIGNAL_COST TYPE BAPISDCOND-COND_VALUE.
DATA:
BEGIN **************************************************************
ATTENTION: This declaration is needed, to get the right offset for
a later assign (to prevent alignment error at statement
ASSIGN ... CASTING ...)
lv_casting TYPE f, "#EC NEEDED
Never insert a new definition between LV_CASTING and
and LS_BAPIMTCS !!!
ct_bapimtcs TYPE bapimtcs.
END ****************************************************************
FIELD-SYMBOLS:
<ledsource_x> TYPE BAPISDCOND,
<ledtarget_x> TYPE BAPISDCOND,
<lfs_data> type any.
DATA: gc_condition TYPE tabname30 VALUE 'BAPISDCOND'.
CASE i_obj_name.
WHEN 'MATERIAL'.
We want to pick up the additional fields from MARA
Mapping of MARA fields into table t_other_info
LOOP AT t_int_tables WHERE tabname = 'MARA'.
ASSIGN t_int_tables-data TO <source_x> CASTING.
ASSIGN ls_mara TO <target_x> CASTING.
IF <source_x> IS ASSIGNED AND
<target_x> IS ASSIGNED.
<target_x> = <source_x>.
ELSE.
CONTINUE.
ENDIF.
ls_com_key-struct = 'MARA'.
ls_com_key-matnr = ls_mara-matnr.
MOVE-CORRESPONDING ls_mara TO ls_com_data1.
t_other_info-field1 = ls_com_key.
t_other_info-field2 = ls_com_data1.
APPEND t_other_info.
We want to pick up the additional fields from MARC
lv_matnr = t_int_tables-data+3(40).
CLEAR ls_marc.
CALL FUNCTION 'MARC_SINGLE_READ'
EXPORTING
matnr = lv_matnr
STILL NEEDS SOME WORK HERE
There is a 1 to many relationship between MARA and MARC
and we need to determine how to handle this.
For testing purposes Plant 10 is hard coded
werks = '10 '
END
IMPORTING
wmarc = ls_marc
EXCEPTIONS
OTHERS = 5.
MOVE-CORRESPONDING ls_marc TO ls_com_data2.
t_other_info-field3 = ls_com_data2.
APPEND t_other_info.
ENDLOOP.
WHEN 'LEDELIVERY'.
*t_int_tables
LOOP AT T_BAPISTRUCT WHERE tabname = 'BAPISDCOND'.
ASSIGN T_BAPISTRUCT-data TO <ledsource_x> CASTING.
ASSIGN ls_BAPISDCOND TO <ledtarget_x> CASTING.
IF <ledsource_x> IS ASSIGNED AND
<ledtarget_x> IS ASSIGNED.
*Following will pass data from T_BAPISTRUCT-data to ls_BAPISDCOND
*Both are having separate memory areas.
<ledtarget_x> = <ledsource_x>.
ELSE.
CONTINUE.
ENDIF.
ORIGNAL_COST = ls_BAPISDCOND-COND_VALUE.
*As <ledtarget_x> refers to ls_BAPISDCOND memory,
*in debugging, you can see <ledtarget_x>-con_value becomes 5000.
ls_BAPISDCOND-COND_VALUE = '5000'.
*<ledsource_x> refers to data field of header line (workline) of
*internal table T_BAPISTRUCT
*So following will change data field of header line of T_BAPISTRUCT
<ledsource_x> = ls_BAPISDCOND.
ENDLOOP.
ENDCASE.
Any help will be considered and rewarded.
Regards,
AndreA
ENDFUNCTION.Hi all,
basically bear in mind when you extend BDOCs in CRM 4.0 two things:
1. create API structure
2. Put x in Badi PRODUCT_CUSTOMER2 in order to map all Z fields.
For example:
ls_zprod_xport-data-zz0010 = ls_com_mara-ZZ_AREA_PR.
ls_zprod_xport-data_X-zz0010 = 'X'.
Regards,
AndreA -
Field Symbols in Download to excel FM
Hi All,
I am trying to use something like below.
field-symbols : <gt_outtab> type any.
Here <gt_outtab> is a dynamic internal table.
It gives me an error message saying ""
i might be asking very silly question but am not able to find a solution.
Is the below code wrong...then is there any FM which supports usage of field symbols in FM to download data with field names.
another thing...is there any way to read the Component names in a field symbol...I am able to read the contents of the same using Assign component though.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = 'C:\test1.xls'
filetype = 'ASC'
append = 'X'
TABLES
data_tab = <gt_outtab>
fieldnames = gt_fieldcat.
Any help is appreciated.
BR,
Krishna.Hi Max,
thanks for that...I did get the structure and was able to create a Dynamic table using the Field catalog fieldnames.
Now I have all my values in <gt_outtab> table and the dynamic table created from the field catalog is <gt_fieldcat> .
DATA: it_create TYPE REF TO cl_alv_table_create,
it_dinamica TYPE REF TO data,
it_fieldcat_lvc TYPE lvc_t_fcat.
CALL METHOD it_create->create_dynamic_table(
EXPORTING it_fieldcatalog = gt_save_fieldcat
IMPORTING ep_table = it_dinamica ).
ASSIGN it_dinamica->* TO <fs_dinamica>.
All I want is to Move corresponding from one fieldsymbol to another.
something like move-corresponding <gt_outtab> to <gt_fieldcat> . But it gives me an error saying its not a structure etc.
I tried another way as well.
loop at <gt_outtab> assigning <gs_outtab>.
ASSIGN COMPONENT MY_STRUCT->COMPONENTS-NAME
OF STRUCTURE <gs_outtab> TO <fs1>.
All I have now is a fieldcatalog..a table with all values...
Move corresponding doesn't work as it says this is not a structure or an internal table.
as this is not a static structure that I am referring to it doesnt allow me to do this.
I think there is no concept of type casting a Field Symbol like another field symbol at runtime.
like : field-symbols : <fs>, <fs1> , <fs2> type itab1.
assign <fs2> to <fs> casting. which then transforms <fs2> to structure <fs>.
for e.g :
<gt_fieldcat> :
orderno itemno adsize date price
<gt_outtab> has below values
orderno itemno price date adsize
400 10 200 10.10.2010 45
500 20 150 11.09.2010 55
All i need is the same field catalog and the rows in as per the fields in the <gt_fieldcat>.
When there is something gt_sp_groups while passing into the below method, the fieldcat and the output table are in same structure but after this method if I try to read the current Field catalog using method " get_frontend_fieldcatalog" ...it gives me a different one after applying the Groups etc.,in such cases I think the ALV excel download doesnt work. I tried checking SAP Notes for the same, but could not find anything. It will be helpful if I can get any notes related to that.
e.g.
CALL METHOD gr_alvgrid->set_table_for_first_display
EXPORTING
is_layout = gs_layout
it_special_groups = gt_sp_groups
it_toolbar_excluding = gt_exclude .
Any one any ideas please....at the moment the only way i am trying is forcing all the fields as characters into the Excel which obvisouly limits if it is a Price columns.
Many thanks,
Krishna.
Edited by: Krishna on Nov 11, 2010 2:24 AM
Edited by: Krishna on Nov 11, 2010 5:56 PM -
I have the following XML file:
<fields>
<name>J. Postma</name>
<date>21-05-2004</date>
</fields>
I want to put the fields in a Hashtable. Name is the key and "J. Postma" is the value. How can I parse the XML and add the fields into a Hashtable?Dubwai, me too. But for only a half-day of effort,
you can make a few helper classes that vastly simplify
the day-to-day usage of DOM.Yes. I've done that too. To the OP, if you use DOM, realize that the text value of a single element may be in multiple Text nodes. You can't just grab the first one. You need to loop through all Text node children and concatenate their values. -
Hi Friends,
How do I cast an object dynamically ?
Here I made a sample example for what I need exactly.
java.lang.String str = "sample";
java.lang.Object obj = str;
Class cls = obj.getClass();
java.lang.String tmpStr = (cls)obj; // this is an error.
Instead of casting like (java.lang.String), I wanted to replace "(java.lang.String)" with an variable.
Any ideas??
Thanks,
SK.Doesn't make sense to me at all why you think you'd
need that. You already know you want it to be a
java.lang.String, because you coded:
java.lang.String tmpStr = (cls)obj;
Certainly you and the compiler have to know beforehand
the object type you need to cast to, so why the fuss?Hi,
I typed wrongly in my org. note. Sorry about that.
Actual code snippet looks like this.
java.lang.String str = "sample";
java.lang.Object obj = str;
Class cls = obj.getClass();
cls tmpStr = (cls)obj; // this is giving me an error.
I wanted to cast that field dynamically, because upfront I dont know the type of the object.
In the above example, just for the example sake, I selected a data type "String". Actually I need to cast it based on the type of the object at runtime.
Thanks,
SK. -
How to use field symbol in select
Hi,
CONCATENATE 'WTG0' LV_MON INTO LV_FNAME.
ASSIGN (LV_FNAME) TO <FS>.
SELECT SINGLE <FS> FROM COSP INTO LV_SAPRST
WHERE OBJNR = LV_OBJ AND GJAHR = LV_YEAR AND WRTTP = '4' AND KSTAR = GT_INOUT-SAKNR
Error message : Unknown column name "<FS>" . field list. . field list. field list.
actually , if i use if command, i can do, but i want to use simple code by fieldsymbol.
is it possible in select command?
Thanks in advance
BenjaminHi
Hope it will help you.
reward if help.
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 -
How to use field symbols in program
how to use field symbols can any one explain with example please..
Regards,
venki...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.
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.
<b>Reward points for useful Answers</b>
Regards
Anji -
Hi,
Can any one give me clear idea of field symbols and their use in the programing?
i read some help docs but could not get it what exactly it means
Thanks,
RaviHi
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.
Regards
Anji -
Field Symbols, Field String, and Field Group.
Hi,
Can you differentiate between filed symbols, field strings and field groups,
With regards,
Bharath Mohan BHi,
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
FIELD GROUPS
are used to hold/handle large amount of data when the internal table are not useful
we use EXTRACT statement, HEADER structure in them
see the example
REPORT demo_extract.
NODES: spfli, sflight.
FIELD-GROUPS: header, flight_info, flight_date.
START-OF-SELECTION.
INSERT: spfli-carrid spfli-connid sflight-fldate
INTO header,
spfli-cityfrom spfli-cityto
INTO flight_info.
GET spfli.
EXTRACT flight_info.
GET sflight.
EXTRACT flight_date.
END-OF-SELECTION.
SORT STABLE.
LOOP.
AT FIRST.
WRITE / 'Flight list'.
ULINE.
ENDAT.
AT flight_info WITH flight_date.
WRITE: / spfli-carrid , spfli-connid, sflight-fldate,
spfli-cityfrom, spfli-cityto.
ENDAT.
AT flight_date.
WRITE: / spfli-carrid , spfli-connid, sflight-fldate.
ENDAT.
AT LAST.
ULINE.
WRITE: cnt(spfli-carrid), 'Airlines'.
ULINE.
ENDAT.
ENDLOOP.
FIELD STRING is nothing but a string with one row of records.
Reward points if useful
regards
Anji -
Re: field symbols and interna table
hi,
here is field symbol which is table type
FIELD-SYMBOLS: <gt_pos_data> TYPE table.
there is one internal table it_data.
how can move <gt_pos_data> to it_data.
please help me.
rgdsHi
You can assign field wise:
like
<gt_pos_data>- field to to it_data-field.
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
Reward points if useful
Regards
Anji -
Is there a way to calculate a date field based on aother date field in sharepoint list?
In a SharePoint list, I have a 'Start of Use Date' and need to ensure the 'Review Date' is no more than 14 months after the 'Start of Use Date', but can't figure out the formula. Can you help?
You can cast the field values in the SPListItem to DateTime objects and call the AddMonths(int) function to see if the two are more than 14 months apart. For instance:
DateTime startOfUseDate = (DateTime) item["Start of Use Date"];
DateTime reviewDate = (DateTime) item["Review Date"];
if (startOfUseDate.AddMonths(14) >= reviewDate)
// Review Date IS NOT more than 14 months after Start of Use Date
else
// Review Date IS more than 14 months after Start of Use Date
Danny Jessee
MCPD - SharePoint Developer 2010
MCTS - SharePoint 2010, Configuring
dannyjessee.com/blog -
What exactly are Field symbols?
Hi SDN,
What exactly are Field symbols?
I have read they are not pointers then what are they?
Regards,
RahulHi
see this
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.
Regards
Anji
Maybe you are looking for
-
I'm seriously about to cry! Someone, anyone please help me! I have: Restored Reseted Plugged usb into wall plug, than back into usb hub Deleted and redownloaded itunes EVERYTHING.
-
My Mac Mini is not connecting to internet through the ethernet
Had an issue with my internet provider, which was resolved after a month.....at this point my internet is not connecting through the ethernet cable (no router is being used, from modem directly to mini mac).....ERROR:YOU ARE NOT CONNECTED TO THE INTE
-
Hi All, I'm facing a problem in Viewer. Whenever I customize the report(change graph style or change rows retrieval or drill up/down) , Drill Through to other reports through links are giving an error- Warning Do you want to save your changes before
-
Element tag in the WSDL file.
I have the following interface for the webservice: public interface DocumentProvider extends Remote { public void deleteDocument(String documentId) throws RemoteException; I use the wscompile command to generate the wsdl file and it creates a complex
-
Is it possible to watch music videos on a nano?
I bought a music video on itunes and when I updated my ipod the music video didn't transfer onto the ipod. Can a nano play music videos? dell Windows XP