‎2008 Aug 27 6:43 AM
hiii
i was wondering is it make sense to declare local constants in a report program
i mean constants is created so that it can be access globally then what's the use of declaring it in a perform like below
perform f_processdata
constants:
lc_test type c value 'X'
endform
i always declare my constant in my top include. i just wanted to know the difference
‎2008 Aug 27 6:44 AM
the difference is only in scope.....if you declare it in an include then it is available globally wherever the include is used....a local constant has only a local scope...
‎2008 Aug 27 6:44 AM
the difference is only in scope.....if you declare it in an include then it is available globally wherever the include is used....a local constant has only a local scope...
‎2008 Aug 27 6:48 AM
Hi,
The only difference comes for there scope.
If we declare the constants in INCLUDE then it has a global scope i.e. we can use this constants in number of programs.
And if we declare in any program its scope is local i.e we can use that in program only.
thanx.
‎2008 Aug 27 6:49 AM
There is no difference except for the availability of the constant. It will be locally available in this case and cant be accessed from other subroutines.
‎2008 Aug 27 6:49 AM
Hi
Refer this link
http://help.sap.com/saphelp_nw70/helpdata/en/fc/eb3041358411d1829f0000e829fbfe/content.htm
Regards,
Sravanthi
‎2008 Aug 27 6:51 AM
Hi Friend,
Declaring constants within a perform has the scope within that subroutine only. It cannot be accessed out of that subroutoine.
Declaring globally, it can be accessed throught the program.
You can check this in debugging.
Regards,
Chandra Sekhar
‎2008 Aug 27 6:53 AM
hiii
yes, if you declare constant globally then anywhere you can use it.and if you declare it in any subroutine then whenever you call that subroutine you can have that constant value.if some variables are really used for so many programs then it is better to declare it as global but constant value will not be used that much time so it is better to declare it as local and call that subroutine whenever you need it.
regards
twinkal
‎2008 Aug 27 7:02 AM
Hi,
perform f_processdata
constants:
lc_test type c value 'X'
endformIf you declare inside a form routine then that is accessible with in that form routine itself.
we cant use them outside the form routine.
If this constant is used only in a particular form routine then it better to declare locally then globally.
If the constant or variable is used in many instances then we declare it globally.
Best regards,
raam