Comments for the ADT Quick Fixes
ABAP Development Tools in Eclipse enable the automated adaptation of custom code for SAP S/4HANA with only a few clicks through Quick Fixes. These can resolve the most frequent findings such as ORDER_BY issues, MATNR issues, and issues related to data model changes such as KONV, BSEG, and others. Mass-enabled Quick Fixes significantly reduce your custom code adaptation efforts by allowing to apply the Quick Fixes for the whole ATC findings list at one shot. See also the blog Semi-automatic custom code adaptation after SAP S/4HANA system conversion.
If you apply mass-enabled Quick Fixes you can display for each your custom code object the source code before (“Original Source”) and after (“Refactored Source”) the Quick Fix:
Very often we’ve got the question from the customers: will there will be comments added to the refactored code in order to be able to reproduce how the source code looked before applying the Quick Fix?
With the SAP Note 2902053 you can now get for each Quick Fix a source code comment in your refactored code on your SAP S/4HANA 1909 system. In order to use the new functionality you have to activate it in the system via the report SATC_AC_QFIX_COMMENTS_ENABLED.
CURRENT LIMITATION: Quick Fix comments are currently available only for transportable objects. It is not possible to apply them for local objects.
|NOTE: Enabling Quick Fix comments is an optional feature and should be used only if it is absolutely necessary to keep the old source code parts since it is not in line with “Clean Code” principles.|
The source code comment contains the following information:
- Textual description of the applied Quick Fix, e.g. “Quick Fix Append ORDER BY PRIMARY KEY to the SELECT statement”
- Your old source code before the Quick Fix
- ID of related transport request
- Description from the related transport request
Here you see an example how it works. A comment section is placed on top of the changed code (via Quick Fix) where you see the old code (lines 35-38) and an explanation which Quick fix was applied, in this case “Replace VBUK table access with the access of compatibility view V_VBUK_S4”. In addition, the ID and the description of the corresponding transport request is provided in the comment:
Just try it out!
Would the changes not be captured automatically by the version control system i.e. you could see what the code used to look like by comparing versions?
The reason I say this is that "Clean Code" principles aim for not having any commented code at all.
In his book Robert Martin describes commented code as an abomination that gets less relevant with every day that passes. I would tend to agree.
I have had people say to me where I work that they are just going to keep the commented code in for "a while" so they can easily see how it used to look. Ten years later it is still there, and the real code is hiding in small islands between pages of commented code.
For the above screen shot it looks like the transport number is automatically added as well. Oh dear. That sort of thing also gets a hammering in the Clean Code book.
That (transport number) is definitely captured by the version control system.
Good comment. The thing with the "small islands of active code" is really a problem. In the past I had serious discussions about "if you are sure, you can remove the code instead of commenting". The point was that developers don't seem to be sure and don't trust version control system.
By the way: In SAPscript forms, for inexplicable reasons, you will find a lot more commented statements. Sometimes windows are just full comments, no active statement. For whatever reason...
you are absolutely right and that's the reason why the feature is optional and needs to be switched-on before using it.
We often have project setups where implementation partners are doing the code adjustment for the customer. For these scenario we got the request to include these kind of code markers.
// no comment
i have an issue when i try to do quick fix for DB operation using join on VBUK and VBUP, i have recommendations to using compatible view. while trying to do quick fix, i'm getting error "Do not use any special characters", when i check on the error it takes me to the comment sections.
Any suggestions on this.
please post your question in the Q&A section of community and provide detailed screenshots.
Thanks & Regards,
Currently we are on SOH, we have an ATC check variant configured to check programs before TR release.
When I do the same ATC check in eclipse, I'm getting ATC problems in eclipse but there is no quick fix option. Is there any pre-requestive to get this option or only work when we are in S4H?
Thanks and Regards
the Quick Fixes feature is only available on an SAP S/4HANA system, SoH is not supported.
Can you please provide us the list of SAP notes required to be implemented for ADT Quick fix enables as per S4H system version.
in another Blog from Olga (https://blogs.sap.com/2018/10/02/semi-automatic-custom-code-adaptation-after-sap-s4hana-system-conversion/) there is quite a good overview. It has to be at least 1809 and ADT has release dependencies (>ADT 2.96), but apart from that the notes are mentioned as well: