Download as pdf or txt
Download as pdf or txt
You are on page 1of 11

4/21/2020 Checkgroups - ABAP Development - Community Wiki

Welcome to the new version of SAP Community Wiki: Learn What's New? and what has changed.
Dashboard

Checkgroups
Created by Anonymous, last modified by Craig Cmehil on Sep 01, 2009

The checkpoints are the type of statements introduced in the SAP Web Application Server (SAP WebAS) 6.20 that is totally
dedicated to ensuring program correctness and maintainability. This improves the quality of software written in ABAP. These
checks are transportable and can be transported .The transaction that takes care of these checkpoints and the place where
they are maintained is SAAB.
The Checkpoints now can be created for break-points and checkpoints and the two statements for this are
1. Assertions
2. Break-points
The one which actually does not checks the errors but is used to log the data that u want is LOG-POINT.
To start with step by step explanation of the checkpoints we start first with the Assertions.
Assertions syntax as per the SAP Library that is to be used in the coding is as below....
ASSERT [[ID idname [stage:SUBKEY subkey]]
[stage:FIELDS field1 field2 table1 table2...]
CONDITION] Some_exp.
Assertions are used as a high quality means of problem determination in the case of code failure. . Assertions are invoked at
run time. They can be made active or inactive. Assertions can be left in code when promoted to production with no impact to
the code. They are only invoked if the checkpoint group is activated.
The checkpoint groups can be activated through the transaction SAAB and that is referred by ID in the programs with assert
statements.

https://wiki.scn.sap.com/wiki/display/ABAP/Checkgroups 1/11
4/21/2020 Checkgroups - ABAP Development - Community Wiki
This is the transaction below SAAB where in the checkpoint group we can create the group ID.

Clicking on the create button below the Name we get to the below screen.

https://wiki.scn.sap.com/wiki/display/ABAP/Checkgroups 2/11
4/21/2020 Checkgroups - ABAP Development - Community Wiki

Now the checkgroup activation can be done with three levels


1. Personal Activation
2. User Level activation
3. Server Level Activation.
In the personal level activation that checkgroup will be active for the current user only and for the User the Checkgroup
will be active for that user that has been defined and same is for the Server.
The User when clicked there you can define the Specific users for it as this...

And similarly it can be done for specific Servers on clicking on the add Sign as below ...
https://wiki.scn.sap.com/wiki/display/ABAP/Checkgroups 3/11
4/21/2020 Checkgroups - ABAP Development - Community Wiki

As for the screen below:-

There are three things that can be controlled with the checkgroups.
The breakpoints can be made active or inactive. Inactive then that particular statement will be ignored and if break then in the
program wherever the statement occurs the program gets into debugging.
The Statement as per the SAP Library that goes with this in the Program is as below...
BREAK-POINT ID idname
some_text
Ex. BREAK-POINT ID YH_check.
Without the addition ID, the breakpoint is always active. The log text is the text which you can specify for the system log
which is seen in the logs getting created.
During background processing the program execution is not interrupted. If the program reaches a breakpoint, the entry
"Breakpoint reached" is written to the system protocol under which the program name and the location of the breakpoint in
the program are recorded. An inactive breakpoint is ignored.
In HTTP sessions like the BSP applications and Web Dynpros the system only stops at an active breakpoint in the Code and
then goes to the ABAP Debugger only if external debugging is switched on for the particular .If the external debugging is not
switched on then the breakpoint behave the same as it would have been behaving in the background mode.
Coming again back to assertions,
There are 4 ways the assertion can be used:-
Inactive (default): statement is ignored
Log: occurrence is logged
Abort: program terminates with runtime error ASSERTION_FAILED
The below two options come with a pop-up having options as:-
Break/Log: program is interrupted and starts the debugger / like LOG mode in background, batch etc.
Break/Abort: program is interrupted and starts the debugger / like ABORT mode in background, batch etc.

https://wiki.scn.sap.com/wiki/display/ABAP/Checkgroups 4/11
4/21/2020 Checkgroups - ABAP Development - Community Wiki
The below two options come as this..

Assertion RULES:
1. Exception handling should always be used to trap and handle failures. DO NOT use an assertion in the place of
exceptions.
2. Assertions should only be used on custom code rather than on standard codes.
3. When an assertion is invoked, it should create a log entry unless and until there is a compelling reason to terminate
with a run time error.

Here is a sample program where the LOG-Points and ASSERTIONS are used.
REPORT yh1316_test_checkgrp.
. .
** Parameters Declarations
PARAMETERS:
p_carrid LIKE sflight-carrid.
*Types Declarations of sflight
TYPES : BEGIN OF type_s_sflight,
carrid TYPE sflight-carrid,
connid TYPE sflight-connid,
fldate TYPE sflight-fldate,
price TYPE sflight-price,
max TYPE i,
END OF type_s_sflight

https://wiki.scn.sap.com/wiki/display/ABAP/Checkgroups 5/11
4/21/2020 Checkgroups - ABAP Development - Community Wiki
*Field String Declarations for sflight
DATA: fs_sflight TYPE type_s_sflight.
*Internal table for Sflight Data
DATA : t_sflight LIKE
STANDARD
TABLE OF fs_sflight.
DATA yh1316_subkey TYPE char200.
IF p_carrid IS INITIAL.
SELECT carrid
connid
fldate
price
FROM sflight
INTO fs_sflight.
WRITE: / fs_sflight-carrid,
fs_sflight-connid,
fs_sflight-fldate,
fs_sflight-price.

APPEND fs_sflight TO t_sflight.


ASSERT ID yh1316_check SUBKEY 'YH1316_parameter_if_initial'
FIELDS p_carrid
t_sflight
fs_sflight-carrid
fs_sflight-connid
fs_sflight-fldate
fs_sflight-price
condition p_carrid eq 'LH' .
ENDSELECT.
ASSERT ID yh1316_check SUBKEY 'YH1316_1'
FIELDS p_carrid
t_sflight
CONDITION p_carrid EQ 'LH' .
EXIT.
ELSE.
ASSERT ID yh1316_check SUBKEY 'YH1316_2'
FIELDS p_carrid
t_sflight
CONDITION p_carrid EQ 'LH'.
SELECT carrid connid fldate MAX( price ) AS max
INTO CORRESPONDING FIELDS OF fs_sflight
FROM sflight
WHERE carrid EQ p_carrid
GROUP BY carrid connid fldate
ORDER BY carrid max DESCENDING.
IF sy-dbcnt < 4.
APPEND fs_sflight TO t_sflight.
LOG-POINT ID yh1316_check SUBKEY 'LOG_POINT'
FIELDS p_carrid
t_sflight
fs_sflight-connid
fs_sflight-fldate
fs_sflight-max.
WRITE: / fs_sflight-carrid, fs_sflight-connid, fs_sflight-fldate,
fs_sflight-max.
ENDIF.
ENDSELECT.
ENDIF.
A variant is created for the Particular Checkgroup created. Variant can be created as a Local as well as at a user level. Here it
is created at the User Level.

https://wiki.scn.sap.com/wiki/display/ABAP/Checkgroups 6/11
4/21/2020 Checkgroups - ABAP Development - Community Wiki

Click on create and enter the following entries.


There are four kind of object type for which a variant can be created asCheck GroupProgramClassFunction GroupAnd for
particular Object type the Different options can be given for Breakpoint, Logpoint and Assert. The Options for them are same
as stated before in the Personal Activation screen for check group.Now save the variant and then go back to the checkgroup
for which we have created the variant. Don't forget to activate the variant.

As above it is seen the Local variant is visible in the Variants tab the same way we can create a Global variant also.
Now run the Program. If the assertion condition is violated the listed logs are created for the assertion as we have selected
the log for assertion in the SAAB transaction in the Check Group.The log will also be created for the LOG-POINT statement
and the SUBKEY there defines the Key to distinguish that the log has been created for which Assertion and checkpoint.In the
Log the data is segregated according to the two Hierarchies:-
1. Gropu/Subkey/Program/Procedure
2. Group/Program/Procedure/Subkey
The log seen is like this

https://wiki.scn.sap.com/wiki/display/ABAP/Checkgroups 7/11
4/21/2020 Checkgroups - ABAP Development - Community Wiki

Double clicking on the Line where the Include line number is seen we can see the description of the log as below. The
number of times the programs have been in run can also be seen in the Frequency with the last run time and date.

https://wiki.scn.sap.com/wiki/display/ABAP/Checkgroups 8/11
4/21/2020 Checkgroups - ABAP Development - Community Wiki

https://wiki.scn.sap.com/wiki/display/ABAP/Checkgroups 9/11
4/21/2020 Checkgroups - ABAP Development - Community Wiki

As we have logged the table entries also double clicking on the table we can see the table entries too.

https://wiki.scn.sap.com/wiki/display/ABAP/Checkgroups 10/11
4/21/2020 Checkgroups - ABAP Development - Community Wiki

We can even check the check groups in the new debugger with the watchpoints and Breakpoints.

This is how the Logs get created and how the Checkpoints works in the Efficient way to check the Codes.

subkey abap chekgroup checkpoint


assertions breakpoints logpoints

1 Comment
Sergio Ferrari
Please check the first screenshot, it seems related to the Debugger not to the /nSAAB transaction.
Nice job, really.

Privacy Terms of Use Legal Disclosure Copyright Trademark


Cookie Preferences

https://wiki.scn.sap.com/wiki/display/ABAP/Checkgroups 11/11

You might also like