‎2013 Jun 12 4:45 AM
Hi SDN's ,
i am getting a warning 'Do not use fields , field symbols (ITAB) globally' ...i want to clear this warning with out using the Pseudo comments like #EC NEEDED if i use these pseudo comments it will show warning in hidden check........
i declare my ITAB as like....
types: begin of ty_final,
----------------
----------------
------------------
end of ty_final.
data: itab type table of ty_final. ( Warning)
how can i clear this warning with out using pseudo comments .......any one help ....
Thanks & Regards,
Suba.
‎2013 Jun 12 5:53 AM
You will get this message whenever you use globally defined internal tables or field symbols. Generally, you should have as little globally defined data as possible - only the essentials. To be rid of the message entirely, you need to encapsulate all operations involving the internal table (and ITAB is a really bad name for an internal table - choose something meaningful). You could for example, hand all the processing involving the internal table to a function module, or a global or locally defined class.
My executable programs usually only have a few globally defined references to classes. Everything else is handled within the class.
‎2013 Jun 12 8:07 AM
Hi Matthew,
Thank you for your valuable suggestion..,but in my program i am not using the OOPs (Ex:classes ) i used the general abap code ...i need some variables globaaly so i declared those in starting of the program...in ecc5 those are not shown warnings but when i check in ecc6 these are showing as warnings ........any other way to clear these earnings....
Thanks & Regards,
Suba.
‎2013 Jun 12 8:59 AM
No. If in ECC6 you declare an internal table or a field symbol outside of form (or local class) in an executable report, then you will get this warning, and must override it with the #EC comment - and explaining why it's being overridden.
The only alternative, if you don't want to use classes, is to put your functionality in function modules in a function group.
matt
‎2013 Jun 12 5:58 AM
Hi Suba,
If you have declare the itab in TOP include or inside the modules you will get such kind of warnings.
Try to declare the ITAB inside form endform so that you can avoid such kind of warnings.
Regards,
Shyja
‎2013 Jun 12 6:30 AM
Hey,
Analyze first if you really need to define your table ITAB globally? If it is used only inside one form routine, then declare the structure their only, don't define it globally (for example in TOP include).
In case you are using it at couple of places and need to define it globally, then you can approach as per Metthew suggestion. Hope it helps!