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

IN operator problem

Former Member
0 Likes
1,508

Hi,

I have a function module.

FUNCTION z_read.

.

.

.

.

RANGES zmfrpn FOR zp-mfrpn.

CONCATENATE mfrpn '*' INTO zmfrpn-low.

zmfrpn-sign = 'I'.

zmfrpn-option = 'CP'.

APPEND zmfrpn.

CLEAR zmfrpn.

.

.

.

.

ENDFUNCTION.

FORM stock.

SELECT mfrpn matnr meins normt

INTO (tp-mfrpn, tpmatnr,tp-meins, tp-normt)

FROM mara WHERE mfrpn IN zmfrpn.

ENDSELECT.

ENDFORM.

And i receive following error: The IN operator with "ZMFRPN" is followed neither by an internal table nor by a value list.

What should i do?

Thank you!

12 REPLIES 12
Read only

Former Member
0 Likes
1,220

hi

i tink u have to use the field name for the ranges as its an internal table.

Read only

Former Member
0 Likes
1,220

in where clause you use mfrpn in low.

Read only

0 Likes
1,220

Hi

use these two

zmfrpn-high = '100'.
zmfrpn-low = '001'.

append.

regards,

kaushik

Read only

0 Likes
1,220

not working

Read only

Former Member
0 Likes
1,220

hi,

now check it.

RANGES zmfrpn FOR zp-mfrpn.

zmfrpn-low = '100'

zmfrpn-high = '200'.

zmfrpn-sign = 'I'.

zmfrpn-option = 'CP'.

APPEND zmfrpn.

CLEAR zmfrpn.

FORM stock.

SELECT mfrpn matnr meins normt

I NTO (tp-mfrpn, tpmatnr,tp-meins, tp-normt)

FROM mara WHERE IN zmfrpn .

ENDSELECT.

ENDFORM.

Regards,

Mahesh,

Edited by: Mahesh Reddy .Pocha on Sep 18, 2008 1:04 PM

Read only

Former Member
0 Likes
1,220

Hello

If you fill ranges in functional module, then you need:

1. before select statement declare new ranges like ranges in FM

2. before select statement call FM

3. FM must return filled ranges to your new ranges.

4. use in select statement new ranfes.

Read only

0 Likes
1,220

Hi,

Please check for 2 things in your code....

Must: Pass the range as passing param in the Subroutine...

1. How is the range declared?

2. Insert [] after the range in the SELECT statement.

Hope this solves your problem.

Regards,

Kunjal

Read only

Former Member
0 Likes
1,220

please you let me know use of

CONCATENATE mfrpn '*' INTO zmfrpn-low.

zmfrpn-sign = 'I'.

zmfrpn-option = 'CP'.

APPEND zmfrpn.

CLEAR zmfrpn.

Read only

Former Member
0 Likes
1,220

Hi,

How are the function module and the Subroutine joined???

You have declared the ranges in FM and trying to use that in a form I guess in a different program.

If the form stock is with in the FM then declare the ranges in the TOP include of the Function group.

santhosh

Read only

matt
Active Contributor
0 Likes
1,220

This is a question of scope.

You've defined zmfrpn in the Function Module. You are attempting to use it in form stock. Data declared in a function module is local to the function module - i.e. the bits between FUNCTION... ENDFUNCTION.

You could define zmfrpn in the global data of the function group (don't do this though, it's REALLY BAD programming, to deal with global data in subroutines, unless you really have to )

What you should do is pass zmfrpn to the form stock as a parameter.

Further, can I suggest that you adopt a more meaningful naming convention for your variable names. E.g. it's a range, start it with the prefix rng_ for example.

Also, you are using SELECT ... ENDSELECT to select a single row from the database. Why not use SELECT SINGLE. Or SELECT ... UP TO 1 ROWS?

matt

Read only

Former Member
0 Likes
1,220

Further, can I suggest that you adopt a more meaningful naming convention for your variable names. E.g. it's a range, start it with the prefix rng_ for example.

OK.

Also, you are using SELECT ... ENDSELECT to select a single row from the database. Why not use SELECT SINGLE. Or SELECT ... UP TO 1 ROWS?

No, that select does not select a single row ...

Thank you for your advices ... .

Read only

Former Member
0 Likes
1,220
FORM stock TABLES tp STRUCTURE zp.

ENDFORM.                    "stock

Thank you to all... i have made it