‎2007 May 23 12:32 AM
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
‎2007 May 23 12:37 AM
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....
‎2007 May 23 12:35 AM
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
‎2007 May 23 12:37 AM
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....
‎2007 May 23 1:02 AM
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 fieldDo let me know if I can be further help on this and reward points if helpful.
Regards,
Ram