2008 Jan 05 9:23 AM
Dear all
Due to some urgent requirement I have to replace an outer join with separate queries.
Kindly help me in replacing an outer join with separate database queries.
I have tried a number of options but I need some experts' advice before proceeding with the changes.
Regards
Dinesh
2008 Jan 05 9:33 AM
Take 2 itabs itab1, itab2.
itab2 contains fields from both from tab1 and tab2.
Read Data into itab1 from table1 (into corrsponding fields).
Read Data into itab2 from table2 for all entries in itab1 using key (into corrsponding fields).
awrd oints if useful
Bhupal
Dear all
Due to some urgent requirement I have to replace an outer join with separate queries.
Kindly help me in replacing an outer join with separate database queries.
I have tried a number of options but I need some experts' advice before proceeding with the changes.
Regards
Dinesh
2008 Jan 05 9:33 AM
Take 2 itabs itab1, itab2.
itab2 contains fields from both from tab1 and tab2.
Read Data into itab1 from table1 (into corrsponding fields).
Read Data into itab2 from table2 for all entries in itab1 using key (into corrsponding fields).
awrd oints if useful
Bhupal
2008 Jan 05 9:34 AM
Hi,
Could u plz post ut outer join query?
or if u know 'FOR ALL ENTRIES' option then u can try.
Regards,
Rajesh Akarte
2008 Jan 05 9:37 AM
Hi Dinesh,
let us assume there are two database tables say DB1 and DB2 .DB1 contain 6 records and DB2 contain 5 records.And also assume u r having two internal tables say ITAB1 and ITAB2.
First we have to select the records form the DB1 table and place them in ITAB1 OK..
Next we have to apply FOR ALL ENTRIES condition on ITAB1.Then ur problem will be resolved.
i will send sample code check it once..
select * from DB1 INTO CORRESPONIDNG FILEDS OF ITAB1.
select * from DB2 into corresponding fileds of ITAB2
FOR ALL ENTRIES IN ITAB1
where vbeln = ITAB1-VBELN..
U HAVE TO GO FOR UR OWN WHERE CLAUSE OK...
For understanding purpose i will take VBELN filed.
Award points if helpful..
Kiran Kumar.G
Have a Nice Day.
2008 Jan 05 9:57 AM
Hi,
Consider u r select statement:-
SELECT AMATNR BWERKS FROM MARA AS A OUTERJOIN MARC AS B
INTO ITAB ON MATNR IN S_MATNR.
INSTEAD OF ABOVE:-
SELECT MATNR FROM MARA INTO TABLE ITAB1.
THEN
SELECT MATNR WERKS FROM MARC FOR ALLENTRIES IN ITAB2 INTO TABLE ITAB2 WHERE MATNR = S_MATNR.
THEN
LOOP AT ITAB1 INTO WAITAB1.
WAITAB3-MATNR = WAITAB1-MATNR.
READ TABLE ITAB2 INTO WAITAB2 WHERE MATNR = WAITAB1-MATNR.
IF SY-SUBRC = 0.
WAITAB3-WERKS = WAITAB2-WERKS.
ENDIF.
APPEND WAITAB3 TO ITAB3.
ENDLOOP.
2008 Jan 20 9:27 AM
It didn't work out as expected.
Edited by: dinesh dhiman on Jan 21, 2008 2:14 PM
2008 Jan 21 8:34 AM
The answer posted later was a little more helpful. So realligning points
2008 Jul 12 12:03 PM
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |