Check Point Group would be very helpful in troubleshooting for the any application. Lets see what is Check Point Group and How to use them.
Introduction
ABAP Check Point Groups are introduced from ABAP release 6.20. Check point group is a combination of various checkpoints. Checkpoints are like “Milestones”. It works like, You define several milestones in your application. As your application is getting executed, system would keep on logging against each milestone.
You can than use the Logs to determine, how many checkpoints are actually visited. This helps you to understand that your application has progressed to nth point but hasn’t reached z point. You can define three different type of behaviors:
- Assertion – If application reaches to any active Assertion, it would only continue if the condition is true. If the condition is violated, it would end up in Short-dump or Log, based on the settings defined in the checkpoint group.
- Logpoints – Log points are to log the information along the way of application execution.
- Breakpoints – You can also define Breakpoints as part of the checkpoint group. Based on the setting, it would be active or inactive – means execution would be interrupted or not.
Creating a Check Point Group
Use transaction SAAB to define a checkpoint group.
In the subsequent screens, we would just leave all the settings Inactive.
Save into your desired package if you wish to migrate this check point in future.
Creating Milestones
Once the checkpoint group is created, you would need to define milestones or check points in your application. As mentioned in the introduction, you can define three different type of behavior.
* Assert
ASSERT ID znp_sales_order_create
SUBKEY ‘ITEM_ASSERT’
FIELDS ‘ITEM’ lv_item_no
CONDITION lv_item_no < 5.
*
* Logpoint
LOG-POINT ID znp_sales_order_create
SUBKEY 'HEADER'
FIELDS 'REACHED' 'HEADER'.
*
* Breakpoint
BREAK-POINT ID znp_sales_order_create.
[/abap_code]
When you create the milestones, but if they are not activated, system would just execute those statement, but wont result into anything - Same like system would ignore those statements.
Demo
Check out this program.
REPORT znp_checkpoint_group_demo.
*
CLASS lcl_so DEFINITION.
PUBLIC SECTION.
METHODS:
get_header,
get_items,
call_bapi.
ENDCLASS. “lcl_so DEFINITION
START-OF-SELECTION.
data: lo_So type ref to lcl_so.
create OBJECT lo_So.
lo_so->get_header( ).
lo_so->get_items( ).
lo_so->call_BAPI( ).
write: ‘Done’.
*
CLASS lcl_so IMPLEMENTATION.
METHOD get_header.
LOG-POINT ID znp_sales_order_create
SUBKEY ‘HEADER’
FIELDS ‘REACHED’ ‘HEADER’.
” header processing
ENDMETHOD. “get_header
METHOD get_items.
DATA: lv_item_no TYPE i.
DO 5 TIMES.
lv_item_no = sy-index.
LOG-POINT ID znp_sales_order_create
SUBKEY ‘ITEM’
FIELDS ‘REACHED’ ‘ITEM’ lv_item_no.
” item relevant processing
*
BREAK-POINT ID znp_sales_order_create. ” lv_text.
*
*
ASSERT ID znp_sales_order_create
SUBKEY ‘ITEM_ASSERT’
FIELDS ‘ITEM’ lv_item_no
CONDITION lv_item_no < 5.
ENDDO.
ENDMETHOD. "get_items
METHOD call_bapi.
LOG-POINT ID znp_sales_order_create
SUBKEY 'BAPI'
FIELDS 'CALLING' 'BAPI'.
"BAPI processing
*
ENDMETHOD. "call_BAPI
ENDCLASS. "lcl_so IMPLEMENTATION
[/abap_code]
Go back to your checkpoint group and activate the Logging for the Logpoint. When you execute your application, it would log each and every logpoint. As you can see, I have given different SUBKEY for different purpose of the logic. This helps you to identify different logic point where the milestone is defined. You would get similar output on execution on this code:
When you drill down to Subkey ITEM, you would also see that the Item information is logged 5 times as we call that for 5 times.
Similarly you can activate the Assertion and Breakpoint.
Usage
These are very powerful when you are working in the complex solution and want to tag each step along the way. For Example, a complex user exit implementation in the Delivery BADI where your code is spread over various different methods. You want to easily debug the application, use the Breakpoint feature to activate them on the fly. You want to log them, use the LogPoints to log the execution.
Have you recently used or do you think you would use this in your next complex development?
With ‘bigger’ custom developments I tend to use the Checkpoint Group, I place these in all the most important stops ( reports, userexits, wda comp controlller doinit, wda view doinit, … ).
This makes it easier for myself and future developers to quickly find everything related to the entire custom development.
I never use logpoints or asserts tho. I try integrate everything tightly with a BAL log, so when they need to troubleshoot they can check the log in SLG1 to see what happend, later on they can pass it on to the developer … .
Hello Wouter,
Yes, its always a better idea to have checkpoints when you have many pieces of the puzzle like you have inbound interface, few enhancements, flowing to the outbound interface. I sometimes use breakpoints when I know that this is complex process and the log wont be sufficient as there are many variables need to be checked during the debugging.
Thanks for sharing your feedback.
Regards,
Naimesh Patel