With SAP S/4HANA, SAP delivers an intelligent suite of enterprise applications that brings innovations such as the Internet of Things, machine learning, and real-time analytics to customers’ business operations, both on premise and in the cloud. As moving to SAP S/4HANA increasingly becomes more a question of “when” rather than “if,” most SAP customers are looking at how to make this move from an SAP Business Suite implementation centered around SAP ERP, the latest version being enhancement package 8 running on the SAP NetWeaver 7.5 technology stack.
Since SAP S/4HANA is a completely new product version with a new data model built on core data services, customers making this transition need to perform a system conversion from SAP Business Suite to SAP S/4HANA and migrate to the SAP HANA database if it is not already in use. In addition, they must adapt any custom code created for SAP Business Suite that is incompatible with SAP S/4HANA. Adapting custom code is never a trivial undertaking for any organization, and to support its customers in this task, SAP delivers analysis tools as a part of SAP NetWeaver that enable you to fully manage this process, including extended syntax checks and the Code Inspector tool.
In the past, these tools were delivered individually as part of the standard SAP NetWeaver shipment. As of SAP NetWeaver 7.5x, these tools are combined in ABAP Test Cockpit, which enables you to get an overview of the project scope, analyze the adaptation requirements, and perform the adaptions directly in the code with the help of the Eclipse-based ABAP development tools, all from a single tool.
This article shows developers and development project managers how to adapt custom code for SAP S/4HANA using ABAP Test Cockpit. While a previous SAPinsider article covered in detail the process of migrating from SAP Business Suite to SAP S/4HANA, this article focuses on the portions of the process that involve adapting custom code for SAP S/4HANA, which takes place after the system migration (see the sidebar "The SAP S/4HANA Migration Process at a Glance" for a brief overview of the overall migration process). You will learn how to create a preliminary overview of potential issues with your custom code that you can use to prepare for your adaptation project, and how to then use ABAP Test Cockpit to identify and resolve incompatibilities between your custom code and the new SAP S/4HANA data model, including a look at how to address three commonly identified issues.
Creating an Overview with Transaction SYCM
Once the technical migration is complete, it is a good idea to get an overview of the impact SAP S/4HANA will have on your custom code before you begin the adaptation project, so that you can plan for the adaption effort that will be required. Transaction SYCM, which is included with SAP NetWeaver 7.5x, can provide this overview. The SYCM overview screen shows how your custom code objects relate to the items in the Simplification Database, which contains documentation on the SAP data objects that have been changed or removed for SAP S/4HANA. You can view the full contents of the Simplification Database in the SYCM overview screen (see Figure 1) or you can refine the results using a selection screen.
Items in the Simplification Database are grouped into different categories, such as “Functionality not available” or “Syntactically incompatible change of existing functionality.” In the latter category (see Figure 2), you will find the most well-known data element change in the SAP S/4HANA data model: The length of the material number field has been extended from 18 characters in SAP Business Suite to 40 characters in SAP S/4HANA. Each simplification item is documented in a corresponding SAP Note, which explains the change and its impact — for example, the item for the material number field change links to SAP Note 2215424, which includes all the general information for the extension of the material number field from 18 to 40 characters (see Figure 3).
You can learn more about which objects will be affected by a change by drilling down into the details of a simplification item from the SYCM overview screen. For example, when you drill down into the item for the material number field change (see Figure 4), you find 305 SAP objects, such as other domains and data elements, that will be affected by this change. You can then drill further down into each of the affected objects — for instance, one object affected by the material number field change is the data element LMBI_MATNR, which now also points to the 40-character domain MATNR (see Figure 5).
You can restrict the result set displayed in the SYCM overview in many ways. For example, if you are interested in transactions related to materials management, you can use the SYCM selection screen to search for all transactions starting with the letter “M” (see Figure 6), which results in the list shown in Figure 7, with the relevant simplification items again grouped by category. You can further refine your search by specifying the SAP Note number, the software component, the release, and support package level, for example.
While SYCM provides an initial impact analysis that is useful for planning purposes, it does not tell you what to do next. This is where ABAP Test Cockpit comes into play.
Adapting Custom Code with ABAP Test Cockpit
ABAP Test Cockpit is standard-delivered with SAP NetWeaver Application Server for ABAP and significantly simplifies the code testing required during development by integrating various individual checks and tests, such as Code Inspector checks, into a single tool. In an SAP S/4HANA adaptation project, you can use this tool to first create an overall worklist for the project by running broad-based checks on your code, and then, with the results of these checks as a guide, you can use the tool to check and adapt individual programs.
Let’s look at how ABAP Test Cockpit can be used to create the overall worklist by walking through how to:
- Check the code
- Analyze the results
- Adapt the code
1. Check the Code
Start ABAP Test Cockpit with transaction ATC. The main screen presents a structured list of various options, such as basic setup and administration settings. To schedule a run to check for code you will need to change for SAP S/4HANA, click on Schedule Run and specify a series name for the run — for example, S4H164_98B (see Figure 8).
Next, configure the run series, including assigning the Code Inspector check variant S4HANA_READINESS, which provides a set of checks that uses the Simplification Database to identify typical errors in custom code when moving to SAP S/4HANA (see Figure 9). You can restrict the objects to be checked during the run series in various ways — for example, you can specify that the run check all objects that belong to a specific ABAP package.
After configuring the run series, select the series from the list of saved configurations (Figure 10) and schedule the series (Figure 11). If it is a long-running job, you can schedule the series to run in the background.
2. Analyze the Results
After the run series has completed — in dialog or when the corresponding job has finished in the background — the next task is to analyze the results. On the ABAP Test Cockpit start screen (Figure 12), select Manage Results, which takes you to a selection screen for browsing the run series results.
Enter the name of the previously defined run series — S4H164_98B in the example (see Figure 13) — and choose the run series from the resulting display (Figure 14).
The result set of the run series is displayed in an overview screen (see Figure 15) that contains the concrete findings and corresponding statistics. The left pane shows the different error categories, such as field length extensions. The right pane provides a summary of the identified errors grouped by priority. The bottom pane displays details such as the specific error message, the affected SAP object, the object owner, and the package assignment. From here, you can drill down into the source code by clicking on the program name, which opens the ABAP Editor in ABAP Workbench (see Figure 16), where you can quickly analyze the code.
To investigate the root cause of an identified error in more detail, double-click on the check, which displays the details shown in Figure 17. In this example, a transaction was called — transaction MB11 — that no longer exists in SAP S/4HANA.
3. Adapt the Code
Now that you have an overall worklist for the adaptation project to use as a guide, you are ready to make the necessary corrections identified in the worklist by checking and adapting the code in the individual programs.
While you can drill down into the code via ABAP Test Cockpit and make the necessary changes using the ABAP Editor in ABAP Workbench, the Eclipse-based ABAP development tools offer many new features that simplify the adaptation process and are not available in ABAP Workbench. We’ll look at how to take advantage of these capabilities next.
Using ABAP Test Cockpit with the Eclipse-Based Development Tools
ABAP Test Cockpit and the Eclipse-based ABAP development tools can be easily used together — they are tightly integrated and work from the same repository. Let’s see how you can combine the tools to analyze and adjust code by looking at a few typical examples:
- Calling obsolete or removed transactions
- Changes in field length
- Invalid assumptions about sort order
Calling Obsolete or Removed Transactions
In traditional ABAP coding, transactions are often called on the fly to link different activity areas, such as materials management and logistics. Figure 18 shows an example selection screen program in the Eclipse IDE for the ABAP development tools. This example program calls two transactions: MB11 and MATGRP03. MB11 has been marked as obsolete in SAP S/4HANA, which results in an error message that also points to the corresponding SAP Note. Since MB11 no longer exists, when transaction MATGRP03 is called in this program, the system dumps.
To analyze the issue, you can start an ABAP Test Cockpit run on the program from within the Eclipse-based ABAP development tools. Right-click on the program name in the Project Explorer pane of the Eclipse IDE, select Run As > ABAP Test Cockpit With, and then enter the check variant S4HANA_READINESS (see Figure 19). ABAP Test Cockpit will show the findings in the ATC Problems view in the lower pane of the Eclipse IDE (see Figure 20) with the corresponding SAP Note displayed on the right, which contains details on how to fix the error. To fix the issue in the example, switch back to the source code editor and replace the obsolete transaction MB11 with a new one called MIGO.
Changes in Field Length
The extension of the material code to 40 characters in SAP S/4HANA can cause problems if the custom code has made assumptions about the length of the material code — this can happen when variables are declared in a dependent fashion or when fields are concatenated into a result field that is not large enough.
Figure 21 shows an example list of materials that looks incomplete — data is missing from the Created On and Created by columns. To investigate the root cause in more detail, start the ABAP Test Cockpit run as before and examine the findings in the ATC Problems view (see Figure 22). If you analyze the error, you can see that a length conflict has occurred. The source field <l_mara> is 40 characters while the target field l_material is 18 characters. You can also view the characteristics of each field, including the length information, in a pop-up by clicking on the field in the source code editor and pressing the field info key (F2).
To fix the issue in this case, simply change the declaration to MATNR, which is 40 characters, and rerun the check by right-clicking on the error in the ATC Problems view and selecting Recheck. The error message disappears (see Figure 23) and the list displays as expected (see Figure 24).
Invalid Assumptions About Sort Order
Invalid assumptions about sort order in custom code is another common cause of issues after an SAP S/4HANA migration. For example, let’s say an empty table is shown that should display sales orders (see Figure 25). If you analyze the ABAP coding with ABAP Test Cockpit, you can see that there is a SELECT statement that uses the addition FOR ALL ENTRIES to read records with specified sales order keys into an internal table (see Figure 26). The logic that follows that statement uses a READ TABLE with BINARY SEARCH, assuming the data is sorted implicitly, as is common in traditional ABAP programs. In standard SQL, which SAP HANA follows, you cannot rely on an implicit sort order, since SQL is set-oriented and does not imply a sort order.
To fix this issue in the example, you can replace the procedural access with the SQL statement shown in Figure 27. The result list is then properly displayed when you rerun the check (see Figure 28).
SAP S/4HANA is SAP’s solution for the intelligent enterprise — it offers a range of innovative technologies that customers can use to simplify, integrate, and modernize their business operations. To help its customers make the move from traditional SAP Business Suite implementations to SAP S/4HANA, which requires adapting custom code to the new SAP S/4HANA data model, SAP provides tools that fully support the process.
All data type and data model changes included in SAP S/4HANA are collected in the Simplification Database, which provides access to relevant SAP Notes that document the technical changes in detail and provide guidance for developers. With this information as a guide, along with the tight integration between ABAP Test Cockpit and the Eclipse-based ABAP development tools, you can identify and resolve incompatibilities between your custom code and the new SAP S/4HANA data model to ensure a smooth transition to a modern ERP system.