‎2009 Apr 08 1:32 PM
Dear all,
i need from one DB table to select matnr and max budat.
I try query like this:
select max( budat ) MATNR
into CORRESPONDING FIELDS OF TABLE IT_ZMATDATE
from /BIC/B0000086000
where BWART = BWART
group by matnr.
I receive matnr but in budat all fields are 000000.
Do someone know how to get the latest date for one matherial ???
Thanks in advance.
‎2009 Apr 08 1:34 PM
‎2009 Apr 08 1:36 PM
Hi,
Can you tell how you declare the internal table IT_ZMATDATE.
Regards,
Soumya.
‎2009 Apr 08 1:38 PM
in report: DATA: IT_ZMATDATE LIKE STANDARD TABLE OF ZMAT_DATE.
where ZMAT_DATE is our z table with 3 Fields: mandt matnr budat.
‎2009 Apr 08 1:40 PM
‎2009 Apr 08 1:43 PM
This is in BW system and type is /BIC/OW_BUDAT_BA which is Data Element and domain is type DATS 8
‎2009 Apr 08 1:45 PM
You have written:
select max( budat ) MATNR
into CORRESPONDING FIELDS OF TABLE IT_ZMATDATE
from /BIC/B0000086000
where BWART = BWART
group by matnr.
just replace it with this one:
select MATNR max( budat )
into CORRESPONDING FIELDS OF TABLE IT_ZMATDATE
from /BIC/B0000086000
where BWART = BWART
group by matnr.
Edited by: Sarbajit Majumdar on Apr 8, 2009 6:16 PM
‎2009 Apr 08 1:51 PM
The result is the same budat fields are 000000.The material fields are ok
‎2009 Apr 08 1:55 PM
hi,
have you checked the /BIC/B0000086000 table for values of BUDAT for the material number MATNR?
also if BUDAT is of type DATS why is the result showing 000000?
usually this kind of select statement works perfectly.
‎2009 Apr 08 2:00 PM
Yes i check the table for matherial 000000000010018397 for example there is 218 records and there budat 08.01.2009,08.01.2009,09.01.2009 and so on...?!?
‎2009 Apr 08 2:01 PM
What I can suggest that you first create a type like the following one:
Type:begin of ty_ZMATDATE,
mandt type ZMAT_DATE-mandt,
matnr type ZMAT_DATE-matnr,
budat type sy-datum,
end of ty_ZMATDATE.
Data: IT_ZMATDATE LIKE STANDARD TABLE OF ty_ZMATDATE.
otherwise I'm not able to find any other type solution.
Regards.
Sarbajit.
‎2009 Apr 08 2:14 PM
HI,
try this,
select max( budat ) MATNR
into CORRESPONDING FIELDS OF TABLE IT_ZMATDATE
from /BIC/B0000086000
where BWART = BWART
Regards,
R K.
‎2009 Apr 08 2:15 PM
‎2009 Apr 08 2:46 PM
hi,
Since its taking long to solve your problem by experts in forum , i have got a temp solution for your problem, which is ofcourse not performnce recommended.
but for time being you can use it untill anyone else comes up with better solnt.
Declare IT_ZMATDATE as a work area.
select max( budat ) MATNR
into IT_ZMATDATE
from /BIC/B0000086000
where BWART = BWART
ENDSELECT.
Edited by: ags on Apr 8, 2009 3:46 PM