‎2009 Sep 14 8:17 PM
Hello Gurus,
I have a internal table filles with data from a custom table. There are two key fields and one non-key field in custom table.
Now I am looping on the internal table. I want certain logic to get executed even if first key or second key field is
different from respective previous first and second key field.
I am using following logic but it does not work.
sort itab by k1 k2.
Loop at itab.
at new k1.
at new k2.
perform logic.
endat.
endat.
endloop.Please help.
Regards,
Jainam.
Edited by: Jainam Shah on Sep 14, 2009 9:17 PM
Edited by: Jainam Shah on Sep 14, 2009 9:18 PM
Edited by: Jainam Shah on Sep 14, 2009 9:18 PM
Edited by: Jainam Shah on Sep 14, 2009 9:19 PM
Edited by: Jainam Shah on Sep 14, 2009 9:19 PM
Edited by: Jainam Shah on Sep 14, 2009 9:20 PM
‎2009 Sep 14 8:45 PM
Hi, Shah
Do the following way,
" K1 must be the First Field in the Internal Table and K2 Must be 2nd
Loop at itab.
at new k1.
" perform logic for K1
endat.
at new k2.
" perform logic for K2
endat.
endloop.Hope will help you to solve out your problem,
Best Regards,
Faisal
‎2009 Sep 14 8:45 PM
Hi, Shah
Do the following way,
" K1 must be the First Field in the Internal Table and K2 Must be 2nd
Loop at itab.
at new k1.
" perform logic for K1
endat.
at new k2.
" perform logic for K2
endat.
endloop.Hope will help you to solve out your problem,
Best Regards,
Faisal
‎2009 Sep 14 8:45 PM
When you chose AT NEW k2, there is a breakdown when k1 or k2 changes.
Loop at itab.
at new k2.
perform logic.
endat.
endloop.