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 query problem

Former Member
0 Likes
968

Dear Friends,

I have problem with select statement:

My query is like this:

REFRESH: r_name_key.

REFRESH: r_PART_NO.

r_name_key-sign = 'I'.

r_name_key-option = 'CP'.

r_name_key-low = '00000000' .

r_name_key-high = '99999999' .

APPEND r_name_key.

r_PART_NO-sign = 'I'.

r_PART_NO-option = 'CP'.

r_PART_NO-low = ' ' .

r_PART_NO-high = ' ' .

APPEND r_PART_NO.

SELECT matnr name_key part_no FROM XXX INTO TABLE

itab_XXX

FOR ALL ENTRIES IN itab_mfg

WHERE NAME_KEY in r_name_key and

PART_NO in r_PART_NO and

matnr = itab_mfg-matnr.

Here itab_mfg is having 305 records and Table XXX is having 2000 records.

The query is failed...its not picked even one records also...Ihave checked the table there are somany matched records need to fetch ( Ihave used the ranges to increse the performence).

whats the problem with query???

Thanks,

Sridhar.

9 REPLIES 9
Read only

Former Member
0 Likes
953

Hi,

check ur ranges

r_name_key-sign = 'I'.
r_name_key-option = 'BT'.
r_name_key-low = '00000000' .
r_name_key-high = '99999999' .
APPEND r_name_key.

r_PART_NO-sign = 'I'.
r_PART_NO-option = 'BT'.
r_PART_NO-low = ' ' .
r_PART_NO-high = ' ' .
APPEND r_PART_NO.

Cheers,

jose.

Read only

Former Member
0 Likes
953

Hi,

Change your code as below :



r_name_key-sign = 'I'.
r_name_key-option = 'BT'. "Chnaged from CP to BT
r_name_key-low = '00000000' .
r_name_key-high = '99999999' .
APPEND r_name_key.

r_PART_NO-sign = 'I'.
r_PART_NO-option = 'BT'. "Changed from CP to BT
r_PART_NO-low = ' ' .
r_PART_NO-high = ' ' .
APPEND r_PART_NO.

Thanks,

Sriram Ponna.

Read only

0 Likes
953

Sriram Thanks for the replay,

The problem is solved but if I removed r_PART_NO range from select statement. if I pass r_PART_NO in my select stament along with r_name_key the condition is failed.....

anyho thanks for the replay.

Sridhar

Read only

Vijay
Active Contributor
0 Likes
953

hi

have u checked that there r records which are satisfying all the three conditions ?

regards

vijay

Read only

Former Member
0 Likes
953

HI shridhar,

Your ranges will be the problem. For option you use 'CP' which means contains pattern, but from the values in low and high this should be BT I guess?

For the second range it is not clear what you want. To select only records with PART_NO = space?

Regards,

John.

Read only

0 Likes
953

Your right ..... I need to take BT instead of CP, I removed it.

and for PART_NO its Char field in my table because of that I have taken it like this in my select statement.

but if I used PART_NO in my select statemnt the condition is failed.( I gues it is empty so ..)

Read only

0 Likes
953

Hi,

Can you do a small change, anyhow you are not passing any values to r_part_no take out the r_part_no from the select statement. And you can use below statement.


Delete itab where part_no not in r_part_no.

Thanks,

Sriram Ponna.

Read only

Former Member
0 Likes
953

hi ,

try like dis,

SELECT matnr name_key part_no INTO TABLE

itab_XXX

FROM XXX

FOR ALL ENTRIES IN itab_mfg

WHERE NAME_KEY in r_name_key and

PART_NO in r_PART_NO and

matnr = itab_mfg-matnr.

reward if helpful

Read only

Former Member
0 Likes
953

Hi,

Option u kept as 'CP'. Is it the exact requirement matches or not . once check.

Thanks,

Suma.