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

Inserting lines into internal table.

Hi please consider the foll pseudo code:

Loop at itab1.

Validations on itab1.

If true.

Move certain fields of itab1 to itab2.

*Then how do I insert these records at the END of itab2?

**Will simply "INSERT itab2" work?

endif.

Endloop.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

6 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Dec 03, 2007 at 05:29 AM

    1. INSERT [wa INTO|INITIAL LINE INTO] itab [INDEX idx].

    2. INSERT [wa INTO|INITIAL LINE INTO] TABLE itab.

    3. INSERT LINES OF itab1 [FROM idx1] [TO idx2]

    INTO itab2 [INDEX idx3].

    4. INSERT LINES OF itab1 [FROM idx1] [TO idx2]

    INTO TABLE itab2.

    http://help.sap.com/saphelp_46c/helpdata/en/34/8e72c56df74873e10000009b38f9b8/content.htm

    simply insert itab.

    else.

    wa .

    insert itab from wa.

    null

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 03, 2007 at 05:31 AM

    hi,

    if u want to put the records at the end of the itab,

    use append stmt.

    or else if u want to put the records in the specified position

    use insert stmt.

    <b><i>Reward points if useful</i></b>

    Chandra

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 03, 2007 at 05:36 AM

    append wa to itab2.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 03, 2007 at 05:38 AM

    HI

    if use workarea then you can do like this

    APPEND WA_OUTPUT TO IT_OUTPUT.

    clear WA_OUTPUT.

    <b>Reward if usefull</b>

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 03, 2007 at 05:43 AM

    Hi Anand,

    Try this

    • If Itab1 is with header line

    Loop at itab1.

    if <condition>.

    append itab1 to itab2.

    endif.

    endloop.

    ( Or )

    *if itab1 is with out header line

    data fs_itab1 like line of itab1.

    Loop at itab1 into fs_itab1.

    if <condition>.

    append fs_itab1 to itab2.

    endif.

    endloop.

    Reward if Help,

    Mahi.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 03, 2007 at 06:08 AM

    Hi

    Loop at itab1.

    Validations on itab1.

    If true.

    APPEND ITAB1 TO ITAB2.

    endif.

    Endloop.

    Hope this Helps.

    Praveen

    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.