cancel
Showing results for 
Search instead for 
Did you mean: 

abap routine code please

Former Member
0 Kudos

i have ods which has field called counter. i want to incremnet counter whenever i read records . so i am planing to put this code in DTP updated routine.

so my counter field : zcnt

please provide me some code

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

do your work by yourself. In case you are facing issues come back and ask. But asking others to do your job is against the rules in here --> see also the rules of engagement.

Siggi

Former Member
0 Kudos

i don't know abap code.

can we add like add 1 to zcnt?

what is the code to add number in abap?

Former Member
0 Kudos

counter = 1.

Loop at <itab>.

indx = sy-tabix.

itab-<counter field name> = counter.

modify itab index indx.

counter = counter + 1.

ENDLOOP.

However, if you have multiple data packets (if you look in the PSA, you see multiple packages), counter will reset for each packet and it gets much more complicated -- as in my brain starts to hurt when I have to think about all of the overhead necessary to come up with a counter across multiple packets.

Brian

Former Member
0 Kudos

Thanks Brain. My counter field is in Target ods. you think i can put this code in DTP ..?

what is <ITAB> means here?

Loop at <itab>.

indx = sy-tabix.

itab-<counter field name> = counter.

modify itab index indx.

counter = counter + 1.

Former Member
0 Kudos

<itab> stands for the name of the internal table you want to loop through.

If you don't know abap, this will be challenging.

Brian

Former Member
0 Kudos

is this can be coded in DTP transformation routine?

former_member207028
Contributor
0 Kudos

Hi,

yes, this code can be implemented in Transformations of that perticular keyfigure which you want to calculate Counter value.

Regards

Daya Sagar

Answers (0)