Skip to Content
0
Former Member
Apr 21, 2010 at 07:29 AM

Add a counter

65 Views

Hi guru good morning

I should add a counter when filed key change starting to 1

examaple like this

count Matr

001 0009901010

001 0009601125

002 0009601125

001 95065-001

002 95065-001

003 95065-001

001 789745400

I tried with this abap code but I are new yet

DATA: BEGIN OF lt_nast OCCURS 0,

count(3) TYPE n VALUE 0,

objky LIKE nast-objky,

END OF lt_nast.

DATA: BEGIN OF lt_nast_temp OCCURS 0.

INCLUDE STRUCTURE lt_nast.

DATA: END OF lt_nast_temp.

*

LOOP AT lt_nast.

*

lt_nast_temp-objky = lt_nast-objky.

lt_nast_temp-count = 0.

*

AT END OF objky.

lt_nast_temp-count = lt_nast_temp-count + 001.

ENDAT.

APPEND lt_nast_temp.

ENDLOOP.

Thanks a lot