Skip to Content

IN operator problem

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!

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

8 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Sep 18, 2008 at 10:50 AM

    hi

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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 18, 2008 at 10:52 AM

    in where clause you use mfrpn in low.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 18, 2008 at 11:01 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 18, 2008 at 11:01 AM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      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

  • author's profile photo Former Member
    Former Member
    Posted on Sep 18, 2008 at 11:02 AM

    please you let me know use of

    CONCATENATE mfrpn '*' INTO zmfrpn-low.

    zmfrpn-sign = 'I'.

    zmfrpn-option = 'CP'.

    APPEND zmfrpn.

    CLEAR zmfrpn.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 18, 2008 at 11:06 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 18, 2008 at 11:09 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

    • 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 ... .

  • Posted on Sep 19, 2008 at 01:21 PM
    FORM stock TABLES tp STRUCTURE zp.
    
    ENDFORM.                    "stock

    Thank you to all... i have made it

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.