08-14-2009 8:13 AM
Hi SDN Community,
Can you possibly provide a sample of how to declare a variable to be dynamic.
the situation is that using the TABLE CLASS INTERFACE,
the numbers from I_VALUE come in as long decimal places. eg. 20.58498497
i wish to have a declaration to then use this further in the code.
for example
DATA: ROUNDEDNUMBER type i DECIMALS 2.
but i want instead of 2, to have this dynamic,
the dynamic value is populated by I_NUMERIC_PRECISION which is derived from the settings of the Bex query.
hence my anticipated result is 20.6 (which has been rounded as well)
I have seen Field symbols achieve this?
Thank you.
Simon
08-14-2009 8:32 AM
TRY THIS :
DEC_NO IS THE VARIABLE WITH THE MAX 14 DECIMALS.
GET YOUR NUMBER IN DEC_NO AND THEN ASSIGN IT TO THE FIELD SYMBOL.
DATA: DEC_NO TYPE P DECIMALS 14.
ASSIGN DEC_NO TO <FS_DEC>.
USE <FS_DEC> IN YOUR FURTHER CODE.
08-14-2009 8:44 AM
Hi Naresh
Thank you for your reply.
Can you possibly put the full snippet of ABAP code that will achieve this.
I only am an amateur ABAP'er, and work on your expertise syntax.
Thank you.
Simon
12-22-2009 12:19 AM
Answer:
write i_display_value to lv_replace_value
no-sign decimals i_numerical_precision.
condense lv_replace_value no-gaps.
07-25-2014 12:39 PM
Hi all,
I had the same issue und solved it in this way:
DATA: lv_decim TYPE numc1 VALUE 0.
DATA: lr_packed TYPE REF TO data.
FIELD-SYMBOLS: <fs_packed> TYPE ANY.
CREATE DATA lr_packed TYPE p DECIMALS lv_decim.
ASSIGN lr_packed->* TO <fs_packed>.