‎2008 Aug 27 6:59 AM
Hi all
Is there any way to declare a constant ,dynamically (ie base on a condition).
Regards
Prabumanoharan
‎2008 Aug 27 7:04 AM
why do you want to use a constant for this purpose....a constant would mean it will have a single value. So whatever be the condition , the value of the constant will not change.
based on your condition, you can work with a normal variable and change its value. Or, you can declare multiple constants and use the appropriate one based on your condition.
if this does not answer your question...can u pls explain the requirement in more detail in terms of what you want to do?
‎2008 Aug 27 7:38 AM
i've two fields (select-options) in the selection screen, any one of that fields will be displayed for input at a time (based on a condition), i've used a flag to identify which field is being displayed, it is the base for the data selection, this is working fine in foreground, but when scheduled in background it always considers the field A and selects data based on that.
if i could declare a constant dynamically , checking the flag , i'll declare the constant(with value 'X') . If run in background , based on the constant value, set the data selection based on the Field B.
This is for the option Program -> Execute in background ,
this will return fcode SJOB, checking that in AT SELECTION-SCREEN , i've to declare the constant.
Regards
Prabumanoharan
‎2008 Aug 27 7:46 AM
I still don't understand how a constant will help here.
if you want to do something when your program is running in background, you can check the value of system variable sy-batch. if the value of this variable is initial, means the program is in online mode, if it has X then it is being run in background....
you can do your checks accordingly. This value will be available in the at selection-screen event.
‎2008 Aug 27 7:52 AM
Hi Prabhu,
For your purpose, use a variable with default value and use it in the same manner as you are going to use it as a constant....
Regards,
Kunjal
‎2008 Aug 27 7:05 AM
no you can not...
if you were able to set CONSTANT values dynamically then it would not make any sense of creating a constant... you can directly use a Variable
‎2008 Aug 27 7:40 AM
‎2008 Aug 27 7:42 AM
Hi
You can not change the Constant's value dynamically.
Instead you define a variable, multiple constants.
And then based on your condition you can dynamically assign the value to that variable
Thnkas & Regards
Mallikharjuna Reddy
‎2008 Dec 22 6:20 AM