Former Member

# Problem with routine

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?

Thanks

10|10000 characters needed characters exceeded

### Related questions

Former Member
Posted on May 21, 2008 at 04: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.

Ganesh.

10|10000 characters needed characters exceeded
• Former Member
Posted on May 20, 2008 at 11:48 AM

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.

10|10000 characters needed characters exceeded
• Posted on May 20, 2008 at 11:51 AM

hi

try like this

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.

prasanth

10|10000 characters needed characters exceeded
• Former Member
Posted on May 20, 2008 at 11:53 AM

Hi,

i think u can try this,

use AT NEW statement.

AT NEW of column1.

column2 = 1.

ENDAT.

Regards,

kk.

10|10000 characters needed characters exceeded
• Former Member
Posted on May 20, 2008 at 12:06 PM

Hi,

As the number 10 is repeated, I need put 1 only once. If number 10 appear again put 0.

10|10000 characters needed characters exceeded
• 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.