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

AT NEW f, AT END OF f in an inernal table Loop ?

I am trying to subtotal an amount in an internal table by KUNAG. I then want to write this out to the output file. (see code below)

When I run this in debug the AT NEW and the AT END OF of are executed for every loop pass even though the KUNAG value appears to be the same .

Any ideas?

J

LOOP AT it_report2.

AT new kunag.

l_netwr = 0.

ENDAT.

l_netwr = l_netwr + it_report2-netwr.

l_line = it_report2.

TRANSFER l_line TO p_ufile.

AT END OF kunag.

it_report4-netwr = l_netwr.

l_line = it_report4.

TRANSFER l_line TO p_ufile.

ENDAT.

ENDLOOP.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Aug 03, 2006 at 05:34 PM

    hi,

    did u sort the table???if yes...

    did u sort it with kunag??

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Aug 03, 2006 at 05:31 PM

    Makes sure that the table is sorting by the KUNAG. You can clear l_netwr at the end of the KUNAG, no need to do it at NEW.

    
    <b>sort it_report2 ascending by kunag.</b>
    
    LOOP AT it_report2.
    
    
    l_netwr = l_netwr + it_report2-netwr.
    l_line = it_report2.
    TRANSFER l_line TO p_ufile.
    
    AT END OF kunag.
    it_report4-netwr = l_netwr.
    l_line = it_report4.
    TRANSFER l_line TO p_ufile.
    l_netwr = 0.
    ENDAT.
    
    ENDLOOP.
    
    
    
    

    Regards

    Rich Heilman

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 03, 2006 at 05:39 PM

    What Exactly is ur table structure. can u tell me this?

    And one more thing are u using any where condition in Loop statement?

    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.