Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
sanjay22
Explorer
448

Checkpoint Group Usage in SAP ABAP
Checkpoint Groups in SAP ABAP are used for logging and analyzing debugging and testing information in a structured way. They provide different types of checkpoints to monitor program execution without modifying the source code dynamically.

Types of Checkpoints in a Checkpoint Group
A Checkpoint Group (SCPR) consists of the following types of checkpoints:

BREAK-POINT – Triggers a debugger session when executed.
LOG-POINT – Writes log entries in SLG1 (Application Log).
ASSERTION – Checks conditions and throws exceptions if violated.

1. Create a Checkpoint Group

Use transaction SAAB (Assertion and Checkpoint Control).

sanjay22_0-1742812139294.png

Click Create and define a new Checkpoint Group.

sanjay22_1-1742812196893.png

Set the activation mode:
Active – Always executed.
Inactive – Skipped during runtime.
Save and activate.

Next open the report In which we have this check points.

REPORT zsm_rp_hierarchy_alv.
"Structure for mara ~ header data
TYPES: BEGIN OF ts_mara,
        matnr TYPE mara-matnr,
        mtart TYPE mara-mtart,
        mbrsh TYPE mara-mbrsh,
        matkl TYPE mara-matkl,
        expand,      "expand field for enabling expand feature in output.
      END OF ts_mara.

"Structure for makt ~ item data
TYPES :BEGIN OF ts_makt,
        matnr TYPE makt-matnr,
        maktx TYPE makt-maktx,
      END OF ts_makt.

"declaring internal tables.
DATA: lt_mara TYPE TABLE OF ts_mara,
      lt_makt TYPE TABLE OF ts_makt,
      lt_fldcat TYPE slis_t_fieldcat_alv,
      ls_layout TYPE slis_layout_alv,
      ls_keyinfo TYPE slis_keyinfo_alv.

TABLES mara.
"declaring select options
SELECT-OPTIONS s_matnr FOR mara-matnr.


START-OF-SELECTION.
"fetching the header table data.
 SELECT matnr, mtart, mbrsh, matkl
   FROM mara INTO TABLE _mara
   WHERE matnr IN @s_matnr.
   "Break-point of check point group.
   BREAK-POINT ID zsm_static_bp.
   "Log-point of check point group.
   LOG-POINT ID zsm_static_bp SUBKEY 'A1' FIELDS s_matnr lt_mara.

"Checking header internal table should not be empty before fetching item data
   CHECK lt_mara IS NOT INITIAL.

"fecthing item data for all the entries of the header Internal table
   SELECT matnr, maktx
     FROM MAkt FOR ALL ENTRIES IN _mara WHERE matnr = _mara-matnr
     INTO TABLE _maKT.

"Fill the structure for layout by passing the expand field which is present in header structure
     ls_layout = VALUE #( expand_fieldname = 'EXPAND' colwidth_optimize = abap_true ).

     lt_fldcat = VALUE #( ( col_pos = '1' fieldname = 'MATNR' tabname = 'LT_MARA' key = abap_true seltext_m = 'Material Number' )
                           ( col_pos = '2' fieldname = 'MTART' tabname = 'LT_MARA' seltext_m = 'Material Type' )
                           ( col_pos = '3' fieldname = 'MBRSH' tabname = 'LT_MARA' seltext_m = 'Industry sector' )
                           ( col_pos = '4' fieldname = 'MATKL' tabname = 'LT_MARA' seltext_m = 'Material category' )
                           ( col_pos = '5' fieldname = 'MATNR' tabname = 'LT_MAKT' seltext_m = 'Material Number' )
                           ( col_pos = '6' fieldname = 'MAKTX' tabname = 'LT_MAKT' seltext_m = 'Material description' ) ).

"here we need to pass the key fields of header and item tables.
     ls_keyinfo = VALUE #( header01 = 'MATNR' item01 = 'MATNR' ).


end-of-SELECTION.

"Log-point of checkpoint group.
LOG-POINT ID zsm_static_bp SUBKEY 'A2' FIELDS  lt_makt lt_fldcat.
"Calling function module to display the hierachial ALV.
     CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
       EXPORTING
*        I_INTERFACE_CHECK              = ' '
        i_callback_program             = sy-repid
        is_layout                      = ls_layout
        it_fieldcat                    = lt_fldcat
         i_tabname_header               = 'LT_MARA'
         i_tabname_item                 = 'LT_MAKT'
         is_keyinfo                     = ls_keyinfo
       TABLES
         t_outtab_header                = lt_mara
         t_outtab_item                  = lt_makt
      EXCEPTIONS
        program_error                  = 1
        OTHERS                         = 2
               .
     IF sy-subrc <> 0.
        MESSAGE 'There is an error' TYPE 'E'.
        ELSE.
          MESSAGE 'Data Displayed successfully' TYPE 'I'.
     ENDIF.

In line no. 35 we have a break-point and in line no. 37 and in line no.64 we have another log point.

If the radio button in checkpoint group, break is selected then it will trigger the debugger as shown in below snippet else program will execute completely without triggering debugger.

sanjay22_2-1742812353651.png

Next we have log points as shown in below snippet.

sanjay22_3-1742812867623.png

Line no.12 and 58 have log-points so this will log the data of mentioned data objects (lt_makt, lt_fldcat). 

sanjay22_5-1742813579847.pngIf the radio button in Log points, Log is selected then it will log the data objects as shown in below snippet else it will not log the data. This logged data can be seen in log tab of Check-point group transaction(SAAB).

sanjay22_0-1742815481544.png

so here we can see the data objects with data they have stored is logged. A1 and A2 are the subkey which represents the log points which are at the different lines in the program.

 

 

Labels in this area