04-08-2010 9:22 AM
Dear experts,
In ALV change mode, user change the data directly in ALV report.
There is one field which stores price information as defined with Domain-WERTV8.
When user input any price data, then press 'Save'. Then the price data will be truncated 2 digits always.
For example:
If user input 2222, then after saved, the ALV report will show as 22.22.
What we want is the ALV report still will show 2222 and updated to the table as 2222. But right now above issues existed...
If we change the table directly via SM30, the price data will not be truncated and no issues.
Please kindly let me know if any where has issues???
Thank you so much.
04-08-2010 10:25 AM
Hi,
I think the problem is the currency key is not referred in the field catalog. The currency key should be referred always, while using currency in ALV.
If you are using LVC_S_FCAT, pass CURRENCY field with the required currency like USD,LYDN etc. If the currency field is different for each line item, populate the currency field in the internal table and pass the fieldname declared for currency key in the internal table to CFIELDNAME. Also, decalre the currency field as type CURR in the internal table.
eg
wa_fcat-COL_POS = '1'.
wa_fcat-FIELDNAME = 'PRICE'. "Price field in internal table INT_OUTPUT
wa_fcat-TABNAME = 'INT_OUTPUT'
wa_fcat-CURRENCY = 'USD'.
OR
wa_fcat-CFIELDNAME = ' CKEY'. "Currency Key Field in internal table INT_OUTPUT
APPEND wa_fcat TO int_fact.
04-08-2010 9:27 AM
Hi Hoo Laa
you must check the datat type of the filed in alv....
try to use a char10...
regards
Marco
04-08-2010 9:42 AM
Hi Marco,
As i checked the price field and found below definations on this field. Data element WERTV8 and domain WERTV8 is used...
Data element WERTV8 Active
Short Description 8(15)-character value field with 2 decimal places
Domain WERTV8 Value field PL8 wit
Data Type CURR Currency field, stored as DE
Length 15 Decimal Places 2
Thanks.
04-08-2010 9:48 AM
Hi..
so the issue is that the field have 2 decimal,
so for the system for all the value you will put into this field must have 2 decimal.
your example is that for the number 2222 you have 22.22, if you put 222200 it will calculate 2222.00..
so if you don't want the decimal number you must use a character type without decimal..
for example a char15....
regards
Marco
04-08-2010 9:58 AM
Hi Macro,
But while i am using SM30 to maintain the data field, there are no such issues. If i input 2222, then 2222.00 will be saved to the table.
So i have to change the data type to char 15..etc right??
Thanks.
04-08-2010 10:01 AM
Hi...
maybe in SM30 there are some conversion routine.
yes..if you changhe with a char type without decimal you will not have problem.
regards
Marco
or you can hold the original data type and before saving the data in table you can multiply the value per 100.
Edited by: Menegazzo Marco on Apr 8, 2010 11:04 AM
Edited by: Menegazzo Marco on Apr 8, 2010 11:08 AM
04-08-2010 10:25 AM
What happens in SM30 is that the values are stored in one string table TOTAL. The data from this string table id the transferred to the database. So there may be the case that the data what ever entered is interpreted correctly.
What you need to do is to display that field as a string and then whil saving you need to convert that into currency using function module ISM_CONVERT_CHAR_TO_CURR and then save that to the database.
04-08-2010 10:25 AM
Hi,
I think the problem is the currency key is not referred in the field catalog. The currency key should be referred always, while using currency in ALV.
If you are using LVC_S_FCAT, pass CURRENCY field with the required currency like USD,LYDN etc. If the currency field is different for each line item, populate the currency field in the internal table and pass the fieldname declared for currency key in the internal table to CFIELDNAME. Also, decalre the currency field as type CURR in the internal table.
eg
wa_fcat-COL_POS = '1'.
wa_fcat-FIELDNAME = 'PRICE'. "Price field in internal table INT_OUTPUT
wa_fcat-TABNAME = 'INT_OUTPUT'
wa_fcat-CURRENCY = 'USD'.
OR
wa_fcat-CFIELDNAME = ' CKEY'. "Currency Key Field in internal table INT_OUTPUT
APPEND wa_fcat TO int_fact.