‎2008 Jan 02 9:52 PM
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
‎2008 Jan 02 11:02 PM
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
‎2008 Jan 02 9:56 PM
it_pernr-low = '343243'.
it_pernr-sign = 'I'.
it_pernr-option = 'EQ'.
append it_pernr.
try this..
‎2008 Jan 02 10:04 PM
Jack,
I cannot use your statements as this part of the code is being written in a method.
Thanks
Vick
‎2008 Jan 02 10:45 PM
‎2008 Jan 02 10:56 PM
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
‎2008 Jan 02 11:02 PM
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