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

Parameter in FM

Former Member
0 Likes
2,014

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.

1 ACCEPTED SOLUTION
Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,705

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

11 REPLIES 11
Read only

jyotheswar_p2
Active Participant
0 Likes
1,705

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

Read only

0 Likes
1,705

Hope that should work...Thanks for the reply.

Can there be any alternative way around?

Read only

0 Likes
1,705

While copying the FM its giving message " Function module name is reserved for SAP".

Read only

0 Likes
1,705

Any suggestions?

Read only

0 Likes
1,705

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

Read only

0 Likes
1,705

Thanks Nick for the reply...

Any other way round without copying the FM to get my solution.

Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,706

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

Read only

0 Likes
1,705

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"

Read only

0 Likes
1,705

Use a factor 10 (0.0053981 becomes 0.053981 per 10)

Read only

0 Likes
1,705

No Luck!!!!!

Edited by: JohnMell02 on Feb 2, 2010 3:31 PM

Read only

0 Likes
1,705

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