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: 

Do not declare global fields in ATC check

Bharath84
Participant
0 Kudos
1,219

Hi All,

In my custom program, I have written the below code.

CLASS: lcl_rep_error DEFINITION DEFERRED.
DATA : lo_object TYPE REF TO lcl_rep_error.

In ATC checks, it is showing me "Do not declare global fields" . What exemption do we need to apply here. How to overcome this warning. Please suggest.

Thanks,

HT

2 REPLIES 2

pokrakam
Active Contributor
301

Prefixing a variable with l doesn't make it local, lo_object is still global. Good program structure should avoid globals.

horst_keller
Product and Topic Expert
Product and Topic Expert
301

Same as https://answers.sap.com/answers/350551/view.html

And as Mike said. Or do you think that

CLASS: lcl_rep_error DEFINITION DEFERRED.

opens a class context?

Last but not least: For the (rare) cases, where global data are needed, you can use the pragma ##NEEDED.