Application Development 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: 

No read access to field string MKPF in SLIN

0 Kudos
199

Hi Friends,

while checking my program through extended program check it is giving warning message as "No read access to field string MKPF" in the TABLES statement. How to correct this?

1 ACCEPTED SOLUTION

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos
125

Not sure that you need to correct it, its really just giving a warning. You can get rid of it by putting

"#EC NEEDED at the end of the line of code.

tables: mkpf.         "#EC NEEDED

Regards,

Rich HEilman

6 REPLIES 6

Former Member
0 Kudos
125

Hello Thalayan,

As far as I know if you are getting warning messages in SLIN it doesnt matter. Make sure you dont get errors while doing extended syntax check.

For your post, to be honest...I dont know.

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos
126

Not sure that you need to correct it, its really just giving a warning. You can get rid of it by putting

"#EC NEEDED at the end of the line of code.

tables: mkpf.         "#EC NEEDED

Regards,

Rich HEilman

0 Kudos
125

Rich,

If we put "#EC NEEDED at the end of the line..what does it exactly do. I dont know what is its main functionality. Can you please explain a bit.

0 Kudos
125

The syntax 'TABLES' was a carry-over from the older versions of SAP R/3 where, you have to declare all your database tables, in order to 'SELECT' from them. It is no longer required. Max has beautifully explained it.

You have to remember that when you do a select, you need a work area to place the values that you read. Now if you declare a work area and use it then you dont need the 'TABLES' statement. This is because, TABLES statement provides you with the work area. What this warning told you is that you declared a work area and you are not using it.

Now you can suppress this warning(you are only suppressing the warning message, not eliminating the reason for that warning which is wastage of memory area!!!) like Rich suggested. What it does is to just suppress the message. This will be particularly useful, where if you have a QA team who look into extended check and raise objections to warning messages!!!

0 Kudos
125

If answered, please reward and close the post.

Former Member
0 Kudos
125

Hi

The system is just only giving warning as if said to you:

- Hey Abaper! You have declared to use the headerline of MKPF, but perhaps you aren't using it. Check your code and if you don't use you delete that declaretion.

So if you don't use MKPF in your program, you can delete the declaretion, if you use it you can do nothing or you put the string "#EC NEEDED at the end of declaretion. If you do it, while checking program through extend program check, the system skips that message and doesn't show you.

We often use header line of dictionary table only to do an existence query, in this case the system can give that warning message.

For example:

TABLES: BKPF.

SELECT SINGLE * FROM BKPF WHERE BUKRS = P_BUKRS

AND BELNR = P_BELNR

AND GJAHR = P_GJAHR.

IF SY-SUBRC = 0.

WRITE: 'Hello'.

ENDIF.

So I made a query on bkpf, but after I haven't read or used its headerline, so the system give me that message.

If I write:

SELECT SINGLE BUKRS FROM BKPF INTO P_BUKRS

WHERE BUKRS = P_BUKRS

AND BELNR = P_BELNR

AND GJAHR = P_GJAHR.

IF SY-SUBRC = 0.

WRITE: 'Hello'.

ENDIF.

I've done the same thing but now I haven't declared to use the headerline BKPF and so the system won't give me that warning message.

Max

Message was edited by: max bianchi

Message was edited by: max bianchi