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

SUM in select query

former_member671224
Participant
0 Likes
6,825

Hi all,

Im need to sum the amount for same company, account, document number and posting key. and my select query is as below;

SELECT bukrs
                   hkont
                   gjahr
                   belnr
*              buzei
                   bschl
                   sum( dmbtr ) as amount
              into CORRESPONDING FIELDS OF TABLE t_recs1
              from BSIS
              where bukrs = bukrs
                and hkont = saknr
                and ( bschl = lc_debit_asset or
                      bschl = lc_credit_asset )
              GROUP BY bukrs hkont gjahr belnr bschl
              order BY bukrs hkont gjahr belnr bschl.

But the amount (DMBTR) is displaying as 0.00 though the amount exist in table BSIS.

Can someone hlep mein this?

Thanks,

Amal

7 REPLIES 7
Read only

Former Member
0 Likes
2,052

and the sy-subrc is 0?

Read only

0 Likes
2,052

Yes.

SY-SUBRC = 0 and also Im getting all other fields as expected except DMBTR.

Thanks,

Amal

Read only

0 Likes
2,052

Field DMBTR might be blank for all the fetched records.

Read only

0 Likes
2,052

I checked in table and its having some value (other than zero ) for DMBTR.

Thanks,

Amal

Read only

0 Likes
2,052

Hi Amal,

you fetch it AS amount, so the data are stored in field amount of your internal table t_recs1. Hope this field exists.

Regards,

Clemens

Read only

Former Member
0 Likes
2,052

hi amal,

have you checked that amount field is present in t_recs1 table

also check the data type you have defined the amount field as.Is it integer or is it TYPE dmbtr.

i think it should be integer.

hope this will help you

thanks

Tanmaya

Read only

0 Likes
2,052

Hi Tanmaya,

thank you for repeating my post.

Regards,

Clemens