‎2008 Aug 29 9:40 AM
Hi
I am using the below code the collect the sum of the fields H_RECIPTS and H_PAYMENTS into w_oreceipts, w_opayments.
Can you tell what is the problem with the below code as it does not give the sum, its just blank at runtime..
I checked whether there was any data with the below selection and found entries in TCJ_DOCUMENTS but the summation does not show up..
SELECT SUM( h_receipts ) SUM( h_payments )
INTO (w_oreceipts, w_opayments)
FROM tcj_documents
WHERE comp_code = p_bukrs
AND cajo_number = wa_tcjdocs-cajo_number
AND document_date < s_date-low.
‎2008 Aug 29 9:48 AM
Hi,
u can't use up to two SUM of vriable's content.
Use following types.......it may be useful to u.
SELECT SUM( h_receipts )
INTO (w_oreceipts)
FROM tcj_documents
WHERE comp_code = p_bukrs
AND cajo_number = wa_tcjdocs-cajo_number
AND document_date < s_date-low.
SELECT SUM( h_payments )
INTO ( w_opayments)
FROM tcj_documents
WHERE comp_code = p_bukrs
AND cajo_number = wa_tcjdocs-cajo_number
AND document_date < s_date-low.
Regards
ricky
Edited by: Ricky Maheshwari on Aug 29, 2008 10:48 AM
‎2008 Aug 29 10:17 AM
>
> Hi,
> u can't use up to two SUM of vriable's content
>
>Hi Smith,
>It is not possible to do two summations in one select statement.
Totally wrong, both of you. Of course you can have more than one SUM in the same select statement.
To the OP. The select statement looks ok to me. Are you completely sure that there are non 0 value in the two columns? What do you get when you remove the SUMs and run the query?
‎2008 Aug 29 9:54 AM
Hi Smith,
It is not possible to do two summations in one select statement.
Your code should be slightly modified in the following way.
SELECT SUM( h_receipts )
INTO (w_oreceipts)
FROM tcj_documents
WHERE comp_code = p_bukrs
AND cajo_number = wa_tcjdocs-cajo_number
AND document_date < s_date-low.
SELECT SUM( h_payments )
INTO (w_opayments)
FROM tcj_documents
WHERE comp_code = p_bukrs
AND cajo_number = wa_tcjdocs-cajo_number
AND document_date < s_date-low.
bye
Prasad G.V.K
‎2008 Aug 29 9:59 AM
Hi,
This code is working fine for meee..
tables mara.
data : VOLUM1 type TCJ_DOCUMENTS-H_RECEIPTS,
VOLUM2 type TCJ_DOCUMENTS-H_PAYMENTS.
select sum( H_RECEIPTS ) sum( H_PAYMENTS )
from TCJ_DOCUMENTS
into (VOLUM1,VOLUM2).
write : VOLUM1, VOLUM2.
‎2008 Aug 29 10:09 AM
hi,
I have seen the Entries in the table, Why do u want to do Perform Summation.
Can you breif the Question. how are the entries are in the Table TCJ_DOCUMENTS.
Thanks & Regards,
Deepthi Dandibhotla.
‎2008 Aug 29 10:11 AM
Hi,
You can perform the Summation Seperatly for both H_Receipts and H_Payments.
Thanks & Regards,
Deepthi Dandibhotla.
‎2008 Sep 22 3:52 PM