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

combining 2 loop at itab --diff structure .to get 1 write statement.

Former Member
0 Likes
1,126

pls look below ,i hv to combine these 2 loops so that i need only 1 write statement to display all in 1 line.

itab2 structure is different from itab10.(itab10 and itab 11 are same)

1) loop at itab2.

g_menge = ITAB2-MENGE.

write : / g_menge.

endloop.

2)

loop at itab10.

read table itab11 .

*read table itab2. -


didnt work

G_days = ITAB10-ADAT - ITAB11-ADAT.

IF ITAB10-ABLESTYP = 01.

G_ESTIMATE = 'Y'.

else.

G_ESTIMATE = 'N'.

endif.

G_DAT = ITAB10-ADAT.

G_READ = ITAB10-V_ZWSTAND.

  • g_menge = ITAB2-MENGE.

write : / G_DAT,G_READ,G_ESTIMATE,G_days.

endloop.

Edited by: Sona on Feb 20, 2008 7:17 PM

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,097

You have to give the READ statement either a key or an index; otherwise, I think it will just read the first row of the table.

Rob

10 REPLIES 10
Read only

Former Member
0 Likes
1,098

You have to give the READ statement either a key or an index; otherwise, I think it will just read the first row of the table.

Rob

Read only

0 Likes
1,097

read table itab2 INDEX 1. -


READS ONLY 1 RECORD

read table itab2 with key menge = itab2-menge -


gives zero values --- whats wrong here?

pls suggest how to use this read statement inside 2nd loop.

Or any other way of achieving my display.

pls suggest how to declare a new struc and the exact step to load these values that i want to display.

Thanks.

I SOLVED THIS by adding a counter to index....

Edited by: Sona on Feb 20, 2008 8:37 PM

Read only

0 Likes
1,097

Could you post the actual code you are using?

Rob

Read only

0 Likes
1,097

Here is it.

g_cnt is 1.

read table itab2 index G_cnt.

G_cnt = G_cnt + 1.

I have another question,while subtracting two dats, is there anything wrong here?

G_days = ITAB10-ADAT - ITAB11-ADAT.

04/21/2008 - 11/05/2007 ouput is 54.

Any better way of doing this.

second value 11/05/2007 - 09/10/2007 ouput is 86

Any help?

Thanks in advance.

Read only

0 Likes
1,097

I meant the loops.

Rob

Read only

0 Likes
1,097

Thats the actual.

Read only

0 Likes
1,097

There aren't any loops in that code! Don't you want to combine two loops?

Rob

Read only

0 Likes
1,097

solved combining those 2 loop at . if thats clear.

any help on this?

I have another question,while subtracting two dats, is there anything wrong here?

G_days = ITAB10-ADAT - ITAB11-ADAT.

04/21/2008 - 11/05/2007 ouput is 54.

Any better way of doing this.

second value 11/05/2007 - 09/10/2007 ouput is 86

Read only

0 Likes
1,097

Well, the approach looks correct, but the numbers are wrong. I get 168 and 56.

Rob

Read only

0 Likes
1,097

Yes,that is wrong output .

Opened another thread for this,pls post any help.

Thanks.