Skip to Content
author's profile photo
Former Member

Advantage of using Field Symbols

Hi ,

What is tha advantage of using field symbols.

Regards

Arun

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

4 Answers

  • Best Answer
    Oct 04, 2005 at 02:22 PM

    The only advantage that I see, is when using them to access fields or fields of tables dynamically.

    Regards,

    Rich Heilman

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Oct 04, 2005 at 02:33 PM

    hi,

    it's an example.

    I've to initializate all fields of a table. I used it in a batch input standard.

    ...

    perform init_table using 'BLFA1'.

    .....

    form init_table using name_tb type string.

    DATA vn_n TYPE i.

    FIELD-SYMBOLS <g> TYPE ANY.

    field-symbols <tb> type any.

    assign (name_tb) to <tb>.

    <tb>-STYPE = '1'. "I know that all tables I'll pass to

    "this form have the STYPE component

    clear vn_n.

    do.

    add 1 to vn_n.

    assign component vn_n of structure <tb> to <g>.

    if sy-subrc ne 0.

    exit.

    endif.

    if <g> is initial.

    move bgr00-nodata to <g>.

    endif.

    enddo.

    endform.

    For more information you con go to the eLearning zone of sdn https://www.sdn.sap.com/sdn/elearning.sdn?node=linkpnode1

    in eLearning Repository there is the ABAP link.

    there in the Advanced course

    https://www.sdn.sap.com/sdn/elearning.sdn?page=el_abap.htm

    there is a class Information

    Advanced and Generic Programming in ABAP

    it explain you because and how use field symbos .

    bye

    enzo

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Oct 04, 2005 at 02:36 PM

    Hi,

    Field symbols are quite good for dymanic assignments and accesses. When you change their value, you actually change the value of the object, that they are assigned to. That's why for int.tables you don't need to use MODIFY stmt.

    Svetlin

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Oct 04, 2005 at 02:43 PM

    FIELD-SYMBOLS <fs>.

    Declares a symbolic field with the name <fs>. At runtime, you can assign a concrete field to it using the ASSIGN statement. Any operations that you then perform using the field symbol directly affect the field that is assigned to it.

    Advantage:

    -


    The main advantage is while processing the records inan internal table and appending to another internal table.

    Just assign the values directly to fieldsymbol and no need to used append.

    It increases the performance of the program.

    Regards,

    Add comment
    10|10000 characters needed characters exceeded