10-15-2008 7:56 AM
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
10-15-2008 7: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
10-15-2008 7: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.
10-15-2008 7:58 AM
10-15-2008 7: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
10-15-2008 7: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.
10-15-2008 8: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
10-15-2008 8: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
10-15-2008 8:13 AM
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
04-26-2011 11:01 AM