‎2007 Aug 06 9:24 AM
Hi all,
Here i have requirement to creat a filed decimal field of lenth 5, in which 2 fields are decimals ( 3.2) and the value range should be 0 to 999.99 only positve .
and the other filed of lenght 7 lenth decimal only (5.2) an the value range is
0 to 99999.99 only positive
for the first one i took data type dec
no of charter 5
decimal 2
system has given output lenth 6
But for the second one
no of charter 7
decimal 2
system has given output lenth 9
but my output lenght should be 8 .
it is giving some information
Output length (8) is less than the calculated output length (9)
Please give me solution in this regard
And at the same time how can i give interval it is with decimal or with out decimals
With regards
anand
‎2007 Aug 06 9:31 AM
Hi,
In the second case it is required to have 9 places for output as you need to show ',' once you have a value more than 1000.
Like this 99,999.99
So 5 + 2 + 1(for ,) + 1 (for .) = 9 char
This is the reason why 9 charcater output field is required.
So at the domain level give the output length as 9.
Regards,
Sesh
‎2007 Aug 06 9:31 AM
Hi,
In the second case it is required to have 9 places for output as you need to show ',' once you have a value more than 1000.
Like this 99,999.99
So 5 + 2 + 1(for ,) + 1 (for .) = 9 char
This is the reason why 9 charcater output field is required.
So at the domain level give the output length as 9.
Regards,
Sesh
‎2007 Aug 06 9:37 AM
Hi,
If you declare the field length 3.2 then the output length will be 6 because .(dot) is also a charecter so it tah total lenght will become 6
Regards
Sudheer
‎2007 Aug 06 9:39 AM
‎2007 Aug 06 10:04 AM
Data Type DEC
No. Characters 5
Decimal Places 2
Output Length 6
int the above case it is ok including decimal it 6 out put lenth
Data Type DEC
No. Characters 7
Output Length 9
in the second case it 9 output lenght
but including '.' (decimal point) my lenght should be 8
the problem with second case
and at the same time pls tell me how i can give range
for the first case range is +ve only from 0 to 999.99
second case also positve 0 to 99999.99
with regards
anand
‎2007 Aug 06 11:20 AM
Hi,
It is not an error ,it is a warning message.
You can ignore it,And activate it.
If you need output length to be one less,go to change node and make change as you want.
Then also,it gives a warning message.
You can ignore it,And activate it.
You can maintain intervals at the domain level-->Value Range.
You can use the dataelements in your report as below:
REPORT z_test.
PARAMETERS:
p_num TYPE zde111. " For this create domain of type dec and there only you can fill intervals in the value range.
WRITE:
/ p_num.
Regards,
Rama.Pammi
‎2007 Aug 06 2:39 PM
"Example :1 .. if you use you currency type then this methodThis addition defines currency-dependent decimal places for the output of data objects of data types i or p. For all other data types, except for f, the addition is ignored. For cur, a three-digit, character-type field is expected that contains a currency key from the column CURRKEY of the database table TCURX in uppercase letters. The system determines the number of decimal places from the column CURRDEC of the respective row in the database table TCURX. If the content of cur is not found in TCURX, two decimal places are used. The following applies for numeric data types:
In the case of data types of type i, a decimal separator is inserted at the position determined by cur and the thousands separators are moved accordingly.
In the case of data objects of type p, the decimal places defined in the definition of the data type are ignored completely. Irrespective of the actual value and without rounding actions, the decimal separators and the thousand separators are inserted at the positions in the numbers determined by cur.
In the case of data objects of type f, the addition CURRENCY has the same effect as the addition DECIMALS (see below). Here, the number of decimal places is determined by cur.
If the addition CURRENCY with length specification * or ** is used after AT, it is used first and the output length is determined from the result.
Note
The addition CURRENCY is appropriate for the display of data objects of type i or p without decimal places, whose contents are currency amounts in the smallest unit of the currency.
"Example
The output of the WRITE statement is "123456,78".
DATA int TYPE i VALUE 12345678.
WRITE int NO-GROUPING CURRENCY 'EUR'.
"Example :2 .. if you mention Decimal place's then this methodThis addition defines the number of displayed decimal places for the output of data objects of data types i, p, or f. For all other data types, the addition is ignored. For dec, a data object of type i is expected that contains the number of required decimal places. If the content of dec is less than 0, it is treated as 0, whereby the content of data objects of data types i or p is previously multiplied by 10 to the power of dec. For the individual numeric data types, the following applies:
In the case of data objects of type i, a decimal separator and as many zeroes as are specified in dec are added on. The content of dec can be maximum 14. Otherwise, an exception that cannot be handled will be triggered. If the content of dec is 0, the output is unchanged.
In the case of data objects of type p, as many decimal places as are specified in dec are displayed - irrespective of the number of decimal places defined in the data type. The content of dec can be maximum 14. Otherwise, an exception that cannot be handled will be triggered. If dobj has more decimal places, it is rounded to the decimal places in dec. If dobj has less decimal places, a corresponding number of zeroes are inserted.
In the case of data objects of type f, the content of dec determines the number of decimal places in scientific notation. If the content of dec is greater than 16, it will be treated like 16. If the content of dec is greater than the number of decimal places in dobj, a corresponding number of zeroes will be inserted. If the content of dec is less than the number of decimal places in dobj, it is rounded to the decimal places defined in dec.
If the addition DECIMALS is used with length specification * or ** after AT, it is used first and then the output length is determined from the result.
If the addition CURRENCY is specified as well, this is executed first in the case of data types i and p, and then the addition DECIMALS is applied. In the case of data type f, the addition CURRENCY is ignored if it is specified together with DECIMALS.
"Example
The output for the WRITE statement is "1234,57".
DATA pack TYPE p LENGTH 8 DECIMALS 4 VALUE '1234.5678'.
WRITE pack NO-GROUPING DECIMALS 2.
reward points if it is usefull ...
Girish