Skip to Content


Hello all

In a weblog by Brian McKellar i found this:

FIELD-SYMBOLS: LIKE LINE OF p_column_definitions.

  • First column is small icon.

APPEND INITIAL LINE TO p_column_definitions ASSIGNING -TITLE = ' '.

I have never seen this APPEND syntax before.

I have also tried to find it documented on - no luck.

Can anyone explain this syntax and show me where SAP has documentede it ?

Best regards

Thomas Madsen Nielsen

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Posted on Feb 05, 2004 at 04:34 PM

    I checked the ABAP Keyword documentation and it does mention the initial line to variant for the append command. The following is what I found.

    Variant 1

    APPEND wa TO itab.


    Appends a new line to the end of the internal table itab. You can only use this variant with index tables (standard or sorted table).

    If you specify wa TO , the new line is taken from the contents of the explicitly specified work area wa.

    If you use INITIAL LINE TO, a line filled with the correct initial value for the type is added.

    If the part before itab is omitted, the new line is taken from the header line of the internal table itab.

    After the APPEND, the system field SY-TABIX contains the index of the last line in the table.

    What he is doing is creating a new empty row in the table p_column_definitions. At the same time he is assigning the address of this row in the table to a field symbol. That way you work directly with that row in the table without having to go though a header work area. You see this a lot in the newer SAP code. They also do their reads and loops without any header work area by using a similar assigning syntax. This type of code would be faster. Instead of having to copy the contents of a table row into a separate work area, changing it there and then copying back - you are directly accessing the data in the table row. I guess this would also reduce the memory foot print of your program as well, because you don't need the extra work areas.

    I have used this in some of the new programs that I have written and I can't say that it makes a visible difference in runtime, but I suppose that every little bit helps.

    Add a comment
    10|10000 characters needed characters exceeded

    • Hello Thomas Jung

      Thank you for your reply.

      I knew the basic syntax incl. the INITIAL LINE stuff.

      It is the assigning part i don't se in any documentation.

      I also guessed what it does and that it must improve performance.

      Can I use it in other commands table statements? Maybe in a loop statement ?

      Or can I maybe assign a fieldsymbol directly at myTable[12] ?

      Best regards

      Thomas Madsen Nielsen

  • Posted on Feb 17, 2004 at 04:48 PM

    Yes you can use the assigining sytax on other table operations. In addtion to the appending initial line, you can use it in a read or loop at statement. You should note that the append initial line to ... assigning is only in 620. Before 620 you have to do this as a two step process. The following is a code sample from 46C where I am looping at one table to copy the contents into another table while gathering more details. This should give you an example of what I am talking about.

    data: user_list type table of xubname.

    select bname from usr01 into table user_list.

    field-symbols: -name2 = i_user-name2.


    Add a comment
    10|10000 characters needed characters exceeded

    • Hello Thomas

      Thanks for your info. I now found the documentation and I understand the concept.

      About performance improvement you mentioned I found this:

      This (assigning) saves the cost of copying the contents to the work area. However, this addition involve table administation costs, and it is therefore only worthwile for lines longer than around 300 bytes.

      Best regards

      Thomas Madsen Nielsen

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.