Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

How to count the per group-entries and put them in the new table

Hello Guru,

I want to sort the table cdhdr.

for example :

SELECT objectclas objectid changenr *******

INTO TABLE cdhdr_data

FROM cdhdr

WHERE ( ********) AND

objectclas = i_objectclas

*******.

The problem that I need to order the table by objectclas and objectid.

Let say objectclas is always MATERIAL.

Let's assume our key is changenr. May be our key will change to "objectclas objectid".

So, my problem that I need to get the number of the same "objectid" with different "changenr".

And also I need to put the count number of each object id with different changenr in the table cdhdr_data.

For example

objectclas objectid changenr count

MATERIAL 00***001 1 3

MATERIAL 00***001 4 3

MATERIAL 00***001 7 3

MATERIAL 00***005 2 2

MATERIAL 00***005 6 2

MATERIAL 00***003 5 2

MATERIAL 00***003 3 2

So later I'm going to use it.

LOOP AT cdhdr_data FROM sy-tabix TO ( sy-tabix + cdhdr_dat ( sy-tabix ) + count - 1 )

***

some optimized cdpos processing

**

IF entry found.

*don't loose time

*change the boundery

  • sy-tabix = count

ENDIF.

ENDLOOP.

Best Regards,

Kais

Tags:
Former Member
Not what you were looking for? View more on this topic or Ask a question