07-31-2009 6:56 AM
Hi,
select sum( a~dmbtr )
into o_debit
from bsik as A inner join FAGLFLEXA as B
on abukrs = bRBUKRS
and agjahr = bRYEAR
and abelnr = bdocnr
where a~bukrs = x_bukrs
and a~lifnr = p_lifnr
and a~shkzg = 'S'
and a~budat in s_budat
and a~hkont gt '0000000000'
and a~hkont le '9999999999'
and b~prctr = p_prctr.
Above query is not giving result in o_debit though data is available in both the table. Please guide me, if I have written something wrong.
08-01-2009 6:31 AM
07-31-2009 7:05 AM
Check your where clause values whether it matches the table values.. i thin something may be wrong with the values in where clause
07-31-2009 7:07 AM
Where caluse values are correct. My problem is with Select Statement. Without inner join it is providing me the value. Can I use SUM() functionality with inner join.
08-01-2009 6:31 AM
08-01-2009 6:38 AM
Hi, Raj.
Test the following Sample It is working fine for me hope will work for you too, I did some little change.
TYPES: BEGIN OF ty_test,
dmbtr LIKE bsik-dmbtr,
END OF ty_test.
DATA: it_test TYPE STANDARD TABLE OF ty_test WITH HEADER LINE.
SELECT SUM( a~dmbtr ) as dmbtr
INTO CORRESPONDING FIELDS OF TABLE it_test
FROM bsik AS a INNER JOIN faglflexa AS b ON ( a~bukrs = b~rbukrs AND a~gjahr = b~ryear AND a~belnr = b~docnr )
WHERE a~bukrs = x_bukrs
AND a~lifnr = p_lifnr
AND a~shkzg = 'S'
AND a~budat IN s_budat
AND a~hkont GT '0000000000'
AND a~hkont LE '9999999999'
AND b~prctr = p_prctr.
Please Reply if still any Issue,
Best Regards,
Faisal
08-01-2009 7:25 AM
08-01-2009 7:54 AM
Hi, Raj
Please Remove the Where Conditions and try again i think data is not available according to your conditions.
Only use the following line of Code with out where conditions.
TYPES: BEGIN OF ty_test,
dmbtr LIKE bsik-dmbtr,
END OF ty_test.
DATA: it_test TYPE STANDARD TABLE OF ty_test WITH HEADER LINE.
SELECT SUM( a~dmbtr ) as dmbtr
INTO CORRESPONDING FIELDS OF TABLE it_test
FROM bsik AS a INNER JOIN faglflexa AS b ON ( a~bukrs = b~rbukrs AND a~gjahr = b~ryear AND a~belnr = b~docnr ).
Please Reply Back if any problem,
Best Regards,
Faisal
08-01-2009 7:54 AM
Thanks Faisel, The query is working perfectly. Thanks for helping me.