Skip to Content
author's profile photo Former Member
Former Member

about field symbols

Hi all,

Can any body explain me about field symblos.

regards

sai

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Apr 28, 2008 at 09:27 AM

    Hi sai,

    Field groups are groups similar fields together into one name. Field group works in conjuction with

    INSERT f1 f2 INTO fg

    EXTRACT fg

    SORT BY fg

    LOOP ... ENDLOOP

    INSERT f1 f2 INTO fg

    -


    The insert statement is used to create a field group dynamically by inserting the field into it. Only global data fields can be inserted and not local data fields eg : in form modules.

    EXTRACT fg

    -


    This will combine all the fields in the fieldgroup and write them to a sequential dataset as a single record.

    SORT BY fg

    -


    Sorting of sequential dataset by field group.

    LOOP AND ENDLOOP

    -


    LOOP.

    AT ***

    ......

    ....

    ENDAT.

    AT ***

    .....

    ....

    ENDAT.

    ENDLOOP

    With best regads

    srinivas.k

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 28, 2008 at 09:36 AM

    Hi

    ii)field symbols

    Field Symbols : Field symbols are placeholders for existing fields. A Field Symbol does not physically reserve space for a field,but points to a field which is not known until runtime of the program.

    eg:- FIELD-SYMBOL <FS> [<TYPE>].

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 28, 2008 at 10:04 AM

    Hi,

    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.

    DECLARING FIELD-SYMBOLS:

    Declaring Field Symbols

    To declare a field symbol, use the statement

    FIELD-SYMBOLS .

    For field symbols, the angle brackets are part of the syntax. They identify field symbols in the program code.

    If you do not specify any additions, the field symbol can have data objects of any type assigned to it. When you assign a data object, the field symbol inherits its technical attributes. The data type of the assigned data object becomes the actual data type of the field symbol.

    Reward if helpful.

    Pria.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.