09-10-2009 4:36 PM
Hi Experts,
i have an internal table eg t_final.
with fields
State
plant
qty
Now i sorted the table as -
>>>
sort t_final1 by state ASCENDING
plant DESCENDING .
Now data in t_final is as follows---
state plant qty
20 1015 10
20 1015 8
20 1001 5
25 1555 100
25 1555 100
25 1550 88
23 1441 86
i need the 1st record every state and plant which should look as follows.
state plant qty
20 1015 10
25 1555 100
23 1441 86
above should be the data in the t_final.
How can i do this, please help.
Thanks and Regards,
Akash Rana
09-10-2009 4:41 PM
09-10-2009 4:38 PM
Use this statement after your sort.
Delete adjacent duplicates from t_final1 comparing state.
09-10-2009 4:40 PM
Dear Friend,
i did the same but some duplicate records also get completely deleted so this is not resolving the issue.
Thanks
Akash Rana
09-10-2009 4:41 PM
09-10-2009 5:15 PM
Dear Kartik,
Still i have many other records of the same state....i just need the first record of every state.
Regards,
Akash Rana
09-10-2009 5:23 PM
Loop the internal table you at new state command and move the first row to a separate internal table.... I believe this works.
09-10-2009 5:27 PM
Dear Kartik,
I did exactly u wrote but my field stateis placed in between internal table its in 7th column,
So i am getting duplicate entries in the other internal table in which i am apending the wa at
"AT new "
also fields after state gets append as ************ according to the length.
Regards,
Akash Rana
09-10-2009 5:39 PM
use on change of STATE. using at new etc events puts * in all other fields after the chosen field.
Edited by: Prakash Sethia on Sep 10, 2009 6:40 PM
09-10-2009 5:41 PM
Hi,
Try this.
sort t_final1 by state ASCENDING
plant DESCENDING .
Define a variable ws_state similar to the data type of t_final1-state.
clear ws_state.
loop at t_final1 into wa_final1.
if ws_state = wa_final1-state.
delete t_final1.
continue.
else.
ws_state = wa_final1-state.
endif.
endloop.
Regards,
Subramanian
09-10-2009 5:44 PM
Thanks Subramanian PL
i had already done similar to your resolution...my issue got resolved.
Thanks a lot.
Regards,
Akash Rana