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: 

Inner Join

Former Member
0 Kudos

Hello,

I've got the following problem in BI 7 :

I've got two tables : CRM_JCDS and TJ30.

In the first one, there are records like :

objnr----


stat

469C4D7D25DD5411E1000000AC1E9ACA E0007

469C4D7D25DD5411E1000000AC1E9ACA I1002

In the second one :

stsma----


estat

ZSTOPAF1 E0001

ZSTOPAF1 E0002

ZSTOPAF1 E0007

I want to join these two tables in order to put in result the status which is the same in the two tables... (the result is : status(5) type c)

But I'm not very good in ABAP.

Someone could give to me the code ?

Cheers,

Vince

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

data:begin of itab occurs 0,"this is an internal table to *hold the datawhich satisfies ur condition

objnr type CRM_JCDS-objnr,

stat type CRM_JCDS-stat,

stsma type TJ30-stsma,

end of itab.

select aobjnr astat bstsma into corresponding fields of itab from CRM_JCDS as a inner join TJ30 as b on astat = b~estat."join condition

write:/ itab-objnr,itab-stat,itab-stsma.

endselect.

<b>reward if helpful</b>

rgds,

bharat.

5 REPLIES 5

Former Member
0 Kudos

Hi,

data:begin of itab occurs 0,"this is an internal table to *hold the datawhich satisfies ur condition

objnr type CRM_JCDS-objnr,

stat type CRM_JCDS-stat,

stsma type TJ30-stsma,

end of itab.

select aobjnr astat bstsma into corresponding fields of itab from CRM_JCDS as a inner join TJ30 as b on astat = b~estat."join condition

write:/ itab-objnr,itab-stat,itab-stsma.

endselect.

<b>reward if helpful</b>

rgds,

bharat.

0 Kudos

Hi Bharat,

In fact the table CRM_JCDS has more records like

objnr----


stat

469C4D7D25DD5411E1000000AC1E9ACA E0007

469C4D7D25DD5411E1000000AC1E9ACA I1002

477777777777777771000000AC1E9ACA E0008

477777777777777771000000AC1E9ACA I1002

477766666666677771000000AC1E9ACA E0007

477766666666677771000000AC1E9ACA I1002

We know still the objnr.

So we must select the good status from CRM_JCDS for the inner join.

Can you do that ?

0 Kudos

Hi,

Try the code below:

data:begin of itab occurs 0,

objnr type CRM_JCDS-objnr,

stat type CRM_JCDS-stat,

stsma type TJ30-stsma,

end of itab.

select aobjnr astat b~stsma

into corresponding fields of table itab

from CRM_JCDS as a inner join TJ30 as b

on astat = bestat

where a~stat+(1) = 'E'.

Loop at itab.

write:/ itab-objnr,itab-stat,itab-stsma.

endloop.

Regards,

Amit

0 Kudos

Hi,

in this condition also the above statement will work

can u explain in more clear way

<b>reward if helpful</b>

rgds,

bharat.

0 Kudos

I would put a condition, but i'm not good in ABAP !!

The good code (for me) is :

SELECT a~stat

INTO statut

FROM crm_jcds AS a

INNER JOIN tj30 AS b

ON astat = bestat

WHERE a~objnr = guid_ds.

ENDSELECT.

Thanks for your help.

Points are assigned.

Cheers,

Vince.