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

Type conversion issue

Former Member
0 Likes
1,218

Hi..

FOB_price like konp-kbetr

n_fsfe(8) type p decimals 4

If n_fsfe ge FOB_price.

Is thr any possibility of converting field with datatype CURR and length 2, to type p decimals 4...

I tried changing the FOB_price to type p decimals 4, bt tht gives a wrong value and so does n_fsfe if chngd to konp-kbetr(coz this is used for some calculation).

The IF condition gives all wrong values because this issue.. Is there any thing tht can be done..

Tnx..

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,159

Data : n_fob(8) type p decimals 4.

n_fob = fob_price.

if n_fsfe ge n_fob.

The above should work.

14 REPLIES 14
Read only

Former Member
0 Likes
1,159

Hi

Yes it can, but you have to create a new currency with 4 decimals (table TCURX) and in the table of the change define the tax rate between the currency with 2 decimals and new currency with 4 decimals.

In this situation if you write 5,1234 the system'll store the data as 512.34.

Max

Read only

Former Member
0 Likes
1,160

Data : n_fob(8) type p decimals 4.

n_fob = fob_price.

if n_fsfe ge n_fob.

The above should work.

Read only

0 Likes
1,159

Hi.. Anurag..

then

n_FOB = 0.1000,

whn the FOB price is actually 10.00..

Any help??

Read only

0 Likes
1,159

Are you really sure of that happening...I tried in a sample prog..

data : lp2 type konp-kbetr,

lp1(9) type p decimals 4.

start-of-selection.

lp2 = '245.68'.

lp1 = lp2.

write : / lp1, lp2.

The output was

245.6800 245.68

Read only

0 Likes
1,159

Hi.. Anurag..

Ya.. i debugged again, bt the same problem..

n_fsfe(8) type p decimals 4,

FOB_price like konp-kbetr,

n_FOB(8) type p decimals 4,

read table xkomv into txkomv with key kschl = 'PR00'

KPOSN = komp-kposn.

if sy-subrc = 0.

FOB_price = txkomv-kbetr.

n_FOB = FOB_price.

endif.

If n_fsfe ge n_FOB.

The above are the code segments i hv used in the program.. Is thr anything wrng with this??

Read only

0 Likes
1,159

Got it ...please change the attribute of your ABAP...

Please tick(select) the check box for Fix Point Arthmetic.

Read only

0 Likes
1,159

HI..Anurag Can u pls explain how to do tht if possible?

Tnx

Read only

0 Likes
1,159

In SE38 enter the ABAP name.

select the radio button Attributes

and click on the button Change.

It would list the attributes of the ABAP...at the bottom there are some 4 check box..there is one for Fix Point Arthmetic..Click on the same and save it.

Read only

0 Likes
1,159

Tnx Anurag.. I'm in the process of getting an developer access key which is needed to do this.. Tnx again.. I'm sure this will solve that problem..

Message was edited by: Keshini Weerasuriya

Read only

0 Likes
1,159

Hi.. Anurag. I tried tht but that doesn't work as well.. I inserted the tick for tht fiexd point arithmetic check box..

Welllll.. Can u think of anything else tht can be done.. Sorry to trouble u again..

Tnx..

Keshi

Read only

Former Member
0 Likes
1,159

Hi,

I think u can also use

WRITE txkomv-kbetr TO FOB_price DECIMALS 2.

instead of..

FOB_price = txkomv-kbetr.

check this.

Message was edited by: JITHENDRA CHADICHAL

Read only

Former Member
0 Likes
1,159

Hi,

I tried Anurag's code..It is working fine for me..

Activate the program once you set the checkbox 'Fixed point arithmetic'.

data : lp2 type konp-kbetr,

lp1(9) type p decimals 4.

start-of-selection.

lp2 = '10.00'.

lp1 = '10.0000'.

if lp1 = lp2.

write: / 'success'.

endif.

write : / lp1, lp2.

Thanks,

Naren

Read only

0 Likes
1,159

Tnx Narendra..

Well i'm trying to change one of the pricing condition source codes in VOFM.. And i got the object keys to teh SAP program and changed it to include the tick for the check box Fixed Point Arithmetic.

But unfortunately its nt workin as well.,.. I activated all related source codes, i mean the SAP program, the include in VOFM etc bt still without any sucess..

Thanks for ur reply anyway..

Read only

0 Likes
1,159

Hey.. It's working.. Tnx allllllllll of u..