‎2010 Feb 02 1:09 PM
HI All,
TYPES : BEGIN OF it_struc,
exch_rate(10) TYPE c.
END OF it_struc.data : it_final TYPE STANDARD TABLE OF it_struc,
wa_final TYPE it_struc. DATA : wa_1 TYPE bapi1093_0,
str(200) TYPE c.LOOP AT it_final INTO wa_final.
CALL FUNCTION 'C147_STRING_TRUNCATE'
EXPORTING
i_string = wa_final-exch_rate
i_maxlen = 7
i_terminator = ' '
IMPORTING
e_string = str." WA_1-EXCH_RATE .
wa_1-exch_rate = str.CALL FUNCTION 'BAPI_EXCHANGERATE_CREATE'
EXPORTING
exch_rate = wa_1
upd_allow = 'X'
* CHG_FIXED = ' '
* DEV_ALLOW = '000'
IMPORTING
return = return2
rate_type = returntype
* FROM_CURR =
* TO_CURRNCY =My Requirement was to upload exchange rates from flat file to OB08.
i have my first currency having exchange rate as 185.25123. Dividing by 1 i.e. i/185.25123 it is 0.0053981.....
I used the FM 'C147_STRING_TRUNCATE' to get only 7 places.
My issue is 'BAPI_EXCHANGERATE_CREATE' has exch_rate as a parameter of decimal value 5 and length 9.
So when i pass it i.e. 0.0053981.... via this FM it shows as 0.00540.
But i want as 0.0053981. How to get with this?
Jmello.
‎2010 Feb 02 1:51 PM
Use the fields FROM_FACTOR and TO_FACTOR of EXCH_RATE structure to keep the rate in the range allowed by the BAPI
(as specified in the online documentation of the parameter)
The exchange rate must be greater than zero and smaller than 9999.99999, and can be entered with up to five decimal places.
The exchange rate relation (or exchange rate factors) serves as an entry for exchange rates which are smaller than 0.00001 or greater than 10000. Entries can only be made in the form "1 : to the power of 10" or "to the power of ten : 1". "To the power of 10" means one of the following numbers: 1, 10, 100, ..., 100000000.
Regards,
Raymond
‎2010 Feb 02 1:16 PM
Hi
Copy the standard BAPI into a custom BAPI and change the exch_rate to whatever data type you need by creating a data element .And execute the BAPI and check how it behaves.
It should work.
Thanks & Regards
Jyo
‎2010 Feb 02 1:30 PM
Hope that should work...Thanks for the reply.
Can there be any alternative way around?
‎2010 Feb 02 1:36 PM
While copying the FM its giving message " Function module name is reserved for SAP".
‎2010 Feb 02 1:42 PM
‎2010 Feb 02 1:47 PM
Hi,
Function module customer name range is usually starting with a Z (or Y) with an underscore (_) in the second character.
That said, the message you're getting is only a warning, so you can enter through it.
Regards,
Nick
‎2010 Feb 02 1:49 PM
Thanks Nick for the reply...
Any other way round without copying the FM to get my solution.
‎2010 Feb 02 1:51 PM
Use the fields FROM_FACTOR and TO_FACTOR of EXCH_RATE structure to keep the rate in the range allowed by the BAPI
(as specified in the online documentation of the parameter)
The exchange rate must be greater than zero and smaller than 9999.99999, and can be entered with up to five decimal places.
The exchange rate relation (or exchange rate factors) serves as an entry for exchange rates which are smaller than 0.00001 or greater than 10000. Entries can only be made in the form "1 : to the power of 10" or "to the power of ten : 1". "To the power of 10" means one of the following numbers: 1, 10, 100, ..., 100000000.
Regards,
Raymond
‎2010 Feb 02 1:55 PM
Thanks Raymond for your reply.
0.0053981.... is my result that i need in OB08 BUTvia this FM it shows as 0.00540.
i want 0.0053981. How to get with this?
One more thing when i copy the FM it gives an error saying "Function group BUS1093 is SAP-specific"
‎2010 Feb 02 2:05 PM
‎2010 Feb 02 2:16 PM
‎2010 Feb 02 2:44 PM
Dont forget that your rate will be stored in table TCURR field UKURS, so 5 decimal positions and none more, forget the idea to store a 6th decimal.
Your report should begin with a call of BAPI_EXCHANGERATE_GETFACTORS which will give your the factor that you will use in BAPI_EXCHANGERATE_CREATE.
(Godverdom, i answered too fast, correct answer was Use a factor 100 (0.0053981 becomes 0.53981 per 100, more exactly, divide 100 (or the factor rate returned by get factors) by the reverse rate and not 1)
Regards,
Raymond