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

Type range of

Former Member
0 Likes
16,914

Hi,

I am trying to create a range object using type range of decalration in a class, but when trying to select data using the range object as one of the condition the program throws an error stating "The in operator with it_pernr-low is followed be neither by an internal table nor by a value list".Listed below is the sample code

data: it_pernr type range of p0001-pernr,

wa_pernr like line of it_pernr.

wa_pernr-low = '343243'.

wa_pernr-sign = 'I'.

wa_pernr-option = 'EQ'.

append wa_pernr to it_pernr.

wa_pernr-low = '12343'.

append wa_pernr to it_pernr.

select * from pa0001

into table it_p0001

where pernr in it_pernr.

If I cannot use the "in it_pernr" because it does not have a header line then what would be the alternative efficient solution. All answers wud be awarded suitably.

Thanks

Vick

This is a duplicate post, I accidentally posted it in the wrong place. Will close both the posts once answered

Edited by: vick vennav on Jan 2, 2008 10:58 PM

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
4,585

Actually Vick, I'm having no problem whatsoever using the TYPE RANGE OF within a method. Not sure what you are doing wrong. Here is my example code.



REPORT  rich_0001.

*----------------------------------------------------------------------*
*       CLASS lcl_app DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_app DEFINITION.
  PUBLIC SECTION.


    DATA: it_t000 TYPE TABLE OF t000.
    DATA: it_mandt TYPE RANGE OF t000-mandt,
          wa_mandt LIKE LINE OF it_mandt.

    METHODS : test.

ENDCLASS.                    "lcl_app DEFINITION

*----------------------------------------------------------------------*
*       CLASS lcl_app IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_app IMPLEMENTATION.

  METHOD test.

    wa_mandt-low = '100'.
    wa_mandt-sign = 'I'.
    wa_mandt-option = 'EQ'.
    APPEND wa_mandt TO it_mandt.

    wa_mandt-low = '200'.
    APPEND wa_mandt TO it_mandt.

    SELECT * FROM t000
            INTO TABLE it_t000
                   WHERE mandt IN it_mandt.


  ENDMETHOD.                    "test

ENDCLASS.                    "lcl_app IMPLEMENTATION

DATA: o_ref TYPE REF TO lcl_app.

START-OF-SELECTION.

  CREATE OBJECT o_ref.
  o_ref->test( ).

Regards,

Rich Heilman

5 REPLIES 5
Read only

former_member156446
Active Contributor
0 Likes
4,585

it_pernr-low = '343243'.

it_pernr-sign = 'I'.

it_pernr-option = 'EQ'.

append it_pernr.

try this..

Read only

0 Likes
4,585

Jack,

I cannot use your statements as this part of the code is being written in a method.

Thanks

Vick

Read only

0 Likes
4,585

Guys any more inputs ???

Read only

0 Likes
4,585

Hi,

Why can you use the internal table with header line in the SELECT statement. Once you finish it you can move the data in to some other internal table where you dont have header line.

Regards,

Satya

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
4,586

Actually Vick, I'm having no problem whatsoever using the TYPE RANGE OF within a method. Not sure what you are doing wrong. Here is my example code.



REPORT  rich_0001.

*----------------------------------------------------------------------*
*       CLASS lcl_app DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_app DEFINITION.
  PUBLIC SECTION.


    DATA: it_t000 TYPE TABLE OF t000.
    DATA: it_mandt TYPE RANGE OF t000-mandt,
          wa_mandt LIKE LINE OF it_mandt.

    METHODS : test.

ENDCLASS.                    "lcl_app DEFINITION

*----------------------------------------------------------------------*
*       CLASS lcl_app IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_app IMPLEMENTATION.

  METHOD test.

    wa_mandt-low = '100'.
    wa_mandt-sign = 'I'.
    wa_mandt-option = 'EQ'.
    APPEND wa_mandt TO it_mandt.

    wa_mandt-low = '200'.
    APPEND wa_mandt TO it_mandt.

    SELECT * FROM t000
            INTO TABLE it_t000
                   WHERE mandt IN it_mandt.


  ENDMETHOD.                    "test

ENDCLASS.                    "lcl_app IMPLEMENTATION

DATA: o_ref TYPE REF TO lcl_app.

START-OF-SELECTION.

  CREATE OBJECT o_ref.
  o_ref->test( ).

Regards,

Rich Heilman