2012 Mar 03 7:16 AM
Hi
Is it possible to do dynamic CONSTANTS assignment up front in INITIALIZATION or does ABAP limit you to define CONSTANTS only as data declaration with literal assignment?
Thanks, Adrian
Is it hard to understand?
a. I'm trying to find out if the CONSTANTS statement can be defined by using a SELECT statement instead of a literal e.g '3.14'. After some answers It seems NOT to be possible. So that's OK then. Moving on.
b. I don't want to revert to workarounds. In other languages this is a very simplistic data declaration that covers my requirement.
2012 Mar 03 7:28 AM
Hi Adrian,
Constants are objects that are created "statically" in a declaration statement.
The value of a constant must be defined when you declare it. It cannot be changed subsequently.
Also, the value of a constant cannot be changed during the execution of the program.
If you do so, a syntax error or runtime error occurs.
Regards,
-Sandeep
2012 Mar 03 7:42 AM
Thanks Sandeep. As mentioned, I understand the usage of a CONSTANT, but would like to know if it can be set once without the use of the literal. It's rather limiting don't you think? There is a workaround though, you can define it with a dynamic data declaration, but still that's a lot of effort for something that should be simplistic.
2012 Mar 03 9:44 AM
Hi Adrian,
I'm sorry, " There is a workaround though, you can define it with a dynamic data declaration, but still that's a lot of effort for something that should be simplistic ", I still can not get the idea since you knew could workaround then what is the different? Would you share your point?
Regards,
Dondi.
2012 Mar 03 9:57 AM
Is it hard to understand?
a. I'm trying to find out if the CONSTANTS statement can be defined by using a SELECT statement instead of a literal e.g '3.14'. After some answers It seems NOT to be possible. So that's OK then. Moving on.
b. I don't want to revert to workarounds. In other languages this is a very simplistic data declaration that covers my requirement.
2012 Mar 05 4:07 AM
It is not possible to declare a constant at runtime, yes the only way is using the literal CONSTANT and assign a value to it. I look for a way to create it using RTTS but it's not possible.
For reference http://help.sap.com/saphelp_nw2004s/helpdata/en/fc/eb3041358411d1829f0000e829fbfe/content.htm
Regards,
Felipe
| User | Count |
|---|---|
| 6 | |
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |