SQL Server administration and T-SQL development, Web Programming with ASP.NET, HTML5 and Javascript, Windows Phone 8 app development, SAP Smartforms and ABAP Programming, Windows 7, Visual Studio and MS Office software
Development resources, articles, tutorials, code samples, tools and downloads for SAP HANA and ABAP, HANA Database, SQLScript, SAP UI5, Screen Personas, Web Dynpro, Workflow

Read ATC Results and Display on ALV Programmatically in ABAP


For code quality ABAP programmers use ATC checks (ABAP Test Cockpit tool). In this ABAP tutorial, I will show how to get list of ATC check findings for a given set of ABAP objects and display ATC results on an AVL display object. ABAP developers can use ATC results as a KPI for their ABAP programming process.

To get most recent ATC results, ABAP programmers can use function module /SDF/CC_ATC_RESULTS (ATC and CI code integration for AdHoc reporting).

In order to limit ATC results to display on ALV and read only ATC findings which are related a selected list of ABAP objects, first ABAP programmers can choose target objects from SAP table TADIR (Directory of Repository Objects) then within an ABAP Loop related ATC errors are selected.

When all related ATC errors are collected in an internal table, ABAP programmers can use cl_demo_output=>display class method to display and output data.

DATA:
 lt_object_set TYPE TABLE OF tadir,
 et_ci_results TYPE TABLE OF /sdf/code_inspector_output.

TYPES: BEGIN OF gty_data,
 author TYPE responsibl,
 devclass TYPE devclass.
 INCLUDE STRUCTURE /sdf/code_inspector_output.
TYPES END OF gty_data.
DATA ls_data TYPE gty_data.
DATA lt_data TYPE TABLE OF gty_data.

SELECT * INTO TABLE lt_object_set FROM tadir WHERE devclass = '/BSH4/SOM_INFO_INVOICE'.

CALL FUNCTION '/SDF/CC_ATC_RESULTS'
* EXPORTING
* IM_SID_FULL =
* IM_SID_SHORT =
TABLES
* et_object_set =
 et_ci_results = et_ci_results
EXCEPTIONS
 no_objects = 1
 ci_error = 2
 OTHERS = 3.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.

LOOP AT et_ci_results REFERENCE INTO DATA(lr_results).

 DATA(idx) = line_index(
  lt_object_set[ pgmid = lr_results->pgmid
  object = lr_results->objtype
  obj_name = lr_results->obj_name ]
 ).
 IF idx IS NOT INITIAL.

  CLEAR ls_data.
  MOVE-CORRESPONDING lr_results->* TO ls_data.
  ls_data-author = lt_object_set[ idx ]-author.
  ls_data-devclass = lt_object_set[ idx ]-devclass.
  APPEND ls_data TO lt_data.

 ENDIF.

ENDLOOP.

*** Display Data
CALL METHOD cl_demo_output=>display
EXPORTING
 data = lt_data
 name = 'ATC Results List'.
Code

When you run above ABAP code, the results will be as seen in below screenshot. Summarized ATC data includes the ABAP object name and its type, the author of the ABAP object and its package. Additionally, the number of ATC findings categorized by its priority like high, medium and low.

ABAP code to display ATC errors for selected programs



SAP HANA and ABAP

Install SAP Free
CRM Companies List
Web Based CRM Software


Copyright © 2004 - 2021 Eralper YILMAZ. All rights reserved.