‎2007 Apr 16 11:04 AM
Hi To All,
I had a flat file in which the currency fields has values like 1,560.85,1,938.47.
I had declared the field KBETR AS data:kbetr(16).
while uploading the data i am getting the value as "1,560.85 " "1,938.47".
and also i need to divide this fieds by 10.but 1,560.85 is not treated as a number due to commas.
could any one help me out.
thanks & Regards,
Satish
‎2007 Apr 16 11:08 AM
Hi Sathish,
Check this info.
In your user profile, change the decimal format you are currently using.
System->User Profile->Own data.
Go to defaults tab and then change your decimal notation.
THIS PROCEDURE IS WITHOUT CHANGING DEFAULT SETTINGS:
Check this sample code.
Report YH642_TEST.
TABLES:
mard.
DATA : W_mard_labst type p decimals 3,
w_dt1(18).
data:
W_N TYPE I.
SELECT SINGLE * FROM MARD INTO MARD WHERE LABST = '10000.00'.
WRITE: mard-labst .
W_mard_labst = mard-labst.
WRITE:/ W_mard_labst .
w_dt1 = w_mard_labst .
write W_mard_labst to w_dt1.
W_N = STRLEN( W_DT1 ).
W_N = W_N - 4.
REPLACE ALL OCCURRENCES OF ',' IN W_DT1 WITH '.' .
REPLACE ALL OCCURRENCES OF '.'
IN SECTION OFFSET W_N LENGTH 4 OF W_DT1 WITH ','.
WRITE: / W_DT1.
Hope this resolves your query.
Reward all the helpful answers.
Regards
‎2007 Apr 16 11:10 AM
Hi..
after uploading that field, just remove all the commas using TRANSLATE statement !!
<b>translate KBETR using ', '. <i>"<<- after ',' space should be there !!</i>
condense KBETR no-gaps.</b>
Now u can divide this KBETR with 10 ..
regards,
Vijay
‎2007 Apr 16 11:13 AM
Hi Sathish,
Declare it as data: kbetr LIKE BSEG-WRBTR.
then, you aassign the respective currency field here...BSEG-PSWSL = KRW. (KRW for korean currency). USD for US dollar...now, try to print kbetr ..it will print according to the currency field u give in PSWSL. then u can manipulate as u want..
Reward point if useful.
Thanx 'n' regards,
Sekhar.
‎2007 Apr 16 11:14 AM
Hi satish,
goto System->User Profile->Own data->Defaults.
select the decimal notation you want.Then the number uploaded from flat file will be treated as a number.
regards,
keerthi.
‎2007 Apr 16 11:15 AM
Hi..Sathish,
Simple...this will solve ur prob...
<b>data:
w_num(6) type n.
move kbetr to w_num.
now divide it by 1000 not with 10.</b>
‎2007 Apr 16 11:15 AM
hi sathish,
in source fields when we are assigning field name, description , length and field type in the field type press f4 and take appropriate one this might be helpful to u
ok
regards
Naveen khan