05-09-2013 9:44 AM
Hi Experts,
I have simple doubt ... in database the value is showing as "1.667,000" so during debug mode i am getting "1667.000" so how to convert to this value as
1.667.
Thanks in advance
05-09-2013 9:59 AM
What you mean is the tool you are using to see the value in the database is showing 1.666,000. Probably there is something that is converting the raw data (which is what you see in debug) into a nicely formatted display.
The question is: what is your program actually doing?
05-09-2013 10:05 AM
hi,
From menu bar follow following steps
System--->User Profile ----> Own Data
Then go to Defaults Tab. There u can change the format of currency
05-09-2013 10:30 AM
Hi Jatin,
As far as i understood your requirement is to change the format of the decimal value notations.
If this is what you require then go to System->user profile ->own data and then go to the defaults tab.
There you have the options to change the decimal notations.
05-09-2013 10:40 AM
Hi Jatin,
Please try below mentioned code.
Find out the variable value l_xdezp from USR01 table for corresponding user.
px_in is character variable
* If comma is used for decimal separator "e.g. 1.500.010,009
if l_xdezp eq space.
TRANSLATE px_in-value USING '. '.
TRANSLATE px_in-value USING ',.'.
* If dot is used for decimal separator "e.g. 1,500,010.009
elseif l_xdezp eq 'X'.
TRANSLATE px_in-value USING ', '.
endif.
regards
Tejas
05-09-2013 10:57 AM
Hi,
Go to SU01. Enter the user id. Go to "Defaults" tab. Set the decimal notation. Log out of the system after saving the changes. And login again and check.
Thanks-
Makarand
05-09-2013 11:07 AM
hi
go to t-code OY01 and change the comma and dot separate under the country code
or
user wise
t-code SU01
Goto System->User Profile->Own data
Defaults tab..Maintain the desired one in field Decimal Notation
or
use bellow code
REPLACE ALL OCCURRENCES OF ',' IN: LV_NUM WITH '.'.
Regard,
Nawa
05-09-2013 11:13 AM
Hi Dear,
Sorry, but could you please tell me is it right to suggest to use OY01, since it will change the setting for entire country?
Thanks -
Makarand
05-09-2013 11:09 AM
Hi Jatin,
1. You can use SAP standard option from System - > User Profile - > Own Data.
2. You can use Translate statement (Check F1 help) Tejas also suggested some methods using this.
3. You can also use, Search and Replace.
For Search and Replace Syntax is as the below mentioned
Constants : C_DQUOTATION(2) Value ''',
Search L_PRESTRING For C_DQUOTATION.
Replace All occurances of C_DOT with C_DQUOTATION.
F1 help will give you more information. hope this helps.
05-09-2013 11:22 AM
Hi,
Just curious why you want it as 1.667.That's a strange format to work with for any purpose DB or program. Any specific need?
Cheers,
Arindam
05-09-2013 11:23 AM
Hi Jatin,
As I understood, you want to convert 1667.000 number to 1.667....
Try assigning this value to an Integer variable. I think it will remove ending 000.....
Sample code -
DATA:
val TYPE P DECIMALS 3 VALUE '1667000',
val1 TYPE I.
BREAK-POINT.
val1 = val.
WRITE: val1.
To replace dot with comma use following syntax
REPLACE '.' WITH ',' IN lv_string.
05-10-2013 2:56 PM
Dear Jatin,
Solution 1 ) U may use standard procedure menu-->system-->user profile---->own data.
Solution 2 ) In programatically write this logic and debug, easily understand this logic
parameters radha type matnr.
DATA: NEW(18) TYPE C,
LENN TYPE I,
NEWW(18) TYPE C,
CH TYPE CHAR18,
POS TYPE CHAR4,
COUNT TYPE I,
P TYPE I,
KP(18) TYPE C,
tp(18) type c,
price(18) type C,
l_prodh(5) type c.
*PRICE = WA_VBRP1-PRODH.
price = RADHA.
SHIFT PRICE LEFT DELETING LEADING SPACE.
SPLIT PRICE AT '.' INTO NEW NEWW.
CLEAR : PRICE.
LENN = STRLEN( NEW ).
POS = LENN.
POS = POS - 1.
COUNT = 0.
DO LENN TIMES.
P = SY-INDEX.
COUNT = COUNT + 1.
IF P = 3 .
IF LENN = P.
CH = NEW+POS(1).
CONCATENATE CH KP INTO KP.
ELSE.
CH = NEW+POS(p).
concatenate '.' ch into kp.
endif.
else.
IF P = 1 OR P = 2 OR P = 3 OR P = 4 OR P = 5 OR P = 6 OR P = 8 OR P = 9 OR P = 11 OR P = 12.
* if not p = 7.
CH = NEW+POS(1).
concatenate ch kp into kp.
else.
CH = NEW+POS(1).
concatenate CH '.' INTO CH.
CONCATENATE CH KP INTO KP.
endif.
endif.
POS = POS - 1.
ENDDO.
IF KP <> ' ' AND NEWW <> ' '.
CONCATENATE kp neww into tp separated by ','.
CLEAR: L_PRODH.
L_PRODH = TP.
ENDIF.
CLEAR: TP,KP.
Regards,
Radhakrishna.Ette
05-27-2013 11:52 AM
Hi Jatin,
Use REPLACE '.' WITH '--' IN Variable name.
REPLACE ',' WITH '.' IN Variable name ,
REPLACE '--' WITH ',' IN Variable name.
Many thanks
venkat
05-27-2013 3:28 PM
Hi,
You are seeing the format difference in the value due to the User profile settings maintained in your system.
Go to Menu System -- User Profile -- Own Data -- Default Tab.
Here You can see the Decimal notation maintained.
05-28-2013 10:56 AM
Hi,
use this code
* Converting Amount field formats
SELECT SINGLE dcpfm INTO l_dcpfm
FROM usr01
WHERE bname EQ sy-uname.
IF l_dcpfm IS INITIAL. "134,50
*
CONDENSE : it_output-kbetr,
it_output-kpein.
* Converting amounts as per User's decimal settings
REPLACE ALL OCCURRENCES OF '.' IN it_output-kbetr
WITH ' '.
REPLACE ALL OCCURRENCES OF '.' IN it_output-kpein
WITH ' '.
REPLACE ALL OCCURRENCES OF ',' IN it_output-kbetr
WITH '.'.
REPLACE ALL OCCURRENCES OF ',' IN it_output-kpein
WITH '.'.
CONDENSE : it_output-kbetr,
it_output-kpein.
ELSEIF l_dcpfm EQ c_x. "134.50
* Converting amounts as per User's decimal settings
REPLACE ALL OCCURRENCES OF ',' IN it_output-kbetr
WITH ' '.
REPLACE ALL OCCURRENCES OF ',' IN it_output-kpein
WITH ' '.
CONDENSE : it_output-kbetr,
it_output-kpein.
ENDIF. " IF gd_dcpfm IS INITIAL.
CONDENSE : it_output-kbetr,
it_output-kpein.
05-28-2013 11:15 AM
As per my understanding the user settings maintained for your profile is dot(.) and comma(,) separator.So for this setting the database will always store the values as 1.667,000. But when you read it in your program from the database table you will always get in SAP internal format as with only dot separator,example 1667.000.
If you want to change the value then you need to use the currency key and change the format using the below syntax:
lv_data = '1667.000'.
WRITE lv_data to lv_final_data CURRENCY 'USD'.
WRITE: lv_final_data.
The currency key "USD" used above is just an example. You have to take the currency key based on your requirement.
Thanks
Akankshi
05-28-2013 11:24 AM
Hi Kumar,
First check u r Own data settings. it's not working
then simply divide the value by 1000 and append to internal table
suresh.