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: 

Problem with User exits when using custom fm

Former Member
0 Kudos

Hi everybody,

I am processing an IDoc using fm IDOC_INPUT_INVOIC_MRM. Nos I had to copy this to Z_...

And this fm has a sun-routine that calls User-exits. When I am using the standard fm, the UEs are being checked for active and executing the logic in the UE. But when I am processing IDoc using Z_...fm, the system is checking if the UEs are active. Its also active and now the cursor is coming to CALL CUSTOMER-FUNCTION '014'. But here when I press F5 in Debug, the cursor moves to the next statement after this function call without executing the user- exits. I dont know why its not executing the UE.

Is there any setting that I need to make?

thanks in advance

kris

7 REPLIES 7

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

You need to activate the user exit in CMOD.

Regards,

Rich Heilman

Former Member
0 Kudos

Hi Vamsi,

User exits are specific to the object they are included in. So when you have a "CALL CUSTOMER-FUNCTION '011'" in IDOC_INPUT_INVOIC_MRM and when you have "CALL CUSTOMER-FUNCTION '011'" in your Z function module, they are two different things.

The purpose of a user exit is that you can include your logic in there within the limits defined by the object and without repairing the system. If you copied it, then you don't need the user exit anymore, as that copied object is your custom object and you can incorporate anything you want within main source code itself. If you really thing you should have that user exit, then double click on the call function statement, the system will ask if you want to create the function module, say yes and proceed with the creation.

But I don't see any reason why you will copy a standard IDOC function module(while you could have used a user exit in there) and still want to use the user exit functionality. Once you copied, it is your object and you don't need a user exit to insert code into your own object.

Hope this is clear.

Srinivas

0 Kudos

Hi,

Actually we had to copy the fm as we are using BAPI_INCOMINGINVOIC_CREATE for creating the invoice instead of MRM_INVOICE.._CREATE. And moreover the User exits are being called from deep includes that I dont prefer to eliminate them and there are some validations that are done after the User Exits are called.

And moreover the UEs are active and are being called when using standard fm. But when I press F2 on the statement CALL CUSTOMER-FUNCTION '014' its taking me to the User exit but its giving a message saying

"More than one main program was found for the current include during navigation.

The system has chosen the most appropriate main program based on the naming conventions.

In exceptional cases, this may be the wrong navigation target." This is because there are more than 1 calling program for the UE. This scenario usually doesnot occur when ever we click on CALL CUSTOMER-FUNCTION '014'.

I hope you got me.

Kris

0 Kudos

That is why you should not try to have the user exits in your Z function module. The system gets confused with two different sources referring to the same exit. That is not the design of the user exits.

You said you wanted the user exits because of the validations that are done after the call to the user exit. If there is no code in those user exits, then those validations have no meaning anyway.

If there is code in those user exits, then why don't you include that code in the custom function module, right where the user exit call is. That way you will not lose your user exit code and you have your Z function module to work with.

You still didn't say why you needed to copy the BAPI in the first place.

Regards,

Srinivas

0 Kudos

Hi Vamsi,

Maybe you can replace the "call customer" to "call function" ( the function module that you get on double clicking '014' ) and directly call the function module of the user exit ? This way you will be able to keep the validations done in the user exit.

Cheers,

Sanjeev

Former Member
0 Kudos

If u r calling customer function from ur own Z FM, that is not advisable to do. Because the use of user exit is itself to add functionality to standard SAP code.

However, check if the include of the user exit is itself active. And that the user exit is itself active in CMOD.

Former Member
0 Kudos

Hi

My understanding of the problem is:

- You wanted to call a particular BAPI via ALE

- The standard IDOC FM didn't use that BAPI

- You copied the IDOC FM

- Now you have problems with the copy

Can you just generate the BAPI-ALE interface for the BAPI? It takes a minute or two. Then call that generated IDOC.

Then you don't have the problems with the copy.

Try here:

http://help.sap.com/saphelp_46c/helpdata/en/18/22b812773211d396b20004ac96334b/frameset.htm

Cheers

Dom