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

ABAP statement

Former Member
0 Likes
602

I didnt giev exact requirement.

my requirement

is REGUH table has fields

azbukr ahbkid ahktid avblnr

azaldt aznme1 a~rwbtr

awaers azbnkl a~rzawe

PAYR has fields

bchect bchecf b~gjahr

common fiels is vblnr

reguh can have 10 records and payr will have 10 or less then that.

for example 5.

but i want to extract all the 10 records.

from reguh but additional field check frok payr to be filled in for 5 records.

remaining 5 fields can be empty.

could you help me out

jeff

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
551

You can use LEFT OUTER JOIN between 2 tables.

SELECT azbukr ahbkid ahktid avblnr

azaldt aznme1 a~rwbtr

awaers azbnkl arzawe bchect bchecf bgjahr

INTO TABLE ITAB

FROM REGUH AS A

LEFT OUTER JOIN PAYR AS B

ON AVBLNR = BVBLNR.

WHERE....

3 REPLIES 3
Read only

Former Member
0 Likes
551

Hi jeff,

Just change the query given by Seshu as below.

tables : REGUH,

PAYR .

data : begin of itab occurs 0,

zbukr like reguh-zbukr,

hbkid like reguh-hbkid,

hktid like reguh-hktid,

vblnr like reguh-vblnr,

CHECT like payr-CHECT,

end of itab.

start-of-selection.

select azbukr ahbkid ahktid avblnr

b~chect into table itab

from reguh as a <b>LEFT OUTER JOIN</b> payr as b on bvblnr = avblnr.

Reward points if useful.

Regards,

Atish

Message was edited by:

Atish Sarda

Read only

Former Member
0 Likes
552

You can use LEFT OUTER JOIN between 2 tables.

SELECT azbukr ahbkid ahktid avblnr

azaldt aznme1 a~rwbtr

awaers azbnkl arzawe bchect bchecf bgjahr

INTO TABLE ITAB

FROM REGUH AS A

LEFT OUTER JOIN PAYR AS B

ON AVBLNR = BVBLNR.

WHERE....

Read only

former_member214288
Participant
0 Likes
551

Hi Jeff,

Resulting set for outer join

The outer join basically creates the same resulting set as the inner join, with the difference that at least one line is created in the resulting set for every selected line on the left-hand side, even if no line on the right-hand side fulfils the join_cond condition. The columns on the right-hand side that do not fulfil the join_cond condition are filled with null values.

Your query should be something like this.

SELECT a~zbukr a~hbkid a~hktid a~vblnr
       a~zaldt a~znme1 a~rwbtr
       a~waers a~zbnkl a~rzawe  
       b~chect b~checf b~gjahr
from REGUH as a 
LEFT OUTER JOIN PAYR as b on a~vblnr = b~vblnr
 AND a~XXXXX = restriction field

Do let me know if I can be further help on this and reward points if helpful.

Regards,

Ram