Application Development and Automation 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: 
Read only

problem while processing internal table

Former Member
0 Likes
783

Hi ,

I have to read 2 line item of same invoice no

for eg.

IN_NO ! MAT ! AMT

XYZ ! MAT1 ! 125

XYZ ! MAT2 ! 325

In o/p its display only 325 for both line items

I used this statement for readiing..

loop at i_final

loop at i_itab1 where knumv = i_final-knumv.

move i_itab1-kwert to i_vbtab-comm .

clear i_itab1-kwert.

endloop.

endloop.

In debuging i have determine that both first line item

amt is coming in header line but while coming in body.

I become the second line item amt

Can any one help me

6 REPLIES 6
Read only

Former Member
0 Likes
766

Hi

sorry its

move i_konv1-kwert to i_final-comm .

Read only

Former Member
0 Likes
766

I guess my last suggestion would not be right.

So is i_final the table with the wrong input? How should it look at the end

Edited by: Ramiro Escamilla on May 14, 2008 9:20 AM

Read only

Former Member
0 Likes
766

Hi ,

sorry

the code which i used for reading is like this,

loop at i_final

loop at i_itab1 where knumv = i_final-knumv.

move i_itab1-kwert to i_final-comm .

clear i_itab1-kwert.

endloop.

endloop.

Read only

0 Likes
766

You still are not MODIFYing the table if you intend to write it later


loop at i_final
  loop at i_itab1 where knumv = i_final-knumv.
    move i_itab1-kwert to i_final-comm .
*   clear i_itab1-kwert.  "<== No need for this at all
  endloop.
endloop.

Additionally, you're moving to your primary loop table. Never going to see two for it unless you write to a 3rd table or

replace the CLEAR with a WRITE:/ .......

Edited by: Paul Chapman on May 14, 2008 10:35 AM

Read only

0 Likes
766

Is knumv the only common key between the two?

what about that MAT in itab1?

What is the structure of i_final?

If the only common key they have is knumv of course you will always get 325 with that logic, because you loop to the last row in itab1 and that is the last record to update the header line.

Post the structure of both tables and how should both look like at the end. Your first post doesn´t make to much sense

Read only

Former Member
0 Likes
766

If you are writing output from i_vbtab, at some point you will need to APPEND information to it.