Application Development 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: 

Divide DMBTR by exchange rate ( SAp filed BAPI1093_0- EXCH_RATE)

Former Member
0 Kudos

Hi

I would like the divede the value of DMBTR(Amount in Local currency) by EXCH_RATE(Direct Quoted Exchange Rate - SAP field BAPI1093_0- EXCH_RATE)

In my data, I have Exchnage rate as 3.25000 and amount as 310000.00

Exchange rate was stored in the field : V_EXCH_RATE, the data type is BAPI1093_0- EXCH_RATE

Amount was stored in the field : Amount_dmbtr, the data type is BSID-DMBTR.

Result have to stored in Result_dmbtr, the data type is BSID-DMBTR.

That is

Result_dmbtr = amount_dmbtr / v_exch_rate.

Result_dmbtr = 310000.00 / 3.25000

expected result is : 9538.461538

But I am getting value as : 0.10.

If I multiply amount_dmbtr by 1000 then this will become 31000000.

If I do calculation as 31000000 / 3.25 getting result as 95.38. Again I am muliplying this by 100 and got result as 9538. I would like to know the logic behind this.

see the piece of code

data : gv_fx_rate_EUR_DUE type UKURSP , "(BAPI1093_0-EXCH_RATE, Direct Quoted Exch Rate)

gv_from_factor type FFACT_CURR, "BAPI1093_0-FROM_FACTOR(From Factor)

gv_to_factor type TFACT_CURR, "BAPI1093_0-TO_FACTOR(To factor)

Amount_dmbtr type dmbtr.

Start-of-selection

gv_fx_rate_eur_due = 325.00000

gv_from_factor = 100

gv_to_factor type = 1

AMOUNT_DMBTR = 31000.00

GV_XCH_F_EUR = GV_FX_RATE_EUR_DUE * gv_to_factor.

GV_XCH_F_EUR_DUE_01 = ( GV_XCH_F_EUR / gv_from_factor ).

Result_dmbtr = amount_dmbtr / GV_XCH_F_EUR_DUE_01

final output :

result_dmbtr = 0.10.

But expected output is : 9538.46.

Regards

Vijay

1 ACCEPTED SOLUTION

GauthamV
Active Contributor
0 Kudos

Check this output.



data : gv_fx_rate_EUR_DUE type UKURSP , "(BAPI1093_0-EXCH_RATE, Direct Quoted Exch Rate)
gv_fx_rate_EUR_DUE1 type UKURSP ,
gv_from_factor type FFACT_CURR, "BAPI1093_0-FROM_FACTOR(From Factor)
gv_to_factor type TFACT_CURR, "BAPI1093_0-TO_FACTOR(To factor)
Amount_dmbtr type dmbtr.

data:GV_XCH_F_EUR type p decimals 2,
       GV_XCH_F_EUR_due1 type p decimals 2,
       result_dmbtr type p decimals 2.

Start-of-selection.
gv_fx_rate_eur_due = '325.00000'.
gv_from_factor = 100.
gv_to_factor  = 1.
AMOUNT_DMBTR = '31000.00'.

GV_XCH_F_EUR = GV_FX_RATE_EUR_DUE * gv_to_factor.
GV_XCH_F_EUR_DUE1 = ( GV_XCH_F_EUR / gv_from_factor ).
RESULT_DMBTR = amount_dmbtr / GV_XCH_F_EUR_DUE1 .

end-of-selection.
write: RESULT_DMBTR.

1 REPLY 1

GauthamV
Active Contributor
0 Kudos

Check this output.



data : gv_fx_rate_EUR_DUE type UKURSP , "(BAPI1093_0-EXCH_RATE, Direct Quoted Exch Rate)
gv_fx_rate_EUR_DUE1 type UKURSP ,
gv_from_factor type FFACT_CURR, "BAPI1093_0-FROM_FACTOR(From Factor)
gv_to_factor type TFACT_CURR, "BAPI1093_0-TO_FACTOR(To factor)
Amount_dmbtr type dmbtr.

data:GV_XCH_F_EUR type p decimals 2,
       GV_XCH_F_EUR_due1 type p decimals 2,
       result_dmbtr type p decimals 2.

Start-of-selection.
gv_fx_rate_eur_due = '325.00000'.
gv_from_factor = 100.
gv_to_factor  = 1.
AMOUNT_DMBTR = '31000.00'.

GV_XCH_F_EUR = GV_FX_RATE_EUR_DUE * gv_to_factor.
GV_XCH_F_EUR_DUE1 = ( GV_XCH_F_EUR / gv_from_factor ).
RESULT_DMBTR = amount_dmbtr / GV_XCH_F_EUR_DUE1 .

end-of-selection.
write: RESULT_DMBTR.