cancel
Showing results for 
Search instead for 
Did you mean: 

i m geeting a error could u please help me with the code

Former Member
0 Kudos

"it_mara" is not defined in the abap dictionary as a table,projection view or database view. this the error

REPORT ZVYSHNAVI_TABLE.

TYPES: BEGIN OF TY_MARA,
MATNR TYPE MARA-MATNR,
ERSDA TYPE MARA-ERSDA,
ERNAM TYPE MARA-ERNAM,
LAEDA TYPE MARA-LAEDA,
END OF TY_MARA.




DATA : IT_MARA TYPE TY_MARA,
WA_MARA TYPE TY_MARA.


SELECT * FROM IT_MARA INTO WA_MARA.

WRITE : /5'MATERIAL NO',
30'CREATE NO',
60'PERSON NO',
90'LAST CHANGED NO'.

LOOP AT IT_MARA INTO WA_MARA.

WRITE :/5 WA_MARA-MATNR,
30 WA_MARA-ERSDA,
60 WA_MARA-ERNAM,
90 WA_MARA-LAEDA.

ENDLOOP.

former_member751964
Participant
0 Kudos

Thank you for visiting SAP Community to get answers to your questions. Since you are new, I recommend that you familiarize yourself with our Q&A Tutorial: https://developers.sap.com/tutorials/community-qa.html. It provides tips for preparing questions that draw responses from our members. Should you wish, you can revise your question by selecting Actions, then Edit.

By adding a picture to your profile you encourage readers to respond: https://www.youtube.com/watch?v=46bt1juWUUM

Thank you!

FredericGirod
Active Contributor

Use the [CODE] button to format the code of your program

Accepted Solutions (0)

Answers (2)

Answers (2)

FredericGirod
Active Contributor
REPORT ZVYSHNAVI_TABLE.

TYPES: BEGIN OF TY_MARA,
MATNR TYPE MARA-MATNR,
ERSDA TYPE MARA-ERSDA,
ERNAM TYPE MARA-ERNAM,
LAEDA TYPE MARA-LAEDA,
END OF TY_MARA.




DATA : IT_MARA TYPE TY_MARA,
WA_MARA TYPE TY_MARA.


"SELECT * FROM IT_MARA INTO WA_MARA.
SELECT * FROM MARA INTO TABLE IT_MARA.

WRITE : /5'MATERIAL NO',
30'CREATE NO',
60'PERSON NO',
90'LAST CHANGED NO'.

LOOP AT IT_MARA INTO WA_MARA.

WRITE :/5 WA_MARA-MATNR,
30 WA_MARA-ERSDA,
60 WA_MARA-ERNAM,
90 WA_MARA-LAEDA.
ENDLOOP.

SELECT make an extraction from a database table.

IT_MARA is declare like an internal table

Internal table <> database table

the database table should be MARA (or maybe something else)

Sandra_Rossi
Active Contributor

Let me explain the issue with your code (see solution in Frederic answer).

Your main error is at this line:

SELECT * FROM IT_MARA ...

the error message ""it_mara" is not defined in the abap dictionary as a table,projection view or database view" is very explicit. It says that instead of IT_MARA, you shoud for instance use the ABAP Dictionary table "MARA" or the database view "MARAV", etc. In your program, you defined IT_MARA as a Structured Variable (DATA ... BEGIN OF ...), you cannot do SELECT * FROM a structured variable.