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

Is it wrong to enhance a standard update function module?

0 Likes
1,804

Hi,

I had a requirement the other day to enhance a specific cycle in our SAP IS-H server, we are working on a healthcare project and we have to run a specific function whenever a service is added to a patient case which can be done from many transactions in the system so enhancing them all would not be efficient, also when i looked into an exit or a BADI that runs whenever a service is added/deleted/changed in a case i found none, so my solution was to enhance the update function module that writes the changes in the database table that stores case services so whenever a service is added i can modify the service data according to certain conditions before having the update module write the database entry, as this is my first time enhancing an update module i thought i might ask if there are any possible issues that could arise from that or if there is anything i should watch out for.

Hi,

I had a requirement the other day to enhance a specific cycle in our SAP IS-H server, we are working on a healthcare project and we have to run a specific function whenever a service is added to a patient case which can be done from many transactions in the system so enhancing them all would not be efficient, also when i looked into an exit or a BADI that runs whenever a service is added/deleted/changed in a case i found none, so my solution was to enhance the update function module that writes the changes in the database table that stores case services so whenever a service is added i can modify the service data according to certain conditions before having the update module write the database entry, as this is my first time enhancing an update module i thought i might ask if there are any possible issues that could arise from that or if there is anything i should watch out for.

4 REPLIES 4
Read only

Former Member
0 Likes
1,554

Hi,

Instead of enhancing the standard FM, I would recommend you to copy the standard FM to a Z FM and do the necessary changes.

Regards,

Mounika

Read only

matt
Active Contributor
0 Likes
1,554

This is advice (known as cloning) is widely recognised as a profoundly bad idea. (There are even tools for identifying where it has been done in the past so it can be fixed). Two reasons:

First:

  • How does the new function module get called? You'd also have to copy the program that calls it. You could end up having to copy an entire group of module pools. And the tables that configure them...

Second:


  • You can't benefit from any bugs fixes coming with new releases and patches.
  • Unless you copy absolutely everything, if one of the SAP standard objects you're continuing to use is changed during a release, you'll have to re-clone all those objects you did copies, which is a very non-trivial exercise.
  • You effectively have written your own code for updating standard SAP tables - you screw it up and you're on your own.

An enhancement (or even a modification) is a clearly identified piece of customer code. If done properly, it can be switched off and on with ease. During upgrades/patches, anything affecting this area will appear in SPAU and can be properly addressed.

For the OP - there's no special reason that Update function modules are more complex to modify than non-update FMs. You should keep any changes to a minimum and as encapsulated from the standard as possible. E.g. put all your code into a function module and call your function module as the first thing in the standard (via an implicit enhancement). There are some ABAP commands you can't use during update, but if you're just making DB operations on your Z table, that shouldn't be an issue.

However, you should also look for a user exit/BADI in the main transaction. There you might simply need to call your function module in the update task. Then it will run with all the other update function modules after a commit.

Read only

0 Likes
1,554

Hi,

Thank you for the clarification, at the moment i have my enhancement at the beginning of the update module but my last concern is that at some condition i am actually changing the value of one the fields passed to the update module and i am worried if there could be any inconsistencies with other SAP tables that may depend on the value of this field in this table.

e.g.

Is it possible that the system enters the value of this field in another table using another update module during the same update process because this will result the same field having 2 different values in the 2 tables and that could cause an issue?, i am asking because i am not familiar if SAP implements any checks that prevent these inconsistencies during the update process or not and i dont want to cause a big issue in production as this is going to be used alot.

Read only

matt
Active Contributor
0 Likes
1,554

All inconsistencies are checked before the commit work that triggers the update task. Therefore if you change something during the update task, there is a risk of inconsistency. You might think if the value is only used in one table, then that would be ok - but in future it might be in more.

Sometimes the risk is worth it. Other times not.