Application Development 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: 

Regarding Inner Join

Former Member
0 Kudos

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.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

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

6 REPLIES 6

Former Member
0 Kudos

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.

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi,

I think it's better to use FOR ALL ENTRIES statement.

You can read this , as a sample for using FOR ALL ENTRIES statement.

Regards,

0 Kudos

use <b>FOR ALL ENTRIES</b> that would be better...