2009 Jul 08 2:41 PM
Hi all,
I have problem with at new stell,
I have table p0001 with several records with different stell values, when I do AT NEW program is moving all record but I wont only new different record.
CLEAR p0001.
SORT p0001 BY stell.
LOOP AT p0001 .
AT NEW stell.
MOVE-CORRESPONDING p0001 TO dat.
APPEND dat.
ENDAT.
ENDLOOP.
SORT dat DESCENDING BY pernr begda.
READ TABLE dat INDEX 1.
2009 Jul 08 2:45 PM
Hello,
If I understood correctly, please follow
1.Decalare another internal table with same fields as P0001but the stell field should be the first field.
2.Move the complete data into the new internal table.
3.Sort the internal by stell field and rest follow the same procedure as you are following.
Hope it would help you.
Regards,
Ravi
Hi all,
I have problem with at new stell,
I have table p0001 with several records with different stell values, when I do AT NEW program is moving all record but I wont only new different record.
CLEAR p0001.
SORT p0001 BY stell.
LOOP AT p0001 .
AT NEW stell.
MOVE-CORRESPONDING p0001 TO dat.
APPEND dat.
ENDAT.
ENDLOOP.
SORT dat DESCENDING BY pernr begda.
READ TABLE dat INDEX 1.
2009 Jul 08 2:45 PM
Hello,
If I understood correctly, please follow
1.Decalare another internal table with same fields as P0001but the stell field should be the first field.
2.Move the complete data into the new internal table.
3.Sort the internal by stell field and rest follow the same procedure as you are following.
Hope it would help you.
Regards,
Ravi
2009 Jul 08 2:45 PM
2009 Jul 08 2:50 PM
I think...what you are doing is right...
As suggested, Just try to declare another internal table and pass data into the internal table and make sure that you have STELL as the first column...
And...try to debug and identify...whether the at new event is triggered always...i.e for each record...
2009 Jul 08 2:52 PM
Hi,
The Sorting field must be a First Field of your Internal table.
Otherwise, it wont work as desired.
Suppose your Field (STELL) is not in the first Column, you can use " ON CHANGE OF ......" event .
Thanks and regards,
Ramani N
2009 Jul 08 3:00 PM
Hi Nick,
Here I do not understand how you get records.
In this below case you will only get Astericks (*****) in your table.
anyhow for this you can follow either of this method:
1) You can sort p0001 BY stell and use 'DELETE ADJACENT DUPLICATES'
2) Use different work area X_P0001 like p0001 and use this before AT NEW.
X_P0001 = P0001.
AT NEW stell
do with X_P0001.
ENDAT.
Left side fields of stell should not be numeric in this case.
Regards,
Subba
2009 Jul 08 4:24 PM
Hi,
AT NEW works as below:
Loop at itab.
...
AT NEW field3.
...
END AT.
...
Endloop.Consider itab contains field1, field2, field3 and so on...
The AT NEW block will be executed only when there is change in the value of field3 or change in the values of it's previous fields i.e. field1 and field2. and other fields are * so copy the itab to workarea and again back to where you want to copy.
That is the reason the field stell should be at the first column. Hope you understand what to do now.
Thanks & Regards,
Anand Patil