A Bap Troubleshooting

25
1 ABAP Troubleshooting Possible !s Everything High Noon Corp There are many different possibilities to be in trouble with ABAP programs: Hard errors (Runtime errors, abortion messages ..) Wrong program flow or behavior Poor performance. But the programming language ABAP and the surrounding tools will not let you alone with the error. Tools allow us to Systematical ly analyze ABAP performance problems. Solve ABAP performance problems that cause: High da taba se load (f requent acces ses to th e database) High CPU lo ad (f requent access es to intern al tables)

Transcript of A Bap Troubleshooting

Page 1: A Bap Troubleshooting

7/28/2019 A Bap Troubleshooting

http://slidepdf.com/reader/full/a-bap-troubleshooting 1/25

1

ABAP TroubleshootingPossible !s Everything 

High Noon Corp

There are many different possibilities to be in trouble with

ABAP programs:

• Hard errors (Runtime errors, abortion messages..)• Wrong program flow or behavior• Poor performance.

But the programming language ABAP and the surroundingtools will not let you alone with the error.

Tools allow us to Systematically analyze ABAP performance

problems.

Solve ABAP performance problems that cause:• High database load (frequent accesses to the

database)

• High CPU load (frequent accesses to internal

tables)

Page 2: A Bap Troubleshooting

7/28/2019 A Bap Troubleshooting

http://slidepdf.com/reader/full/a-bap-troubleshooting 2/25

2

ABAP Trouble shootingPossible !s Everything 

High Noon Corp

Tools for ABAP programs

Page 3: A Bap Troubleshooting

7/28/2019 A Bap Troubleshooting

http://slidepdf.com/reader/full/a-bap-troubleshooting 3/25

3

ABAP Trouble shootingPossible !s Everything 

High Noon Corp

Overview of Tools

Page 4: A Bap Troubleshooting

7/28/2019 A Bap Troubleshooting

http://slidepdf.com/reader/full/a-bap-troubleshooting 4/25

4

ABAP Trouble shootingPossible !s Everything 

High Noon Corp

Static Checks

Extended program check(SLIN)

Extended program check (transaction SLIN)

You can decide which checks shall be done. Press F1

for each test family to get detailed information on thetests to be executed.

Page 5: A Bap Troubleshooting

7/28/2019 A Bap Troubleshooting

http://slidepdf.com/reader/full/a-bap-troubleshooting 5/25

5

ABAP Trouble shootingPossible !s 

Everything 

High Noon Corp

The result of an extended program check is a table which

displays the messages/ warnings / errors for each test

family. This will lead to a runtime error during program execution

anyway.

From the overview table you get, via double click, to adetailed error description and from here you can directly

access the source code to do your correction.

Page 6: A Bap Troubleshooting

7/28/2019 A Bap Troubleshooting

http://slidepdf.com/reader/full/a-bap-troubleshooting 6/25

6

ABAP Trouble shootingPossible !s 

Everything 

High Noon Corp

Static Checks

Code Inspector(SCI)

The code inspector (transaction SCI) is a mass testframework.

You can define your own:

• Program set (Which programs shall be checked?).• Test set (Which test shall be executed – you can even

define your own checks).

Page 7: A Bap Troubleshooting

7/28/2019 A Bap Troubleshooting

http://slidepdf.com/reader/full/a-bap-troubleshooting 7/25

7

ABAP Trouble shootingPossible !s 

Everything 

High Noon Corp

The Code Inspector test set contains the following tests:

• Performance checks (e.g. tuning of selectstatements)

• Security checks (e.g. client dependingINSERT/UPDATE….)

• Syntax Check/Generation

• Extended program check• User Interfaces

Page 8: A Bap Troubleshooting

7/28/2019 A Bap Troubleshooting

http://slidepdf.com/reader/full/a-bap-troubleshooting 8/25

8

ABAP Trouble shootingPossible !s 

Everything 

High Noon Corp

Runtime Checks

Post Mortem Analysis – System Log(SM21)

System Log can be accessed

with transaction SM21.

The syslog is helpful if you encounter:

• Update terminations (SM13).• Job terminations (SM37).• Anykind of unknown errors.

• If you encounter the dump SNAP_NO_NEW_ENTRY(no more dump can be written in the dump database

table SNAP), then you can find the real error in thesyslog

Page 9: A Bap Troubleshooting

7/28/2019 A Bap Troubleshooting

http://slidepdf.com/reader/full/a-bap-troubleshooting 9/25

9

ABAP Trouble shootingPossible !s 

Everything 

High Noon Corp

Runtime Checks

Post Mortem Analysis – Dump Analysis(ST22)

Get the date/time and user data from the system log andselect the appropriate dumps in Tcode ST22.

Usually a periodic job deletes all dumps which are e.g olderthan one week. To ensure that a dump will not be deleted

you can explicitly lock it.

Page 10: A Bap Troubleshooting

7/28/2019 A Bap Troubleshooting

http://slidepdf.com/reader/full/a-bap-troubleshooting 10/25

10

ABAP Trouble shootingPossible !s 

Everything 

High Noon Corp

The most valuable information are included in:

• Error analysis• How to correct the error• System environment• User, transaction…• Information on where termination occurred

• Source code extract• Contents of system fields• Chosen variables

• Active calls / events

• Internal notes

• Active calls in SAP kernel

Page 11: A Bap Troubleshooting

7/28/2019 A Bap Troubleshooting

http://slidepdf.com/reader/full/a-bap-troubleshooting 11/25

11

ABAP Trouble shootingPossible !s 

Everything 

High Noon Corp

ABAP Runtime Analysis – Overview

Enables you to execute a performance and structure

analysis of any transaction, program, or function modulecreated with ABAP.

Only this tools is able to trace the flow of ABAP programs on

statement level. Trace the memory consumption of your application.

Determine the SQL or ABAP statement causing the highest

load.

Page 12: A Bap Troubleshooting

7/28/2019 A Bap Troubleshooting

http://slidepdf.com/reader/full/a-bap-troubleshooting 12/25

12

ABAP Trouble shootingPossible !s 

Everything 

High Noon Corp

ABAP Runtime Analysis – Overview

What is measured?

ABAP statements that are potentially expensive in terms of CPUtime.

The most significant of these are:

• DB accesses: Select, Exec SQL,• Module. units: Module, CALL Function, CALL Screen, CALLTransaction, CALL Dialog

• Internal tables: Append, Collect, Sort, Read Table, Read

Dataset

• File handling: Transfer, Open Dataset• Others: EXPORT … TO …, IMPORT … FROM …, Rollback,SET PF-STATUS, SET TITLEBAR, MESSAGE, ASSIGN

Page 13: A Bap Troubleshooting

7/28/2019 A Bap Troubleshooting

http://slidepdf.com/reader/full/a-bap-troubleshooting 13/25

13

ABAP Trouble shootingPossible !s 

Everything 

High Noon Corp

ABAP Runtime Analysis – Overview

How is it measured?

• During runtime analysis, the system measures thestatements listed above.

• The system stores these measurements in a performance

data file. (DIR_ATRA)• You can evaluate the file (on the current server) immediatelyor at a later time.

• The system subtracts the CPU consumption needed for

doing the measurement from the total CPU consumption.

Page 14: A Bap Troubleshooting

7/28/2019 A Bap Troubleshooting

http://slidepdf.com/reader/full/a-bap-troubleshooting 14/25

14

ABAP Trouble shootingPossible !s 

Everything 

High Noon Corp

Runtime Analysis Traces

ABAP Runtime Analysis(SE30)

With WEB AS 6.20 you can easily create a se30 variant witha new “Create Icon”.

With aggregation the hierarchy is not available.For memory usage info in the hierarchy check the “With

memory use” flag. Program (parts) – “Particular units”.

Page 15: A Bap Troubleshooting

7/28/2019 A Bap Troubleshooting

http://slidepdf.com/reader/full/a-bap-troubleshooting 15/25

15

ABAP Trouble shootingPossible !s 

Everything 

High Noon Corp

Runtime Analysis Traces

ABAP Runtime Analysis(SE30) - Analyze

Start the program / transaction via se30 with your variant.

You get a list which represents the complete path through

your application.

Additionally you can now filter which data you want to

display.

Page 16: A Bap Troubleshooting

7/28/2019 A Bap Troubleshooting

http://slidepdf.com/reader/full/a-bap-troubleshooting 16/25

16

ABAP Trouble shooting

Possible !s 

Everything 

High Noon Corp

Runtime Analysis Traces

ABAP Runtime Analysis(SE30) - Analyze

The hierarchy list contains the following data:• Gross/net time (-> performance part of this chapter)• Level: Stack level

• Call hierarchy: name of the statement / event.• Program: current program / class

Page 17: A Bap Troubleshooting

7/28/2019 A Bap Troubleshooting

http://slidepdf.com/reader/full/a-bap-troubleshooting 17/25

17

ABAP Trouble shooting

Possible !s 

Everything 

High Noon Corp

Runtime Analysis Traces

ABAP Runtime Analysis(SE30) - Analyze

• Memory requirement: the currentuse of memory. The maximum values

are marked with a redbackground colour.

• This feature is only available,if you switch on “With memory use”

in the area duration/type of your

trace variant. (default: switched off)

Page 18: A Bap Troubleshooting

7/28/2019 A Bap Troubleshooting

http://slidepdf.com/reader/full/a-bap-troubleshooting 18/25

18

ABAP Trouble shooting

Possible !s 

Everything 

High Noon Corp

Runtime Analysis Traces

Screen Trace(ST20)

With SAP Basis release 46B,transaction ST20 is available to

analyse Batch Input or all othererrors which are connected withscreen handling(field transport, screen sequence,

resize, F1, F4 help)

In older releases you can use the report RSTRC000 to look at

the screen trace.

Page 19: A Bap Troubleshooting

7/28/2019 A Bap Troubleshooting

http://slidepdf.com/reader/full/a-bap-troubleshooting 19/25

19

ABAP Trouble shooting

Possible !s 

Everything 

High Noon Corp

Runtime Analysis Traces

ABAP Debugger Report)

The report will be starteddirectly in debugging mode.

If you insert /h in the OK-field,you will not debug RSPARAMbut the editor.

Page 20: A Bap Troubleshooting

7/28/2019 A Bap Troubleshooting

http://slidepdf.com/reader/full/a-bap-troubleshooting 20/25

20

ABAP Trouble shooting

Possible !s 

Everything 

High Noon Corp

Runtime Analysis Traces

ABAP Debugger Function Module)

For function modules use transactionSE37 -> Button “Single Test”.

In the generated function interfacefill in the parameters and pressDebugging.

Please notice that this is the

only possibility to debug functions which are connected to

Conversion Exits or Field Exits. They can’t be debuggedduring the running transaction (-> only isolated testing ispossible)

If you debug a complicated transaction and you are sure that

the problem occurs in one function module, obtain theparameters for the function interface and try to reproduce the

error in an isolated test (SE37).

Page 21: A Bap Troubleshooting

7/28/2019 A Bap Troubleshooting

http://slidepdf.com/reader/full/a-bap-troubleshooting 21/25

21

ABAP Trouble shooting

Possible !s 

Everything 

High Noon Corp

Runtime Analysis Traces

ABAP Debugger Transaction)

You can start a transaction indebug mode from the transaction

maintenance. (SE93) With R/3 Release < 4.6A:• SE80, button “Edit”• Fill in transaction (e.g. VA01)

• Test / Execute (F8)

• Select radio button “Debugging” Or much faster (Enjoy release ≥ 4.6A):• Transaction SE93• Fill in your transaction

• Menu path: Transaction Code -> Test -> Debugging

Page 22: A Bap Troubleshooting

7/28/2019 A Bap Troubleshooting

http://slidepdf.com/reader/full/a-bap-troubleshooting 22/25

22

ABAP Trouble shooting

Possible !s 

Everything 

High Noon Corp

Runtime Analysis Traces

ABAP Debugger Features

Starting the debugger while the program is already runningallows you to reach the point of interest faster and more

precisely.• Start the debugger (/h) in a transaction at the point where

you have the problem• Start to debug e.g. a batch report when you think the

problem comes up (e.g. high memory consumption)

• For debugging basis transactions usually the systemdebugging will be needed (/has)

A batch job will not stop if a breakpoint is reached. Even forthe statement BREAK-POINT only a sys log entry (Breakpoint

reached …) is generated.

Page 23: A Bap Troubleshooting

7/28/2019 A Bap Troubleshooting

http://slidepdf.com/reader/full/a-bap-troubleshooting 23/25

23

ABAP Trouble shooting

Possible !s 

Everything 

High Noon Corp

Runtime Analysis Traces

ABAP Debugger Features

In the job overview(SM37) you can debug each job with the

ok-code JDBG. But please keep in mind: This is like a restart 

of the job. -> All possible updates will be executed 

If you have to analyze an aborted job, then you can restart the job in debug mode. This is a “background simulation” whichactually runs in a dialog work process to allow debugging.

Instructions: Run SM37, Mark the job you want to restart indebug mode, Prompt JDBG in the ok code & You reached the

debugger But please keep in mind, this is no simulation. All updates, deletes or

whatever else is done in this job will be executed !)

Page 24: A Bap Troubleshooting

7/28/2019 A Bap Troubleshooting

http://slidepdf.com/reader/full/a-bap-troubleshooting 24/25

24

ABAP Trouble shooting

Possible !s 

Everything 

High Noon Corp

Runtime Analysis Traces

ABAP Debugger Navigation

Page 25: A Bap Troubleshooting

7/28/2019 A Bap Troubleshooting

http://slidepdf.com/reader/full/a-bap-troubleshooting 25/25

25

ABAP Trouble shooting

Possible !s 

Everything 

High Noon Corp

Runtime Analysis Traces

ABAP Debugger Navigation

You navigate from the debugger to: – The current state of the list-output (GOTO -> Display

condition -> Display List) – The current ABAP source (Development -> ABAP Editor / 

Object Browser) – The screen painter (if you are in the flow logic of a dynpro)