‎2009 Feb 20 6:52 AM
Dear Guru's,
I have a requirement where i have to move the values to variable when control break (AT END OF) process. So i want to move the values according to the end of Vendor so for that i want to know is there any sy-index available which reflects changes when Control break (AT end of) process.
LIKE Sy-subrc = 0 when select statement fetches record or sy-tabix is like counter for loop.
Hope to get reply soon.
Regards,
Himanshu Rangappa
‎2009 Feb 20 7:05 AM
Hi
SY_TABIX will show the record position in the internal table
‎2009 Feb 20 7:11 AM
Dear Tharani,
Is there any System field available which counts how many time control break statement process.
Regards,
Himanshu
‎2009 Feb 20 7:16 AM
I dont think there is a system variable available to count that. You can declare a variable yourself and increment it within the AT END OF...ENDAT statement. This will give you the total number of times the control break is triggered.
DATA: W_COUNTER TYPE I.
LOOP AT T_TABLE INTO FS_WORKAREA.
AT END OF LIFNR.
W_COUNTER = W_COUNTER + 1.
ENDAT.
ENDLOOP.
‎2009 Feb 20 7:18 AM
Hi,
Put a counter in the control-break
data: count like I.
count = 0.
AT NEW itab-fname.
count = count + 1.
...
ENDAT.thanks\
Mahesh
‎2009 Feb 20 7:07 AM
You can check the system variable SY-TABIX. This will give the current record number in the loop irrespective of whether you are using a control-break or not. Only when you are performing a READ TABLE within the loop, then SY-TABIX will be set with the record read from the other table.
In your case, move the SY-TABIX value to a variable in the AT END OF...ENDAT control break. It will give you the position of the last record to be processed for the vendor.
‎2009 Feb 20 7:23 AM
Dear Avinash,
I don't want to move the value from my internal table. My requirement is like that there are 20 vendor available for a single matarial & for every material we have to check the quality(like fe, sio2 ).
so at end of every vendor for a same material I have to move the particular value for calculation purpose.
So for that I have to check the counter for contol break.
Is there any sy-field available which counts the control break statement process.
Regards,
Himanshu
‎2009 Feb 20 7:28 AM
Hi,
There is no system Fields for it.
But your requirement can be done with 'AT NEW' and 'AT END' statement.
Refer this sample example,
loop at otab.
at new module.
move otab-module to otab2-module.
ENDAT.
at END OF effort.
sum. "Do your calculations here
move otab-count to otab2-count.
append otab2.
endat.
endloop.
‎2009 Feb 20 7:11 AM
‎2009 Feb 20 7:17 AM
Hi,
there is no system field.
Use a counter inside the AT NEW.
Every time AT NEW is triggered increment the Counter by 1
LOOP AT ITAB.
AT NEW FEILD.
ADD 1 TO COUNTER.
ENDAT.
ENDLOOP.
Regards,
Gurpreet
‎2009 Mar 26 8:58 AM