ABAP Code remediation using ATC and Transport Blocking ECC Code remediation team
Agenda • ABAP Code Remediation
ABAP Test Cockpit ATC Demo Code Remediation Examples ABAP Test Cockpit result for ECC FB0 custom code
Transport blocking
Intel Information Intel Confidential – for internal use Technology
ABAP Code Remediation ABAP code remediation is to prepare custom code work flawlessly with SAP HANA. ABAP Code remediation is required because • DB Migration Need to take care of DB specific code (Native SQLs, DB Hints) • SAP HANA Architecture Column based architecture . Code to Data Paradigm • De-pooling / De-clustering During HANA migration most of the pool and (A001, A010) cluster tables (KONV, CDPOS, BSEG) will be transformed to transparent table Intel Information Intel Confidential – for internal use Technology
ATC – ABAP Test Cockpit ATC – ABAP Test Cockpit is new global Code Inspector. This static code checker can be used to prepare Custom ABAP code for HANA. The ABAP Test Cockpit is directly integrated into the ABAP workbench as well as in the ABAP Development Tools for Eclipse.
Custom variant Y_HANA_DB_AND_ADDITION crated in FI0 combining the FUNCTION_DB and Intel Information FUNTIONAL_DB_ADDITION variant Intel Confidential – for internal use Technology
SAP recommends below 3 Variants (preconfigured checks), using ATC, for custom code migration to HANA and performance tuning. FUNCTIONAL_DB This check variant contains checks that are regarded as mandatory for the analysis of ABAP custom code as part of an SAP HANA migration. FUNCTIONAL_DB_ADDITION This check variant contains additional checks that are not directly linked with the SAP HANA migration, but locate potential functional errors and SQL statements with poor performance. Thus the checks in this check variant are not mandatory for the SAP HANA migration, but they are recommended by SAP. PERFORMANCE_DB This contains all the main static SQL performance checks.
SQL Monitor
• It is performance analysis tool / utility can be used – not only but especially – for the purpose of optimizing custom code for SAP HANA. • Traces each and every SQL statement coming from an ABAP program - this includes OPEN SQL, native SQL and SQL statements coming from the ABAP kernel • SQL Monitor can run in a productive system without disturbing business processes and can be run before HANA migration
SAP recommend measurement period of 1-2 weeks
Allows downloading SQL Monitor data in order to import it in a development system where the code corrections are done.
It captures data like What are the most expensive and most frequently executed SQLs? Which SQL reads/writes maximum of records, has the highest execution time, often executed SQL statements in custom code Which of the business processes run a huge number of SQL statements or work with a lot of data? Derives the entry point of each process driving the traced SQL statement. The entry point can be a transaction, report, RFC module or URL Intel Information Intel Confidential – for internal use Technology
SQL Performance Tuning Worklist The SQL Performance Tuning Worklist tool enables to find ABAP SQL code that has potential for performance improvement in productive business processes. This tool combines new ABAP code scans (ABAP Test Cockpit or Code Inspector ) with monitoring and analysis utilities (SQL Monitor and Coverage Analyzer), and automatically creates a condensed worklist. The resulting findings allow to rank and filter the worklist according to specific performance issues Intel Information Intel Confidential – for internal use Technology
ATC Check Result Functional check: Functional Checks
Description
Priori Priori Prior ty 1 ty 2 ity 3
Search problematic statement for Binary search, Delete after filling internal table without 167 32 676 result of SELECT/OPEN CURSOR sort order, or loop to search an internal table without sort without ORDER BY by. Test Existence of a Program Program does not exist in system but entry in available in 5 TADIR table Scan a Program Include Programs are missing 10 Critical Statement Certain statements that are critical for security or that 38 threaten program stability are used. Table Attributes Check Examines the technical settings (transport attributes, 21 1 215 buffering) and the secondary index of database tables Unsecure use of FOR ALL ENTRIES The driver table (internal table) is not checked for zero 113 547 records. When that happens, program will read the complete DB table Analysis of WHERE condition in Where clause check for UPDATE AND DELETE statement 3 2 UPDATE and DELETE Analysis of WHERE condition for Examines the WHERE condition of the SELECT statement 37 57 SELECT for not using Where clause, Index fields, etc. • Priorities 1 and 2 indicate serious problems that usually need to be fixed as quickly as possible, since they may 243 243 1438 affect the correct functioning of a program. • Lower priorities indicate less severe quality problems. Intel Information Intel Confidential – for internal use Technology
ATC Demo
Intel Information Intel Confidential – for internal use Technology
ATC Result Browser
Intel Information Intel Confidential – for internal use Technology
Add Order by for Select statement from Transparent table SQL DB interface adds sorting by primary key to dataset selected . After migrating to HANA DB, developers need to add explicit Order by / sort command based on processing needs.
Start adding Order by to select statements from transparent tables wherever possible now before Information HANA Intel migration!. Technology Intel Confidential – for internal use
Add Sort Order for Pool/Cluster Tables Converted SQL DB interface adds sorting by primary key to pool/cluster table processing. During HANA migration pool/cluster tables are converted to transparent tables. After migrating to HANA DB, developers need to add explicit sort command based on processing needs.
Can only be fixed after HANA Intel Information migration.
Intel Confidential – for internal use Technology
Add Sort Order to Internal Table Processing SQL DB interface adds sorting by primary key to internal table. After migrating to HANA DB, this sorting is not automatically done by system, developers need to add explicit sort command based on processing needs. e.g. Binary search internal table, delete adjacent duplicates. Sort must be added for binary search to work.
Start coding with explicit sort order now before HANA migration! Intel Information Intel Confidential – for internal use Technology
Check Driver Table Before execute “For all Entries” Check the driver table to make sure it’s not empty before a “FOR ALL ENTRIES” statement is executed. If the driver table is empty, all the data records are read from the database. Large volume of returned data may cause a short dump.
Start checking driver table now before Intel Information HANA migration!. Technology
Intel Confidential – for internal use
Critical statements DB hits are used to improve the performance. DB hints are Database specific and need to remove as it will not be required with HANA DB. This change will happen with HANA DB migration.
Can only be fixed after HANA migration. Intel Information Intel Confidential – for internal use Technology
Inflight Projects & Unplanned Maintenance Fixes New process being put in place for migration through PtP (Path to Prod) • During the Remediation of code for HANA on ECC •
We have seen code for inflight projects as well as prod fixes land into PROD without checking for HANA compliance
• This forces us to ensure we have a plan in place to limit HANA code issues going forward • This will have implications on how you release code into PtP • The aim is to make it as painless as possible while protecting the environment Intel Information Intel Confidential – for internal use Technology
15
Transport Release Block Process We will be using the Y_HANA_DB_ADDITION Code Inspector Variant to the default variant in the ABAP Test Cockpit (ATC) • This variant might change in the future to incorporate Security checks For all new code, ADs must check against both the Y_HANA_DB_ADDITION as well as the YINTEL_GLOBAL_QAC_L1 to ensure issues are resolved. If you are fixing existing code, you must check against the Y_HANA_DB_ADDTION and resolve issues that might arise. • Due to the possibility of old code written before the QAC process & Naming standard changes, it is not expected for you to fix these Intel Information Intel Confidential – for internal use Technology
16
Transport Release Block Upon Transport release, any priority 1 & 2 errors will result in a Pop-Up You can choose to display the errors, it will give you a list of errors to look at • Double-Clicking the ATC Checks, will give you a list of issues • Correct priority 1 & 2 issues and the system should allow you to release the transport • If the issue is a false positive, you can use pseudo comments to prevent the error •
Specific Line End comment to hide error
Intel Information Intel Confidential – for internal use Technology
17
Demo
Intel Information Intel Confidential – for internal use Technology
18
Q/A
Intel Information Intel Confidential – for internal use Technology
19
Back up
Intel Information Intel Confidential – for internal use Technology
Sprint 1 Timelines Time lines Sprint 1 ww10 – ww24 Remediate code in DEV, Unit Test Pre-Test in CONS – can run parallel to remediation Each remediated object will move to CONS as soon as it’s remediated, unit-tested AND Pre-Test in CONS is done To ensure a consistent completion of above deliverables, use status that we have in the remediation spreadsheet. These statuses are captured in object remediation workflow i.e. object Development status = “Ready for Test” and Test Status = “QC test case & pre-test completed”. Post-Test done in CONS once code migrated WW24/WW25 ALL Post migration CONS Testing must be done ww27 – ww28 CONS Post-Test on HANA DB to ensure remediated code works on HANA DB ** SAs will be quite busy here with regressing testing as well for MR, so need to ensure Post-Test happens fairly quickly ww29.3 ww29.2 Go/No Go Prod Migration Intel Information Intel Confidential – for internal use Technology
21
Sprint 2 (HANA Related Code, Must Go with HANA DB) Time lines Sprint 2 (Current PROD Target is ww32.6) WW22.3-WW22.5 SPDD/SPAU Done ww23 – ww26 Pre-Test in CONS HANA Dependent Code Remediated and tested ww27 – ww28 (CONS will be upgraded to HANA by this time) Migrate Code to CONS Post-Test in CONS on HANA DB Defect resolution WW32.6 PROD Go Live with MR & HANA Intel Information Intel Confidential – for internal use Technology
22
ATC Check Result- Functional check Details Search problematic statement for result of SELECT/OPEN CURSOR without ORDER BY :
Test Existence of a Program Back
Intel Information Intel Confidential – for internal use Technology
ATC Check Result- Functional check Details Scan a Program
Critical Statement
Back
Intel Information Intel Confidential – for internal use Technology
ATC Check Result- Functional check Details Table Attributes Check
Unsecure use of FOR ALL ENTRIES Back
Intel Information Intel Confidential – for internal use Technology
ATC Check Result- Functional check Details Analysis of WHERE condition in UPDATE and DELETE
Analysis of WHERE condition for SELECT
Back
Intel Information Intel Confidential – for internal use Technology