2006 Oct 06 11:09 AM
hi
i am looping at mchb and i need to join on the following conditions
i. Read table MKPF and retrieve MAX (MKPF-CPUDT) inner join MSEG based on MSEG-WERKS = MCHB-WERKS and MSEG-LGORT = MCHB-LGORT and MSEG-MATNR = MCHB-MATNR and MSEG-CHARG = MCHB-CHARG
ii. Read table MKPF and retrieve MKPF-BDATU MAX (MKPF-CPUTM) inner join MSEG WHERE MSEG-WERKS = MCHB-WERKS, and MSEG-LGORT = MCHB-LGORT and MSEG-MATNR = MCHB-MATNR and MSEG-CHARG = MCHB-CHARG and MKPF-CPUDT = above retrieved date
DETERMINE latest material doc for movement type (MSEG-BWART) 531 using above logic to get latest doc and get MSEG-AUFNR DETERMINE protein contact (AFKO-PLNBEZ) using MSEG-AUFNR
can any one help me out. its very urgent
raju
2006 Oct 06 11:27 AM
SELECT MAX(MKPF-CPUDT) MAX(MKPF-CPUTM) into (ldate, ltime)
from mkpf inner join mseg on
mkpfmblnr = msegmblnr and mkpfmjahr = msegmjahr
where msegwerks = mchbwerks and
mseglgort = mchblgort and
msegmatnr = mchbmatnr and
msegcharg = mchbcharg.
hi
i am looping at mchb and i need to join on the following conditions
i. Read table MKPF and retrieve MAX (MKPF-CPUDT) inner join MSEG based on MSEG-WERKS = MCHB-WERKS and MSEG-LGORT = MCHB-LGORT and MSEG-MATNR = MCHB-MATNR and MSEG-CHARG = MCHB-CHARG
ii. Read table MKPF and retrieve MKPF-BDATU MAX (MKPF-CPUTM) inner join MSEG WHERE MSEG-WERKS = MCHB-WERKS, and MSEG-LGORT = MCHB-LGORT and MSEG-MATNR = MCHB-MATNR and MSEG-CHARG = MCHB-CHARG and MKPF-CPUDT = above retrieved date
DETERMINE latest material doc for movement type (MSEG-BWART) 531 using above logic to get latest doc and get MSEG-AUFNR DETERMINE protein contact (AFKO-PLNBEZ) using MSEG-AUFNR
can any one help me out. its very urgent
raju
2006 Oct 06 11:23 AM
Check the sample code:
data: begin of i_data occurs 0,
MBLNR type MKPF-MBLNR,
MJAHR type MKPF-MJAHR,
CPUDT type mkpf-cpudt,
ZEILE type MSEG-zeile,
end of i_data.
select amblnr amjahr acpudt bzeile
into table i_data
from mkpf as a inner join mseg as b
on aMBLNR = bMBLNR
<b> for all entries in i_mchb </b>
where b~WERKS = i_mchb-werks
and b~lgort = i_mchb-lgort
and b~matnr = i_mcbh-matnr
and b~charg = i_mcbh-charg.
Sort i_data by CPUDT Descending.
*U will get the latest record
*Follow the same step 2 select query also.
Regards,
Prakash.
2006 Oct 06 11:27 AM
SELECT MAX(MKPF-CPUDT) MAX(MKPF-CPUTM) into (ldate, ltime)
from mkpf inner join mseg on
mkpfmblnr = msegmblnr and mkpfmjahr = msegmjahr
where msegwerks = mchbwerks and
mseglgort = mchblgort and
msegmatnr = mchbmatnr and
msegcharg = mchbcharg.
2006 Oct 06 11:34 AM
hi bankley,
thanks for ur answer but have seen it the second point should be based on above retrived data( from point 1).
look at it once again
2006 Oct 06 11:37 AM
Raju,
No need to give 2 sepaerate select queries u can do that in a single query as said by anurag.
Regards,
Prakash.
2006 Oct 06 11:42 AM
DETERMINE latest material doc for movement type (MSEG-BWART) 531 using above logic to get latest doc and get MSEG-AUFNR DETERMINE protein contact (AFKO-PLNBEZ) using MSEG-AUFNR
I am not 100% certain about your requirement whether you require all three information max-cpudt and time as well as docno for movement type 531 or it is just the docno for 531 movt type ??
select max(mblnr) into ldocno
from mblnr inner join mseg
on (same as above)
where mseg~bwart = '531'.
select afko~plnbez into lplnbez
from afko inner join mseg on
afkoaufnr = msegaufnr
where mseg~mblnr = ldocno.
Please award points to all helpful answers!!
Message was edited by: Anurag Bankley
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |