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

How to modulerise code within an implicit enhancement?

Former Member
0 Likes
1,805

Hi,

I would like some ideas on how to modulerise code within an implicit enhancement?

I understand that implicit enhancements should be used wisely and only minimum code needs to be used, however i have come across many of our customers who have systems in which they have a lot of code written in an implicit enhancement. Of-course in most cases it starts as small piece of code but then over a period of time more and more code is added to the existing enhancement and it becomes un-maintainable.

I have been thinking of different options to modularise the code wihtin an implicit enhancement:

  • To create a Subroutine Pool Include Program and write perform statements in the implicit which will call the forms defined in the subroutine pool ( type F program in SE38 )
  • Create a custom class for each implicit enhancement and write all the logic in individual methods. This way if there is a need to add more code later on then we can simply create more methods instead of writing code in the same place?
  • Create a normal Include program ( type I program in se38 ) and write all the code within this include - ofcourse using performs and forms. This is very similar to point 1 above just the program type defined is different.

All of the above have some pros and cons. I am not sure if its a good idea to keep creating additional custom repository object for each implicit enhancement.

Any other suggestions? Which one do you thing is a good approach?

Thanks

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,069


Hi Sap Learner.

Point 1.  You can only generate a finite number of subroutine pools per session.  (38 I think although it's too long ago for me to remember exactly).

Point 3.  You would not be able to use procedures in the include since an implicit enhancement (or an explicit one for that matter) occurs within a coding block such as a form or a function module.  You cannot embed forms inside other forms.

So that just leaves point 2.  You could also do the same thing with a function group but custom classes are a good idea which also provides you with encapsulation and a lower maintenance effort.

It's good to see someone thinking about good coding practices.

Good luck!

Regards

Rich

Hi,

I would like some ideas on how to modulerise code within an implicit enhancement?

I understand that implicit enhancements should be used wisely and only minimum code needs to be used, however i have come across many of our customers who have systems in which they have a lot of code written in an implicit enhancement. Of-course in most cases it starts as small piece of code but then over a period of time more and more code is added to the existing enhancement and it becomes un-maintainable.

I have been thinking of different options to modularise the code wihtin an implicit enhancement:

  • To create a Subroutine Pool Include Program and write perform statements in the implicit which will call the forms defined in the subroutine pool ( type F program in SE38 )
  • Create a custom class for each implicit enhancement and write all the logic in individual methods. This way if there is a need to add more code later on then we can simply create more methods instead of writing code in the same place?
  • Create a normal Include program ( type I program in se38 ) and write all the code within this include - ofcourse using performs and forms. This is very similar to point 1 above just the program type defined is different.

All of the above have some pros and cons. I am not sure if its a good idea to keep creating additional custom repository object for each implicit enhancement.

Any other suggestions? Which one do you thing is a good approach?

Thanks

2 REPLIES 2
Read only

Former Member
0 Likes
1,070


Hi Sap Learner.

Point 1.  You can only generate a finite number of subroutine pools per session.  (38 I think although it's too long ago for me to remember exactly).

Point 3.  You would not be able to use procedures in the include since an implicit enhancement (or an explicit one for that matter) occurs within a coding block such as a form or a function module.  You cannot embed forms inside other forms.

So that just leaves point 2.  You could also do the same thing with a function group but custom classes are a good idea which also provides you with encapsulation and a lower maintenance effort.

It's good to see someone thinking about good coding practices.

Good luck!

Regards

Rich

Read only

0 Likes
1,069

Many Thanks Rich. Appreciate your feedback.