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

Not getting data

Former Member
0 Likes
450

Hi all,

Can anybody tell me why i m not getting bwart & matnr fields(showing empty while degugging), for this code

if eban_ekbe[] is not initial .

select ebeln ebelp max( bwart ) matnr werks

into corresponding fields of table itab_ekbe1

from ekbe where werks eq p_werks

and matnr = eban_ekbe-matnr

group by ebeln ebelp matnr werks.

endif.

\[removed by moderator\]

Edited by: Jan Stallkamp on Jun 23, 2008 4:42 PM

3 REPLIES 3
Read only

Former Member
0 Likes
432

Hi ,

Modify your query as below.

if eban_ekbe[] is not initial .

select ebeln ebelp max( bwart ) matnr werks

into corresponding fields of table itab_ekbe1

from ekbe for all enrties in eban_ekbe

where werks eq p_werks

and matnr = eban_ekbe-matnr

group by ebeln ebelp matnr werks.

endif.

Read only

0 Likes
432

I think u cannot use aggregate func. MAX with FOR ALL ENTRIES..Pl. see this sap help documentation.

If the addition FOR ALL ENTRIES is used in front of WHERE, or if cluster or pool tables are listed after FROM, no other aggregate expressions apart from COUNT( * ) can be used.

In that case u can modify ur select as shown below:

if eban_ekbe[] is not initial .

<<Find min. and max. matertial nos and store them in 2 variables say l_low and l_high

endif.

select ebeln ebelp max( bwart ) matnr werks

into corresponding fields of table itab_ekbe1

from ekbe

where werks eq p_werks

and matnr between l_low and l_high

group by ebeln ebelp matnr werks.

Read only

former_member202474
Contributor
0 Likes
432

Hi Savitha,

Modify ur code as

select ebeln ebelp max( bwart ) matnr werks

from ekbe

into corresponding fields of table itab_ekbe1

for all enrties in eban_ekbe

where werks eq p_werks

and matnr = eban_ekbe-matnr .

group by ebeln ebelp matnr werks.

<REMOVED BY MODERATOR>

Regards,

Ruby.

Edited by: Alvaro Tejada Galindo on Jun 23, 2008 10:47 AM