65
Olgierd Waszak Senior Consultant Zurich, 18.05.2006 ABAP for Consultants

Olgierd Waszak Senior Consultant Zurich, 18.05.2006 ABAP for Consultants

Embed Size (px)

Citation preview

Page 1: Olgierd Waszak Senior Consultant Zurich, 18.05.2006 ABAP for Consultants

Olgierd Waszak

Senior Consultant

Zurich, 18.05.2006

ABAP for Consultants

Page 2: Olgierd Waszak Senior Consultant Zurich, 18.05.2006 ABAP for Consultants

2| © The Information Management Group. All rights reserved. Proprietary and confidential.

| |

Agenda

ABAP Development Workbench

Debuging

SAP extensions

System modyfications

Errors and protocols

„...”

Lunch about 11:30

Page 3: Olgierd Waszak Senior Consultant Zurich, 18.05.2006 ABAP for Consultants

3| © The Information Management Group. All rights reserved. Proprietary and confidential.

| |

ABAP Workbench – training map

SAP AG 1999

ABAP Workbench

ABAP Workbench:Foundations andConcepts

BC400 5 days

Managing ABAPDevelopments Projects

MBC40 2 days

Data TransferBC420 5 days

Techniques of ListProcessing and InfoSetQuery

BC405 3 days

SAPscript: Forms Designand Text Management

BC460 3 days

CATT:Test Workbench andComputer Aided Test Tool

CA610 (Rel. 4.0) 2 days

ABAP PerformanceTuning

BC490 3 daysABAP ProgrammingTechniques

BC402 3 days

ProgrammingDatabase Updates

BC414 3 days

Enhancementsand Modifications

BC425 3 days

Recommended supplementarycourses are:Business Process TechnologiesCA925, CA926, CA927BC095 (Business Integ. Techn.)BC619 (ALE), BC620, BC621

Level 2

ABAP Objects: Object -Oriented Programming in R/3

BC404 3 days

Form Printing UsingSAP Smart Forms

BC470 2 days

ABAP DictionaryBC430 2 days

Dialog Programmingusing EnjoySAP Controls

BC412 3 daysProgrammingUser Dialogs

BC410 5 days

CommunicationInterfaces in ABAP

BC415 2 days

Level 3

Page 4: Olgierd Waszak Senior Consultant Zurich, 18.05.2006 ABAP for Consultants

4| © The Information Management Group. All rights reserved. Proprietary and confidential.

| |

Architecture/program flow – user oriented view

Page 5: Olgierd Waszak Senior Consultant Zurich, 18.05.2006 ABAP for Consultants

5| © The Information Management Group. All rights reserved. Proprietary and confidential.

| |

Sample program

Page 6: Olgierd Waszak Senior Consultant Zurich, 18.05.2006 ABAP for Consultants

6| © The Information Management Group. All rights reserved. Proprietary and confidential.

| |

Program modularization (report)

ABAP Event blocks

Subroutines

Page 7: Olgierd Waszak Senior Consultant Zurich, 18.05.2006 ABAP for Consultants

7| © The Information Management Group. All rights reserved. Proprietary and confidential.

| |

Possible elements of the ABAP report

An ABAP program is a collection of processing blocks. A processing block is a passive section of program code that is processed sequentially when called.

Processing blocks are the smallest units in ABAP. They cannot be split, which also means that they cannot be nested.

There are various kinds of ABAP processing blocks:– Event blocks are ABAP processing blocks that are called by the runtime system. Event blocks can logically belong to the

executable program, to the selection screen, to the list or to the screen. This unit deals with event blocks that belong to the executable program. You can find information on event blocks that belong to the selection screen, the list or the screen in the units on user dialogs.

– Subroutine processing is triggered by an ABAP statement. Parameters can be passed to subroutines using an interface and subroutines can contain local variables.

Modules are special ABAP processing blocks for processing screens. Therefore modules are dealt with in the User Dialogs: Screens unit.

Page 8: Olgierd Waszak Senior Consultant Zurich, 18.05.2006 ABAP for Consultants

8| © The Information Management Group. All rights reserved. Proprietary and confidential.

| |

Example: program with event blocks and selection screen

Page 9: Olgierd Waszak Senior Consultant Zurich, 18.05.2006 ABAP for Consultants

9| © The Information Management Group. All rights reserved. Proprietary and confidential.

| |

Subroutines

Form declaration– FORM <name of subroutine> USING <u-parameter 1> <...><u-parameter n> CHANGING <c-parameter 1> <...> <c-parameter m>. ...ENDFORM.

Form call– PERFORM <name of subroutine> USING <actual parameter 1><...><actual parameter n> CHANGING <actual parameter n+1><...><actual parameter n+m>.

Page 10: Olgierd Waszak Senior Consultant Zurich, 18.05.2006 ABAP for Consultants

10| © The Information Management Group. All rights reserved. Proprietary and confidential.

| |

Other program elements

Function modules

Local classes– Attributes

– methods

Macros

Includes– TOP include xxxTOP

– Constant declaration

– Common subroutines

– ...

Screens– Screen modules

– Screen events (on Value request, on input, ...)

Page 11: Olgierd Waszak Senior Consultant Zurich, 18.05.2006 ABAP for Consultants

11| © The Information Management Group. All rights reserved. Proprietary and confidential.

| |

Program object hierarchy

Packet (old Dev.Class)

Programs Function groups Class Library DDIC Transactions others

Function

Modules, screens,

...

Methods,

Attributes,

...

DDIC objects

Page 12: Olgierd Waszak Senior Consultant Zurich, 18.05.2006 ABAP for Consultants

12| © The Information Management Group. All rights reserved. Proprietary and confidential.

| |

Application hierarchy

Transaction SE81

References to the program from the component point of view

Page 13: Olgierd Waszak Senior Consultant Zurich, 18.05.2006 ABAP for Consultants

13| © The Information Management Group. All rights reserved. Proprietary and confidential.

| |

Repository

Page 14: Olgierd Waszak Senior Consultant Zurich, 18.05.2006 ABAP for Consultants

14| © The Information Management Group. All rights reserved. Proprietary and confidential.

| |

Repository – transaction SE84

Page 15: Olgierd Waszak Senior Consultant Zurich, 18.05.2006 ABAP for Consultants

15| © The Information Management Group. All rights reserved. Proprietary and confidential.

| |

Training system

Client: 903

User: xxx or ABAP01, ABAP02

Pass: abc123

Page 16: Olgierd Waszak Senior Consultant Zurich, 18.05.2006 ABAP for Consultants

16| © The Information Management Group. All rights reserved. Proprietary and confidential.

| |

Demo

Page 17: Olgierd Waszak Senior Consultant Zurich, 18.05.2006 ABAP for Consultants

17| © The Information Management Group. All rights reserved. Proprietary and confidential.

| |

ABAP Workbench – set of tools for Repository

The ABAP Workbench contains different tools for editing Repository objects. These tools provide you with a wide range of assistance that covers the entire software development cycle

Page 18: Olgierd Waszak Senior Consultant Zurich, 18.05.2006 ABAP for Consultants

18| © The Information Management Group. All rights reserved. Proprietary and confidential.

| |

ABAP Dictionary (SE11)

Page 19: Olgierd Waszak Senior Consultant Zurich, 18.05.2006 ABAP for Consultants

19| © The Information Management Group. All rights reserved. Proprietary and confidential.

| |

ABAP Dictionary - objects

Page 20: Olgierd Waszak Senior Consultant Zurich, 18.05.2006 ABAP for Consultants

20| © The Information Management Group. All rights reserved. Proprietary and confidential.

| |

Screen Painter

Transaction SE51

Used to screen create/change/display

Integrated into the Object Navigator

Page 21: Olgierd Waszak Senior Consultant Zurich, 18.05.2006 ABAP for Consultants

21| © The Information Management Group. All rights reserved. Proprietary and confidential.

| |

Menu Painter

Transaction SE41

Used to menu create/change/display

Integrated into the Object Navigator

Page 22: Olgierd Waszak Senior Consultant Zurich, 18.05.2006 ABAP for Consultants

22| © The Information Management Group. All rights reserved. Proprietary and confidential.

| |

ABAP Editor

Transaction SE38

Transaction SE39 – split screen editor– Used to compare two programs

Used to menu create/change/display

Integrated into the Object Navigator

Page 23: Olgierd Waszak Senior Consultant Zurich, 18.05.2006 ABAP for Consultants

23| © The Information Management Group. All rights reserved. Proprietary and confidential.

| |

Function Builder

Transaction SE37

Used for FM create/change/display

Integrated into the Object Navigator

Page 24: Olgierd Waszak Senior Consultant Zurich, 18.05.2006 ABAP for Consultants

24| © The Information Management Group. All rights reserved. Proprietary and confidential.

| |

Class Builder

Transaction SE24

Used for ABAP class create/change/display

Integrated into the Object Navigator

Page 25: Olgierd Waszak Senior Consultant Zurich, 18.05.2006 ABAP for Consultants

25| © The Information Management Group. All rights reserved. Proprietary and confidential.

| |

Demo

Page 26: Olgierd Waszak Senior Consultant Zurich, 18.05.2006 ABAP for Consultants

26| © The Information Management Group. All rights reserved. Proprietary and confidential.

| |

Demo – how to create a program

Create a new program via SE38 transaction

Report should read fly data and display in on the screen

Select-options

Parameters

Select statment

Write statment

Example – packet SLIS

ALV – funciton modules REUSE_ALV_LIST_DISPLAY, REUSE_ALV_GRID_DISPLAY

Page 27: Olgierd Waszak Senior Consultant Zurich, 18.05.2006 ABAP for Consultants

27| © The Information Management Group. All rights reserved. Proprietary and confidential.

| |

Object Navigator – transaction SE80

Page 28: Olgierd Waszak Senior Consultant Zurich, 18.05.2006 ABAP for Consultants

28| © The Information Management Group. All rights reserved. Proprietary and confidential.

| |

Database Browser

Transaction SE16 – old database browser

Transaction SE16N – new database browser

Page 29: Olgierd Waszak Senior Consultant Zurich, 18.05.2006 ABAP for Consultants

29| © The Information Management Group. All rights reserved. Proprietary and confidential.

| |

Transport Organizer

What is the transport?

Transaction SE09, SE10

You can check the status of the changes – if already are transported

...

Page 30: Olgierd Waszak Senior Consultant Zurich, 18.05.2006 ABAP for Consultants

30| © The Information Management Group. All rights reserved. Proprietary and confidential.

| |

Others Workbench Tools

SE32 – text elements for programs

SE91 – messages

SE92 – system log messages

SNRO – number ranges

SLG0 – application log

SE93 – transaction definitions

SE63 - translations

Page 31: Olgierd Waszak Senior Consultant Zurich, 18.05.2006 ABAP for Consultants

31| © The Information Management Group. All rights reserved. Proprietary and confidential.

| |

Demo

Page 32: Olgierd Waszak Senior Consultant Zurich, 18.05.2006 ABAP for Consultants

32| © The Information Management Group. All rights reserved. Proprietary and confidential.

| |

I want to know more !!!

Something does not work as I expect

I want to know everything !!! I need to be a master !!!

I’d like to see it in the Database

...

Page 33: Olgierd Waszak Senior Consultant Zurich, 18.05.2006 ABAP for Consultants

33| © The Information Management Group. All rights reserved. Proprietary and confidential.

| |

Which program should I analyze?

How to check which program I need to see in the ABAP Workbench?

Which component needs to be checked?

Where to start?

Page 34: Olgierd Waszak Senior Consultant Zurich, 18.05.2006 ABAP for Consultants

34| © The Information Management Group. All rights reserved. Proprietary and confidential.

| |

Which program should I analyze? – example VA03

F1F9

or

Page 35: Olgierd Waszak Senior Consultant Zurich, 18.05.2006 ABAP for Consultants

35| © The Information Management Group. All rights reserved. Proprietary and confidential.

| |

Debugger

Transaction

Screen (program / screen number)

GUI (Program / Status)

Screen Field/Table Field (structure!!!)

Page 36: Olgierd Waszak Senior Consultant Zurich, 18.05.2006 ABAP for Consultants

36| © The Information Management Group. All rights reserved. Proprietary and confidential.

| |

Debugger

Immer Mit DebuGger

/h and ...– Continue, execute, single step

– Set breakpoint

– Value show

– Internal tables

– Change values/internal tables

– Set breakpoint at ....

– Watchpoint

Transaction SE16: table content edition

Page 37: Olgierd Waszak Senior Consultant Zurich, 18.05.2006 ABAP for Consultants

37| © The Information Management Group. All rights reserved. Proprietary and confidential.

| |

Debugger

Creation of the shortcut for debugging on the desktop

Page 38: Olgierd Waszak Senior Consultant Zurich, 18.05.2006 ABAP for Consultants

38| © The Information Management Group. All rights reserved. Proprietary and confidential.

| |

Tips & Tricks in Debugger mode

SE16 – value of data ‘CODE’

How to jump the authorization?( upssss... )

SE16n – how to edit transparent table– Start SE16n

– Choose table name for showing

– Enter selection parameters

– Put the command &sap_edit in the command line

– Press ENTER to switch to edit mode

– Press F8 to get a result

– You are ready to change non-key fields in the table

Page 39: Olgierd Waszak Senior Consultant Zurich, 18.05.2006 ABAP for Consultants

39| © The Information Management Group. All rights reserved. Proprietary and confidential.

| |

System extensions

Page 40: Olgierd Waszak Senior Consultant Zurich, 18.05.2006 ABAP for Consultants

40| © The Information Management Group. All rights reserved. Proprietary and confidential.

| |

Change levels

Page 41: Olgierd Waszak Senior Consultant Zurich, 18.05.2006 ABAP for Consultants

41| © The Information Management Group. All rights reserved. Proprietary and confidential.

| |

Extensions

How in/out to/from the system with additional info:• user exity of all types

• menu exity, screen exity

• field exity, key word exity

• Table extension: append, customer include

• matchcode: new ID

• workflow

• Outputs

Page 42: Olgierd Waszak Senior Consultant Zurich, 18.05.2006 ABAP for Consultants

42| © The Information Management Group. All rights reserved. Proprietary and confidential.

| |

Extensions – User Exits

Old types – still in use:Perform userexit_field_modification.

You have an access to the whole program work area!– A lot of possibility to change (global values)

– Be carreful – it is easy to destroy something!!!

Search/View in the Module pool

Example: SAPMV45A i MV45AFZZ etc.

Possibility: depends on the SAP Module– Update of additional tables/fields in the standard tables

– Check before document save

– Display change on the screen: obligatory fields, only for display etc.

– This is not simple! -> update of additional customer table

Page 43: Olgierd Waszak Senior Consultant Zurich, 18.05.2006 ABAP for Consultants

43| © The Information Management Group. All rights reserved. Proprietary and confidential.

| |

Extensions – User Exits

Function module• call customer-function '001'

- tables xmkpf = zmkpf

- xmseg = zmseg

- xvm07m = zvm07m.

Limited possibility of read/change data (depends on the defined by SAP interface)

Activation of such exists (Projects)

How to find: – transaction SMOD

– Debugging

Page 44: Olgierd Waszak Senior Consultant Zurich, 18.05.2006 ABAP for Consultants

44| © The Information Management Group. All rights reserved. Proprietary and confidential.

| |

Extensions – User Exits (example)

sales order area - include MV45AFZZ– Form userexit_move_field_to_vbak – copy customer fields

– Form userexit_pricing_prepare_tkomk – prepare pricing

– ....

Classification – durring search we can fill characteristics:– EXIT_SAPLCLSC_001

MM – material document posting – you can update customer table: – EXIT_SAPLMBMB_001

– Question: Why we do not have access to all data? What is the reason of this restriction?

Page 45: Olgierd Waszak Senior Consultant Zurich, 18.05.2006 ABAP for Consultants

45| © The Information Management Group. All rights reserved. Proprietary and confidential.

| |

Extensions – Menu Exits

Business Add-Ins or Customer exits

Possibility to have the own transaction call in the standard menu – only in the special places- this is Menu exit.

– How to find it?: SMOD or technical settings of the screen

– Example: Transaction S000, VC01

Page 46: Olgierd Waszak Senior Consultant Zurich, 18.05.2006 ABAP for Consultants

46| © The Information Management Group. All rights reserved. Proprietary and confidential.

| |

Demo

Page 47: Olgierd Waszak Senior Consultant Zurich, 18.05.2006 ABAP for Consultants

47| © The Information Management Group. All rights reserved. Proprietary and confidential.

| |

Extensions – Screen Exits

Possibility to add the new subscreen to the standard SAP screen

The SAP developer must:– Define the subscreen areas

– Specify the corresponding calls in the flow logic

– Provide the framework for the data transport

– Include the screen exit in an enhancement

– Maintain the documentation

Page 48: Olgierd Waszak Senior Consultant Zurich, 18.05.2006 ABAP for Consultants

48| © The Information Management Group. All rights reserved. Proprietary and confidential.

| |

Extensions – DDIC tables extensions

We can do this only in the case if there is possibility to manage such change in the program process

Append / Customer Include

CI_Includes – multiply use, must be planned by SAP developers

Standard table extension or customer table?

Page 49: Olgierd Waszak Senior Consultant Zurich, 18.05.2006 ABAP for Consultants

49| © The Information Management Group. All rights reserved. Proprietary and confidential.

| |

Business Transaction Events (BTE)

The SAP application program dynamically calls a function module in the customer namespace

Page 50: Olgierd Waszak Senior Consultant Zurich, 18.05.2006 ABAP for Consultants

50| © The Information Management Group. All rights reserved. Proprietary and confidential.

| |

BTE

Are enhancement that were developed for Financial Accounting (FI) component of R/3

Have predefined interfaces allowing customer access

Have one of the following types of interfaces– Publish & subscribe - These interfaces inform external software that certain events have

taken place in an SAP standard application and provide them with the data produced. The external software cannot return any data to the R/3 System

– Process interfaces - These interfaces are used to control a business process differently than the way in which it is handled in the standard R/3 System. They intervene in the standard process, and return data to the SAP application

Page 51: Olgierd Waszak Senior Consultant Zurich, 18.05.2006 ABAP for Consultants

51| © The Information Management Group. All rights reserved. Proprietary and confidential.

| |

How to find BTE?

To find out directly whether an application transaction offers business transaction events, you can search it in the program source text for the character string "OPEN_FI_PERFORM". The number that completes the name of the function module is also the name of the event

In the SAP Customizing Implementation Guide (IMG), you will find the entry "Use business transaction events " under the "Financial Accounting Global Settings" node of the Financial Accounting area. Choosing this entry calls a transaction (FIBF) where you can execute all of the actions necessary for using Business Transaction Events

Under Environment, you will find search functions that you can use to identify appropriate business transaction events. You can view the documentation for the event from the list

Page 52: Olgierd Waszak Senior Consultant Zurich, 18.05.2006 ABAP for Consultants

52| © The Information Management Group. All rights reserved. Proprietary and confidential.

| |

Business Add-Ins (Badis) – via ABAP OO technique

The application program calls a method of a class or instance of a class. This class lies in the customer namespace

Page 53: Olgierd Waszak Senior Consultant Zurich, 18.05.2006 ABAP for Consultants

53| © The Information Management Group. All rights reserved. Proprietary and confidential.

| |

How to find Badis?

SE18 – definition, SE19 - implementation

You can search in a relevant application program for the string "CL_EXITHANDLER". If a business add-in is called from the program, the "GET_INSTANCE" method of this class must be called

You can then reach the definition of the business add-in using forward navigation. The definition also contains documentation and a guide for implementing the Business Add-In

However, you can also use the application hierarchy to restrict the components in which you want to search. Start the Repository Information System, then choose Environment -> EXIT techniques -> Business Add-Ins" to start the relevant search program

Alternatively, you can use the relevant entries in the IMG

Page 54: Olgierd Waszak Senior Consultant Zurich, 18.05.2006 ABAP for Consultants

54| © The Information Management Group. All rights reserved. Proprietary and confidential.

| |

Badis - exercise

Check if program SAPBC425_BOOKING_00 can be enhanced

Check the badi definition name

Implement the badi to change data and output

Page 55: Olgierd Waszak Senior Consultant Zurich, 18.05.2006 ABAP for Consultants

55| © The Information Management Group. All rights reserved. Proprietary and confidential.

| |

Do we realy need the extension/modification?

Page 56: Olgierd Waszak Senior Consultant Zurich, 18.05.2006 ABAP for Consultants

56| © The Information Management Group. All rights reserved. Proprietary and confidential.

| |

System modyfications

New field on the screen: this is not only the layout change, but also we need to maintain this in the program – means the modification is needed in a few places

Similar issues:– Standard report copy with adjustment

– Standard transaction copy

– We can have a problem with Includs: in the case of upgrade very often means to make it once again

Did I decide in the right way?

Page 57: Olgierd Waszak Senior Consultant Zurich, 18.05.2006 ABAP for Consultants

58| © The Information Management Group. All rights reserved. Proprietary and confidential.

| |

Errors and protocols – what is going on with my system?

Trace request

Dump analysis

Update Records – background processing

Page 58: Olgierd Waszak Senior Consultant Zurich, 18.05.2006 ABAP for Consultants

59| © The Information Management Group. All rights reserved. Proprietary and confidential.

| |

Trace Request – ST05

Very offten this is not enough to check the technical data on the screen

How to check which objects are used in the background processing?

Which tables are updated durring my process?

The answer is TRACE REQUEST

Page 59: Olgierd Waszak Senior Consultant Zurich, 18.05.2006 ABAP for Consultants

60| © The Information Management Group. All rights reserved. Proprietary and confidential.

| |

Trace Request – result list

Page 60: Olgierd Waszak Senior Consultant Zurich, 18.05.2006 ABAP for Consultants

61| © The Information Management Group. All rights reserved. Proprietary and confidential.

| |

ABAP Runtime Analysis

Transaction SE30

This is a tool for consultant, who wants to know more and more...

For a consultant, who want to make a little performance analyze

Page 61: Olgierd Waszak Senior Consultant Zurich, 18.05.2006 ABAP for Consultants

62| © The Information Management Group. All rights reserved. Proprietary and confidential.

| |

Dump Analysis

Transaction ST22

Sometimes this is a simple reason why something does not work

If you have an ABAP base you can check it in a simply way

Page 62: Olgierd Waszak Senior Consultant Zurich, 18.05.2006 ABAP for Consultants

63| © The Information Management Group. All rights reserved. Proprietary and confidential.

| |

Update Records

Transaction SM13

Used to check background process

...

Page 63: Olgierd Waszak Senior Consultant Zurich, 18.05.2006 ABAP for Consultants

64| © The Information Management Group. All rights reserved. Proprietary and confidential.

| |

Demo

Page 64: Olgierd Waszak Senior Consultant Zurich, 18.05.2006 ABAP for Consultants

65| © The Information Management Group. All rights reserved. Proprietary and confidential.

| |

Questions???

Page 65: Olgierd Waszak Senior Consultant Zurich, 18.05.2006 ABAP for Consultants

66| © The Information Management Group. All rights reserved. Proprietary and confidential.

| |

Contact

Phone:+48 + 71 78 32 100Fax: +48 + 71 78 32 200Web: www.img.pl

TheInformation Management Group (IMG)IMG Polandul. Legnicka 51-5354-203 Wrocław

Olgierd Waszak (OWA), Senior [email protected]