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

counter

Former Member
0 Likes
879

I need to start a counter

counter ++ does not work

any other way to assign it besides count = count + 1 ?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
762

No, that is the way to code unlike C language. You can use statements like ADD 1 TO counter.

5 REPLIES 5
Read only

Former Member
0 Likes
762

Hi,

What is wrong with this code?


data: count type i.

loop at itab.
  count = count + 1.
endloop.

Please paste your code ....

Regards,

Ferry Lianto

Read only

Former Member
0 Likes
762

nothing wrong

just wondering if there is another way to do it

Read only

Former Member
0 Likes
763

No, that is the way to code unlike C language. You can use statements like ADD 1 TO counter.

Read only

0 Likes
762

Hi Megan, there is nothing like that in ABAP as of yet. But you can simulate it using a macro. AGain the use of special characters such as ++ is not suggested(it will give a syntax warning).




report zrich_0001 .


data: counter type i.


define counter++.
  counter = counter + 1.
end-of-definition.


do 10 times.

   counter++.

enddo.


write:/ counter.

Regards,

Rich HEilman

Read only

former_member194669
Active Contributor
0 Likes
762

Hi,


data: begin of numbers,
        one   type i value 1,
        two   type i value 1,
      end   of numbers,
      counter type i.

add numbers-one then  numbers-two until numbers-two to counter.

aRs