06-02-2006 7:21 AM
Hi All,
Is it possiblt to Inner Join one Data Base Table and One Internal table.
In my case in a EXIT i will have XVBAP I.Table & VBEX D.B.Table common condition will be VBELN & POSNR.
Can i do the Inner Join both to pick up all the entries from VBEX. From there i need to fetch VBEX-ALNUM, VBEX-EMBGR, VBEX-GENNR, XVBAP-NETWR.
Is it possible by inner join.
Or there is any other way to join.
Thanks in advance.
Thanks & Regards,
Prasad.
06-02-2006 7:37 AM
Hi Prasad,
Try this code(PSEDO).
Select ALNUM EMBGR GENNR
into corrspondig fields of table t_vbex
FROM VBEX
for all entries in XVBAP
WHERE VBELN = XVBAP-VBELN
AND POSNR = XVBAP-POSNR.
IF SY-SUBRC = 0 .
LOOP AT T_VBEX .
READ TABLE XVBAP WITH KEY VBELN = T_VBEX-VBELN POSNR = T_VBEX-POSNR.
IF SY-SUBRC = 0 .
T_VBEX - NETWR = XVBAP-NETWR .
MODIFY T_VBEX .
ENDIF.
ENDLOOP.
<i>Hope This Info Helps YOU.</i>
Regards,
Raghav
06-02-2006 7:23 AM
Hi prasad,
1. FOR ALL ENTRIES
2. We do this using this syntax.
3. select * from DBTABLE
FOR ALL ENTRIES IN ITAB
where dbfield1 = itab-fieldA
and dbfield2 = itab-fieldB.
regards,
amit m.
06-02-2006 7:25 AM
Why can't you loop at the internal table and fire a SELECT on the table with whatever condition you want, it is as good as inner join.
As such inner join between internal table and DB table is not possible.
Regards,
Ravi
06-02-2006 7:36 AM
Hi,
its not possible to inner join a ITAB and DBTABLE.
go for For all entries as amit said.
if XVBAP not inital.
select fields
from VBEX
into itab
for all entries in XVBAP
where 'condition'.
end if.
dont go for select inside loop as it will be a performance problem.
rgds,
latheesh.
Message was edited by: Latheesh Kaduthara
06-02-2006 7:37 AM
Hi Prasad,
Try this code(PSEDO).
Select ALNUM EMBGR GENNR
into corrspondig fields of table t_vbex
FROM VBEX
for all entries in XVBAP
WHERE VBELN = XVBAP-VBELN
AND POSNR = XVBAP-POSNR.
IF SY-SUBRC = 0 .
LOOP AT T_VBEX .
READ TABLE XVBAP WITH KEY VBELN = T_VBEX-VBELN POSNR = T_VBEX-POSNR.
IF SY-SUBRC = 0 .
T_VBEX - NETWR = XVBAP-NETWR .
MODIFY T_VBEX .
ENDIF.
ENDLOOP.
<i>Hope This Info Helps YOU.</i>
Regards,
Raghav
06-02-2006 8:21 AM
06-02-2006 8:27 AM