on ‎2005 Dec 14 3:32 PM
Hello,
I am working with 4 tables - lfa1, lfb1, bsik and bsak.
Initially i have to get 'LIFNR' from 'lfa1' based on some condition for 'BUKRS' in 'lfb1'.
Now, i should use these 'LIFNRs' and look up payments in 'bsik' and 'bsak'. I am stuck in the middle of writing the select statements. My code:
SELECT DISTINCT a~lifnr INTO itab-lifnr
FROM lfa1 AS a INNER JOIN lfb1 AS b ON alifnr = blifnr
WHERE b~bukrs BETWEEN '100' AND '200'.
SELECT DISTINCT clifnr cdmbtr INTO CORRESPONDING FIELDS OF TABLE itab2
FROM bsik AS c INNER JOIN bsak AS d ON clifnr = dlifnr
WHERE cbukrs = dbukrs AND
c~lifnr = itab-lifnr.
itab has field 'lifnr' and itab2 has fields 'lifnr' & 'dmbtr'. After executing these select statements, i am not getting expected output from the second select statement. Can someone tell me where am i going wrong.
Thanks.
Request clarification before answering.
Try this:
select alifnr cshkzg c~dmbtr
from ( ( lfa1 as a inner join lfb1 as b on alifnr = blifnr ) inner join bsak as c on clifnr = blifnr )
into table itab
where b~bukrs between '100' and '200'.
The shkzg is the debit/credit indicator.
Another thing, i dont see the reason why you have to use the lfa1 table at all. If vendor numbers are all you are after then all you need is to get them from lfb1 and use it to get line items from bsak.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.