Skip to Content

Why do you need to adapt your custom code during system conversion from the classic SAP ERP system running on any DB to SAP S/4HANA? The blog SAP S/4HANA System Conversion – Challenge for your custom code gives you the answer to this question.

Considering SAP S/4HANA system conversion (more on this in SAP S/4HANA System Conversion – At a glance) we focus in this blog on the custom code related process, which consists basically of two major phases. Before SAP S/4HANA system conversion – during preparation phase – we recommend to get rid of your old unused custom code (custom code evaluation) and then analyze your custom ABAP code with the Simplification Database and find out which objects need to be changed to get adapted to the SAP HANA and SAP  S/4HANA (SAP S/4HANA checks). After SAP S/4HANA system conversion – during the realization phase – you need to adapt your custom ABAP code to the new SAP S4/HANA software (functional adaptation) and optimize performance for SAP HANA database (performance tuning).

Please note: all following recommendations, processes and the tools for handling custom code on the way to SAP S/4HANA are largely the same as for SAP Business Suite and generally any other ABAP-based products. Therefore all custom code related activities are not the “one-time procedure” and have to be carried out on a permanent basis (of course especially before the SAP S/4HANA system conversion and before upgrade within the SAP S/4HANA product family) and to be considered as the regular best practice for all ABAP-based products.

Custom code evaluation

Please note: custom code evaluation is recommended but not obligatory. You can carry out your custom code adaptation process without it (e.g. in case if you don’t use CCLM in SAP Solution Manager).

Traditionally SAP customers developed over years so much custom ABAP code that it is not clear, which parts of it are still really productively used. Therefore it is recommended to monitor your system landscape for a longer period of time in order to do some housekeeping and eliminate the code, which is not used anymore within your productive business applications.

For this purpose we recommend to turn on the Usage Procedure Log (UPL) in your productive system to find out, which custom ABAP objects are really used within your running business processes. You can also use this step for prioritization: to find out which objects are more important as the others. The UPL has no impact on the performance of your productive system. Refer to the Monitor usage of your custom code via Usage and Procedure Logging (UPL) for more details.

The advantage of the SCMON (ABAP Call Monitor) compared to the UPL is that using this tool you not only collect the usage data (how often a specific ABAP object was called), but also the information about the calling business process. See ABAP Call Monitor (SCMON) – Analyze usage of your code for more details.

The SAP Solution Manager tool Custom Code Lifecycle Management (CCLM) can retrieve the usage data from your productive system and visualize them for your convenience. Based on the graphical presentation you get better transparency of the usage of your custom ABAP code and can easier analyze it then using only UPL technical data.

You should monitor your business processes with the UPL for a longer period of time to get really reliable results for not productively used code. Only after that longer period of monitoring you can remove unused custom ABAP code using CCLM decommissioning cockpit. For more details please refer to the Custom Code Management Decommissioning.

SAP HANA and SAP S/4HANA checks

This step is the most important one for your custom ABAP code on the way to the system conversion to SAP S/4HANA.  Here you check your custom ABAP code for SAP HANA and SAP S/4HANA related changes.

The SAP S/4HANA is based on the SAP HANA database. Generally the ABAP code runs on SAP HANA as on any other supported database. So why do you need to adapt it to SAP HANA?

One reason is, that you possibly used native SQL of the predecessor database and these database vendor specific dependencies must be eliminated. Another reason is, that in some custom code implementations the SELECT statement without ORDER BY is used assuming that the data in a database table was already sorted (for example by key). According to the SQL specification when using SELECT statement without ORDER BY, you cannot rely on the sort order because it depends on the respective implementation of the DB vendor and therefore can cause unexpected behavior when the database changes (for example to SAP HANA) because the results of SELECT without ORDER BY return in a different order.

Thus you need to check your SQL SELECTs without ORDER BY statement if they are still correct. Beyond this pool/cluster tables were removed with SAP HANA, therefore the database operations on these tables also need to be removed in your custom ABAP code.

To prepare your custom ABAP code for the actual SAP S/4HANA conversion, you need to compare it with the Simplification Database. For more information on Simplification Database please refer to the blogs Upcoming tools for SAP S/4HANA migration – the simplification database, Simplification List SAP S/4HANA 1709.

The result is the work list of the incompatible findings, which you would need to process one by one. At this step you can estimate the required custom ABAP code adaptations efforts to migrate your code to the SAP S/4HANA.

The tool of choice for SAP HANA and SAP S/4HANA checks is the ABAP Test Cockpit (ATC) with Remote Code Analysis. You set up only one ATC central system (SAP_BASIS >=7.51) for all static checks of your custom ABAP code in your system landscape, which needs to be migrated to SAP S/4HANA. More details on ATC Remote Code Analysis in the blog Remote Code Analysis in ATC – One central check system for multiple systems on various releases.

 

The recommended procedure is the following:

  1. Setup ATC as (see Remote Code Analysis in ATC – Technical Setup step by step) and implement the SAP Note 2436688 – Recommended SAP Notes for using ATC checks “S/4HANA Readiness”
  2. Download the newest version of the Simplification Database content from SAP Service Marketplace (see SAP Note 2241080)
  3. Install the Simplification Database content on the central ATC check system (use transaction SYCM).
  4. Execute SAP HANA and SAP S/4HANA checks: Run the ABAP Test Cockpit with the variant S4HANA_READINESS_REMOTE.
  5. Analyze the ATC result list
SAP S/4HANA Checks in SAP NetWeaver AS ABAP 7.51

  • The Field Extension check finds length conflicts in your coding for material number fields
  • The Search DB Operations check finds write operations on specific database tables
  • The Search for usages of simplified objects check finds usages of objects stored in Simplification Database
  • The Search for ABAP Dictionary enhancements finds extensions in the data dictionary (like appends)
  • The Search for base table of ABAP Dictionary views finds usages of database tables in views
  • The Search for S/4HANA related Syntax errors tries to map syntax errors to simplification items

 

In SAP NetWeaver AS ABAP 7.52 the coverage of checked custom code was significantly improved. Custom code checks now scan all custom code in Enhancements, Modifications, Customer EXITs, Smart Forms and ignore findings in SAP includes and generated code. Additionally simplification item information (e.g. OSS note)  is displayed in ATC result list including filtering and sorting capabilities.


Functional adaptation

After you did the system conversion to SAP S/4HANA with Software Update Manager (SUM) (you don’t need first to migrate the database to SAP HANA and then update the software to the SAP S/4HANA, the SUM does it in one step) we recommend to run ATC with SAP HANA and SAP S/4HANA checks. After that you need to carry out functional adaptation based on the ATC results.

Adjust modifications and enhancements

First you need to adapt the modifications and enhancements using the standard transactions SPDD, SPAU and SPAU_ENH. This is the same process as in previous upgrades within the SAP Business Suite product portfolio, only the tools SPDD and SPAU have been renewed. Especially when moving the very old system to SAP S/4HANA many modifications and enhancements can be removed or set to SAP standard. For this purpose the new UI was invented for SPAU, which supports mass activities in order to adjust modifications and enhancements or reset objects to SAP standard more easily.

                                                                    New UI in SPAU

Recommendation: Reset as many objects as possible to SAP standard.

Fix SAP HANA and SAP S/4HANA findings

Second, you need to fix SAP HANA and SAP S/4HANA findings. Adapt your custom ABAP code, using the findings of the SAP HANA and SAP S/4HANA checks (ATC results).Findings of SAP S/4HANA checks are related to S/4HANA Simplifications. Each simplification requires a different approach to solve findings. Therefore, findings of SAP S/4HANA checks refer to a SAP Note which describes how you can solve them.

SAP HANA finding example: if you selected from the table without any order and execute binary search, it will return the wrong entries, therefore you need to fix your SELECT by either providing ORDER BY statement or sort the internal table before the statement READ TABLE … BINARY SEARCH.

                                                                 Fix ORDER BY

SAP S/4HANA finding example: replace your own defined material number with the SAP data type MATNR:

                                                                                  Fix MATNR

The TOP 10 Simplification Items

SAP Note Topic
2215424 Material number field length extension
2198647 Data model changes in SD
1976487 Data model changes in SAP S/4HANA Finance
2220005 Data model changes in Pricing and Condition Technique
2214585 Sales support is not available
2223144 Foreign Trade is not available
2206980 Data model changes in Material Inventory Management
2227579 Storage Location MRP
2226131 Public Sector specific fields in Business Partner
2296016  Removal of orphaned objects

 

Naturally after functional adaptation you need to test your business processes (using automated testing like eCATT).

Performance tuning

After you did the system conversion to SAP S/4HANA and the system is up and running, you need to look which business processes can to be optimized on SAP HANA database, since you can now make use of full power of SAP HANA regarding performance. Therefore you need to look which SQL statements can be optimized. The SQL Monitor (ABAP SQL Monitor – Implementation Guide and Best Practices) allows you to get performance data for all SQL statements executed in your productive system. You can run it for a longer time period directly in your productive system (transaction SQLM) without major performance impact on your business processes (performance overhead < 3%). SQL Monitor helps you to understand, what are the most expensive and most frequently executed SQL statements, which SQLs read/write millions of records and provides the transparent SQL profile. SQL Monitor allows you to link the monitored SQL statements to the corresponding business processes including various aggregation and drill-down options.

                                                           SQL Monitor

As shown on the screenshot you can use for example transaction as the entry point and drill down the collected SQL runtime information to optimize SQL statements (e.g. by pushing the application logic to the SAP HANA database).

SQL Monitor Example:

 

To report this post you need to login first.

29 Comments

You must be Logged on to comment or reply to a post.

  1. Kiran K

    Thanks for sharing the info.Good document to start with when we have to deal with Custom Code while migrating to SAP HANA DB.

    K.Kiran.

    (0) 
  2. Stephan Scheithauer

    Hello,

    Thanks for your description. But I am completely confused now. In the SAP Note 2271900 Custom Code Management: Generation of Code Inspector Variant and SAP Note 2270689 RFC Extractor for performing static checks SAP describes how to use the SAP Code Inspector to execute a remote check for the custom code analysis. These SAP Notes contain also How-To-Guides for the SAP Code Inspector.

    But in your description the ATC is the tool of choice.

    What is the right recommendation for customers?

     

    Thanks in advance

    Stephan Scheithauer

    (0) 
    1. Olga Dolinskaja Post author

      Hi Stephan,

      we recommend to use ATC with Remote Code Analysis.

      The Remote Code Analysis with ATC is new and available since October 2016 with AS ABAP 7.51. Therefore some previous SAP Notes and guides relate to Code Inspector and need to be updated subsequently. Thank you for this notice.

      Best Regards,

      Olga.

       

      (0) 
  3. Martin Kukielka

    Using SYCM (in NW 7.50 and previous) there was a possibility to “sharpen” the Custom code migration worklist based on the UPL data from the productive system. In the new way via ATC I’m missing this step.

    Is it really missing or have I overseen it?

     

    (0) 
    1. Thomas Fiedler

      Hi Martin,

      you are right, this is currently missing in ATC. But we are working on it.

      Will be available with the next major version of ATC.

       

      Regards,

      Thomas.

       

       

      (1) 
  4. Joachim Rees

    Hey Olga,

    you mention note 2436688 but there seems to be something wrong with it:

    This is what I get when I try to access it:

     

    Any ideas?

    Joachim

    (0) 
    1. Olga Dolinskaja Post author

      Hi Joachim,

      I’ve just checked the link to the note: it works. Please try again. Maybe it was a temporary issue with access to the knowledge base.

      Regards,

      Olga.

      (0) 
      1. Joachim Rees

        Hi Olga,

         

        I checked again, still, it doesn’t work for me! 🙁

        (But other notes do work, see screenshot).

        Is it maybe only available SAP-internally or something (without giving me a better message?).

         

        best

        Joachim

         

         

        PS: there is no other way of accessing notes as via Launchpad, is there?

        Well, there is SNOTE, of course, which says the note is “incomplete”?

         

        Edit: Oh, there is a message saying it’s not released, it’s just hidden deep down:

         

        [Yet another Edit]: As suggested by the SNOTE-message, I now opened an Incident (200273 / 2017). 

        (0) 
  5. Narasimha Rao

    Hi Olga,

     

    we are using ATC and doing custom code conversion on priority1 .

    we are in a situation not able to handle few suggestion given by sap notes or cook books.

    for example KNOV is replaced by PRCD_ELEMENTS and some changes to VBFA table fields. cookbooks suggest to use some factory classes to  select or insert data from these new data models.

    My question here is,do we need to handle these using new classes only after migration? oR is there any other way to handle at time of conversion as my current system doesn’t contain these factory classes or even these new data model.

    your suggestion will help us a lot to go further.

     

     

     

    (0) 
    1. Olga Dolinskaja Post author

      Hi Narasimha,

      functional adaptations to S/4HANA should take place after S/4HANA system conversion, see also the “Functional adaptation” chapter of this blog. Before you cannot adapt your custom code since you don’t have the new S/4HANA data types and models in your classic ERP system as you correctly noticed it.

      Regards,

      Olga.

      (0) 
  6. Narasimha Rao

    Hello Olga,

    When we run ATC, I was wondering why standard  RV13A* programs are listed.

    Could you put a light how these objects have to be handled. Program header comments log says.

    Regards,

    Narasimha

    (0) 
    1. Olga Dolinskaja Post author

      Hi Narasimha,

      just ignore them. We plan not to list ATC findings in generated code and SAP Includes in the next ATC release.

      Regards,

      Olga.

      (0) 
  7. Susana Zorita

    Dear Olga,

    In sap help: SAP S/4HANA Conversion steps it was mentioned (before 7.51) to generate the Custom Code Migration Worklist for code analysis in addition to the ATC or SCI anaylis. Now this step is not mentioned anymore in help.sap.com and neither is mentioned in your blog.

    Is it current recommendation to do not generate the Custom Code Migration Worklist and only perform checks with the ATC?

    Thanks,

    Susana

    (0) 
    1. Olga Dolinskaja Post author

      Dear Susana,

      after you execute ATC checks, you will get the worklist of ATC findings, which you need to fix in your custom code to get it adapted to S/4HANA. This worklist is the Custom Code Migration Worklist. In the 7.50 release you got this list by executing Custom Code Analyzer, in 7.51 you get it just by executing ATC.

      Best Regards, Olga.

      (0) 
      1. Ajith Cheruvally

        Hi Olga,

        Thanks for the Article.

        I understand that we need to run the ATC check with variant S4HANA_READYNESSin the preparation phase ( before the technical conversion ). What are we expected to do with the findings in the ATC check? Should we fix them after the conversion or should they be fixed before or would there be items to be fixed before and after as well?

         

        Thanks,

        Ajith

         

        (0) 
        1. Olga Dolinskaja Post author

          Hi Ajith,

          using ATC check results before system conversion you can estimate the effort for your custom code adaptation and fix some findings (e.g.like statements without ORDER BY or replace your custom data types for material numbers with SAP data type MATNR). But still the actual functional custom code adaptation takes place after system conversion, because only then you have the new S/4HANA models, APIs, datatypes in place.

          Best Regards,

          Olga.

          (0) 
          1. Malcolm Clark

            Hi Olga,

            we have an S4 converted system but the Readiness Check variant is not in the system, so how do we manage the code changes and know that they are complete?

             

            thanks,

            Malcolm.

            (0) 
            1. Olga Dolinskaja Post author

              Hi Malcolm,

              is you S4 converted system  SAP S/4HANA 1511 on SAP NetWeaver AS ABAP 7.50 release? If it is so,we recommend to set up ATC Remote Code Analysis in the SAP NetWeaver AS ABAP 7.51 – based system and use the S4HANA_READINESS_REMOTE variant for code checking and Remote ATC for Developers scenario for functional code adaptation.

              Best Regards,

              Olga.

              (0) 
  8. Jan Pascal Tschudy

    I would like to check all the repository stuff we have within our own namespace.

    So I created a run with “Check Variant”: S4HANA_READINESS_REMOTE
    Objects to Check – by Query – Package /BLA/* for instance.

    When saving it comes up with a information message, that the input data is inconsistent. “Selection contains restricted packages e.g. /BLA/MAIN”

    After that I save my Run and execute it immediately in background. In the monitor I can see that there were no objects found to check.

     

    However, if I choose the same Check Variant but only check for Z* packages then there are plenty of objects to check.

     

    Is this because of the /BLA/MAIN package which is flagged as “Main Package” which directly adds “Adding further objects not possible”(restricted-Flag) to it?

    (0) 
  9. Narasimha Rao

    Hi Olga,

    ATC has given code error on MARA , MARC and QMAT tables  DB statements like INSERT and DELETE statements. I am not success in finding any Factory classes on these tables, could you Help how to handle these.

     

    Regards,

    Narasimha

    (0) 
    1. Olga Dolinskaja Post author

      Hi Narasimha,

      is your system before or after system conversion? Have you tried to follow the SAP notes linked to the corresponding ATC findings? Maybe you can drop me an email with related screenshots of ATC findings.

      Best regards,

      Olga.

      (0) 
  10. Narasimha Rao

    Hi Olga,

    we are doing post conversion functional changes and handling few custom programs as part of post conversion. I tried to follow the notes , I could not find any Update/Delete related factory class methods on MARC and MARA. But was able to see DB select related. Find below ATC messages on objects:

    DB Operation UPDATE found (MARC, see Note(s):0002378796)  Cannot be hidden using a pragma or pseudo-comment
    DB Operation UPDATE found (MARC, see Note(s):0002206980)  Cannot be hidden using a pragma or pseudo-comment
    (0) 
    1. Michael Schneider

      Hi Narasimha,

      I double-checked note 2206980: Updates on master data attributes are still possible for hybrid tables.

      2 Code adjustments and optimizations

      Technically it is still possible to do DB write operations (INSERT, UPDATE, DELETE, MODIFY) on the tables MKPF, MSEG as well as the fields representing actual stock quantities in the hybrid and replaced aggregation tables. But such write operations are without any effect! Therefore write operations on MKPF, MSEG as well as the fields representing actual stock quantities in the hybrid and replaced aggregation tables shall be removed from customer coding. Write operations on the material master data attributes in the hybrid tables are still possible. Write operations on table MATDOC and your moved customer append fields are done by class CL_NSDM_STOCK.

      MARC should be also a hybrid table mentioned in the beginning of the Note:

      The SAP ERP 6.0 stock inventory management data model consists of the two document tables MKPF for document header information and MSEG for document item data. Additionally there were aggregated actual stock quantity data stored in several tables. Some of these tables do also store material master data attributes like the tables MARC, MARD and MCHB. Such tables with material master data attributes as well as actual stock quantities will be named as hybrid tables in the following. In contrast there are also tables like MSSA containing only aggregated actual stock quantities for sales order stock. Such tables will be called in the following as replaced aggregation tables.

      I hope this helps.

      Michael

      (0) 

Leave a Reply