cancel
Showing results for 
Search instead for 
Did you mean: 

MDX query with range in where condition

Former Member
0 Kudos

Hi All ,

I have a MDX query which is retrieving data from BW ,

APPEND 'SELECT' TO lt_mdx.

APPEND 'NON EMPTY { [Measures].[D478AI4915PGBGUNCJKU9U4DG],' TO lt_mdx.

APPEND ' [Measures].[D478AI4915Q8036EO30GC9IN8] ' TO lt_mdx.

APPEND ' } ON COLUMNS, ' TO lt_mdx.

APPEND 'NON EMPTY { [0MATL_GRP_2].MEMBERS , ' TO lt_mdx.

APPEND '[0MATL_GRP_3].MEMBERS , ' TO lt_mdx.

APPEND '[0PLANT].MEMBERS } ON ROWS ' TO lt_mdx.

APPEND 'FROM RCHL_M01/STQ_CHLD_Q002 ' TO lt_mdx.

APPEND 'WHERE (' TO lt_mdx.

CONCATENATE '[0MATL_GRP_2].[' lv_mat2 '] , ' INTO lv_where. APPEND lv_where TO t_mdx.

CONCATENATE '[0MATL_GRP_3].[' lv_mat3+1 '] , ' INTO lv_where. APPEND lv_where TO lt_mdx.

CONCATENATE '[0PLANT].[' lv_plant '] ) ' INTO lv_where. APPEND lv_where TO lt_mdx.

The above query fetches data but its repetative and also with some blanks in 'DATA(field)' column of the internal table I am storing.

and also is it possible to pass the range in where condition ,

Thanks in advance for any input .

Regards

Vinay kolla

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Vinay,

If the field is char type, then you should keep the values in single quotes(').

Like this:

v_where = field_name BETWEEN '0000000300' AND '0000001450' .

Best regards

Mahesh

Former Member
0 Kudos

Hi,

Yes, it is possible to pass the ranges in where clause.

you can use like this

v_where = '& BETWEEN ''&'' AND ''&'' '

where '&' refers to the field_name.

regards

Mahesh

Former Member
0 Kudos

Hi Mahesh ,

Thanks for ur response but it doe s not work

The error is

Value between 0000000300 and 0000001450 for characteristic 0SOLD_TO unknown "

the value a are actually there for that range .

Further input will be great

Thanks

Vinay Kolla