2005 Jul 06 12:02 PM
Hi People,
How can I access different lines of an internal table where there is not set index which I have to access? I have to write only the last occurence of each kunnr getting stored in the internal table. Can somebody help?
Thanks,
AM
2005 Jul 06 12:06 PM
Hi,
you can try using control break statements in a loop endloop statement.
at new - will get fired at every new value of say kunnr.
at end of - will get fired at end of a set of common value say kunnr.
at first - will occur only at the starting of loop for the first time.
at last - will get fired at the last loop occurence.
Regards,
Jagath.
2005 Jul 06 12:06 PM
Hi,
you can try using control break statements in a loop endloop statement.
at new - will get fired at every new value of say kunnr.
at end of - will get fired at end of a set of common value say kunnr.
at first - will occur only at the starting of loop for the first time.
at last - will get fired at the last loop occurence.
Regards,
Jagath.
2005 Jul 06 12:13 PM
If you internal table si sort by kunnr, you can try this :
loop at itab.
at end of kunnr.
move itab-....
endat.
endloop.
Hope this helps,
Erwan.
2005 Jul 06 12:29 PM
Hi,
What about:
data: count type i.
count = lines( itab ).
read table itab index count into ...
or if you can sort it
sort itab by kunnr descending.
read table itab index 1 into ...
Eddy
2005 Jul 06 1:12 PM
Hi Eddy,
The logic u gave is wrong.If there are two kunnr available in the internal table.Then it will take the last value of the highest kunnr no.
I think at <b>end of kunnr</b> will be correct.
With Regards,
Ranganathan
2005 Jul 06 1:17 PM
2005 Jul 06 1:33 PM
Hi AM,
You have got multiple solutions, each one of those are based on some assumptions.
1. At end - this solution will work if kunnr is the first field in your internal table (Sorted).
2. Edde's solution will work if all the values for kunnr in the internal table are same.
If not of this applies then you need write a piece of logic between LOOP and ENDLOOP, but the right solution will depend on the exact nature of your problem. More you explain your problem better are the chances of getting a solution.
Regards,
Sanjeev
2005 Jul 06 10:09 PM
Thanks everybody.
These different answers solved my problem.
regards,
AM