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

Range on matnr

Former Member
0 Likes
2,780

Hi,

There is a select statement which is causing performance issue.

SELECT

matnr

charg

sobkz

kunnr

lfgja

lfmon

kulab

FROM msku

INTO TABLE t_msku

FOR ALL ENTRIES IN t_msku_key

WHERE

matnr IN s_matnr

AND werks IN r_werks

AND sobkz IN r_sobkz

AND kunnr = t_msku_key-kunnr

In this select statement matnr is not a mandatory field.Since this is a mandatory field in msku table and this is not passed in the where condition of the select statement it is taking lot of time for execution.

Is it possidle to use range on matnr field instead of select-option field?

If so how do we populate that range?which function module do we use for this?

Hi,

There is a select statement which is causing performance issue.

SELECT

matnr

charg

sobkz

kunnr

lfgja

lfmon

kulab

FROM msku

INTO TABLE t_msku

FOR ALL ENTRIES IN t_msku_key

WHERE

matnr IN s_matnr

AND werks IN r_werks

AND sobkz IN r_sobkz

AND kunnr = t_msku_key-kunnr

In this select statement matnr is not a mandatory field.Since this is a mandatory field in msku table and this is not passed in the where condition of the select statement it is taking lot of time for execution.

Is it possidle to use range on matnr field instead of select-option field?

If so how do we populate that range?which function module do we use for this?

2 REPLIES 2
Read only

Former Member
0 Likes
1,583

Hi,

I'm assuming that s_matnr is a select-option on the selection screen, you can make that select-option obligatory. Even if you use ranges, you will need the material numbers for which the data should be selected.

Also check that the table t_msku_key is not initial before executing the query.

 if  it_msku_key[] is not initial.
select.... for all entries in msku_key....
where....

regards,

Advait

Edited by: Advait Gode on Nov 20, 2008 11:24 AM

Read only

Former Member
0 Likes
1,583

Hi,

Thers is no function module for ranges.

you have to define ranges in your program and use in select query.

you can use ranges in following way.

DATA : r_qmart TYPE RANGE OF qmel-qmart,

r_mawerk TYPE RANGE OF qmel-mawerk,

r_stat TYPE RANGE OF jest-stat,

r_objnr TYPE RANGE OF jest-objnr.

DATA : rs_qmart LIKE LINE OF r_qmart,

rs_mawerk LIKE LINE OF r_mawerk,

rs_stat LIKE LINE OF r_stat,

rs_objnr LIKE LINE OF r_objnr.

CLEAR : rs_stat.

rs_stat-sign = 'I'.

rs_stat-option = 'BT'.

rs_stat-low = 'E0001'.

rs_stat-high = 'E0005'.

APPEND rs_stat TO r_stat.

CLEAR : rs_stat.

rs_stat-sign = 'I'.

rs_stat-option = 'EQ'.

rs_stat-low = 'I0068'.

APPEND rs_stat TO r_stat.

CLEAR : rs_stat.

rs_stat-sign = 'I'.

rs_stat-option = 'EQ'.

rs_stat-low = 'I0070'.

APPEND rs_stat TO r_stat.

CLEAR : rs_stat.

rs_stat-sign = 'I'.

rs_stat-option = 'EQ'.

rs_stat-low = 'I0072'.

APPEND rs_stat TO r_stat.

and use ranges in select

in where condition give matnr in r_matnr in place of s_matnr.

Thanks

Ankur Sharma