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

USING COUNT(*)

Former Member
0 Likes
734

Any ideas why the below select would always return a count of 0 in the count column. Data is being returned and appears to be group;ed correctly but the count equals 0.

BEGIN OF t_dups2,

zuonr TYPE DZUONR,

dmbtr TYPE dmbtr,

count TYPE i,

END OF t_dups2.

SELECT zuonr dmbtr COUNT( * )

INTO CORRESPONDING FIELDS OF TABLE git_dups2

FROM zfi_dups

WHERE BUKRS in s_bukrs

AND gjahr in s_gjahr

GROUP BY zuonr dmbtr.

1 ACCEPTED SOLUTION
Read only

ThomasZloch
Active Contributor
0 Likes
698

Try dropping "CORRESPONDING FIELDS OF", as this requires identical field names which is not the case here.

Thomas

5 REPLIES 5
Read only

ThomasZloch
Active Contributor
0 Likes
699

Try dropping "CORRESPONDING FIELDS OF", as this requires identical field names which is not the case here.

Thomas

Read only

Former Member
0 Likes
698

you are not using occurs o clause in your begin statement of internal table declaration.

Regds,

Anil

Read only

huseyindereli
Active Contributor
0 Likes
698

try using this.

SELECT zuonr dmbtr COUNT( * ) AS count

INTO CORRESPONDING FIELDS OF TABLE git_dups2

FROM zfi_dups

WHERE bukrs IN s_bukrs

AND gjahr IN s_gjahr

GROUP BY zuonr dmbtr.

Read only

Former Member
0 Likes
698

Hi,

Please go for F1 help on the select statement and you will get to know how to fetch the count along with the fieds... You have some sample programs there to help you..

Read only

Former Member
0 Likes
698

hi,

try this:

SELECT zuonr dmbtr COUNT( * )

INTO TABLE git_dups2

FROM zfi_dups

WHERE BUKRS in s_bukrs

AND gjahr in s_gjahr

GROUP BY zuonr dmbtr.

regards, darek