Skip to Content
Technical Articles

Semi-automatic custom code adaptation after SAP S/4HANA system conversion

If you are involved in a SAP HANA system conversion project and take care of the custom code (see also the blog SAP S/4HANA System Conversion – Custom code adaptation process) at a time you will reach the point, where you will need to do functional adaptation for your custom code on your brand new SAP S/4HANA system.

For this purpose, you will run ABAP Test Cockpit with the S4HANA_READINESS check variant on your SAP S/4HANA system and will get a long list of ATC findings which you need to fix.

No doubt, it as a substantial manual effort to look at every ATC finding and adjust your custom code. Besides this, often the most ATC findings are the SAP S/4HANA standard known issues, which could be fixed quickly without dipping into source code analysis, reading SAP Notes for adaptation guidance and so on.

Therefore, in order to minimize your adaptation efforts, we started to offer automatic code adaptations using the Quick Fixes (or Ctrl +1 shortcut) feature of ABAP Development Tools in Eclipse (ADT).

 

Prerequisites

Client: ABAP Development Tools (ADT) 2.96

Backend: ABAP platform 1809 (AS ABAP 7.53 SP00)

 

First Quick Fixes for SAP HANA related issues (SELECT without ORDER BY)

One of the typical functional adaptation use cases during SAP HANA migration is the missing ORDER BY clause in SELECTs before the READ statement. According to the SQL specification, you can not rely on the sort order in SELECT without ORDER BY. This can lead to unexpected behavior when the database is changed (for example to SAP HANA) because the results return in a different order without ORDER BY.

When you check your ABAP code containing such issues with ABAP Test Cockpit in ABAP Development Tools (ADT), you will most probably get a long list of ATC findings in your ATC Problems View at READ.. BINARY SEARCH statements, which were caused by the missing ORDER BY clauses in the previous SELECTs.

Now you can correct such issues automatically via ADT Quick Fixes.

Note: ATC findings that can be fixed with a Quick Fix are displayed with a lightbulb icon  

There are two possibilities for applying Quick Fixes.

You can select an ATC finding and choose Quick Fix (or Ctrl + 1 shortcut) in the context menu:

Then select the displayed Quick Fix in the popup and press Finish button:

Recommendation: If there is more than one Quick Fix available for an ATC finding, we recommend to select the first Quick Fix displayed.

Alternatively, you can jump to the affected source code line by double clicking the corresponding ATC finding and choose Quick Fix in the context menu (or Ctrl + 1 shortcut). Double-click the Quick Fix in the popup to apply it to the affected source code line.

That’s it. You can save and activate your source code and rerun ATC.

 

Further Quick Fixes

Further Quick Fixes for the most prominent SAP S/4HANA simplification use cases which are suitable for automatic adaptations are available with the SAP Note 2738251. These Quick Fixes are applicable for accesses to database tables VBFA, VBUK, VBUP, KONV, BSEG and usage of VBTYPE data elements in source code. With the SAP Note 2364938 is also the QuickFix for MATNR available.

Here is the overview of the ATC checks and corresponding simplification items, for which the Quick Fixes are currently available:

Check Simplification Item Referenced Object
S/4HANA: Field length extensions 2215852 – Material Number Field
Length Extension: Code Adaptions

 

for example MATNR
2610650 – Amount Field Length Extension: Code Adaptations
S/4HANA: Search for database operations 2198647 – S/4 HANA: Data Model
Changes in SD
VBFA, VBUK, VBUP
2220005 – S/4 HANA: Data Model
Changes in Pricing and Condition Technique
KONV
2431747 – General Ledger: Incompatible
changes in S/4HANA compared to classic ERP releases
BSEG
S/4HANA: Search for usages of simplified objects 2198647 – S/4 HANA: Data Model
Changes in SD
VBTYP
S/4HANA: Search for S/4 related syntax errors VBTYP
Search problematic statements for result of SELECT/OPEN CURSOR without
ORDER BY

 

Mass-enabled Quick Fixes

Beyond this the mass-enabled Quick Fixes are now available with ABAP Development Tools 3.0 and ABAP Platform 1809 FPS01, which make it possible to adapt full packages or software components in one shot and in this way drastically reduce your custom code adaptation efforts. You can also get mass-enabled QuickFixes on SAP S/4HANA 1809 FPS00 by applying the SAP Note 2695592.

Just select multiple ATC findings in your ATC result and use the context menu Recommended Quick Fixes…:

The wizard with recommended Quick Fixes for your selected ATC findings starts:

If you press Finish button, you apply the Quick Fixes for all your selected ATC findings, for which the Quick Fixes are available, at one shot.

32 Comments
You must be Logged on to comment or reply to a post.
  • “Relying on the implicit sort order of the database vendor leads to functional incorrectness when you switch the database e.g. to SAP HANA.”

    This is not a HANA specific behaviour.

    As I’ve often had to point out on questions on the ABAP tag “my data isn’t being returned in the correct ord”, while observed behaviour might initially mislead you, there is no implicit sort order on relational databases. The order in which you get records back is simply undefined – whether you’re using Oracle, HANA or whatever.

     

    • Hi Matthew,

      it is indeed so, that many implementations of SELECTs without ORDER BY relied on the presumable “sort order” in the underlying database. It was the motive of using SELECTs without an explicit sorting clause. The applications were programmed using the “expected” order in the result set returned by such SELECTs, and switching the DB vendor (SAP HANA is only the example) caused functional incorrectness.

      I agree with you, that actually DB vendors don’t sort data in tables, they rather implement the way, how the data is fetched by SELECTs on their DBMS, and it can vary from DB vendor to DB vendor.

      I changed the text in the blog so it will become more clear.

      Regards,

      Olga.

      • “Switching the DB vendor (SAP HANA is only the example) caused functional incorrectness.”

        It’s not really a question of vendor implementation – it’s a feature of relational databases by design. A programmer who relies on a mythical database sort order has written a broken program.

        Generally, records remain in the order they’re added. This is particularly visible with internal number ranges. However, a database reorgansiation can completely muck that up – especially if there have been deletions and insertions.

        So – here’s a reason to switch databases every so often -> you’re more likely to see that the sort order is illusory when you migrate data. I’ll mention it to my CIO! 😀

  • I would like to suggest an improvement for this quick fix. You see, about 20 years ago, HASHED and SORTED tables were introduced into the ABAP language. Since then, BINARY SEARCH is rarely (if ever) required. Sadly, many programmers are firmly stuck in the last millenium and don’t use these “new” constructs.

    It would be nice if your quick fix, or the ATC finding, pointed out that better results might be obtained by simply defining the table as HASHED or SORTED. Of course, you are fixing a programmatic issue in a quick way, but the danger is that you’re applying a bandaid to a gaping wound…

     

    • Hi Matthew,

      thanks for the Feedback.

      You can be sure that the Quick fix described in the blog is only the start of our roadmap. Besides the fixes for functional correctness after S/4HANA conversion we also have Quick fixes for security, performance and other code quality aspects in mind. And we also keep an eye on the modern ABAP and how we can get rid of the old ABAP stuff by using Quick fixes.

      I’m sure this blog will help to collect proposals from you ABAPers.

       

      Regards,

      Thomas.

  • Hi colleagues,

    I understand from the prerequisites the quick fixes can only be used once the conversion occured (ie backend is  SAP S/4HANA 1809)  although, if I am not wrong, these are the fixes which could be done on ERP as a pre-project activity.

    If I am right on both statement above, do you foresee a possibility to have those nice tools available  with ERP as a backend so that code can be corrected before the SAP S/4HANA project starts?

    Best regards

    Renaud

  • Hi Olga,

    It’s a helpful feature for developers, hope to see such features, not only for conversion but for regular development of codes and looking forward to see more features in it.

    Regards,

    Deepti

  • Hi Olga,

    This information is very helpful.I tried to do the same in my system but I am not getting the ATC check option in eclipse. Currently I am using the eclipse IDE version.

    Can you please guide me which version of the eclipse we can use so that we can get the ATC check option along with this quick fix option ?.

    Thanks and Regards,

    Rajeev

  • Hi Olga Dolinskaja ,

    thanks for providing the information about the QuickFixes, which is a very nice way how to deal with the custom code from my point of view.

    Some of the fixes are realated to a conversion to S/4HANA, and some are related to the conversion to SAP HANA (like e.g. the sort order problem). Is it planned, that the QuickFixes considering SAP HANA are also provided for older releases, like NetWeaver 7.40 or 7.50?

    (This would be very suitable for customers, who want to “just” migrate to the HANA database today, before moving to S/4HANA maybe in 2 or 3 years.)

    Best regards,

    Sebastian

     

     

     

  • Hi,

    Very informative and useful blog. I tried this option in 1809 FPS001, after adding notes system started bringing S4H related quick fixes as well. I have a question, I didnt complete remediation but lead till recommendations, will there be somekind of comments added to remediated code? Will there be a dashboard once we are done with quickfixing in mass for reporting? If not is there a way to identify which all objects are remediated by quickfix(not from transport request point of view).

    Information on ATC problem view is very feeble. From eclipse if we want to run on all custom packages, how can we do it? Should we ran ATC from GUI, then will result set be available from Eclipse for doing a mass Quick Fix?

    Regards

    Mohinder

    • Hi Mohinder,

      thank you for trying out the Quick Fixes and providing feedback.

      Regarding adding the comments to remediated code: such functionality in already in our development backlog.

      Regarding the dashboard for Quick Fixes and which objects are remediated: you get the preview and dashboard on Quick Fixes using the SAP Fiori App Custom Code Migration and by grouping the ATC findings by Quick Fix filter in the App.

      From ADT in Eclipse you can run ATC on several custom packages and then apply the Quick Fixes to the ATC findings in the ATC Problems View. We will also provide the central ATC check run result of the system in ADT, so that you will be able to execute mass Quick Fixes for this ATC result. This feature is also already in our development backlog.

      Best regards,

      Olga.

  • Hi Olga,

    Thanks to the brand new article,

    I have one doubt, sometimes we write code:

    “read table <itab>…. with key fieldx = val1 fieldy = val2 binary search”

    where fieldx and fieldy is possible be non-primarykey fields for some scenarios

    If table <itab> is not sorted before this read statement, then how the “Quick Fixes” will work in this case?

    As I can see in the screenshot below(copied from your article above):

    “Table is sorted by the primary key”,  while in my code I am using non-primary key fields.

     

    Is there any limitation for quick fixes?

     

     

     

     

    • Hi Masoom,

      actually the ORDER BY… Quick Fix gets applied to the previous SELECT (or OPEN CURSOR) statement (from database table into internal table), before READ statement. So I don’t see any limitations here.

      Best regards,

      Olga.

  • Hello Olga,

     

    Is it possible doing mass quick fixes in ATC browser viewa without doing a recheck?

     

    I mean, only quick fixes are possible in ATC problem view, so we need to do a recheck of all inspections we did in backend ATC central system

     

    Thanks and regards.

    Gerardo.

    • Hi Gerardo,

      it is currently not possible to apply quick fixes to ATC central check run result, since ATC central check run result isn’t yet available in ADT in Eclipse. But this functionality will come this year.

      Regards,

      Olga,

      • Hi Olga ,

        We have latest ADT 3.4.1 and S/4 Hana 1809 FSP 02 on NW 7.53. I am trying to apply multi-Quick fixes from ATC Problems view in ADT but can’t see the option for “Recommended Quick Fixes. Checked the SAP note 2695592 for multi-quick fixes but seems proc status is “Not Relevant” and implementation state is “cannot be implemented. Checked all the objects in the note “Transformations” and they all exist in the system.

        Could you please let me know what we might be missing here to get this functionality working?

         

        -thanks & regards

        Baajeerao Dabhade

  • Hi Olga,

    Wanted to understand on patterns on which Quick fixes for S4 and SOH remediations are applied. In recent document of Custom Code Migration Guide FPS02, available fixes mentioned at 4.3.3.1 talks about reference object, this information is good. However, Is there any document which can enlist list type of pattern for each reference object. Eg. A query on BSEG can have a multiple scenarios, will Quick fix applies API for each one of them or a selected few and how its been decided which one should be remediated or a pseudo comment to be used?

     

    Thanks in advance.

    Regards

    Mohinder Singh Chouhan

    • Hi Mohinder,

      no, there is no such document. But if you try to apply Quick Fixes, you will see in the Quick Fix wizard two compare editors: the source “before” Quick Fix and “after”. You will see the suggested implementation pattern there. You don’t need to apply Quick Fixes, you can just take a look at the patterns.

      Regards,

      Olga.

  • Hi Olga,

    Applied SAP Note 2364938  for the QuickFix for MATNR but unfortunately, the QuickFix option in ADT does not automatically fix the code rather gives an option as “Append pseudo comment ‘#EC CI_FLDEXT_OK[0002215424]”. Please advise on how to automatically fix “MATNR Field Length Extension” See below sample code.

    data: lv_matnr type char18,

    wa type mara.

    select single * from mara into wa where matnr like ‘A%’.

    lv_matnr = wa-matnr.

    write: lv_matnr.

    Appreciate your prompt response on this matter.

    • Hi Arifuddin,

      Did you also apply SAP Note “2738251 – Quick Fixes for the S/4HANA Custom Code Checks” (Attention Consider the manual pre and post implementation steps of all dependent notes)? This SAP Note provides the infrastructure for quick fixes related to S/4HANA custom code checks.

      Furthermore, most quick fixes only apply if you don’t use the long material number (i.e., you keep your material number length <= 18). In order to run the checks for a specific material number length, you can copy the check variant S4HANA_READINESS and specify your desired length of the material number for the check “S/4HANA: Field length extension” in transaction SCI.

      I hope this information helps.

      Michael

       

      • Hi Michael,

        Thank you for your assistance.

        As suggested, applied SAP Note 2738251 but unfortunately, the Quick Fix option in ADT does not automatically fix the code for “MATNR fixed length extension” rather again it gives an option as “Append pseudo comment ‘#EC CI_FLDEXT_OK[0002215424]”. Moreover, Quick fix is being applied for the material number length <=18 and the S/4HANA is 1809.

        Please advise on how to automatically fix “MATNR Field Length Extension”. Also, does 1909 has the built-in feature for automatic quick fix for MATNR.

        Appreciate your prompt response on this matter.

        Regards,

        Arif