Application Development and Automation 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: 
Read only

inner join condition help

Former Member
0 Likes
832

i want to join two table where project number is equal to project no with concantate number 999.

for eg.

select * from proj as a

inner join Prsp as b

on bposid = aposid+'999'

into table ittab where invl=inventoryno

any suggestion.

6 REPLIES 6
Read only

Former Member
0 Likes
795

First select data from PROJ and collect in internal table(Itab) than do concatenate ITAB-POSID with 999 and store in internal table in different field(temp) than use 'for all entries' with itab-tamp while selecting data from PRSP with condition posid = itab-temp.

Read only

0 Likes
795

Well, I'm not sure, Would you please provide an example.

two table only matching project from one table in another table with value concantate 999.

Read only

Former Member
0 Likes
795

hi,

You can first select the data from proj into 1 internal table and then concatenate proj number with 999 into a variable and then select data from prps by using for all entries for first itab.

thanks

Read only

Former Member
0 Likes
795

Hi

Try using

Select * from PROJ into table it_tab1.

loop at it_tab1 into wa_tab1.

CONCATENATE wa_tab1-posid '999' into wa_tab1-posid.

modify it_tab1 from wa_tab1.

endloop.

select * from PRPS into table it_tab2

for all entries in it_tab1

where posid = it_tab1-posid.

Regards,

Harshada

Read only

Former Member
0 Likes
795

>

> i want to join two table where project number is equal to project no with concantate number 999.

>

> for eg.

>

> select * from proj as a

> inner join Prsp as b

> on bposid = aposid+'999' <===

> into table ittab where invl=inventoryno

>

> any suggestion.

Hi Prabha,

Let me tell you one thing...

PROJ table is not having the field POSID itself...

> select * from proj as a

> inner join Prsp as b

> on bposid = aposid+'999' <=== Here what I can see is There is No POSID field in table PROJ

> into table ittab where invl=inventoryno

If you want to Join PROJ and PRPS u can link it through fields PROJ-PSPNR and PRPS-PSPHI

Please have a look at the tables and fileds and the records(DATA) once more...

Hope it will solve your problem..

Thanks & Regards

ilesh 24x7

Read only

Former Member
0 Likes
795

see this folloiwng example herer two table KNA1 AND KNVP AND FETCH ALL RECORD WHERE BOTH KUNNR IS SAME

select single name1 a~kunn2

into (itab-agent , itab-pcode)

from knvp as a

inner join kna1 as b

on akunn2 = bkunnr

where a~kunnr = itab-kunag and

a~vkorg = itab-vkorg and

a~vtweg = itab-vtweg and

a~spart = itab-spart and

a~parvw = 'PC'.