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

error in creating a class.

Former Member
0 Likes
1,465

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

9 REPLIES 9
Read only

bpawanchand
Active Contributor
0 Likes
1,237

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

Read only

Former Member
0 Likes
1,237

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.

Read only

Former Member
0 Likes
1,237

Hi

Can you pls show how the IT_MARA is declared

Regards

Madhan

Read only

Former Member
0 Likes
1,237

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

Read only

Former Member
0 Likes
1,237

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.

Read only

Former Member
0 Likes
1,237

Hi,

Please declare the as below

data:it_mara type standard table of mara.

select * from mara into table it_mara.

regards

jana

Read only

Former Member
0 Likes
1,237

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

Read only

0 Likes
1,237

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

Read only

Former Member
0 Likes
1,237

This message was moderated.