Skip to Content
avatar image
Former Member

error in creating a class.

Hi Experts,

While creating a class for the created interface..

I am getting following error.

"IT_MARA" is not an internal table - the "OCCURS n" specification is missing.

Please correct the error.

method Y_IF_INTERFACE~SELECT_METHOD .

SELECT * FROM MARA INTO TABLE IT_MARA

WHERE MATNR BETWEEN P_MATNR_LOW AND P_MATNR_HIGH.

endmethod.

Regards

nani

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

8 Answers

  • Oct 15, 2008 at 06:57 AM

    Hi

    it means that IT_MARA is not a internla table but you have declared it as work are

    declare it as follows

    IT_MARA TYPE STANDARD TABLE OF <type / table>

    or modify you code in the below way

    METHOD <name>.
    Data :
       IT_MARA TYPE STANDARD TABLE OF  mara.
    
    SELECT * FROM MARA INTO TABLE  IT_MARA
    WHERE MATNR BETWEEN P_MATNR_LOW AND P_MATNR_HIGH.
    
    ENDMETOD

    Regards

    Pavan

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 15, 2008 at 06:58 AM

    Hi

    You have not mentioned the declarations in the code you have entered...But it is acting like a work area.

    Data: begin of it_mara occurs 1,

    end of it_mara.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 15, 2008 at 06:58 AM

    Hi

    Can you pls show how the IT_MARA is declared

    Regards

    Madhan

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 15, 2008 at 06:58 AM

    Hi,

    Can you please let us know as to how you have declared IT_MARA. I think you will not have declared it as an internal table and hence the error. There is no problem with the class i suppose.

    Regards,

    Pramod

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 15, 2008 at 06:59 AM

    Hi,

    Change the code as follows:

    method Y_IF_INTERFACE~SELECT_METHOD .
    
    data:
    it_mara type standard table of mara with header line.
    
    SELECT * FROM MARA INTO TABLE IT_MARA
    WHERE MATNR BETWEEN P_MATNR_LOW AND P_MATNR_HIGH.
    endmethod.

    Thanks & Regards,

    Navneeth K.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 15, 2008 at 07:00 AM

    Hi,

    Please declare the as below

    data:it_mara type standard table of mara.

    select * from mara into table it_mara.

    regards

    jana

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 15, 2008 at 07:05 AM

    The code is like this

    tables: mara.

    *provide mara table

    DATA: zMARA TYPE MARA.

    *provide data objects

    DATA: OBJ TYPE REF TO Y_CL_INTERFACE,

    IT_MARA TYPE standard table of MARA with header line,

    WA_MARA TYPE MARA.

    *provide selection screen

    SELECT-OPTIONS: S_MATNR FOR MARA-MATNR.

    *provide object

    START-OF-SELECTION.

    CREATE OBJECT OBJ.

    *call the method.

    CALL METHOD OBJ->Y_IF_INTERFACE~SELECT_METHOD

    EXPORTING

    P_MATNR_LOW = S_MATNR-LOW

    P_MATNR_HIGH = S_MATNR-HIGH

    IMPORTING

    IT_MARA = IT_MARA

    WA_MARA = WA_MARA.

    *display the data

    LOOP AT IT_MARA INTO WA_MARA.

    WRITE:/ WA_MARA-MATNR,

    WA_MARA-ERSDA,

    WA_MARA-ERNAM,

    WA_MARA-MATKL,

    WA_MARA-MEINS.

    ENDLOOP.

    Regards

    Nani

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi,

      I think you have not declared IT_MARA within the class definition. Could you please check that the class that has this method also has the table declaration of IT_MARA.

      Regards,

      Pramod

  • avatar image
    Former Member
    Apr 26, 2011 at 10:01 AM

    This message was moderated.

    Add comment
    10|10000 characters needed characters exceeded