Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Select max ( budat ) problem

Former Member
0 Likes
1,529

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.

13 REPLIES 13
Read only

sarbajitm
Contributor
0 Likes
1,308

please provide the structure of IT_ZMATDATE.

Read only

soumya_jose3
Active Contributor
0 Likes
1,308

Hi,

Can you tell how you declare the internal table IT_ZMATDATE.

Regards,

Soumya.

Read only

0 Likes
1,308

in report: DATA: IT_ZMATDATE LIKE STANDARD TABLE OF ZMAT_DATE.

where ZMAT_DATE is our z table with 3 Fields: mandt matnr budat.

Read only

0 Likes
1,308

IS BUDAT's type SY_DATUM?

Read only

0 Likes
1,308

This is in BW system and type is /BIC/OW_BUDAT_BA which is Data Element and domain is type DATS 8

Read only

sarbajitm
Contributor
0 Likes
1,308

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

Read only

Former Member
0 Likes
1,308

The result is the same budat fields are 000000.The material fields are ok

Read only

0 Likes
1,308

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.

Read only

Former Member
0 Likes
1,308

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...?!?

Read only

0 Likes
1,308

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.

Read only

Former Member
0 Likes
1,308

HI,

try this,

select max( budat ) MATNR

into CORRESPONDING FIELDS OF TABLE IT_ZMATDATE

from /BIC/B0000086000

where BWART = BWART

Regards,

R K.

Read only

Former Member
0 Likes
1,308

thanks Sarbajit,

but this also do not help.

Read only

0 Likes
1,308

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