‎2007 Mar 08 6:48 AM
Hi all,
i need to do join between
mkpf and mseg instead of select,
any help will be appreciated.
dana.
my code is:
SELECT MBLNR BLDAT FROM MKPF
into CORRESPONDING FIELDS OF TABLE ITAB_mkpf
WHERE BLDAT >= date. "itab_ekko-bedat.
SELECT MBLNR MJAHR ZEILE BWART MATNR menge LGORT SHKZG EBELN
KOSTL FROM MSEG
into CORRESPONDING FIELDS OF TABLE ITAB_mseg
for all entries in itab_mkpf
WHERE MBLNR = itab_mkpf-mblnr
and ( ( bwart = '351' or bwart = '352'
and ebeln > ebeln )
or ( bwart = '201' or bwart = '202' ) )
and kostl = p_kostl
and lgort = itab_ekko-UNSEZ.
‎2007 Mar 08 6:59 AM
my answer is:
SELECT a~MBLNR
a~BLDAT
b~MBLNR
b~MJAHR
b~ZEILE
b~BWART
b~MATNR
b~menge
b~LGORT
b~SHKZG
b~EBELN
b~KOSTL
FROM MKPF as a
inner join mseg as b
on amblnr = bmblnr
into CORRESPONDING FIELDS OF TABLE ITAB_mkpf_mseg
WHERE a~BLDAT >= date "itab_ekko-bedat.
and ( ( bbwart = '351' or bbwart = '352'
and bebeln > bebeln )
or ( bbwart = '201' or bbwart = '202' ) )
and b~kostl = p_kostl
and b~lgort = itab_ekko-UNSEZ.
Please let me know for anymmore queries
‎2007 Mar 08 6:59 AM
my answer is:
SELECT a~MBLNR
a~BLDAT
b~MBLNR
b~MJAHR
b~ZEILE
b~BWART
b~MATNR
b~menge
b~LGORT
b~SHKZG
b~EBELN
b~KOSTL
FROM MKPF as a
inner join mseg as b
on amblnr = bmblnr
into CORRESPONDING FIELDS OF TABLE ITAB_mkpf_mseg
WHERE a~BLDAT >= date "itab_ekko-bedat.
and ( ( bbwart = '351' or bbwart = '352'
and bebeln > bebeln )
or ( bbwart = '201' or bbwart = '202' ) )
and b~kostl = p_kostl
and b~lgort = itab_ekko-UNSEZ.
Please let me know for anymmore queries
‎2007 Mar 08 7:37 AM
‎2007 Mar 08 7:00 AM
SELECT MKMBLNR MKBLDAT MSMJAHR MSZEILE MSBWART MSMATNR MSmenge MSLGORT MSSHKZG MSEBELN MSKOSTL FROM MKPF AS MK INNER JOIN MSEG AS KS WHERE MKMBLNR = MS~MBLNR
and ( ( MSbwart = '351' or MSbwart = '352' )
or ( MSbwart = '201' or MSbwart = '202' ) )
and MS~kostl = p_kostl
and MS~lgort = itab_ekko-UNSEZ.
BTW, i did not under stand the condition:
and ebeln > ebeln in your second select statement.
~thomas
null
‎2007 Mar 08 7:06 AM
Hi,
You can try ur code in the following way:
Select AMBLNR ABLDAT BMJAHR BZEILE BBWART BMATNR Bmenge BLGORT BSHKZG BEBELN BKOSTL FROM MKPF as A inner join MSEG as B on AMBLNR = B~MBLNR into table itab
where ( ( Bbwart = '351' or Bbwart = '352' )
and B~EBELN > ebeln )
or ( ( BBWART = '201' or BBWART = '202' )
and B~KOSTL = p_kostl )
and B~LGORT = itab_ekko-UNSEZ.
Reward useful answers...
‎2007 Mar 08 7:07 AM
hi dana,
select mkpfblnr mkpfbldat msegMJAHR msegZEILE msegBWART msegMATNR msegmenge msegLGORT msegSHKZG msegEBELN
mseg~KOSTL into table itab from mkpf inner join mseg
on mkpfblnr = msegblnr
WHERE BLDAT >= date
MBLNR = itab_mkpf-mblnr
and ( ( bwart = '351' or bwart = '352'
and ebeln > ebeln )
or ( bwart = '201' or bwart = '202' ) )
and kostl = p_kostl
and lgort = itab_ekko-UNSEZ.
regards,
keerthi