Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

at new invoice number

former_member203480
Participant
0 Kudos

Hi I'm looping through the internal table it is not working it is getting exit.after at new

loop at lt_invoice_data into data(ls_invoice).

at new ls_invoice-innumber.

lv_flag = 'X'.

endloop.

4 REPLIES 4

RAF
Active Contributor
0 Kudos

Hi,

maybe only one innumber in the table?

SimoneMilesi
Active Contributor

If you can share a bit more of your code, we can help you.

If your code looks like this below, exiting after the 1st INNUMBER is the correct behaviour

loop at lt_invoice_data into data(ls_invoice).
at new ls_invoice-innumber.
lv_flag = 'X'.
endat.
if lv_flag = 'X'.
exit.
endif.
endloop.

Sandra_Rossi
Active Contributor
0 Kudos

Just indicate the component name:

loop at lt_invoice_data into data(ls_invoice).
   at new innumber.
     ...
   endat.
endloop.

former_member1716
Active Contributor

lakshmi.chinta,

Before you check the issue recommend you to have the below understanding.

1) When you apply AT NEW on a field system checks and compares all the fields before it to be Same. AT NEW is triggered only when there is a difference in all the fields before during the iteration.

2) We need to align all the fields we need to compare to be the frontline fields of the internal table. This Helps us in applying the control break statements better.

3) The LINK can you help you understand the concept better.

If you can help us with the code we can provide better solutions. Also I expect all the lines of the internal table to hold the same number in the field INNUMBER. Kindly share the code to take this further.

Regards!