2007 Jun 19 11:15 AM
hi experts,
i have many items and many values for those items .but i want to take the first value of each item in an internal table .
example
item1 100
item1 50
item1 200
item2 300
item2 100
i want to take
item1 100
item2 300
what is the code for it .
at new item.it is not printing the value.what to do ?
2007 Jun 19 12:04 PM
Hi,
Sort itab by item
At new item
read table itab with key item = xxxx binary search.
Don't forget to reward if useful...
hi experts,
i have many items and many values for those items .but i want to take the first value of each item in an internal table .
example
item1 100
item1 50
item1 200
item2 300
item2 100
i want to take
item1 100
item2 300
what is the code for it .
at new item.it is not printing the value.what to do ?
2007 Jun 19 11:18 AM
Hi,
U can use like this,
loop at <itab1>.
loop at <itab2> upto 1 row.
...
endloop.
endloop.
Regards,
Padmam.
2007 Jun 19 11:20 AM
hi,
here ATNew doesnt work out.
U can go for ON CHANGE OF FIELD1.
Revert back if any issues,
Reward with points if helpful ,
Regards,
Naveen
2007 Jun 19 11:21 AM
hi
for this you can use the control break statement <b>AT NEW</b> or <b>ON CHANGE OF<field1>
</b>
Thanks
Ashu
Message was edited by:
Ashu
2007 Jun 19 11:21 AM
Hello,
Do like this.
data: wa_itab like itab,
itab1 like itab occurs 0 with header line.
sort itab by item.
loop at itab.
wa_itab = itab.
at new item.
move-corresponding wa_itab to itab1.
append itab1.
endat.
endloop.
loop at itab1.
write: itab1-item , itab1-value.
endloop.If useful reward.
Vasanth
2007 Jun 19 11:21 AM
Hi manikandan ,
if u use at new ,the values will not display rather it willl dispaly as ****. to avoid this copy to another work area and then loop it .
reward points if useful
reena
2007 Jun 19 11:23 AM
sort itab by fld1 fld2.
loop at itab.
at new fld1.
read table itab index sy-tabix.
write : itab-fld1 , itab-fld2.
endat.
endloop.
2007 Jun 19 11:23 AM
data : wtab like itab,
ifinal like itab occurs 0 with header line.
sort itab by item.
loop at itab.
move-corresponding itab to wtab.
at new.
append wtab to ifinal.
endat.
endloop.
now check ifinal.
regards
shiba dutta
2007 Jun 19 11:26 AM
sort itab by item .
loop at itab .
At new item.
move itab to itab1.
endat .
endloop.Reward points if it is usefull ..
Girish
2007 Jun 19 11:30 AM
Hi Manikandan,
Kindly check the structure of the table , that meams the field which is storing ITEM1 ITEM2 etc. should be the first field in the table or all the fields which are to the left of the field should change when this field is changing.
You can check in debugging what is exactly happening.
If you do not want to change the structure of the table just sort the table by that field and perform delete adjacent duplicates comparing the same field.
For any further queries please revert back.
Regards,
Saurabh
2007 Jun 19 12:04 PM
Hi,
Sort itab by item
At new item
read table itab with key item = xxxx binary search.
Don't forget to reward if useful...
2007 Jun 19 12:06 PM
hi,
You can use
sort itab by item
ON CHANGE OF ITAB-ITEM.
READ TABLE ITAB WITH KEY ITEM = XXXXX BINARY SEARCH.
ENDON.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |