Simple ABAP/4 for trouble shooting

83
Simple ABAP/4 for trouble shooting May 25th, 2004

description

Simple ABAP/4 for trouble shooting. May 25th, 2004. Objectives:. Understand and get an idea on what ABAP/4 programming does, and what is the component in ABAP workbench Get to know common statement, understand the ABAP program logic roughly. - PowerPoint PPT Presentation

Transcript of Simple ABAP/4 for trouble shooting

Page 1: Simple ABAP/4 for trouble shooting

Simple ABAP/4 for trouble shooting

May 25th, 2004

Page 2: Simple ABAP/4 for trouble shooting

Objectives:

� Understand and get an idea on what ABAP/4 programming does, and what is the component in ABAP workbench

� Get to know common statement, understand the ABAP program logic roughly.

� Able to do the basic investigation when facing the problem.

Page 3: Simple ABAP/4 for trouble shooting

Content

� Introduction R/3 Basis system overview

� ABAP/4 overviewComponent, Program, ABAP dictionary, Function Module , Message/Transaction code, etc.

� Common Statement / Command- Main event in ABAP program

- General ABAP command

� Transportation for ABAP objects

� Type of problem and how to investigateProgram bug, ABAP runtime error, Update terminate, Unexpected error message.

Page 4: Simple ABAP/4 for trouble shooting

Introduction R/3 Basis system overview

R/3 Basis

system

R/3 user R/3 user

Presentation component

ABAPWorkbench

R/3 user

R/3Application 1

R/3Application N...

Kernel & Basis services

Database Management System

Database

Page 5: Simple ABAP/4 for trouble shooting

Content

� Introduction R/3 Basis system overview

� ABAP/4 overviewComponent, Program, ABAP dictionary, Function Module , Message/Transaction code, etc.

� Common Statement / Command- Main event in ABAP program

- General ABAP command

� Transportation for ABAP objects

� Type of problem and how to investigateProgram bug, ABAP runtime error, Update terminate, Unexpected error message.

Page 6: Simple ABAP/4 for trouble shooting

ABAP/4 overview

� Often used transactions

� What is ABAP/4 program?

� ABAP dictionary

� Function Module

� Message

� Transaction code

� Authorization in ABAP object

Topics:

Page 7: Simple ABAP/4 for trouble shooting

Often used transactions

• SE80 - Repository Browser: Used to display and edit hierarchical lists of development objects.

• SE11 - Dictionary : Used to define and save data definitions You can also store documentation, help information, data relationships, and other information. You also use the Dictionary to generate database objects like tables and indexes.The Dictionary is a central storage area for system-wide data definitions. Because definitions are stored centrally, they are available for use anywhere in any program throughout the system

• SE38 - ABAP editor : Create/edit/Display program code

• SE37 - Function Builder : define and store function modules, use the library to write new modules and look up information on existing modules

Page 8: Simple ABAP/4 for trouble shooting

Often used transactions (con’t)

• SE51 - Screen Painter : Used to design the screens in an application's graphical user interface.

• SE41 - Menu Painter : Used to design the menus that appear in your interface

• SE16 - Data browser : Display data in Transparent table or Database view

• SM30 - Table maintenance : Maintain data

Page 9: Simple ABAP/4 for trouble shooting

ABAP/4 overview

� Often used transactions

� What is ABAP/4 program?

� ABAP dictionary

� Function Module

� Message

� Transaction code

� Authorization in ABAP object

Topics:

Page 10: Simple ABAP/4 for trouble shooting

What is ABAP/4 program?

ABAP/4 : Advance Business Application Programming

Type of ABAP/4 program

1 Executable program(Report/Interface) Can be started with transaction code/directly/background (via SE38 or SA38 - For example: RMCB0100 )

I INCLUDE programCan not run on its own, has been included in other program

M Module poolProcessing step of screens, can be executed via transaction code or Menu function (For example: SAPMV45A - Sale order processing)

F Function groupContain function modules (SE37)

S Subroutine poolExternally-called subroutines

Page 11: Simple ABAP/4 for trouble shooting

ABAP/4 overview

� Often used transactions

� What is ABAP/4 program?

� ABAP dictionary

� Function Module

� Message

� Transaction code

� Authorization in ABAP object

Topics:

Page 12: Simple ABAP/4 for trouble shooting

ABAP Dictionary

ABAP Dictionary

TableView

Data element

Domain

Structure

Lock objectF4

Search help

SE11 - Data dictionary

Page 13: Simple ABAP/4 for trouble shooting

ABAP/4 overview

� Often used transactions

� What is ABAP/4 program?

� ABAP dictionary

� Function Module

� Message

� Transaction code

� Authorization in ABAP object

Topics:

Page 14: Simple ABAP/4 for trouble shooting

Function module

Function Module- ABAP/4 program: Include program

- Special external subroutines (include) stored in a central library

- Different from normal ABAP routine is the clearly defined interface

for passing data to and from the function module. The calling program

and the called function module have separate work areas

- Located in Function group (main program start with SAPLxxxx)

- Can be tested separately in SE37

- Statement in ABAP to call function module are:

- CALL FUNCTION ‘xxxxx’

Page 15: Simple ABAP/4 for trouble shooting

ABAP/4 overview

� Often used transactions

� What is ABAP/4 program?

� ABAP dictionary

� Function Module

� Message

� Transaction code

� Authorization in ABAP object

Topics:

Page 16: Simple ABAP/4 for trouble shooting

Message

There are several different types of message:

W - Warning (Correction possible)

E - Error (Correction required)

S - Success (message on next screen)

I - Information (press Enter to continue)

A - Abend (Transaction terminated)

X - Exit (Terminated with short dump)

Note : Transaction code for message maintenance is SE91,

Table store the message text is T100, language dependent.

ABAP key word - MESSAGE

Page 17: Simple ABAP/4 for trouble shooting

ABAP/4 overview

� Often used transactions

� What is ABAP/4 program?

� ABAP dictionary

� Function Module

� Message

� Transaction code

� Authorization in ABAP object

Topics:

Page 18: Simple ABAP/4 for trouble shooting

Transaction code

Transaction code is: Sequence of alphanumeric characters forming a code for

business task.

Transaction type:Dialog transaction - Flow by sequence of screens (for example FB03)

Report transaction - Start program with type 1 (for example MCBA)

Variant transaction - (client specific) start another transaction with variant (for example UPAR)

Area menu - Menu which contain the group of frequently-used transactions (for example S001)

Parameter transaction - pre-assign values in the initial screen and suppress the screen when transaction is executed (for example OB22)

Note : All transactions are stored in table TSTC, Maintain via SE93

Page 19: Simple ABAP/4 for trouble shooting

ABAP/4 overview

� Often used transactions

� What is ABAP/4 program?

� ABAP dictionary

� Function Module

� Message

� Transaction code

� Authorization in ABAP object

Topics:

Page 20: Simple ABAP/4 for trouble shooting

Authorization in ABAP object

• Program authorization

• Transaction code

• Table maintenance/Data browser

Page 21: Simple ABAP/4 for trouble shooting

Program authorization group

Authorization group is field of the authorization objects S_DEVELOP (program development and program execution) and S_PROGRAM (program maintenance).

This field contains the name of a program group that allows users to execute programs schedule jobs for background processing maintain programs maintain variants

When creating a program, you can specify an authorization group as one of the program attributes. This allows you to group together programs for the purposes of authorization checking.

Page 22: Simple ABAP/4 for trouble shooting

Transaction authorization group

Authorization object in transaction code will be checked whenever the transaction is started. The following object will be checked

S_TCODE(Authorization check for transaction start )

The authorization checks defined by the developer with transaction SE93 (transaction maintenance) or in the ABAP/4 source code continue to be performed.Field to be checked is TCD: Transaction code

Page 23: Simple ABAP/4 for trouble shooting

Table maintenance/Data browser

Authorizations for displaying or maintaining tables. The object onlycontrols access using the standard table maintenance tool (SM31), enhanced table maintenance (SM30) or the Data Browser (SE16), including access in Customizing.Object S_TABU_DIS -Table Maintenance (via standard tools such as SM31) will be checked for the following fields:

Authorization group for DD objects: Authorization for tables byauthorization class according to table TDDAT. (Using SM31 to display the authorization group table)Activity: Allowed operations.Possible values are:- 02: Create, change or delete (Maintain) table entries- 03: Display table entries only

Page 24: Simple ABAP/4 for trouble shooting

Content

� Introduction R/3 Basis system overview

� ABAP/4 overviewComponent, Program, ABAP dictionary, Function Module , Message/Transaction code, etc.

� Common Statement / Command- Main event in ABAP program

- General ABAP command

� Transportation for ABAP objects

� Type of problem and how to investigateProgram bug, ABAP runtime error, Update terminate, Unexpected error message.

Page 25: Simple ABAP/4 for trouble shooting

Common Statement / Command

� Event in ABAP/4 program- Dialog module

- Executable program (Selection screen, lists)

� ABAP statement and Keyword

Topics:

Page 26: Simple ABAP/4 for trouble shooting

Event in ABAP/4 program

Event in Dialog Module

100

200

300

Transaction code has been requested from R/3 user

Dialog screen chain Module pool

PBO Module. Module xxxx Module yyyyPAI Module Module aaaa Module bbbbPBO Module.

Module xxxx Module yyyyPAI Module Module aaaa Module bbbb

PBO Module. Module xxxx Module yyyyPAI Module Module aaaa Module bbbb

PBO = Process Before OutputPAI = Process After Input

Page 27: Simple ABAP/4 for trouble shooting

Question??

Page 28: Simple ABAP/4 for trouble shooting

Common Statement / Command

� Event in ABAP/4 program- Dialog module

- Executable program (Selection screen, lists)

� ABAP statement and Keyword

Topics:

Page 29: Simple ABAP/4 for trouble shooting

ABAP statement and Keyword

An ABAP program consists of individual ABAP statements. Each statement begins with a keyword and ends with a period. There might be comment in the same line as a statement

For example:

PROGRAM ZTEST.

WRITE ‘Hello world’.

In this case program ZTEST will generate the list consist of line ‘Hello world’.

StatementThe ABAP programming language consists of the following element types: STATEMENT, KEYWORD, COMMENT.

Page 30: Simple ABAP/4 for trouble shooting

ABAP statement and Keyword(con’t)

KeywordsDeclarative keywords : define data types or declare the data objects Modularization keywords : define processing blocks in an ABAP program

• Event keyword :The respective processing blocks are processed as soon as a particular event occurs

• Define keyword: define processing blocks that are processed as soon as they are called by an explicit statement in an ABAP program or in a screen flow logic

Control keywords: control the flow of an ABAP program according to certain conditions

Calling keywords: call processing blocks (defined by modularization keywords) in the same or other ABAP programs or branch completely to other ABAP programs

Expression and Operation keywords: Process the data

Page 31: Simple ABAP/4 for trouble shooting

ABAP statement and Keyword(con’t)

Declarative keywordsTYPES create user-defined elementary data types and structured data types

Example TYPES: surname(20) TYPE C.

DATA define local/global variable for structure/internal table/memory block

Example DATA: BEGIN OF address,

address_number(10) TYPE C,

street(30),

country LIKE T001-LAND1,

END OF address.

TABLES create a data object called a table work area refer to ABAP dictionary(tables, structure,view)

Example TABLES: KNA1, KNB1.

CONSTANTS declare it as a fixed value variable Example CONSTANTS: name(10) VALUE ‘Exxon Mobil’

structure

address OCCURS 0

Internal table

Page 32: Simple ABAP/4 for trouble shooting

ABAP statement and Keyword(con’t)

Modularization keywordsEvent define keywords

INITIALIZATION Before selection screen is displayed

AT SELECTION-SCREEN After input selection screen + selection screen is active

START-OF-SELECTION After process selection screen

GET <table> when logical DB offer a line of database table

END-OF-SELECTION After all selection has been done

TOP-OF-PAGE Process when new page is started

END-OF-PAGE Process when page is ended

AT LINE-SELECTION When user select line in the list

AT USER-COMMAND When user press function key/enter command in command field

Page 33: Simple ABAP/4 for trouble shooting

ABAP statement and Keyword(con’t)

Modularization keywords (con’t)Process define key word for statement block

FORM...ENDFORM Define subroutine

FUNCTION...ENDFUNCTION

Define Function module

MODULE...ENDMODULE

After process selection screen

Page 34: Simple ABAP/4 for trouble shooting

ABAP statement and Keyword(con’t)

Built in functionArithmetic & string function

ABS Amount (absolute value) x von xSIGN Sign of x;

SIGN( x ) = 1 if x > 0 SIGN( x ) = 0 if x = 0 SIGN( x ) = -1 if x < 0

CEIL Smallest integer value that is not less than xFLOOR Largest integer value that is not greater than xTRUNC Interger part of xFRAC Decimal part of xSTRLEN String length

Page 35: Simple ABAP/4 for trouble shooting

1. SELECT statements

2. SAP tables vs. Internal Tables

3. LOOP-ENDLOOP

4. WRITE statements

5. Comment in ABAP

6. Expressions and Operations in ABAP

7. Subroutines: FORMS, FUNCTION MODULE

ABAP statement and Keyword(con’t)

Page 36: Simple ABAP/4 for trouble shooting

• to read table entries (records) from a table (database)

• the return code is stored in system field SY-SUBRC

- 0: if one or more table entries were retrieved

- 4: if no table entries were retrieved (table is empty/ no data match the criteria)

ABAP statement and Keyword(con’t)

SELECT statement

Page 37: Simple ABAP/4 for trouble shooting

SELECT * FROM <dbtab>

For selecting 1 or more records from a table:

Additions

. . . WHERE <condition>

. . . ORDER BY PRIMARY KEY

. . . ORDER BY <f1> <f2> . . . <fn>

ABAP statement and Keyword(con’t)

SELECT statement

Page 38: Simple ABAP/4 for trouble shooting

For selecting individual columns from a table:

SELECT <f1> . . . <fn> INTO (<h1> . . . <hn>) FROM <dbtab> . . .

For selecting a single record from a table:

SELECT SINGLE * FROM <dtab> WHERE <condition>. ( full key )

ABAP statement and Keyword(con’t)

SELECT statement

Page 39: Simple ABAP/4 for trouble shooting

SELECT DISTINCT <f1> <f2> . . . <fn> INTO (<g1> <g2> . . . <gn>) FROM <dbtab> . . .

For excluding duplicates:

Aggregate expressions:

SELECT

AVG( <f1> )COUNT( DISTINCT <f1> )COUNT( * )MAX( <f1> )MIN( <f1> )SUM( <f1>

FROM <dbtab> . . .

INTO (<g1> . . . <gn>)

ABAP statement and Keyword(con’t)

SELECT statement

Page 40: Simple ABAP/4 for trouble shooting

• Two dimensional matrix describing relationship in database system

• Components:• Table fields• Foreign keys• Technical Settings• Indexes

ABAP statement and Keyword(con’t)

SAP Table

Page 41: Simple ABAP/4 for trouble shooting

• One way to process large quantities of data in ABAP• Internal table is a dynamic sequential dataset in which

all records have the same structure and a key• The data is taken from a fixed structure, stored line by

line in the memory

ABAP statement and Keyword(con’t)

Internal Table

Page 42: Simple ABAP/4 for trouble shooting

TYPES:BEGIN OF T_T001K,

BWKEY LIKE T001K-BWKEY,BUKRS LIKE T001K-BUKRS,

END OF T_T001K.

DATA:IT_T001K TYPE T_T001K OCCURS 0.

ABAP statement and Keyword(con’t)

Internal Table Declaration <No header line>

Page 43: Simple ABAP/4 for trouble shooting

DATA:BEGIN OF IT_T001K OCCURS 0,

BWKEY LIKE T001K-BWKEY,BUKRS LIKE T001K-BUKRS,

END OF IT_T001K.

• WITH HEADER LINE

ABAP statement and Keyword(con’t)

Internal Table Declaration <With header line>

Page 44: Simple ABAP/4 for trouble shooting

Allows us to get contents of table and put it into internal table

SELECT <field1> <field2>.. <fieldn>

FROM <table>

INTO TABLE <internal table>

WHERE <condition>

ABAP statement and Keyword(con’t)

SAP --> Internal table

Page 45: Simple ABAP/4 for trouble shooting

• To perform looping operation in the flow logic• Four kinds of loops in ABAP:

• Unconditional loops using the DO statement• Conditional loops using the WHILE statement• Loops through internal tables and extract datasets

using the LOOP statement• Loops through datasets from database tables using

SELECT statement

ABAP statement and Keyword(con’t)

LOOP Command

Page 46: Simple ABAP/4 for trouble shooting

DO <n> TIMES.

ENDDO.

SY-INDEX Loop index

statements

ABAP statement and Keyword(con’t)

DO Command

Page 47: Simple ABAP/4 for trouble shooting

WHILE <logical expression>.

ENDWHILE.

WHILE COUNTER > 0....SUBTRACT 1 FROM COUNTER.

ENDWHILE.

statements

SY-INDEX Loop index

ABAP statement and Keyword(con’t)

WHILE Command

Page 48: Simple ABAP/4 for trouble shooting

LOOP AT IT_T001K.WRITE: / IT_T001K-BWKEY.

ENDLOOP.

ABAP statement and Keyword(con’t)

LOOP Command Example

Page 49: Simple ABAP/4 for trouble shooting

The basic ABAP statement for displaying data on the screen

WRITE <f> <AT position(length)> <option>

<AS CHECKBOX><AS SYMBOL><AS ICON><AS LINE>

ABAP statement and Keyword(con’t)

WRITE Command

Page 50: Simple ABAP/4 for trouble shooting

• <OPTION> behind the WRITE statement is for formatting options• E.g. : ..NO-ZERO, NO-SIGN, No GROUPING, DD/MM/YY,

• LEFT-JUSTIFIED, CENTERED, RIGHT-JUSTIFIED• The most commonly used options:

• CURRENCY wto treat the content of field <f> as a currency amount with w as a currency key

• DECIMALS dto determine number of decimals to be displayed

• UNIT uto format the value according to the unit specified in the field u. The content of field <f> is treated as a quantity.

ABAP statement and Keyword(con’t)

WRITE Command

Page 51: Simple ABAP/4 for trouble shooting

WRITE: / ‘Write’.WRITE: it_bseg-dmbtr CURRENCY it_bkpf-hwaer.WRITE: text-t01 LEFT-JUSTIFIED.

ABAP statement and Keyword(con’t)

WRITE Command Example

Page 52: Simple ABAP/4 for trouble shooting

• Written between statements of the ABAP program to explain its purpose to a reader / for internal documentation

• Helps to understand and change the program• Flagged by special character:

• Asterisk (*) entire line to be a comment• Double quotation mark (“) part of a line to be a

comment• Ignored by the system

ABAP statement and Keyword(con’t)

Comment

Page 53: Simple ABAP/4 for trouble shooting

* Write Sales Order number to the screenWrite: ‘Sales Order : ‘,

20 it_vbak-vbeln. “Sales Order Number

ABAP statement and Keyword(con’t)

Comment example

Page 54: Simple ABAP/4 for trouble shooting

• Relational Operator• String Comparison• Logical Expression• If/Case/Check Statement• Exit/Continue Statement

ABAP statement and Keyword(con’t)

Expression & Operation

Page 55: Simple ABAP/4 for trouble shooting

DisplayDisplay MeaningMeaning

EQ = Equal to

NE <> >< Not equal to

GT > Greater thanGE >= => Greater than or equal toLT < Smaller thanLE <= =< Smaller than or equal to

DATA: START TYPE D, SUM1 TYPE F, SUM2 TYPE P. . . .IF START IS INITIAL ... .IF SUM1 GT SUM2 ... .

IF SUM1 BETWEEN 0 AND 100 ... .

BETWEEN f1 and f2 Interval

IS INITIAL Initial value

ABAP statement and Keyword(con’t)

Relational Operator

Page 56: Simple ABAP/4 for trouble shooting

<f1> CO <f2> contains only: f1 contains only characters from f2ACCOUNT CO '0123456789'

<f1> CA <f2> contains any: f1 contains at least one characterfrom f2

<f1> CS <f2> contains string: f1 contains the string f2'ABCDE' CS 'DE'

<f1> CP <f2> contains pattern: f1 corresponds to the model f2Model: * any string+ any character# escape symbol

'ABXDE' CP '*B+D*'

ABAP statement and Keyword(con’t)

String Comparison

Page 57: Simple ABAP/4 for trouble shooting

Logical Expression

1. AND2. OR3. NOT

COUNTER GE 0

COUNTER GT 0 ANDFLAG IS INITIAL

( FLAG1 NE SPACE OR FLAG2NE SPACE ) AND COUNTERBETWEEN 0 AND 100

COUNTER EQ 0 AND NOT( FLAG1 EQ SPACE AND FLAG2 EQ SPACE )

ABAP statement and Keyword(con’t)

Page 58: Simple ABAP/4 for trouble shooting

IF StatementIF <logical expression>.

ENDIF.

IF <logical expression>.

ELSE.ENDIF.

IF <logical expression>.

ELSEIF <logical expression>.

ELSEIF <logical expression>.

ELSE.

ENDIF.

statements

statements

statements

statements

statements

statements

statements

ABAP statement and Keyword(con’t)

Page 59: Simple ABAP/4 for trouble shooting

• Execute different statement blocks depending on the contents of particular data fields

• WHEN OTHERS:• contents of <field>

does not equal to any of the <value?> contents

CASE <field>.WHEN <value1>.

WHEN <value2>.

WHEN <value3>.

WHEN OTHERS.

ENDCASE.

statements

statements

statements

statements

ABAP statement and Keyword(con’t)

CASE statement

Page 60: Simple ABAP/4 for trouble shooting

• Within Loop:to terminate looppass conditionally

CHECK <logical expression>.

CHECK <condition>.

statements

statements

CHECK within a loop structure.

CHECK outside loop structures.

WHILE COUNTER GT 0.

CHECK FLAG NE SPACE.

ENDWHILE.

statements

statements

11

22

ABAP statement and Keyword(con’t)

CHECK statement

Page 61: Simple ABAP/4 for trouble shooting

• Terminate loop entirely without any condition

• Terminate a subroutine without any condition

DO ...

IF COUNTER GE 100.EXIT.

ENDIF.

ENDDO.

statements

statements

EXIT within a loop structure.

EXIT outside loop structure.

EXIT.

IF ... .EXIT.

ENDIF.

statements

statements

11

22

ABAP statement and Keyword(con’t)

Page 62: Simple ABAP/4 for trouble shooting

• Terminate loop pass immediately without any condition

DO 100 TIMES.

IF SY-INDEX GE 10 AND SY-INDEX LE 20.

CONTINUE.

ENDIF.

ENDDO.

statements

statements

CONTINUE.

ABAP statement and Keyword(con’t)

Page 63: Simple ABAP/4 for trouble shooting

Call calculate_tax

SubroutineCalculate_tax

PROGRAM RSDEMO01.

PROGRAM RSDEMO02.

PROGRAM RSDEMO03.

Subroutine SUB1

SubroutineCalculate_tax

PROGRAM RSDEMO04.

Function moduleCalculate_tax

ABAP/4 function library

Function module

...

...

...

...

Call calculate_tax

Call calculate_tax

• Avoid redundancy• Modularization:

• easy to read• easy to call

ABAP statement and Keyword(con’t)

Page 64: Simple ABAP/4 for trouble shooting

• DefineFORM <name> [<parameters>]. <statement block>ENDFORM.

• Calling internallyPERFORM <name> [<parameters>].

• Calling external subroutinePERFORM <name>(program name) <parameters> [IF FOUND]

ABAP statement and Keyword(con’t)

Page 65: Simple ABAP/4 for trouble shooting

form f_check_file_exists using filename..............

endform.

Parameters:

p_path like rlgrap-filename.

..............................

perform f_check_file_exists using p_path.

ABAP statement and Keyword(con’t)

Page 66: Simple ABAP/4 for trouble shooting

Content

� Introduction R/3 Basis system overview

� ABAP/4 overviewComponent, Program, ABAP dictionary, Function Module , Message/Transaction code, etc.

� Common Statement / Command- Main event in ABAP program

- General ABAP command

� Transportation for ABAP objects

� Type of problem and how to investigateProgram bug, ABAP runtime error, Update terminate, Unexpected error message.

Page 67: Simple ABAP/4 for trouble shooting

Transportation of ABAP objects

Type of ABAP objectIn Workbench organizer, there are several ABAP objects which are transportable

Object In Transport request contain the following key

PgmID: Program Id in request and task, normally there are 2 types for ABAP objects

R3TR - name for R/3 Repository objects and Customizing objectsLIMU - enables transport of R/3 Repository object components

Obj: Object type (for example, DOMA, DTEL, FORM, PROG..)Object name:

Name of the each objectFunct.: Function D,K,MObjStatus: LOCKED,ERR_IMP,OK_IMP and OK_GEN

Page 68: Simple ABAP/4 for trouble shooting

Transportation of ABAP objects (con’t)

Version management serves different purposes and user groups:

- The developer can keep track of his or her work ("What have I changed?")

- The developer can restore a previous version by reactivating it.

- The system administrator can monitor work ("Which objects were changed and how were they changed in a specific time interval?")

- It provides the basis for the auditor, who requires a complete history of changes.

- It enables customers to adjust data with the help of the system after upgrading to a new Release.

Page 69: Simple ABAP/4 for trouble shooting

Transportation of ABAP objects (con’t)

ABAP object Version compare

ABAP program

Transaction code SE38, Under menu Utilities-->Version management

Function module

Transaction code SE37, Under menu Utilities-->Version management

Data Dictionary

Transaction code SE11, Under menu Utilities-->Version management

Object Browser

Transaction code SE80, Go to specific object and under menu utilities, Version management

Workbench Organization

Transaction code SE09, under menu Environment

Page 70: Simple ABAP/4 for trouble shooting

Transportation of ABAP objects (con’t)

ABAP object Version compare From Version management, you can

1. Display the object in other version

2. Compare the object in 2 versions

3. Retrieve the content of older version

4. Remote compare with another system

5. Display Transport Request

Page 71: Simple ABAP/4 for trouble shooting

Content

� Introduction R/3 Basis system overview

� ABAP/4 overviewComponent, Program, ABAP dictionary, Function Module , Message/Transaction code, etc.

� Common Statement / Command- Main event in ABAP program

- General ABAP command

� Transportation for ABAP objects

� Type of problem and how to investigateProgram bug, ABAP runtime error, Update terminate, Unexpected error message.

Page 72: Simple ABAP/4 for trouble shooting

Type of problem & How to investigate

Type of problems

ABAP Runtime ErrorCause: Program error, system exception, database process error, etc.

Using transaction code ST22 to analyze error.

Unexpected message

Update TerminateCause: Update module can not be completed

Program bug

Cause: Written code is not correct

Page 73: Simple ABAP/4 for trouble shooting

ABAP Runtime error - Analysis

Error ID

Date and time

Double click to display detail

Page 74: Simple ABAP/4 for trouble shooting

Unexpected message

How to deal with unexpected message?1. Go to Message long text if available.2. Read through the section in the message help text, process where appropriate.Message help text component

• Diagnosis• System response• Procedure

3. Find the message location, the logic that drive the message appearance.

• Debugging• Use “Where used list” function to find out the code where message is located (Not applicable for dynamic call)

Page 75: Simple ABAP/4 for trouble shooting

Unexpected message (con’t)

How to debug and locate the message in the program?1. Debugging Set Debugger ON In Debugging screen, Set dynamic breakpoint on command “Message” Select debugging -> Continue (F8) When program reach MESSAGE command, cursor will be stopped Check the above logic before get into the current command, see the related data/value from debugging screen.

2. Using “Where used list” Function in message workbench SE91/SE80 When message is displayed, Double click on the status bar(if the message appear only in status bar , not popup) OR press F1 for popup message. Go to transaction code SE91/SE80 to find the location of the message call.

Page 76: Simple ABAP/4 for trouble shooting

Update terminate

Update terminate: Message/SAP internal mail will be sent to the transaction owner, either Error message Or ABAP runtime error (short dump) might be created.

Analyzing the errorGo to transaction code SM13 to analyze the update error.(Or Select Tools --> Administration --> Monitoring --> Update)

Go to detail in update modules, You will get the following information:Where the error occurred: Program name, function module, line

number and error text. (go to ABAP short dump Or Editor to locate the position)

Why the error occurred:

Page 77: Simple ABAP/4 for trouble shooting

Program bug

Analyzing the error1. Find out what went wrong.2. Locate the position in the ABAP program

How to find the right place?1. Debugging 2. Use Call Hierarchy (SE48)3. Use find function in ABAP editor

Page 78: Simple ABAP/4 for trouble shooting

Simple Debugging

How to: • Switch on the debugger. • Set and delete static and dynamic breakpoints. • Set Watch points. • Stop a program at specific key words or events or when a fields contents change. • Continue processing after an interrupt. • Display field contents during runtime. • Display the contents of an internal table. • Change field contents for testing purposes. • Change the contents of an internal table. • Display and use the debugger’s six different views.

Page 79: Simple ABAP/4 for trouble shooting

Simple Debugging

Start debugging:• /h

Start the debugger in Normal mode. Press enter to start.• /hs

Start the Debugger in System mode, for example, in order to debug the system program (program with type S)

• Appropriate menu options under system -> Utilities -> Debug ABAP

• Break-points Command.• SE38 Start of programs in the debugging of transaction code

SE38 • SM50/SM51 via debugging menu• SE80 - Object browser

Page 80: Simple ABAP/4 for trouble shooting

Simple Debugging

Set and delete static and dynamic breakpoints• Static break-point

– Command BREAK-POINT. Or BREAK <User name>• Dynamic break-point

– In ABAP Editor SE38 --> Utilities --> Breakpoints --> Display/Set– In Debugging mode

Place the cursor on the statement Choosing break-point -> Set/Delete

– At ABAP command– At Event/Subroutine– At Function module– System exception

Page 81: Simple ABAP/4 for trouble shooting

Simple Debugging

Single step (F5)

Execute (F6)

Return (F7)

Continue (F8)

Field : Display content of fields up to 8 fields

Table: Display content of internal table

Watchpoints: Manage watchpoint during debug mode

Calls : Display Call stack up to current statement (in sequence)

Overview: structure of program, display event, sub routine, module and current statement

Stepping Display mode

Page 82: Simple ABAP/4 for trouble shooting

Simple Debugging

Caution when debugging in Production system

Since only a restricted number of dialog work processes can be switched to debugging mode, you should leave the debugger as soon as possible when you have finished working with it. Otherwise, the work process is not released for other users

Page 83: Simple ABAP/4 for trouble shooting

Question ??