Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

regarding currency fields

Former Member
0 Likes
704

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

6 REPLIES 6
Read only

Former Member
0 Likes
680

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

Read only

Former Member
0 Likes
680

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

Read only

Former Member
0 Likes
680

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.

Read only

Former Member
0 Likes
680

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.

Read only

Former Member
0 Likes
680

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>

Read only

Former Member
0 Likes
680

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