‎2007 Apr 10 6:55 AM
hi everyone
1) I have to make a INNERJOIN on "MKPF AND MSEG" table to select the fields from both tables into one "INTERNAL TABLE" but there is no relationship exist between these two tables
plz help how i can do it
Thanks
with regards
surity for points
‎2007 Apr 10 6:59 AM
Hi,
Select amblnr amjahr bzeile bbwart bebeln bebelp b~erfmg
into table ITAB
from mkpf as a join MSEG as b on
amblnr = bmblnr and
amjahr = bmjahr
where a~mjahr = p_year
b~ebeln in S_ebeln..
reward points if useful
regards,
Anji
‎2007 Apr 10 6:57 AM
hi gaurav,
if there is no relation then it is not possible to use inner joins.There should be some relation in between the two tables.
Regards...
Arun.
‎2007 Apr 10 6:58 AM
Hi,
material Document no and year are the link between these tables. MBLNR and MJAHR.
Regards,
‎2007 Apr 10 6:59 AM
Hi,
Select amblnr amjahr bzeile bbwart bebeln bebelp b~erfmg
into table ITAB
from mkpf as a join MSEG as b on
amblnr = bmblnr and
amjahr = bmjahr
where a~mjahr = p_year
b~ebeln in S_ebeln..
reward points if useful
regards,
Anji
‎2007 Apr 10 7:00 AM
Hi,
In both tables MBLNR was common field.U can use this field in inner join to get relationship between these two tables.
pls give reward if it helpful
Thanks
vana
‎2007 Apr 10 7:00 AM
Hi,
MKPF is the header table for material documents, whereas MSEG is the item table for material documents. You can very well join these two tables.
Please check the key fields in the MKPF table, MBLNR and MJAHR.
These two fields are also the key fields in MSEG table apart from the third field ZEILE(Item number).
Therefore, you can make a join based on the key fields of the MKPF table.
Thank you.
reward all useful answers.
‎2007 Apr 10 7:02 AM
Hi,
there is relation between these 2 tables
select based on the material doc no i.e. MBLNR
select aa1 bb1 from mseg as a inner join mkpf as b
on amblnr = bmblnr.
Regards,
Sonika
‎2007 Apr 10 7:02 AM
Hi gaurav,
There are field like MBLNR, MJAHR which are common in both the tables.
Even if some of the field names are not same, if there data element or domain is same u can put inner join condition.
Thanks
Sandeep
Award point if benefited
‎2007 Apr 10 7:05 AM
‎2007 Apr 10 7:10 AM
gaurav,
Query:
select smblnr smjahr sbwart smatnr swerks smenge
appending corresponding fields of table t_mseg
from mseg as s inner join mkpf as k
on smblnr = kmblnr and
smjahr = kmjahr
where
conditions....
PLs. reward if useful..
‎2007 Apr 10 7:11 AM
use select query like this
select mkpf----
into table itab from mkpf inner join mseg on mkpfmblnr = msegmblnr where -
‎2007 Apr 10 7:47 AM
thanks to everybody for your help but i got struck in another problem related to "where condition"
1) i have to select mblnr , mjahr and budat from MKPF into itab (internal table) for user input in the selection screen
+++(Inner join)
select zeile,bwart,matnr,werks,lgort,charg,sobkz,erfmg,erfme,kzbew,kzvbr,kzzug,shkzg from MSEG into itab(internal table) for user input in the selection screen
2) now i got confused in "For user input in the selection screen " because at selection screen i have only following fields
matnr , werks , lgort,charg,lifnr,kunnr,bwart,sobkz,usnam,vgart.
and i am using a query like this
select a-mblnr
a-mjahr
a-budat
b-zeile
b-bwart
b-matnr
b-werks
b-lgort
b-charg
b-sobkz
b-erfmg
b-erfme
b-kzbew
b-kzvbr
b-kzzug
b-shkzg into table t_mat_data from mkpf
as a join mseg as b on a-mblnr = b-mblnr
and a-mjahr = b-mjahr
where .....................
so wat should i written in Where condition plz reply
thanks
points will be awarded
‎2007 Apr 10 7:52 AM
Hi,
In the where condition
write
where a~matnr in s_matnr(if it is selection screen option)
and in the same way other fileds from select options
Go through the SAP help on select query fot better understanding
Regards,
Sonika