‎2006 Jan 11 7:58 AM
Hello, all.
In order to process an outbound IDoc, I created a Z_function_module as a copy of the standard function module provided by SAP fot the same purpose. I included this Z_function_module in a new Function Group.
The problem is that I need to call, from this new FM, a customer function (a user-exit) that was called by the standard FM, somewhere in the processing. The coding of the ZFM is almost identical with the standard FM, except a few lines added for a specific client request.
While the standard FM calls the Customer function (the user-exit), my Z-FM doesn not. The Customer function is included in a CMOD enhancement project. Activating or deactivating this project has no effect on the functionality.
What should I do, in order to call the user-exit in my Z-FM too?
Thank you,
Bogdan
‎2006 Jan 11 8:35 AM
Hi Bogdan,
1. u have copied the original to z
2. the original and your copy,
must be using
CALL CUSTOMER-FUNCTION.
3. But this won't work.
(becasue it will take the current program name,
and check further)
4. So what u do,
u must be knowing that function module
of the user exit.
Call this FM Directly.
No problem.
It will work fine
(just note that, in this case,
the activateion/deactivation
of enhancmenet/project won't have any effect,
it will always be activated, bcos
we are directly callig the REAL FM)
regards,
amit m.
‎2006 Jan 11 8:30 AM
Use this
CALL CUSTOMER-FUNCTION
Customers use Transaction CMOD to activate the function module. The actual name of the function module is made up of EXIT_, the name of the module pool in which the function module is called, and the name func. For example, the statement CALL CUSTOMER-FUNCTION '001' in module pool SAPMS38M would call the function module EXIT_SAPMS38M_001.
If the function module has not been activated using Transaction CMOD, the call has no effect. System fields such as SY-SUBRC keep the same values that they had before the function call.
<b>If it did help you don't forget the reward</b>
Message was edited by: STEPHAN KAMINSKI
‎2006 Jan 11 8:35 AM
Hi Bogdan,
1. u have copied the original to z
2. the original and your copy,
must be using
CALL CUSTOMER-FUNCTION.
3. But this won't work.
(becasue it will take the current program name,
and check further)
4. So what u do,
u must be knowing that function module
of the user exit.
Call this FM Directly.
No problem.
It will work fine
(just note that, in this case,
the activateion/deactivation
of enhancmenet/project won't have any effect,
it will always be activated, bcos
we are directly callig the REAL FM)
regards,
amit m.
‎2006 Jan 11 8:50 AM
Hey, Amit.
You got it right, at source code level (syntax level) there is no problem, but at runtime the customer-function is never called in my new Function Group. Why is that?
That's what interests me the most: why isn't the Customer-exit called in my Z-FM?
Is the CMOD project associated to a specific Function Group? If so, can this assignment be changed?
As far as I'm concerned, calling the Customer-exit (by means of "CALL CUSTOMER-FUNCTION '00x' " should act identically throughout the system. That means that, if I add a CALL CUSTOMER-FUNCTION '00x' WHEREVER in one of my own programs, the exit should work. But it does not. Why?
Thanks,
Bogdan
‎2006 Jan 11 8:55 AM
Hi again,
1. CALL CUSTOMER-FUNCTION '001'
This is some special syntax.
what the system does is :
It will check the current program name (in ur case Z..)
then it will find FM with the name
EXIT_ZPROGRAM_001. (which is not there)
In ur case, fm
EXIT_ORIGINALPROGRAM_001 is there for enhancment.
2. The program name is imprtant.
EXIT_PRGNAME_001
EXIT_PRGNAME_002 ETC.
regards,
amit m.
‎2006 Jan 11 9:11 AM
I see. It's a mechanism based on the program name. Lousy.
Still, how could I work-around this?
Any ideas?
Thanks
‎2006 Jan 11 9:22 AM
Hi Bogdan,
The customer function cannot be anyways called and hence you can do the following:
Copy the EXIT_..... FM without changing its interface parameters into your function group and instead of calling CALL CUSTOMER-FUNCTION, call the zFM straight. Write the code in the function module which you wanted to write in the include. I think this would work.
Regards,
Srikanth
‎2006 Jan 11 9:37 AM
Yes, Srikanth,
But that would leave the client without the possibility to Activate/Deactivate this specific functionality.
Bogdan
‎2006 Jan 11 9:41 AM
Hi bodgan,
1. The option is that
u call the original FM EXIT_ORGPRG_001
DIRECTLY
from your program.
(There is no harm in that)
(No need to copy this FM to Z group)
2. Regarding, activation/deactivation,
don't worry,
we can detect whether it is active or not
and accordingly call this FM .
(give some time for this)
3. First of all , call the original FM
and do the ground work !
regards,
amit m.
‎2006 Jan 11 9:55 AM
Hi again,
1. But that would leave the client without the possibility to Activate/Deactivate this specific functionality
For this problem, there is a solution.
2. U must know the enhancmenet PROJECT name.
(since u have created, u must be knowing)
3. MODATTR - Attributes of Extension Projects
This is the required table.
4. Name = ProjectName
Status = ?
If status = 'A' then it is activated.
The following status values exist for a project:
A = Active: All project components are active
o = Partially active: At least 1 component is inactive
' ' = Inactive: All components have been deactivated
5. Now based on this 'A',
u can conditionally call the FM.
regards,
amit m.
‎2006 Jan 11 9:55 AM
Hi Bogdan,
Then you can construct a custom table with only one flag.
Check before processing the function Module if the flag is set, if it is set do go ahead or dont do the functionality.
Provide customising option to client to set and reset the flag by providing table maintainence.
Regards,
Srikanth
‎2006 Jan 11 12:59 PM
‎2006 Jan 11 3:25 PM
Just to inform: I called the exit directly, after checking (in table MODATTR) if the enhancement project is active.
Things work fine.
Many thanks for help and suggestions.
Bogdan