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: 

Changes to standard functional Module

Former Member
0 Kudos

Hi Friends,

I am working with a standard functional module called <b>'convert_to_foreign_crrency'</b>. When I am trying to debug this, it calls another FM called convert_to_foreign_crrency_n. The problem is it gives me an overflow at the statment foreign_amount = refe. It is because of the data mismatch between them. To get rid of this I want to change the data type of foreign_amount whch is an export parameter of this FM. The best way to do is to copy this FM and the one that is calling this. and modify as per the requirement. My quoestion is what sort of problems will arise when we copy and modify thses FM's. And what is the procedure in real time. I think it is better If I copy the whole functin group and then make modifications to te FM. Did anyone ever did that ? Please help me how do we handle this in real time.

Regards,

Varun.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

I don't think it has anything to do with the function module itself Varun. I think your variable that you are passing to the FOREIGN_AMOUNT parameter is not long enough to hold the converted amount. Please let us know your declaration of this variable.

16 REPLIES 16

former_member188685
Active Contributor
0 Kudos

Hi,

copy the Function and modify it. and use it for your purpose. do not make any changes to the standard FM's. they might be used in some other places.

Regards

vijay

0 Kudos

Hi Vijay,

What do you suggest ? COpy the FM alone or copy the whole group ? Which is the best industry practice ?

Here convert_to_foreign_currency is calling convert_to_foreign_currency_n and both belong to different function gruoups.

Regards,

Varun.

0 Kudos

Varun

Copying the function alone will be little tricky as there might be the declarations and the subroutines which will in different includes.

So, if there aren't too many functions in the group, you could consider the entire group, else you will have copy the function first and then COPY and PASTE the related declarations and subroutines.

Regards,

Ravi

0 Kudos

Hi varun,

i mean to say all the related declarations and forms,include which are usefull to the FM. not the Full Function group. that will be simple but need to take care of all objects included in the FM's

Regards

vijay

former_member181962
Active Contributor
0 Kudos

Do not make changes to a standard function module at any cost.

MOreover the FM you are talking about is a very popular one. There must be a simpler alternative for your problem than to create a new FM.

Can you let us know what exactly is the problem?

If you still want to go for it, i suggest you to create a new Function Module which calls this FM(Wrapper FM).

Regards,

Ravi

Former Member
0 Kudos

the global declarations in the function group mite create problem when u copy the FM

Former Member
0 Kudos

This sounds like an SAP problem - have you checked OSS notes? There seem to be a few that might apply.

Rob

0 Kudos

Hi Rob,

No I did not go through the OSS notes. I wil check and get back to you all.

Regars,

varun.

0 Kudos

When you have problems with standard SAP functionality, your first step should be to look for notes. If there are none that seem to suit you, you should raise an OSS message. That way, if there is an SAP problem, they can fix it properly and create a note for others to use.

rob

Former Member
0 Kudos

I don't think it has anything to do with the function module itself Varun. I think your variable that you are passing to the FOREIGN_AMOUNT parameter is not long enough to hold the converted amount. Please let us know your declaration of this variable.

0 Kudos

Also you mentioned that you are getting an overflow error, that is why I am thinking that it is related to the length of the variable that you declared.

But in the same length, you also mentioned that it is the data type that is creating this issue. Are you trying to test this in SE37? You cannot do that because, even though the FOREIGN_AMOUNT parameter has no type info in the interface, the code is expecting it to be a type P field. In SE37, you cannot send any type information. That is why there will be a type mismatch dump. You will have to test it through a program. Declare the variable that you pass to this FOREIGN_AMOUNT paramater same as REFE which is declared as REFE(16) TYPE P.

0 Kudos

Hi,

Ravi, the convert_to_foreign_currency calls the FM convert_to_foreign_currency. That is for sure.

Srinivas,

This is the code where exactly the overflow problem is coming.

<b>

CATCH SYSTEM-EXCEPTIONS arithmetic_errors = 1.

foreign_amount = refe.

ENDCATCH.

IF sy-subrc = 1.

WRITE refe TO char CURRENCY foreign_currency.

MESSAGE e106 WITH char foreign_currency

RAISING overflow.

ENDIF.

</b>

The foreign_amount is an export parameter of the second FM.I am testing it in a program only.

The data declaration of the variable which is trying to capture the amount is CUrr with length 11 and 4 decimlas.

Regards,

Varun.

0 Kudos

That is your problem. Use a variable of length 16, type P and you will be good to go. I think your resultant amount is greater than what the variable you are passing can hold.

0 Kudos

Hi Srinivas,

It seems you are right and I am close to the problem. I will get back to you soon.

Regards,

Varun.

0 Kudos

Hi all,

Thank you all friends for your constant and valuable help.

Srinivas,

Thank you very much man. Just a simple thank you will not be enough to payback your favour. You are 100 % right. The issue is with the variable.My problem is solved. Thanks a ton.

Regards,

Varun.

former_member181962
Active Contributor
0 Kudos

HI Varun,

The FM doesn't call any function by the name CONVERT_TO_FOREIGN_CURRENCY_N.

Can you tell us what the dump says?

Regards,

Ravi