Você está na página 1de 12

SAP ABAP Checkpoint Group –

If changes are made to the code, then there is no guarantee that previous assumptions are satisfied. SAP ABAP

checkpoints can be used to make sure that program correctness is maintained. Under checkpoints, we consider

Assertions, Break point and Log points.

Assertions can be used to improve the quality of software. BREAK-POINT and LOG-POINT are used to

investigate program behaviour in case of problems. They help in understanding and maintain the code.

Checkpoint Group

The activation state of all checkpoints which can be activated is controlled by the checkpoint group.

Assertion

let us consider a scenario where money is transferred from one account to another. Here, sum of both

balances must be equal before and after transfer. With the help of assertion we can check this condition. It is

a statement which we can put in the program describing a specific condition.

ASSERT logexpr.

During program execution if expression fails, execution can be stopped. Program execution can be stopped by

raising ASSERTION_FAILED.

ASSER ID checkpointgroup CONDITION logicalexpr.

If ID statement is used then assertion is active otherwise it is always active.

How to create checkpoint group?

Checkpoint group can be created using SAAB transaction.

Enter Name and click on create. Save it and activate it.


By default Assertion is Inactive as below you can see in Assertions frame. Create a Check group and activate

the group.
Write simple code and execute in SE38.

REPORT zcheeck_pt.

DATA : lv1 TYPE c VALUE 'A'.


DATA : lv2 TYPE c VALUE 'B'.

INITIALIZATION.

LOG-POINT ID zcheck_pt FIELDS: lv1,lv2.

START-OF-SELECTION .

lv1 = 'X'.
lv2 = 'Y'.

LOG-POINT ID zcheck_pt FIELDS: lv1,lv2.

WRITE 'Run.. Done'.

ASSERT ID zcheck_pt CONDITION lv1 EQ lv2.

BREAK-POINT ID zcheck_pt.
Then go to transaction SAAB, select radio button Abort in Assertions frame and activate checkpoint group.
Again run the program. You will get dump describing the position where assertion is violated.
When you select Log option the occurrence of assertion will be logged. Run the Program again.
You can see the log details with Variable values, which would be useful in cases like where we can’t replicate
the scenarios in Quality or development box – To chase the mysterious missing values.
When you select Break option you will get following option.

In normal case program is interruption and debugger is started and in case of background processing it will

behave like Log mode or Abort mode depending on what is selected.

Same way BREAK-POINT and LOG-POINT can be activated by selecting Break and Log.
BREAK-POINT:

Break Point can be activated by writing following code in your program.

BREAK-POINT ID <Checkpoingroup>

Active break point behaves same as always active break point. In case of background processing activatable

break points are simply ignored. Run the Program, you can see the program stop by at line 30.
LOG-POINTS:

Log Point can be made active by writing following code in your program.

LOG-POINT ID <Checkpoingroup>

Logs can be used to identify or analyse the system behaviour. Variable values can be logged so that program

developer can analyse those values.

You can add in your program statement LOG-POINT ID ZCHEECK_PT.

Run the program and go to transaction SAAB. Go to tab ‘LOG’. You will see following details which will help

you to analyse program’s behaviour.


You can also use following syntax.

Run the program and check the Log in SAAB transaction.

Above statement log the value of field ‘log’. We can log up to 32 fields.

You can use SUBKEY addition to prevent production of huge amount of data in log. All log occurrences will

produce one record for same SUBKEY. Only last occurrence can be seen but counter will be incremented.

LOG_POINT ID ZTRY SUBKEY ‘TEST’ FIELDS log.

Checkpoint group activation can be done with three levels

Personal Activation – Checkpoint group will be active for current user only.

User Level activation – Checkpoint group will be active for all defined users.
Server level Activation. – Same way we can define servers for which it will be active.

Você também pode gostar