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

SQL Query Help

Former Member
0 Likes
451

Hello All,

I am quite an experienced consultant, but for the love of god I can't figure this out...

I have this query

select avbeln bvbeln cvbeln dvbeln into table gt_output

from vbak as a "master contract

join vbak as b "inquiry

on bvgbel = avbeln

join vbak as c "quotation

on cvgbel = bvbeln

join vbak as d "debit memo

on dvgbel = cvbeln

WHERE a~vbeln in s_mc

and b~vbeln in s_inq

and c~vbeln in s_quo

and d~vbeln in s_deb

and a~trvog eq '4'.

Now table C has 23 entries so I would assume that my internal table will have 23 lines. I know table a, b and d bring back one entry... And the output right now is 1 line... How can I rectify this without splitting the query into several for all entries (because the selection screen has 4 options and anyone of them can be chosen or not)

Note that there are 4 different doc types, and each one is related vgbel = vbeln so i know my query is semi-right as the 1 line it brings back is correct, just there should be more lines!!

Thanks in advance.

1 ACCEPTED SOLUTION
Read only

former_member156446
Active Contributor
0 Likes
417

did you try outer join?

2 REPLIES 2
Read only

former_member156446
Active Contributor
0 Likes
418

did you try outer join?

Read only

Former Member
0 Likes
417

done