‎2008 May 20 12:46 PM
Hi Expert,
I have the following problem. I have in flat file the Column1, and I need write the column2. I need the number 1 with 10 only once, the number 1 with 11 only once, the number 1 with 12 only once, the number 1 with 13 only once, the number 1 with 14 only once......
Column1---- -
Column2
10----
1
10----
0
10----
0
11----
1
12----
1
12----
0
13----
1
13----
0
13----
0
13----
0
13----
0
14----
1
14----
0
14----
0
Is there any routine?
Can you help me please?
Thanks
‎2008 May 21 5:40 AM
Hi,
REPORT z_example NO STANDARD PAGE HEADING .
data : begin of itab occurs 0,
col1(2) ,
col2(2) ,
end of itab.
itab-col1 = 10.
append itab.
itab-col1 = 10.
append itab.
itab-col1 = 11.
append itab.
itab-col1 = 11.
append itab.
itab-col1 = 12.
append itab.
itab-col1 = 12.
append itab.
itab-col1 = 13.
append itab.
itab-col1 = 13.
append itab.
sort itab by col1.
loop at itab.
on change of itab-col1.
itab-col2 = 1.
modify itab.
else.
itab-col2 = 0.
modify itab.
endon.
endloop.
loop at itab.
write:/ itab-col1,
itab-col2.
endloop.
Plz rewards points if helpful,
Ganesh.
‎2008 May 20 12:48 PM
Hi,
DO this,
sort itab by column1.
loop at itab.
s_itab = itab.
at new of column1.
write s_itab-column2.
endat.
endloop
Cheers.
...Reward if useful.
‎2008 May 20 12:51 PM
hi
try like this
after uploading data into your internal table
sort itab by col1.
METHOD 1
loop at itab.
on change of itab-col1.
itab-col2 = 1.
modify itab.
endon.
endloop.
METHOD 2 " take care col 1 must be the first field
loop at itab.
at new col1.
itab-col2 = 1.
modify itab.
endat.
endloop.
reward if helpful
prasanth
‎2008 May 20 12:53 PM
Hi,
i think u can try this,
use AT NEW statement.
AT NEW of column1.
column2 = 1.
ENDAT.
Regards,
kk.
‎2008 May 20 1:06 PM
Hi,
As the number 10 is repeated, I need put 1 only once. If number 10 appear again put 0.
Can you help me please??
Thanks for your answer.
‎2008 May 21 5:13 AM
hi,
sort itab by col1.
loop at itab.
on change of itab-col1.
itab-col2 = 1.
modify itab.
else.
itab-col2 = 0.
modify itab.
endon.
endloop.
waiting for your reward
prasanth
‎2008 May 21 5:40 AM
Hi,
REPORT z_example NO STANDARD PAGE HEADING .
data : begin of itab occurs 0,
col1(2) ,
col2(2) ,
end of itab.
itab-col1 = 10.
append itab.
itab-col1 = 10.
append itab.
itab-col1 = 11.
append itab.
itab-col1 = 11.
append itab.
itab-col1 = 12.
append itab.
itab-col1 = 12.
append itab.
itab-col1 = 13.
append itab.
itab-col1 = 13.
append itab.
sort itab by col1.
loop at itab.
on change of itab-col1.
itab-col2 = 1.
modify itab.
else.
itab-col2 = 0.
modify itab.
endon.
endloop.
loop at itab.
write:/ itab-col1,
itab-col2.
endloop.
Plz rewards points if helpful,
Ganesh.