2006 Aug 07 10:38 AM
Hello,
I need to join a subquery in ABAP but do not know how to do this. Maybe someone can help me.
Example:
select mmatnr sal*
INTO CORRESPONDING FIELDS OF TABLE xxx
from mara as m
join (
SELECT SUM( ewmeng ) AS best SUM( ebmeng ) AS assi a~matnr AS matnr
FROM vbep AS e
INNER JOIN vbap AS a
ON avbeln = evbeln AND aposnr = eposnr
GROUP BY a~matnr
) as sal
on mmatnr = salmatnr.
This is just a simplified example. I know, I could join all three tables here.
In the bigger example, the results should look like this
material # best assi XXXX
111 10 5 abcde
111 10 5 cdefg
112 5 5 ahftw
112 5 5 jagre
...
Thanks for any help!
2006 Aug 07 10:44 AM
Hello,
I need to join a subquery in ABAP but do not know how to do this. Maybe someone can help me.
Example:
select mmatnr sal*
INTO CORRESPONDING FIELDS OF TABLE xxx
from mara as m
join (
SELECT SUM( ewmeng ) AS best SUM( ebmeng ) AS assi a~matnr AS matnr
FROM vbep AS e
INNER JOIN vbap AS a
ON avbeln = evbeln AND aposnr = eposnr
GROUP BY a~matnr
) as sal
on mmatnr = salmatnr.
This is just a simplified example. I know, I could join all three tables here.
In the bigger example, the results should look like this
material # best assi XXXX
111 10 5 abcde
111 10 5 cdefg
112 5 5 ahftw
112 5 5 jagre
...
Thanks for any help!
2006 Aug 07 10:44 AM
2006 Aug 07 10:59 AM
Hello MB
As I can check from your query you wish to list the material number and sal table contents as your output but I would just to use your sub query as the result since does have the material number...do you have any other information required from material master ?
Regards
Anurag
2006 Aug 07 12:08 PM
Hello,
thanks for your reply. I know, I could get the material number from this query. This is just an example. The SQL that I want tu build uses 5 tables. I have to join 4 of them with a grouped expression like in my example.
So I would like to use a subquery, group and sum up some fields in there and join it to the other 4 tables.
Best regards,
MB
2021 Nov 26 11:23 AM
In which ABAP version sub query is allowed as I am getting select is invalid here(due to grammer)
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |