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 on MBEW problem

Former Member
0 Likes
1,676

Dear friends,

I am retriving the data from MBEW Table based on Material (MATNR) ,Fiscal year of current period (LFGJA), Current period (posting period) (LFMON).

I want to retrive all the data from table where material is equal to given material and Fiscal year of current period(LFGJA) is less then or equal to given value, and Current period (posting period) (LFMON) less then or equal to given value. but it is not fetching the data.

the query is like this.

SELECT matnr

bwkey

bwtar

lbkum

salk3

verpr

lfmon

INTO TABLE gt_mbew

FROM mbew

WHERE matnr = 'XXXXX'

AND lfgja LE '2008'

AND lfmon LE '01'.

with the above query i want to get the data wich is less then or equal to given value. I mean It shout retrive first 01/2008, then 12/2007,11/2007,10/2007.....

how to do this...

Thanks,

Sridhar

4 REPLIES 4
Read only

Former Member
0 Likes
882

Hi,

Try this :

SELECT matnr

bwkey

bwtar

lbkum

salk3

verpr

lfmon

INTO TABLE gt_mbew

FROM mbew

WHERE matnr = 'XXXXX'

AND lfgja LE 2008

AND lfmon LE 01.

The values for the fields 'lfgja' and 'lfmon' should not be written in single quotes because the data type is NUMC.

Reward if helpful

Thanks,

Chinmaye

Read only

0 Likes
882

Sorry, The values for 'lfgja' and 'lfmon' are comming from selection screen, just for our reference I haven it like this.

Read only

Former Member
0 Likes
882

Hi,

The data will be fetched in to the internal table as its in the database.

If you want the data to be in the order in which you have specified, sort the internal table once you get the data.

SORT gt_mbew by LFGJA.

Reward if helpful.

Regards.

Read only

Former Member
0 Likes
882

Hi,

Aren't u getting output or aren't u getting output in the desired order?

Regards,

Ramya