‎2009 Aug 26 6:07 AM
HI Guys,
Can you please check the code error?
Select MBLNR MJAHR CPUDT CPUTM
into gt_mkpf
from mkpf
where werks = p_werks
and cpudt = sy-datum
and ( ( cputm > sy-uzeit ) and ( cputm < ( sy-uzeit - p_hours ) ) ).
Edited by: deva gembali on Aug 26, 2009 7:12 AM
‎2009 Aug 26 6:19 AM
Hi,
Change the select query like this,
data: temp like sy-uzeit.
temp = sy-uzeit - p_hours.
Select MBLNR MJAHR CPUDT CPUTM
into gt_mkpf
from mkpf
where werks = p_werks
and cpudt = sy-datum
and cputm > sy-uzeit
and cputm < temp.
Regards,
Vik
‎2009 Aug 26 6:13 AM
‎2009 Aug 26 6:17 AM
Hi ,
Check the syntax
select statement> ::= <query> ( <order by clause> )?.
<query> ::= <query specification>
| <query expression>
Have a look on this page.
Link:[SELECT|http://help.sap.com/saphelp_nw04/helpdata/en/62/10a423384746e8bf5f15ccdd36e8b1/content.htm]
Have a best day ahead.
Edited by: Srivastava.G on Aug 26, 2009 7:18 AM
‎2009 Aug 26 6:19 AM
Hi,
Change the select query like this,
data: temp like sy-uzeit.
temp = sy-uzeit - p_hours.
Select MBLNR MJAHR CPUDT CPUTM
into gt_mkpf
from mkpf
where werks = p_werks
and cpudt = sy-datum
and cputm > sy-uzeit
and cputm < temp.
Regards,
Vik
‎2009 Aug 26 6:22 AM
Hello
Table MKPF does not contain field WERKS.
Check conditions.
‎2009 Aug 26 6:28 AM
Hi,
First of all MKPF table doesnt have WERKS(Plant).
So if you want to run this query using Plant as a parameter, you need to join MKPF & MSEG on Material Doc(MBLNR) and Material Year(MJAHR).
Calculate sy-uzeit - p_hours and store it in a variable say q_hours and then write select as follows:
Select aMBLNR aMJAHR aCPUDT aCPUTM
into table t_mkpf
from mkpf as a inner join mseg as b
on amblnr = bmblnr
and amjahr = bmjahr
where b~werks = p_werks
and a~cpudt = sy-datum
and ( ( cputm > sy-uzeit ) and ( cputm < q_hours ) ).
DECLARE q_hours as syst-uzeit which is same as data element CPUTM.
It works.
Regards,
Amit
Edited by: Amit Iyer on Aug 26, 2009 10:59 AM