Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Which Routine is better?

Former Member
0 Likes
710

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......

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

Example:

Column1---- -


Column2

10----


1

10----


0

10----


0

14----


1

19----


1

19----


0

13----


1

13----


0

13----


0

13----


0

13----


0

11----


1

14----


0

14----


0

Is there any routine?

Can you help me please?

Thanks

Thanks.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
693

Loop at itab.

at new column1.

column2 = '1'.

modify itab.

endat.

endloop.

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......

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

Example:

Column1---- -


Column2

10----


1

10----


0

10----


0

14----


1

19----


1

19----


0

13----


1

13----


0

13----


0

13----


0

13----


0

11----


1

14----


0

14----


0

Is there any routine?

Can you help me please?

Thanks

Thanks.

4 REPLIES 4
Read only

Former Member
0 Likes
694

Loop at itab.

at new column1.

column2 = '1'.

modify itab.

endat.

endloop.

Read only

rodrigo_paisante3
Active Contributor
0 Likes
693

Hi,

You are using an internal table, then, loop it and use the AT NEW command.

Regards.

Read only

Former Member
0 Likes
693

Hi,

fist sort the internal table before passing to flat file

sort i_itab by column1 column2.

loop itab into l_itab

at new colum1.

column2 = 1.

continue.

endat.

column2 = 0.

endloop.

Regards,

Sriram

Read only

prasanth_kasturi
Active Contributor
0 Likes
693

Hi Germán López Rodríguez

do the following way,

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.

reward if helpful

prasanth