Sie sind auf Seite 1von 302

CR590 BDT - Business Data Toolset

CR590
BDT - Business
Data Toolset
SAP AG 2002

2002/Q3
SAP BBPCRM / 300
Material number 5005 5126
Copyright

Copyright 2002 SAP AG. All rights reserved.


No part of this publication may be reproduced or transmitted in
any form or for any purpose without the express permission of
SAP AG. The information contained herein may be changed
without prior notice.

All rights reserved.

SAP AG 2002

Trademarks:
Some software products marketed by SAP AG and its distributors contain proprietary software
components of other software vendors.
Microsoft, WINDOWS, NT, EXCEL, Word, PowerPoint and SQL Server are registered
trademarks of Microsoft Corporation.
IBM, DB2, OS/2, DB2/6000, Parallel Sysplex, MVS/ESA, RS/6000, AIX, S/390,
AS/400, OS/390, and OS/400 are registered trademarks of IBM Corporation.
ORACLE is a registered trademark of ORACLE Corporation.
INFORMIX-OnLine for SAP and INFORMIX Dynamic ServerTM are registered trademarks of
Informix Software Incorporated.
UNIX, X/Open, OSF/1, and Motif are registered trademarks of the Open Group.
HTML, DHTML, XML, XHTML are trademarks or registered trademarks of W3C, World Wide
Web Consortium, Massachusetts Institute of Technology.
JAVA is a registered trademark of Sun Microsystems, Inc.
JAVASCRIPT is a registered trademark of Sun Microsystems, Inc., used under license for
technology invented and implemented by Netscape.
SAP, SAP Logo, R/2, RIVA, R/3, ABAP, SAP ArchiveLink, SAP Business Workflow, WebFlow,
SAP EarlyWatch, BAPI, SAPPHIRE, Management Cockpit, mySAP.com Logo and mySAP.com
are trademarks or registered trademarks of SAP AG in Germany and in several other countries all
over the world. All other products mentioned are trademarks or registered trademarks of their
respective companies.
mySAP CRM 1 Col22

CR400 3 Days

Interaction Center in
CRM

CR600 3 Days
Marketing Planning
CR100 3 Days & Campaign
Management
CRM Basics
CR700 3 Days

CRM Service
CR010 2 Days

CRM Overview CR800 5 Days

Internet Sales
(ex ECO220)

CR205 3 Days

Mobile Sales &


Mobile Service

CR900 3 Days

Analytical CRM

SAP AG 2001
mySAP CRM 2 Col22

CR100 3 Days CR225 2 Days

CRM Basics SAP IPC


Admin/Technology

CR010 2 Days

CRM Overview CR235 2 Days

SAP IPC Pricing

CR245 2 Days

SAP IPC Product


Configuration

SAP AG 2001
mySAP CRM 3 Col22

CR550 3 Days

Enhancing the CRM


Middleware

CR500 2 Days

CRM Middleware
Overview
CR010 2 Days

CRM Overview

CR310 3 Days CR320 2 Days CR540 2 Days

SAP Mobile SAP Mobile CRM Middleware


Application Studio Application Studio for Mobile Scenarios
Basic Concepts Advanced Features
22

CR590 2 Days

BDT Business Data


Toolset

SAP AG 2001
Course Prerequisites

Essential:
good knowledge of ABAP programming

Recommended:
experience with dialog programming

SAP AG 2002
Target Audience

Participants
Technical consultants and developers
who work with the BDT and
develop new functions and extensions
within SAP or for development partners
Customers who extend existing BDT
applications

Duration:
2 days

SAP AG 2002

User notes

The training materials are not teach-yourself programs. They complement the explanations
provided by your course instructor. Space is provided on each page for you to note down additional
information.

There may not be time during the course itself for you to complete all the exercises. The exercises
provide additional examples that are covered during the course. You can also work through these
examples - if you have time - to increase your understanding of the topics.
Course Overview CR590

Contents:

z Course Goals
z Course Objectives
z Course Content
z Course Overview Diagram
z Main Business Scenario

SAP AG 2002

SAP AG CR590 1-1


Course Goals CR590

This course will prepare you to:

z Execute enhancements to the data model in the


ABAP Dictionary online and for service programs,
using the BDT. The course provides a solid base
of dialog, program logic, and service program
logic, and service program functions in the BDT.

SAP AG 2002

SAP AG CR590 1-2


Course Objectives CR590

At the conclusion of this course, you will be able to:

z Describe the goals of the BDT.


z Name differences to conventional dialog programming
z Process extensions of a standard object using the
example of SAP Business Partner using the BDT
z Describe functionality of BDT service programs

SAP AG 2002

SAP AG CR590 1-3


Course Content CR590

Preface

Unit 1 Course Overview Unit 6 Extensions with Table-


Participating Applications
Unit 2 Introduction to DTB
Unit 7 Extensions with Table-
Unit 3 BDT Basics
Owning Applications
Unit 4 Dialog
Unit 8 Service Programs and
Unit 5 Program Logic Functionality

Exercises
Solutions
Appendices
SAP AG 2002

SAP AG CR590 1-4


Course Overview Diagram CR590

Course Overview Program Logic

Extensions with Table-


Introduction to BDT
Participating Applications

Extensions with Table-


BDT Basics
Owning Applications

Service Programs and


Dialog
Functionality

SAP AG 2002

SAP AG CR590 1-5


Main Business Scenario CR590

z The IT department in the IDES company is required


to extend the standard object SAP Business Partner
developed with BDT with specific attributes and
functionality to provide an ideal business process
for employees. This can entail: the configuration
of screen layout and screen sequences, the
development of program logic for the application,
extension by way of additional fields, ...

SAP AG 2002

SAP AG CR590 1-6


Introduction to the BDT

Contents:
Why the BDT?
Targets
Functionality

SAP AG 2002

SAP AG CR590 2-1


Introduction: Unit Objectives

At the conclusion of this unit, you will be able to:

Define the BDT and describe its history.


List design targets of the BDT.
Describe the functionality of the BDT.

SAP AG 2002

SAP AG CR590 2-2


Introduction: Overview Diagram

Course Overview Program Logic

Extensions with Table-


Introduction to the BDT
Participating Applications

Extensions with Table-


BDT Basics
Owning Applications

Service Programs and


Dialog
Functionality

SAP AG 2002

SAP AG CR590 2-3


Introduction: Business Scenario

Your IT team has been requested to extend


objects that have been developed in the BDT.
They must become familiar with the BDT and
its functions in order to be able to carry out
the extensions.

SAP AG 2002

SAP AG CR590 2-4


Business Data Toolset (BDT):

Definition:
Toolset for master data and simple transaction data

SAP AG 2002

The BDT (Business Data Toolset) is a central control tool for maintaining master data and simple
transaction data. In addition to dialog maintenance, the BDT also supports maintenance with direct
input and/or function modules.
The BDT also provides generic object services for consistently recurring requirements such as the
change to document lists, field groupings and the deletion program. The BDT controls these objects
as well as generic parts thereof and calls the applications using predefined interfaces (control tables
and events). The applications introduce application-specific enhancements, such as writing and
reading database application tables.
Note: The BDT is used at SAP for maintaining several application objects. Development partners
and customers can also extend these application objects via the BDT interfaces, without having to
make modifications. However, application objects belonging entirely to development partners and
customers are not supported by the BDT technology since this does not concern a development tool
of the ABAP Workbench.
The BDT resulted from the project 'Central Business Partner.' Besides many demands made by the
business world of the data entry technology, those demands listed in the following slides had a high
priority. Initially the necessary technology was developed in a common program with the
application data for the Business Partner. It quickly became clear that not only the second part of
this project - the BP relationship - made the same technical demands of the data maintenance, but
that other application objects did as well. For this reason the project group Business Partner decided
to separate the technical part of the application data and to make this technology available to other
application objects as well. This technical part, which was for a long time called BP Control or
Master Data Control, is now called the Business Data Toolset, or BDT for short.

SAP AG CR590 2-5


Design Targets

Extensibility
Configurability
Divisibility
Alternative user interfaces
Usability
Quicker development
Generic object services

SAP AG 2002

Extensibility: modification-free extension of various dialog parts, for example screen layout, screen
sequence, program logic, menu, field grouping, etc. via several layers.
Configurability: application developers (maintenance of the control tables of the BDT) or customers
(Visual Configuration Tool) can adapt screen layout and screen sequence.
Divisibility: the maintenance of larger object parts can be split into smaller sections.
Alternative user interfaces: the interface and the program logic are separate in the BDT. The
program logic of the application can be found entirely in the function modules. These are called at
defined events. In this way the SAP GUI interface can be replaced by another interface.
Usability: besides the SAP Business Partner, other application objects can also take advantage of the
BDT. Various application objects have the same design targets.
Quicker development: the dialog control is carried out via the BDT. The business functions are
realized by the applications. In addition the BDT provides several services in which the applications
can include themselves.
Generic object services: direct input, transfer mode, field control, etc.

SAP AG CR590 2-6


Extensibility

Tables
Append / Include Structures
Own Tables
Screen Layout and Screen Sequence
Program Logic
Event Techniques
Field Checks
Data Retention

SAP AG 2002

The project group Business Partner defined the central attributes of a business partner (for example,
name components, addresses and bank details). In addition to that, other applications have
application-specific attributes. Development partners and customers needed to incorporate their own
attributes into the maintenance. In the area of customer and vendor master data, you have to make a
modification to do this.
Because you can not collect and implement all these different attributes in one project group,
maintenance for downstream enhancements has to be extensible without the need for modifications.

SAP AG CR590 2-7


Extensibility: Development Cycle

Distributed Without
development in modifications
various systems DevtPartner1

IS-U MM IS-B

FI Central SD
Data

TR-TM
IS-IS
DevtPartner2

Customer
SAP AG 2002

Several development groups are working with the same object. Based on the development of the
central data in the SAP Basis (for example, Business Partner) there is standard and industry
application development, as well as the additional development layers of the development partners
and customers.
The BDT can support all the development cycles listed above, with regard to the extension of a BDT
standard object.

SAP AG CR590 2-8


Configurability: Screen Layout

Change Business Partner: Address

Partner TESTER
Partner
Name
SAP BP Form of addr.

First name Form of addr. 01


Last name
First name John
Last name Tester

Address

Street/number Ridge Road 11


Street/number
BAS Postcode/City Postcode/City 99999 Smithtown
Delivery district 123456
Delivery district
SD Transport zone Transport zone 1122

SAP AG 2002

Mid-sized customers in particular tend to suppress most of the standard SAP data fields.
However, dialog maintenance becomes tedious when you go through screen after screen on
which only one or two fields are relevant. Switching screens often slows down data entry
considerably. As a result, SAP decided to make screens configurable so customers could tailor data
entry screens to their individual needs and keep the number of screens to a minimum.
Note:
BAS - Business Address Services (previously CAM - Central Address Management). All addresses
are contained in the tables of the Business Address Services. In order to be able to access addresses
later, the application saves only the key of an address in its application table.

SAP AG CR590 2-9


Configurability: Customizing Screen Layout /
Sequence

Configuration via
Drag&Drop (Visual
Basic)
Screen layout and
screen sequence
Technology
Subscreens
Generation of
subscreen
containers

SAP AG 2002

The Visual Configuration Tool (VCT) allows configuration of the dialog.


This tool allows changes to screen layout to be carried out without modification and by Drag&Drop.

SAP AG CR590 2-10


Divisibility

Depending on business criteria, objects can be split into parts.


These parts can be maintained individually.
Choices
Each object can be maintained in one or several object parts.
A business partner can assume different BP roles. A range of
attributes is assigned to each BP role.
Each object can be created in just one object part.
Each object is always created as one whole part, no divisibility
is required.
Example, a contract account is always maintained with all
attributes.

SAP AG 2002

If you were to count up all the attributes in the SAP System that are relevant for a business partner,
you would have several hundred fields. Since it is impossible to include all these attributes in each
type of maintenance, the maintenance itself must be divisible into parts where only those attributes
are visible that are relevant in the current business context. These parts are called roles in the SAP
Business Partner.
Object parts, like roles, narrow the view of the whole object.

SAP AG CR590 2-11


Example of Divisibility: BP Role

Policyholder

Premium Payer
Contract

Borrower

SAP AG 2002

The example above shows that a business partner can have several BP roles (account holder,
contract partner, borrower), depending on the business process in which he is involved.
The BP role determines which fields are displayed and which fields are changeable.

SAP AG CR590 2-12


Usability with Any Object

Others ...
SAP BP ApplObject
ApplObject ????
BUPA

BDT
SAP BP-
Relationships Claims
ApplObject Capture
BUPR ApplObject
ICL
Bank IS-RE
Account Contract Contract
ApplObject Account ApplObject
BKK ApplObject RECN
FICA

SAP AG 2001

These are some examples of objects that were developed using BDT.
Central Business Partner
Partner maintenance
Relationship maintenance
Contract Accounts Receivable and Payable
Contract account
IBU Banking
Bank account
Standing order
Financial product
Financial conditions
Risk object
Variable transactions
IBU Insurance
Insurance: Claims
Insurance: Loss event
Commissions: Remuneration agreements
Real Estate
Real estate contract
Cost efficiency analysis

SAP AG CR590 2-13


Development Without the BDT

Processing Data
Transactions Transfer

Field Change
Grouping Service Document
Evalutions

Authori-
Notes
zations

SAP AG 2002

In a development project and also in an implementation project, you always need the same
functionality. SAP Basis provides service functions, but most of the functions still have to be
developed.
Examples are field grouping, change document evaluation and screen checking from the ABAP
Dictionary.

SAP AG CR590 2-14


Quicker Development With the BDT

TA Da
s ing ta
Tr
es an
roc s fe
P r

Change Doc. Eval.


Field Grouping
Service

Au
t ho
riz
ati o tes
o ns N

Central
Central service
service
Less
Less development
development work
work
SAP AG 2002

Because the BDT takes control of dialog processes, the applications limit themselves to realizing
business functions. The BDT also provides services in which the applications can be included. These
factors provide significant reductions in the time needed to develop applications.
The applications loose a small part in individuality, but gain the advantage of less object
maintenance, equality of dialogs, generic services and quicker development.

SAP AG CR590 2-15


Data Maintenance Functionality

Dialog Maintenance
Configuration of Screen and Screen Sequence
Extension of Program Logic
Definition and Configuration of the Menu
Field Groups and Extensible Field Group Criteria
Search Help
Transfer Mode
External Interfaces
Authorization Checks
Notes
Change Documents (Planned)

SAP AG 2002

Functions supported through dialog maintenance include:


Field grouping: it is possible to extend existing field grouping criteria (like activity) by customer
defined criteria.
Search help: can be extended by customer-defined search fields

SAP AG CR590 2-16


Functionality

Maintenance without a Dialog


Direct Input
Maintenance Using Function Modules
Change Documents
Archiving
Where-Used List
Screen Configuration using Drag&Drop (VCT)

SAP AG 2002

Additional functions:
Different interfaces exist for data maintenance without a dialog. These interfaces are integrated
and always use the same coding for the business logic.
Archiving is connected to the BDT and is supported by it.
Where-used list: this tool shows all other objects with their identification, in which the actual
object is used. By a simple select, you can call up the relevant programs.
Visual Configuration Tool (VCT): this tool makes a configuration possible by means of
Drag&Drop. This tool, which is based on Visual Basic, simplifies the configuration process for
the customer.

SAP AG CR590 2-17


Introduction to the BDT: Unit Summary

You are now able to:

Define the BDT and describe its history.


List design targets of the BDT.
Describe the functionality of the BDT.

SAP AG 2002

SAP AG CR590 2-18


BDT Basics

Contents:
System Architecture and Example Program with
Selection Screen
BDT Programming
Positioning
Application Objects and Applications
Basis and the BDT

SAP AG 2002

SAP AG CR590 3-1


BDT Basics: Unit Objectives

At the conclusion of this unit, you will be able to:

Describe in principle the architecture of the


SAP System and the process of a simple dialog
program via the ABAP runtime system
Differentiate between the BDT and conventional
programming with user exits.
Position the BDT with regard to the SAP Basis
and application objects
Define application objects and applications
Discuss the relationship between Basis and
the BDT.

SAP AG 2002

SAP AG CR590 3-2


BDT Basics: Overview Diagram

Course Overview Program Logic

Extensions with Table-


Introduction to the BDT
Participating Applications

Extensions with Table-


BDT Basics
Owning Applications

Service Programs and


Dialog
Functionality

SAP AG 2002

SAP AG CR590 3-3


Architecture and Dialog Program: Unit Objectives

At the conclusion of this unit, you will be able to:

Describe in principle the architecture of the


SAP System and the process of a simple dialog
program via the ABAP runtime system

SAP AG 2002

SAP AG CR590 3-4


Client / Server Architecture

Presentation
Server
Layer SAPGUI SAPGUI SAPGUI SAPGUI SAPGUI SAPGUI

Dispatcher Dispatcher
Application
Server
Layer Work Work Work Work
Process Process Process Process

Work Work Work Work


database Process Process Process Process

SAP AG 2001

The R/3 System has a modular software architecture that follows software-oriented client / server
principles.
The R/3 System allocates presentation, applications, and data storage to different computers. This
serves as the basis for the scalability of the R/3 system.
The lowest level is the database level. Here data is managed with the help of a relational database
management system (RDBMS). In addition to master data and transaction data, programs and the
metadata that describe the R/3 System are stored and managed here.
ABAP programs run at the application level, which includes both the applications provided by SAP
and the ones you develop yourself. ABAP programs work with data called up from the database
level. New data stores there as well.
The third level is the presentation level (SAPGUI). This level contains the user interface where an
end user can access an application, enter new data, and receive the results of a work process.
The technical distribution of software is independent of its physical location on the hardware.
Vertically, all levels can be installed on top of each other on one computer or each level on a
separate computer. Horizontally, application and presentation level components can be divided
among any number of computers. The horizontal distribution of database components, however,
depends on the type of database installed.

SAP AG CR590 3-5


User-Oriented View

Presentation
Server
Layer

Work Process

Application ABAP Program


Server
Layer

Database

SAP AG 2002

This graphic can be simplified for most topics discussed during this course. The interaction between
ABAP programs and their users will be of primary interest to you during this course. The exact
processes involved in user dispatching on an application server are secondary to understanding how
to write an ABAP program. Therefore, you will work with a simplified graphic that does not
explicitly show the dispatcher and the work process. Certain slides will, however, be enhanced to
include these details whenever they are relevant to ABAP programming.
ABAP programs are processed on the application server. The design of the user dialogs and the
database dialogs is therefore of particular importance when writing application programs.

SAP AG CR590 3-6


Program Flow: What the User Sees

Screen
Screen

Black Box
Selection
Selection Screen
Screen

List
List

SAP AG 2001 Time

The user is primarily interested in how his or her business transaction flows and in how data can be
input into and displayed from the transaction. Technical details, such as whether a single program is
running or multiple programs are called implicitly, or the technical differences between the kind of
screens being displayed, are usually less important to the user. The user does not need to know the
precise flow of the ABAP program on the application server. Users see the R/3 System with
application servers and database as a black box.
There are, however, three technically distinct screen types (screens, selection screens, and lists) that
offer the user different services. The developer's job is to determine which type of user dialog is
most suitable to the user's needs.

SAP AG CR590 3-7


Interaction Between Server Layers

Program ABAP Program


Start
ABAP
Processing
Block

Database
Table
ABAP
Processing
Block

ABAP Runtime System

SAP AG 2001 Time

When the user performs a user action (choosing Enter, a function key, a menu function or a
pushbutton, for example), control is handed over from the presentation server to the application
server and certain parts of the ABAP program are processed. If further user dialog is triggered
within the ABAP program, the system sends a screen to the presentation server and control is once
again handed over to the presentation server.

SAP AG CR590 3-8


Sample Program: Program Start

Program ABAP Program


Start
Data objects Repository

Database
Table
Screen ABAP
Processing
Block

ABAP Runtime System

SAP AG 2001 Time

When the user starts the program, the program context is loaded first. This time, however, our
sample program contains three processing blocks, a selection screen, a screen, and a variable and
two structures as its data objects.

SAP AG CR590 3-9


ABAP Runtime System Sends Screen

Program ABAP Program


Start Data objects

Database
Table
Screen ABAP
Processing
Block

ABAP Runtime System

SAP AG 2001 Time

Since the program contains a selection screen, the ABAP runtime system sends it to the presentation
server at the beginning of program processing.

SAP AG CR590 3-10


User Leaves Selection Screen

Program ABAP Program


Start Data objects

Database
Table
Screen ABAP
Processing
Block

ABAP Runtime System

SAP AG 2001 Time

As soon as the user has finished entering data on the selection screen, he or she can trigger further
processing by choosing Execute. All data input on the selection screen is then automatically placed
in its corresponding data object in the program and the ABAP runtime system resumes control of
processing. The runtime system then triggers sequential processing of the ABAP processing block
that comes after the selection screen.

SAP AG CR590 3-11


Program Requests Data Record from Database

Program ABAP Program


Start Data objects

Database
Table
Screen ABAP
Processing
Block

ABAP Runtime System

SAP AG 2001 Time

The ABAP processing block contains a read access to the database that has been programmed into
it. The program also passes the database information about which database table to access and which
line in the table to read.

SAP AG CR590 3-12


Database Returns Data Record

Program ABAP Program


Start Data objects

Database
Table
Screen ABAP
Processing
Block

ABAP Runtime System

SAP AG 2001 Time

The database returns the requested data record to the program and the runtime system ensures that
this data is stored in the appropriate data objects. Normally a structure is the target field when you
access a single record. The structure contains variables for all fields requested from the database.

SAP AG CR590 3-13


Program Calls Screen

Program ABAP Program


Start Data objects

Database
Table
Screen ABAP
Processing
Block

Process
Before
Output

ABAP Runtime System

SAP AG 2001 Time

The ABAP processing block now triggers screen processing. This is often expressed simply by
saying the program calls the screen. However, in reality, each screen possesses its own processing
block that is sequentially processed before the runtime system sends the screen to the presentation
server (Process Before Output). This allows screens to be used in a very flexible manner.
PBO contains coding that is fixed to the screen. Other interfaces have to call a screen in the
background to get coding or development has to replicate the code.

SAP AG CR590 3-14


ABAP Runtime System Sends Selection Screen

Program ABAP Program


Start Data objects

Database
Table
Screen ABAP
Processing
Block

Process
Before
Output

ABAP Runtime System

SAP AG 2001 Time

After processing the screen's processing block, the ABAP runtime system sends the screen to the
presentation server. During this process, data is transported into the screen's fields from a structure
that serves as an interface for the screen.

SAP AG CR590 3-15


User Executes User Action

Program ABAP Program


Start Data objects

Database
Table
Screen ABAP
Processing
Block

Process
Before
Output
Process
After
Input

ABAP Runtime System

SAP AG 2001 Time

Once the user performs a user action (choosing Enter, a function key, a menu function or a
pushbutton, for example), control is handed over to the runtime system on the application server
again. The screen fields are transported into the structure that serves as the screen's interface and a
special processing block belonging to the screen is triggered. This processing block is always
processed immediately following a user action (Process After Input).
PAI contains coding that is fixed to the screen. Other interfaces have to call a screen in the
background to get coding or development has to replicate the code. This is mainly important for
checking logic.

SAP AG CR590 3-16


Processing of the ABAP Processing Block
Resumes

Program ABAP Program


Start Data objects

Database
Table
Screen ABAP
Processing
Block

Process
Before
Output
Process
After
Input

ABAP Runtime System

SAP AG 2001 Time

After processing the Processing After Input block, the program continues at the the next ABAP
statement after the screen was called.

SAP AG CR590 3-17


ABAP Program Flow and User Exits

Screen
Screen Screen Screen
Screen
1000 2000 3000

PBO
PBO PAI
PAI PBO
PBO PAI
PAI PBO
PBO PAI
PAI

User
User Exit
Exit
Start ABAP Program Flow

Customer
Customer Programs
Programs

SAP AG 2002

The program flow in conventional ABAP programs is mostly fixed without the possibility of
changing the screen sequence. Only user exits support customer changes or enhancements.

SAP AG CR590 3-18


Function Module Exit: Flow Diagram

Application Program X Function Group

Exit Function Module


EXIT_<prog_name>_001

CALL CUSTOMER
FUNCTION
Include in
Customer
Namespace

SAP AG 2002

This diagram represents the flow of a program that provides an extension in the form of a function
module exit
The exit function module is called at a point in the source text that has been defined by an SAP
application developer. Within the function module, the user can add functionality with the help of an
include in the customer namespace.

SAP AG CR590 3-19


Function Module Exits

SAP Application Program X Function Group

ABAP ABAP Screens

***Global Data***
DATA: gl_field... 9000
CALL CUSTOMER FUNCTION exit_prg_001.
FUNCTION '001 *IMPORTING i_vars
EXPORTING
i_vars = gl_field. INCLUDE ZXaaaU01.
ZXaaaU01.

ENDFUNCTION.

*INCLUDE ZXaaaU01

CALL SCREEN 9000. 9100


<additional
processing logic>

Text element
GUI interface

SAP AG 2002

You can extend an SAP application at pre-determined points through additional processing logic.
In the context of such an extension, you can also include your own screens with the relevant
processing logic and GUI interface, and create customer text elements.

SAP AG CR590 3-20


BDT Programming: Topic Objectives

At the conclusion of this topic, you will be able to:

Differentiate between the BDT and conventional


programming.

SAP AG 2002

SAP AG CR590 3-21


Overview of BDT Programming
Application Program X Function Group

SAP
SAP BP
BP Exit Function Module
ApplObj
ApplObj BUPA
BUPA EXIT_<prog_name>_001

CALL CUSTOMER
FUNCTION
Include in
Customer
Namespace

Customer
Application

"Jump" from a customer application


Function into customer and application
Group program logic from BDT-defined
events

Sub-
Sub-
screen FMFB
screen
SAP AG 2002

The term 'application' is central to the BDT. Applications are, for example, central data of the
Business Partner or central data of the Business Partner Relationships. An application can own one
or more tables and also participate in the tables of other applications.
Each application is based technically on a function group in which its screens (including PBO and
PAI), function modules and data structures are found.
The application's behavior is controlled by the BDT by means of events. The application can
therefore offer function modules for various events. These function modules are called up by the
BDT in dependence on the control tables.

SAP AG CR590 3-22


Overview of BDT Program Logic

Visible
Application

Control Tables
Initial screen Data screen

DTITL DTITL
DCUAD DCUAC DCUAD DCUAC
ISDAT
Before Output ISDST Before Output A
Before Before
ISSTA Call AUTH1 Call

Events
Call Subscreen Call Subscreen
Start
Call Subscreen Call Subscreen
After Input After Input

BDT
FCODE FCODE

Save Back Exit Cancel Screens


XCHNG XCHNG XCHNG XCHNG

Change ?
No
Change ?
No
Change ?
No
Change ?
No
Status ...
Fixed DSAVB
AUTH1
Yes

Abbr.
Yes

Save ?
No Abbr
.
Yes

Save ?
No
Yes

Cancel ?
Yes

Program
Yes Yes No
DCHCK A A
DTAKE DSAVB DSAVB A
DSAVC AUTH1 AUTH1
DSAVE DCHCK DCHCK

Logic
DTAKE DTAKE
DSAVC DSAVC
DSAVE DSAVE

DLVE1
DLVE2

End
Screen 1: Events with Dialog, Save Mode

SAP Basis
SAP AG 2001

The program logic of the BDT us static (fixed). Events call dynamically customized Function
Modules and Screens.

SAP AG CR590 3-23


Positioning: Topic Objectives

At the conclusion of this topic, you will be able to:

Position the BDT with regard to the SAP Basis


and application objects

SAP AG 2002

SAP AG CR590 3-24


Positioning

Application Programs
(programmed
(programmed with
with BDT)
BDT)

BDT

SAP Basis (DDIC,...)

SAP AG 2001

BDT, which is developed in ABAP, is a layer between the applications and the SAP Basis.

SAP AG CR590 3-25


Alternative User Interfaces

SAPGUI WEB

Visual Basic
Java
....

CHECK Function Check Direct Input


Module

DB_UPDATE Function Data


Module Retention

SAP AG 2001

BDT is internal divided into several layers. One part is for data retention, one for checking purposes.
External interfaces are designed solely in external maintenance transactions (abbreviation: external
maintenance). You define how data fields are distributed on the screens of this maintenance
transaction. The only restriction is that fields belonging to one view always have to be put together
on a data screen since there is a common function module for each view that is used to check data
(event After input).
The function modules defined for the BDT events are used to read data from the database as well as
to check the data and save it. External maintenance determines the current data prior to output using
the function modules that read the data (see section 3.2.4).
External maintenance and BDT maintenance can be fully integrated. You can call BDT maintenance
in transfer mode from external maintenance. Data can be changed in both types of maintenance.
Changes are also visible in each type of maintenance. When making the transition from one kind of
maintenance to the other, the data is flagged in the global memory of the application function
groups.
The BDT provides varying function modules that are called in external maintenance (procedure
described in detail in the next section). These modules in turn process one or more BDT events,
which calls event modules in the applications.
Multiple BDT application objects can be maintained simultaneously in external maintenance.
Note: In order to work with external interfaces, you must adhere to the specifications given by the
developer for the required actions in events. Correct reading and correct supply of the current and
global memory in events ISDAT, DTAKE, DSAVC and DSAVE are particularly important.

SAP AG CR590 3-26


Application Objects and Applications: Topic
Objectives

At the conclusion of this topic, you will be able to:

Define application objects and applications

SAP AG 2002

SAP AG CR590 3-27


Application Object

Each master or transaction data object that can be


maintained with the BDT is an application object.
Examples
BUPA SAP Business Partner
BKKA Bank Account
FICA Contract Accounts

SAP AG 2002

The values for application objects and differentiation types must be established centrally. This is the
only way of avoiding objects with the same ID being created in the case of distributed development.
This could potentially lead to entries overwriting each other.

SAP AG CR590 3-28


Positioning of the Business Data Toolset (BDT)

Application Objects
SAP- Contract
Bank Account SAP BP Additional...
Additional...
BP Relations Account
(BKKA)
BKKA) (BUPA)
BUPA) ...
(BUPR)
BUPR) (FICA)
FICA)

BDT

SAP Basis (DDIC, Development Environment, ABAP...)


SAP AG 2002

The BDT (Business Data Toolset) is a central control tool for maintaining master data and simple
transaction data.
The BDT is based on the ABAP Workbench, the Data Dictionary, etc.
The BDT was developed with ABAP and constitutes a layer between the SAP Basis and the
applications. Since R/3 Release 4.0, the BDT is shipped in all core R/3 installations.

SAP AG CR590 3-29


Applications

Each application within an application object adds own


elements such as tables, table fields or object parts.
An application can be
SAP components (such as FI, SD, TR, IBU, NDA)
Development partners
Customers
Separate function group for each application
Decoupling
Communication between the applications is conducted via
GET or COLLECT function modules

SAP AG 2002

Applications are always assigned to an application object.


User-specific function groups can be developed that are decoupled (independent) of applications.
Existing function groups cannot be modified.

SAP AG CR590 3-30


Application Objects and SAP Basis

Application Objects SAP


SAP BP
BP
ApplObj
ApplObj BUPA
BUPA
BDT
Application
SAP- Customer
Application II Application

SAP BASIS
Function
Function Function
Group Group
Group

FuMo Sub-
Sub- FuMo Sub-
Sub-
FB screen
screen FB screen
screen
SAP AG 2002

An application object (for example, SAP BP object BUPA) is extensible for SAP applications,
development partners, SAP Industry Business Solutions and customers.
All applications are assigned to exactly one application object.
Each application always has one or several own function groups. By using separate function groups
in each application, the memory areas are encapsulated.
The function groups in the BDT are not customized. Only the content of the BDT, like screens and
function modules, is maintained in the BDT control tables.
A function group includes all program objects of an application:
Event function modules
- (Service) function modules (GET / COLLECT)
- Module (PBO / PAI)
- Subscreens
- Update task
- Digression: Function modules
- Functions are like subroutines (forms). They encapsulate code and data. Accessing data is
allowed only via the function module interface.
- Function modules are executed via their name, which is unique in the SAP System.
- Function modules have a defined interface, which can be extended.

SAP AG CR590 3-31


Basis and the BDT: Topic Objectives

At the conclusion of this topic, you will be able to:

Discuss the relationship between Basis and


the BDT

SAP AG 2002

SAP AG CR590 3-32


Overview of Development with the BDT

Applications
SAP
SAP SAP
SAP Customer
Customer
Application
Application II Application
Application IIII Application
Application 77
SAP BP
(BUPA)

Development

Development
DDIC BDT Control Tables
Workbench

SAP AG 2002

In table-participating applications, you have development areas Data Dictionary (DDIC),


Development Workbench and the BDT control tables. The same development areas are also needed
for developing the table-owning applications.

SAP AG CR590 3-33


BDT Development and the Development
Workbench

Function
Function Modules
Groups

ISSTA
ISDAT Events for Each
Application
ISDST
...

Program Logic
GET Events for
Screens PBO Module Tables
Collect

0010 First Contact PBO ...


...
..._PBC
..._PBC_..
_..
Events for Each
PAI Module ..._PBO
..._PBO_..
_..
View
PAI ..._PAI
..._PAI_..
_..
...
...
SAP AG 2002

Each application develops in their own function group.


Screens (type subscreen), PBO and PAI modules and function modules for events (for each
application, table and view) are created in the function group.
The PBO module calls only the service function module BUS_PBO for executing the field status.
The PAI module calls only the service function module BUS_PAI for getting the cursor position.
Program logic:
Events for each application (read data, check data, save data)
Events for tables (communication between applications / function groups)
Events per view a. PBC Event for preparing tables (sorting, etc)
b. PBO Event prior to data entry
Reading of texts from Customizing tables,
formatting of the date etc.
c. PAI Event following data entry.
Checking of the entry values.
Conversion of the date
Note:
The same coding is carried out in the maintenance mode without dialog (e.g. direct input). There is
no redundant coding.

SAP AG CR590 3-34


BDT Development: DWB - Events for Each
Application

ISSTA Initialization
ISDAT Read data from DB
ISDST Distribute data to participating application
FCODE Process own function code
XCHNG Check whether data changed
DCHCK Check data
DSAVB Collect data from owning app.
DTAKE Note data in global memory
DSAVC Complete data (internal number)
DSAVE Save data on DB
DLVE1 Initialize current memory
DLVE2 Initialize global memory
SAP AG 2002

The BDT uses fixed events within the dialog flow. All applications are able to extend the object by
their own program logic.
The BDT calls application-specific function modules dynamically.
The most important events are displayed in the above slide.

SAP AG CR590 3-35


BDT Development: DWB - Events for Each View

Change Business Partner Create Subscreen with


Screen Painter
Partner TESTER
Screen type:
Name activate subscreen BUS_PBO
Form of addr. 01
Create layout BUS_PAI
First name John
Last name Tester Flow logic

Address PBO module -> Call


Street/number PAI module -> Call
Postcode/City 69121 Smithtown
Events Create function modules
ZZ_... for each view
Date of first contact
Create FM "before screen call"
Rating of first contact
Create FM "before output"
Create FB "after input"

SAP AG 2002

Within a view all attributes are grouped together that are displayed and checked together.
You can not separate fields by means of the Customizing. The fields are fixed on one screen. A view
is assigned to only one application.
Other applications are not allowed to extend an existing standard view. An application has to use
own screens and BDT views.
Create a View
Create a screen in the DWB with screen type subscreen.
Create a PBO module in the flow logic that calls the function module BUS_PBO.
Create a PAI module in the flow logic that calls function module BUS_PAI.
Don't program any field checks. Field checks take place separately in function modules.
Otherwise checks are linked to the calling of a screen. For direct input, you have to create the
same coding twice.
Create Events for each View
(All events are optional, screens are called without any coding in the events of the view).
Create function module "before call"
This event is triggered by the BDT for all views of a screen when moving from one
screen to another. Normally views with step-loop / table controls need a function module
for sorting entries.
Create function module "before output"
This event is triggered before the subscreen is called by the BDT. Used for displaying and
reading of explanatory text.
Create function module "after input"
This event is triggered after all the relevant subscreens are called in the PAI. Used for field
checking for the view.
Event DCHCK provides the possibility for checking several views.

SAP AG CR590 3-36


Tables

Existing tables can be extended by


Includes
Append structures
New tables can be created and integrated in the maintenance
For every table
there is an owning application
there are several participating applications

SAP AG 2002

Includes constitute a modification; only allowed for SAP applications.


There is a limit of 255 fields for each table. Due to this, it is recommended that table append
structures used as extensions be kept to a maximum of 10 fields.

SAP AG CR590 3-37


BDT Development: Data Dictionary

Applications
SAP
SAP SAP
SAP Customer
Customer
Application
Application II Application
Application IIII Application
Application

Table BUT000: Table ZZ_...


... ...
... ...
... ...
Append structure ...
ZZ_... ...
ZZ_... ...

Development in the DDIC


SAP AG 2002

All applications of an application object can add own fields or tables.


Existing tables can be extended by way of new table fields with the help of append structures.
(Exception: SAP applications generally create their own tables).
Completely new tables can be created and integrated in the dialog.

SAP AG CR590 3-38


BDT Basics: Unit Summary

You are now able to:

Describe in principle the architecture of the


SAP System and the process of a simple
dialog program via the ABAP runtime
system
Differentiate between BDT programming
and programming with user exits.
Position the BDT with regard to the SAP
Basis and application objects
Define application objects and applications
Discuss the relationship between Basis
and the BDT.

SAP AG 2002

SAP AG CR590 3-39


Dialog

Contents:
Views
Field Groups
Sections
Screens
Screen Sequences
BDT Screen Processing
GUI Menu

SAP AG 2002

SAP AG CR590 4-1


Dialog: Unit Objectives

At the conclusion of this unit, you will be able to:

Differentiate between a view and a


screen.
List all attributes belonging to a view.
Explain the functions of field groups.
Explain the functions of screen sequences.
Describe the internal BDT processing for carrying
out dialog screens.

SAP AG 2002

SAP AG CR590 4-2


Dialog: Overview Diagram

Course Overview Program Logic

Extensions with Table-


Introduction to the BDT
Participating Applications

Extensions with Table-


BDT Basics
Owning Applications

Service Programs and


Dialog
Functionality

SAP AG 2002

SAP AG CR590 4-3


Dialog: Business Scenario

An employee requires a certain screen


sequence and a certain screen layout for a
business partner in the role "prospect".

SAP AG 2002

SAP AG CR590 4-4


Targets for Screen Layout

Extensions and changes to screens are possible


Add other fields
in new frames
in existing frames
Assign fields differently, even between screens
Merge screens
No changes to development environment objects
of the BDT
of other applications

SAP AG 2002

Screen layout and sequence should be extended and configured using control tables (without the
need for modification). Customers should adapt standard SAP screens to their needs with
Drag&Drop in the Customizing. Using the Visual Configuration Tool (VCT), customers can change
screen layout - or group several screens together
screen sequence
screen titles
frame titles

SAP AG CR590 4-5


Screen->Section->View

Screen Sequence

Address Relationships Additional Partner Data

View 1
Section 1
View 2
A screen contains one
or more sections
View 3
A section contains one or
View 4 Section 2
more views
View 5 A view is presented by a
subscreen
View 6

View 7 Section 3

View 8

SAP AG 2002

The Dialog has a hierarchical structure.


Screen sequence (contains one or more screens)
Screens (contain one or more sections)
Sections (contain one or more views)
Views (contain one or more field groups)
Field groups (contains one or more screen fields)
All views correspond to one screen (type subscreen) in the DWB.

SAP AG CR590 4-6


Screen Layout: Screen Sequence ZF00

A screen sequence contains


one or more screens

SAP AG 2002

SAP AG CR590 4-7


Screen Layout: Screen(s)

A screen sequence contains


one or more screens
A screen contains one
or more sections

SAP AG 2002

SAP AG CR590 4-8


Screen Layout: View(s)

A screen sequence contains


one or more screens
A screen contains one
or more sections
A view contains one or more
field groups

SAP AG 2002

SAP AG CR590 4-9


Screen Layout: Field Group(s)

A screen sequence contains


one or more screens
A screen contains one
or more sections
A view contains one or more
field groups

SAP AG 2002

SAP AG CR590 4-10


Screen Layout: Table Field(s)

A screen sequence contains


one or more screens
A screen contains one or
more sections
A view contains one or more
field groups
Field groups contain one or
more screen fields

SAP AG 2002

SAP AG CR590 4-11


View Definition

Properties are summarized in a view if they


belong together in terms of content
are tested together
The fields of a view are placed together in a subscreen
(each view is assigned to a subscreen)
A view belongs to an application
Assignment view --> field groups (field grouping)
Multiple use of views in object parts is possible
(Example: BP roles)

SAP AG 2002

During the use of object parts, the BDT offers the possibility of making different settings for screen
layout and sequence for each object part.
A business process-specific dialog provides employees with the best support for their business
processes.

SAP AG CR590 4-12


View Attributes

Event function modules


Before output (PBO): Display explanatory texts, ...
After entry (PAI): Field checks, ...
Before screen call (PBC): Sort table, begin display with first entry
Only display view if
the application of the view is active
the view is assigned to the object part/s to be maintained
Flow logic of the subscreen
Call function module BUS_PBO in PBO
(field grouping, messages)
Call function module BUS_PAI in PAI
(determine cursor position)

SAP AG 2002

Screen-specific coding is encapsulated in function modules. This coding can now be carried out
without calling the screen.
In the actual subscreen logic, only service function modules of the BDT (BUS_PBO, BUS_PAI) are
called.
All subscreen checks have to be switched off.

SAP AG CR590 4-13


Additional View Checks

Owning application of the view


Carries out checks in a function module
Defines the name of the function module in the attributes for
the view
All other applications
Carry out checks in a function module
Add the name of the function module under 'further checks'
Important note:
All error messages are issued via the message handler
(function module BUS_MESSAGE_STORE)

SAP AG 2002

Existing views can not be changed in event PAI. All changes in the Customizing of the SAP System
are modifications.
Other applications are able to define input checks by creating "additional checks" and customizing
the view.
You have to issue all messages via the message handler. The message handler is used for all modes,
as well as for direct input.

SAP AG CR590 4-14


Section

Assignment section --> views


Sequence of views by way of position numbers
Frame around a section (exception: header data)
Frame title for each section

SAP AG 2002

Position numbers are for SAP, SAP IBS, development partners and customers. You can find
namespace descriptions in the BDT manual.

SAP AG CR590 4-15


Screen

Assignment Screen --> Sections


Sequence of sections by means of item numbers
Representation as
normal screen (full screen)
modal dialog box (pop-up)
Screen title for each screen
External screens (not created with the BDT)

SAP AG 2002

So-called subscreen containers are generated automatically


In a new system, you may have to generate all screens. Tools -> generate subscreen containers.

SAP AG CR590 4-16


Procedure - Step 1

Change Business Partner:


Empty screen container for screen B1

SAP AG 2001

SAP AG CR590 4-17


Procedure - Step 2

Change Business Partner: Address


Empty screen container for screen B1
Include screen title in screen
container title

SAP AG 2001

SAP AG CR590 4-18


Procedure - Step 3

Change Business Partner: Address


Empty screen container for screen B1
Partner TESTER
Include screen title in screen
container title
Fill 1st view for 1st section

SAP AG 2001

SAP AG CR590 4-19


Procedure - Step 4

Change Business Partner: Address


Empty screen container for screen B1
Partner TESTER
Include screen title in screen
container title
Name Fill 1st view for 1st section
Present title of 2nd section

SAP AG 2001

SAP AG CR590 4-20


Procedure - Step 5

Change Business Partner: Address


Empty screen container for screen B1
Partner TESTER
Include screen title in screen
container title
Name Fill 1st view for 1st section
Form of addr. 01
Present title of 2nd section
Fill 1st view for 2nd section

SAP AG 2001

SAP AG CR590 4-21


Procedure - Step 6

Change Business Partner: Address


Partner TESTER
Empty screen container for screen B1
Include screen title in screen
container title
Name Fill 1st view for 1st section
Form of addr. 01
Present title of 2nd section
First name Otto
Last name Tester
Fill 1st view for 2nd section
Fill 2nd view for 2nd section

SAP AG 2001

SAP AG CR590 4-22


Procedure - Step 7

Change Business Partner: Address


Empty screen container for screen B1
Partner TESTER
Include screen title in screen
container title
Name Fill 1st view for 1st section
Form of addr. 01
Present title of 2nd section
First name John
Last name Tester
Fill 1st view for 2nd section
Fill 2nd view for 2nd section

Address Present title of 3rd section

SAP AG 2001

SAP AG CR590 4-23


Procedure - Step 8

Change Business Partner: Address


Empty screen container for screen B1
Partner TESTER
Include screen title in screen
container title
Name Fill 1st view for 1st section
Form of addr. 01
Present title of 2nd section
First name John
Last name Tester Fill 1st view for 2nd section
Fill 2nd view for 2nd section

Address Present title of 3rd section


Street/number Ridge Rd 112
Postcode/City 99999 Smithtown Fill 1st view for 3rd section

SAP AG 2001

SAP AG CR590 4-24


Procedure - Step 9

Change Business Partner: Address


Empty screen container for screen B1
Partner TESTER

Name Include screen title in screen


Form of addr. 01 container title
First name John
Last name Tester Fill 1st view for 1st section
Address Present title of 2nd section
Street/number Ridge Road 112
Postcode/City 99999 Smithtown 0 Fill 1st view for 2nd section
Fill 2nd view for 2nd section
Present title of 3rd section
Fill 1st view for 3rd section
Compress screen

SAP AG 2001

BDT automatically compresses the screen. Dialog surface without fields is suppressed.

SAP AG CR590 4-25


Targets for Screen Sequences

Screen sequences at any level


Individual additional screens
Extend screen sequences to include new screens
Integrate screens not created with the BDT
Change sequence of screens within a screen sequence
Navigation between screen sequences / screens with the BDT
Tabstrips
Divisibility: best possible screen sequence for each object part

SAP AG 2002

SAP AG CR590 4-26


Overview

Additional Screen Sequence Address Overview


Previous
Screen
Deletion
Deletion
Flags Lock
Lock
Flags Next
Screen

Other Back
Data

Main Screen Seq.


Previous Previous
Screen Screen

Initial
Initial Screen
Screen Address
Address Control
Control ...
...
ENTER
Next Next
Screen Screen

SAP AG 2002

The starting point is always the main screen sequence category (customized as SPACE).
One or more screen sequences are assigned to a screen sequence category. You then assign the
specific screen sequence to an object part.
From the main screen sequence, you can move via the dialog to each screen sequence category
supported by the dialog.

SAP AG CR590 4-27


Definition

Screen sequence category


Levels at which a screen sequence is required
Assignment screen sequence category --> screen sequences
Screen Sequence
Sequence of screens through item numbers
Main screen sequence: assignment object part --> screen sequence
Standard screen sequence
Any screens possible
BDT screens
External screens (by calling a function module)

SAP AG 2002

Business Partner and Relationships is an example of BDT screens that appear within another
application object.
The Business Document Navigator (BDN) in the application object Business Partner is an example
of an integrated, external screen.

SAP AG CR590 4-28


Other Screen Sequences

Jump from a screen of another screen sequence


Implementation: alternatives
Define the screen sequence category when defining the
GUI function
Call function module BUS_SCREEN_CALL in event FCODE
Navigation options
Menu (edit, extras, environment)
Freely positionable pushbuttons

SAP AG 2002

Screen sequences are flexible and can be called by the function module BUS_SCREEN_CALL.

SAP AG CR590 4-29


Targets for the GUI Menu

Own menu with standard functions for each application object


Add additional functions
Activate / deactivate functions
per activity
per view
per screen sequence category
on the basis of additional program logic
Link menu function <--> freely positionable pushbutton
Extensions to the GUI menu without changes to development
environment objects
of the BDT
of other applications

SAP AG 2002

SAP AG CR590 4-30


Standard Functions

Contained in the standard menu


Activate / deactivate in system tables
per activity Lowest priority
per activity / view
per activity / view / screen sequence Highest priority
category

SAP AG 2002

The BDT separates standard functions and additional functions.


Standard functions are contained in the standard menu. The system tables activate and deactivate
visible functions in the GUI menu.
The visible GUI menu functions are controlled by the dialog activity, the activity, and the view or
activity actually displayed, as well as the actual screen sequence category.

SAP AG CR590 4-31


Additional Functions

Can be included in the standard menu via the option


"additional functions"
Displayed in an additional popup
Activate / deactivate in system tables
per activity Lowest priority
per activity / view
per activity / view / screen sequence Highest priority
category

SAP AG 2002

Additional functions represented in an additional dialog box.

SAP AG CR590 4-32


Example - "Save" Function

Display Mode Change Mode Create Mode


- - -
Save Button Save Button Save Button
not active active active

Display Partner: Address Change Partner: Address Create Partner: Address

Screen 1 Save Screen 1 Save Screen 1 Save

Section Section Section


View View View

View View View

View View View

SAP AG 2002

Examples of the Customizing of different functions in the menu.


The function "save" is only active in create and change mode.
The activity mode is the only criterion.

SAP AG CR590 4-33


Example: "Delete Bank Details" Function

Display mode Display mode and Create/change mode and


- bank details visible bank details visible
- -
Delete button not active Delete button not active Delete button active

Display Partner: Address Display Partner: Payment Create Partner: Payment

Screen 1 Screen 1 Screen 1

Section Section Section


View View bank details View bank details

View

View
Delete Delete

SAP AG 2002

Examples of the Customizing of different functions in the menu.


The function "delete bank details" is only active if you are in create / change mode and the view
"bank details" is displayed.

SAP AG CR590 4-34


Example: Address Overview Function

Create/change/display Create/change/display Create/change/display mode


mode mode Address overview visible and
Main screen seq. Main screen seq.
Address 0verview button
not visible Address overview button Address overview button
not visible active

Main screen seq. Main screen seq. Main screen seq.

Display Partner: Payment Change Partner: Control Create Partner: Address

Screen 1 Screen 1 Screen 1


Address overview Address overview Address overview

Section
Section Section Section

Display bank details View Display Address

View View

View View

SAP AG 2002

Examples of the Customizing of different functions in the menu.


The function "address overview" is only visible in create / change / display mode, the view
"address data" is visible and you are in the main screen sequence.

SAP AG CR590 4-35


Events

DCUAD (Determine GUI status)


The standard menu with GUI status is in the application function
group of the application that owns the application object
The application can set the required GUI status
DCUAC (Change GUI status)
Programmed activation / deactivation of GUI functions
The function "delete bank" is inactive if field group "bank details"
is hidden or is only displayed
Scroll functions are only active with a large number of entries

SAP AG 2002

The menu is determined in events DCUAD and DCUAC. Menu options can also be set to active or inactive
here if the rule that applies to this function cannot be represented using the settings in the Customizing table.
Event DCUAD (Customizing of the menu)
Description:The application determines the GUI status and sends it to the BDT. The BDT also receives the
name of the function module that sets the GUI status (command SET PFSTATUS...). This function module
must be included in the function group of the application that owns the application object. The naming
convention for this function module is <Application>_<Application object>_PFSTATUS_SET.
Application area: Application that owns the application object.
Naming convention: <Application>_<Application object>_EVENT_DCUAD
(Customer: Function module name also has the prefix Y_ or Z_).
Example: BUP_BUPA_EVENT_DCUAD
Action required:
Determine GUI status for the screen and send it to the BDT.
Send the name of the function module for setting the GUI status to the BDT.
Event DCUAC (changing the menu)
Description:Menu options may be set to active or inactive at runtime. This is done here for the menu options
whose active / inactive rule cannot be fully represented in the Customizing tables.
Application area: All applications.
Naming convention: <Application>_<Application object>_EVENT_DCUAD
(Customer: Function module name also has the prefix Y_ or Z_).
Example: BUP_BUPA_EVENT_DCUAC
Action required:
Determine current GUI status with the function module BUS_CUA_STATUS_GET
Include inactive standard functions or active additional functions in the relevant tables
Return current GUI status to the Customizing with the function module BUS_CUA_STATUS_SET

SAP AG CR590 4-36


Dialog: Unit Summary

You are now able to:

Differentiate between a view and a screen


List all attributes belonging to a view
Explain the functions of field groups
Identify the differences between BDT
screens and DWB screens
Explain the functions of screen sequences
Describe the internal BDT processing for
carrying out dialogs
Explain the functions and different
Customizing possibilities of GUI menus

SAP AG 2002

SAP AG CR590 4-37


Exercises

Unit: Dialog
Topic: Dialog Maintenance

At the conclusion of this exercise, you will be able to:


Change screen sequence and the order of sections and views for an
application object in the BDT.

The processor maintains credit card data and bank details for prospects. To
improve the business process, the application consultant has to integrate
the views of credit card details and bank details and to provide both with a
frame.

Navigate to the Easy Access Menu:


/n Enter /nbupt Use the area menu and not the Easy Access Tree.

Replace all ## with your group number.


For example: Group number 11
ZF## = ZF11

1-1 Preparatory steps to avoid changes to the SAP Standard Customizing.


BP control Screen Sequence
1-1-1 Copy the screen sequence BUP001 to ZF##. In mySAP CRM, you would use
the screen sequence BUP001 and in SAP R/3 the screen sequence BUP1 by
default as the template. Replace the last two positions 00 of the position number
with 10. You are now in the customer namespace.
1-1-2 Assign the main screen sequence category BUP001 to the screen sequence
ZF##.
In SAP R/3:Assign the main screen sequence <SPACE> to the screen sequence
ZF##. Do not set the radio button to Standard.

SAP AG CR590 4-38


1-1-3 Create a new object part.
An object part is a restricted view of the whole object. The name for an object
part in the SAP Business Partner is role. The development of an application
object decides whether divisibility, and therefore object parts, is used or not.
BP Control Divisibility BP Roles.
Copy from Prospect role.
Parameter Value

Copy ZCXX10
Role ZC##10
Description ZC##: Prospect
Title ZC##: Prospect
Screen Sequence ZF##
Differentiation type 0
Screen selection not specified
Valid Business Partner categories Organization
Person
Group
1-1-4 Check that the screen sequence in role ZC##10 has been changed.

SAP AG CR590 4-39


1-2 Changes to the screen layout for bank details and credit cards.
1-2-1 Create a new section.
A section groups a number of views. The sequence is established through
position numbers and a line is drawn around these.
BP Control Screen Layout Sections
Section ZA##00
Description Bank and Credit Cards ##
Title Bank and Credit Cards ##
1-2-2 Assign the views to the section.
Position number 1000010
View BUP600
Position number 2000010
View BUP500
1-2-3 Create a screen and assign the view to the section.
A screen includes one or more sections and represents one tab page in the
dialog. The position numbers in the screen sequence control the sequence of
screens.
BP Control Screen Layout Screens
Screen ZB##00
Description Bank and Credit Cards ##
Title Bank and Credit Cards ##
Data screen X
BDT X
Screen type normal
1-2-4 Assign screen to sections.

Position number 1000010


Section BUP009
Position number 2000010
Section ZA##00

SAP AG CR590 4-40


1-2-5 Assign the screen to the screen sequence.
BP Control Screen Sequence Define Sequence

Screen Sequence ZF##


Position number 300005
Screen ZB##00
1-2-6 Delete screen BUP500 from screen sequence ZF##.
1-2-7 Check the result in your object part (BP role) ZC##10.
mySAP CRM:GoTo Menu (BP) SAP Menu Master Data Business
Partner Maintain Business Partner
SAP R/3:Application Business Partner Create

SAP AG CR590 4-41


Program Logic

Contents:
Program Flow
Events
Table-Participating Applications
Table-Owning Applications
Current and Global Memory

SAP AG 2002

SAP AG CR590 5-1


Program Logic: Unit Objectives

At the conclusion of this unit, you will be able to:

Trace the processing flow of the BDT program


flow
Name events and their function in the BDT
Describe the processing of table-participating
applications
Describe the processing of table-owning
applications and the differences with regard to
table-participating applications
Differentiate between the current and global
memory and their tasks

SAP AG 2002

SAP AG CR590 5-2


Program Logic: Overview Diagram

Course Overview Program Logic

Extensions with Table-


Introduction to the BDT
Participating Applications

Extensions with Table-


BDT Basics
Owning Applications

Service Programs and


Dialog
Functionality

SAP AG 2002

SAP AG CR590 5-3


Targets

Use program logic for


Dialog maintenance via the standard user interface
Dialog maintenance via an external user interface
(in R/3 or a non-R/3 system)
Maintenance without dialog (direct input or function modules)
Decouple program logic from the user interface
Foreign key checks not at the user interface
Data category checks not at the user interface
Extensions without changes to development environment
objects
of the BDT
of other applications

SAP AG 2002

SAP AG CR590 5-4


Event Techniques

Communication
Between the BDT and applications
Between applications
Defined Events
Within the maintenance dialog
With different object services
Assignment Event --> Event Function Modules
Define name in control tables
Dynamic call via BDT
Sequence of event function modules by way of position
numbers

SAP AG 2002

Within the dialog flow, events defined by the BDT are used, for which the applications can develop
a separate program logic in the form of function modules. The function modules can be defined for
each event; then the BDT automatically calls up these modules.
Position numbers have separate namespaces for SAP, SAP-IBS, development partner and customers.

SAP AG CR590 5-5


Event Areas

Program Events
Table
Check
BDT processing
Views
Event Table
Field Status
Field Grouping Criteria

SAP AG 2002

The BDT can be divided into different areas with regard to the events.
The events for tables serve the purposes of direct input, the communication between applications,
and the evaluation of change documents.
Views have events for PBC (Process Before Call), PAI and PBO.
Program events
Table events are for read- and save-processing (for example, ISDAT, DSAVE)
The check is for business check and data integration checks (for example, DCHCK).
The BDT processing contains events for the BDT program flow (for example, XCHNG,
DTAKE).
The event field status changes the status of the field group during BDT processing.
The event field grouping criteria allows you to adapt different field grouping statuses for each
criterion.

SAP AG CR590 5-6


Event Table

ISSTA Initialization
ISDAT Read data from DB
ISDST Distribute data to participating applications
FCODE Process own function code
XCHNG Check to see if data has been changed
DCHCK Check before saving
DSAVB Collect data at owning application
DTAKE Note data in global memory
DSAVC Complete data (get internal number)
DSAVE Save data in DB

SAP AG 2002

SAP AG CR590 5-7


Views

Before Call (PBC)


Begin with the first data record (table control)
Sort data records (table control)
Before Output (PBO)
Read tables for explanatory texts
After Entry (PAI)
Field checks

SAP AG 2002

Views encapsulate their coding in function modules. These function modules are called both in the
dialog and in the direct input mode.

SAP AG CR590 5-8


Events, Flow

Initial Screen Data Screen

DTITL DTITL
DCUAD DCUAC DCUAD DCUAC
ISDAT
Before output ISDST Before output A
Before Before
ISSTA Call Call Subscreen AUTH1 Call Call Subscreen
Start
Call Subscreen Call Subscreen
After entry After entry

FCODE FCODE

Save Back Exit Cancel

XCHNG XCHNG XCHNG XCHNG

No No No No
Change ? Change ? Change ? Change ?

Yes Yes Yes Yes

DSAVB . Save ?
Cancel No . Save ?
Cancel No Cancel ? Yes
AUTH1
Yes Yes No
DCHCK A A
DTAKE DSAVB DSAVB A
DSAVC AUTH1 AUTH1
DSAVE DCHCK DCHCK
DTAKE DTAKE
DSAVC DSAVC
DSAVE DSAVE

DLVE1
DLVE2

Events at the dialog: save mode


End

SAP AG 2002

A normal transaction code is the starting point. The transaction code always carries out the same
program (in BP BUSSTART). The BDT reads all the necessary information in the control tables
together with the name of transaction code.
The program flow has a fixed definition. All function modules belonging to the object part that has
been carried out are called dynamically in the relevant events.

SAP AG CR590 5-9


Tables (Service Function Modules)

Communication Between the Applications


Distribute Data (Event ISDAT or ISDST)
Data from an owning application to a participating application
Creator: owning application
Table BUT000: BUP_BUPA_BUT000_GET
Collect Data (Event DSAVB)
Data from a participating application to an owning application
Creator: owning application
Table BUT000: BUP_BUPA_BUT000_GET

SAP AG 2002

Each table-owning application can provide data to its current tables, which is encapsulated in its
function module. This data can also be provided via communication interfaces to other applications.
Without this interface, a table-participating application is not able to receive the data that it has to
process.

SAP AG CR590 5-10


Example A (Initial Situation)

Applications: SAP BP
Financial Service BP Table-participating
Customer applications
Tables: Table BUT000:
Owner: SAP BP
Key fields

INCLUDE for SAP BP

APPEND for FS BP
ZZCNT_FIRST
APPEND for Customer
ZZCNT_FIRST

SAP AG 2002

Example initial situation:


Three applications: SAP BP, Financial Service, Customer
SAP BP:
Table-owning application (BUT000)
Financial Service BP:
Table-participating application (append BUT000)
Customer:
Table-participating application (append BUT000)

SAP AG CR590 5-11


Example A - Read Data 01

Applications: SAP BP
Financial Service BP
Customer

Event ISDAT
(Read data)

SAP AG 2002

The BDT carries out all necessary function modules in event ISDAT.

SAP AG CR590 5-12


Example A - Read Data 02

Applications: SAP BP
Financial Service BP
Customer

Event ISDAT Read BUT000


(Read data)

SAP AG 2002

The function module of application SAP BP reads BUT000.

SAP AG CR590 5-13


Example A - Read Data 03

Applications: SAP BP
Financial Service BP
Customer

Event ISDAT Read BUT000 BUT000


(Read data)

SAP AG 2002

Data is stored in the internal structure BUT000.

SAP AG CR590 5-14


Example A - Read Data 04

Applications: SAP BP
Financial Service BP
Customer

Event ISDAT Read BUT000 BUT000


(Read data)

Event ISDST
(Distribute data)

SAP AG 2002

Event ISDST carries out all function modules for distributing data from table-owning to table-
participating applications.

SAP AG CR590 5-15


Example A - Read Data 05

Applications: SAP BP
Financial Service BP
Customer

Event ISDAT Read BUT000 BUT000


(Read data)

Event ISDST BUT000


(Distribute data)
Get BUT000

SAP AG 2002

The function module of the application Financial Service BP is called.

SAP AG CR590 5-16


Example A - Read Data 06

Applications: SAP BP
Financial Service BP
Customer

Event ISDAT Read BUT000 BUT000


(Read data)

Service
Function Modules

Event ISDST BUT000


(Distribute data)
Get BUT000

SAP AG 2002

The application Financial Service BP calls the data from BUT000 via the call of the service
function module.

SAP AG CR590 5-17


Example A - Read Data 07

Applications: SAP BP
Financial Service BP
Customer

Event ISDAT Read BUT000 BUT000


(Read data)

Service
Function Modules

Event ISDST BUT000


(Distribute data)
Get BUT000 BUT000

SAP AG 2002

The data from BUT000 including the append data is stored in the function module of the Financial
Service BP application.

SAP AG CR590 5-18


Example A - Read Data 08

Applications: SAP BP
Financial Service BP
Customer

Event ISDAT Read BUT000 BUT000


(Read data)

Service
Function Modules

Event ISDST BUT000


(Distribute data)
Get BUT000 BUT000

Get BUT000

SAP AG 2002

The function module of the customer application is called.

SAP AG CR590 5-19


Example A - Read Data 09

Applications: SAP BP
Financial Service BP
Customer

Event ISDAT Read BUT000 BUT000


(Read data)

Service
Function Modules

Event ISDST BUT000


(Distribute data)
Get BUT000 BUT000

Get BUT000 BUT000

SAP AG 2002

The customer application calls the data from BUT000 via the call of the service function module.

SAP AG CR590 5-20


Example A - Read Data 10

Applications: SAP BP
Financial Service BP
Customer

Event ISDAT Read BUT000 BUT000


(Read data)

Service
Function Modules

Event ISDST BUT000


(Distribute data)
Get BUT000 BUT000

Get BUT000 BUT000

SAP AG 2002

The data from BUT000 including the append data is stored in the function group of the customer
application.

SAP AG CR590 5-21


Example A - Save Data 01

Applications: SAP BP
Financial Service BP
Customer

Event DSAVB
(Collect data)

SAP AG 2002

Starting point for saving data.


The BDT dynamically calls function modules of the event DSAVB.
The event serves the purpose of collecting data from table-participating to table-owning applications
in order to store data in the database.

SAP AG CR590 5-22


Example A - Save Data 02

Applications: SAP BP
Financial Service BP Service
Customer Function Modules

Event DSAVB BUT000


(Collect data)

BUT000
Transfer BUT000

BUT000

SAP AG 2002

The application Financial Service BP transfers data from the append structure to the application
SAP BP.
The application Financial Service BP calls service function module Collect from BUT000.

SAP AG CR590 5-23


Example A - Save Data 03

Applications: SAP BP
Financial Service BP Service
Customer Function Modules

Event DSAVB BUT000


(Collect data)

BUT000
Transfer BUT000

BUT000

SAP AG 2002

Only data of the Financial Service BP table append is transferred to the BUT000 structure in the
application SAP BP.

SAP AG CR590 5-24


Example A - Save Data 04

Applications: SAP BP
Financial Service BP Service
Customer Function Modules

Event DSAVB BUT000


(Collect data)

BUT000
Transfer BUT000

BUT000
Transfer BUT000

SAP AG 2002

The customer application calls the service function module Collect from BUT000.

SAP AG CR590 5-25


Example A - Save Data 05

Applications: SAP BP
Financial Service BP Service
Customer Function Modules

Event DSAVB BUT000


(Collect data)

BUT000
Transfer BUT000

BUT000
Transfer BUT000

SAP AG 2002

Only data of the table append of the customer application is transferred to the BUT000 structure in
the application SAP BP.

SAP AG CR590 5-26


Example A - Save Data 06

Applications: SAP BP
Financial Service BP Service
Customer Function Modules

Event DSAVB BUT000


(Collect data)

BUT000
Transfer BUT000

BUT000
Transfer BUT000

Event DTAKE
(Transfer data)

SAP AG 2002

The BDT carries out all necessary function modules for the event DTAKE.
DTAKE moves all data from current memory to the global memory.

SAP AG CR590 5-27


Example A - Save Data 07

Applications: SAP BP
Financial Service BP Service
Customer Function Modules

Event DSAVB BUT000


(Collect data)

BUT000
Transfer BUT000

BUT000
Transfer BUT000

Event DTAKE
BUT000 in Global Memory
(Transfer data)

SAP AG 2002

The event DTAKE is available only for table-owning applications.


The application SAP BP moves the current memory to the global memory. This process also
includes data from the append structures for the table in BUT000.

SAP AG CR590 5-28


Example A - Save Data 08

Applications: SAP BP
Financial Service BP Service
Customer Function Modules

Event DSAVB BUT000


(Collect data)

BUT000
Transfer BUT000 FIBUB1

BUT000
Transfer BUT000

Event DTAKE
BUT000 in Global Memory
(Transfer data)

Event DSAVE
(Save data)

SAP AG 2002

All the necessary function modules in event DSAVE are carried out.
The event DSAVE is available only to table-owning applications.

SAP AG CR590 5-29


Example A - Save Data 09

Applications: SAP BP
Financial Service BP Service
Customer Function Modules

Event DSAVB BUT000


(Collect data)

BUT000
Transfer BUT000

BUT000
Transfer BUT000

Event DTAKE
BUT000 in Global Memory
(Transfer data)

Event DSAVE
BUT000 in DB
(Save data)

SAP AG 2002

The application SAP BP saves the structure BUT000 in the database, including the table append
data.

SAP AG CR590 5-30


Example B (Initial Situation)

Applications: SAP BP
Financial Service BP

Tables: Table BUT000: Table FSBUB1


Owner: SAP BP Owner: FS BP
Key Fields Key Fields
INCLUDE for SAP BP INCLUDE for FS BP

SAP AG 2002

Example initial situation:


Three applications: SAP BP, Financial Service BP, Customer
SAP BP:
Table-owning application (BUT000)
Financial Service BP :
Table-owning application (FSBUB1)

SAP AG CR590 5-31


Example B - Read Data 01

Applications: SAP BP
Financial Service BP

Event ISDAT
(Read data)

SAP AG 2002

The BDT carries out all necessary function modules in event ISDAT.

SAP AG CR590 5-32


Example B - Read Data 02

Applications: SAP BP
Financial Service BP

Event ISDAT Read BUT000


(Read data)

SAP AG 2002

The function module of application SAP BP reads BUT000.

SAP AG CR590 5-33


Example B - Read Data 03

Applications: SAP BP
Financial Service BP

Event ISDAT Read BUT000 BUT000


(Read data)

SAP AG 2002

Data is stored in the internal structure BUT000.

SAP AG CR590 5-34


Example B - Read Data 04

Applications: SAP BP
Financial Service BP

Event ISDAT Read BUT000 BUT000


(Read data)
Get BUT000

SAP AG 2002

The application Financial Service BP needs the data from BUT000 for reading its own table. (The
partner number is the search parameter.)

SAP AG CR590 5-35


Example B - Read Data 05

Applications: SAP BP
Financial Service BP GET / Service
Function Modules

Event ISDAT Read BUT000 BUT000


(Read data)
Get BUT000

SAP AG 2002

For the purpose of reading data, Financial Service BP calls the GET function module of table
BUT000.

SAP AG CR590 5-36


Example B - Read Data 06

Applications: SAP BP
Financial Service BP Service
Function Modules

Event ISDAT Read BUT000 BUT000


(Read data)

Get BUT000 BUT000

SAP AG 2002

FS BP saves data in an own structure.

SAP AG CR590 5-37


Example B - Read Data 07

Applications: SAP BP
Financial Service BP Service
Function Modules

Event ISDAT Read BUT000 BUT000


(Read data)
Get BUT000
Read FSBUB1 BUT000

SAP AG 2002

The application FS BP reads its own table FSBUB1 with the partner number of the structure
BUT000.

SAP AG CR590 5-38


Example B - Read Data 08

Applications: SAP BP
Financial Service BP Service
Function Modules

Event ISDAT Read BUT000 BUT000


(Read data)
Get BUT000 BUT000 FSBUB1
Read FSBUB1

SAP AG 2002

Data is saved in the internal structure FSBUB1.

SAP AG CR590 5-39


Example B - Read Data 09

Applications: SAP BP
Financial Service BP Service
Function Modules

Event ISDAT Read BUT000 BUT000


(Read data)
Get BUT000
BUT000 FSBUB1
Read FSBUB1

Event ISDST
(Distribute data)

SAP AG 2002

The event ISDST carries out all function modules for distributing data from table-owning to table-
participating applications.

SAP AG CR590 5-40


Example B - Read Data 10

Applications: SAP BP
Financial Service BP Service
Function Modules

Event ISDAT Read BUT000 BUT000


(Read data)
Get BUT000
BUT000 FSBUB1
Read FSBUB1

Event ISDST BUT000


(Distribute data)
BUT000 FSBUB1

SAP AG 2002

Data from FSBUB1 is stored in the internal table.


Once the read process is complete, all applications display and check their own datasets.
Complete external publication of the application tables takes place on the basis of the table structure.
Data can be changed only in the append structure of the customized table.

SAP AG CR590 5-41


Example B - Save Data 01

Applications: SAP BP
Financial Service BP

Event DSAVB
(Collect data)

SAP AG 2002

Starting point for saving data.


The BDT dynamically calls function modules of the event DSAVB.
The event is for collecting data from table-participating to table-owning applications in order to
store data in the database.

SAP AG CR590 5-42


Example B - Save Data 02

Applications: SAP BP
Financial Service BP Service
Function Modules

Event DSAVB BUT000


(Collect data)

Transfer BUT000 BUT000 FSBUB1

SAP AG 2002

SAP AG CR590 5-43


Example B - Save Data 03

Applications: SAP BP
Financial Service BP Service
Function Modules

Event DSAVB BUT000


(Collect data)

Transfer BUT000 BUT000 FSBUB1

Event DTAKE
(Transfer data)

SAP AG 2002

The BDT carries out all necessary function modules for the event DTAKE.
DTAKE moves all data from the current memory to the global memory.

SAP AG CR590 5-44


Example B - Save Data 04

Applications: SAP BP
Financial Service BP Service
Function Modules

Event DSAVB BUT000


(Collect data)

Transfer BUT000 BUT000 FSBUB1

Event DTAKE BUT000 in Global Memory


(Transfer data)

SAP AG 2002

The event DTAKE is available only for table-owning application.


The application SAP BP moves the current memory to the global memory. This process also
includes data from the append structures for the table in BUT000.

SAP AG CR590 5-45


Example B - Save Data 05

Applications: SAP BP
Financial Service BP Service
Function Modules

Event DSAVB BUT000


(Collect data)

Transfer BUT000 BUT000 FSBUB1

Event DTAKE BUT000 in Global Memory


(Transfer data)
FSBUB1 in Global Memory

SAP AG 2002

The application FS BP moves the current memory from FSBUB1 to the global memory.

SAP AG CR590 5-46


Example B - Save Data 06

Applications: SAP BP
Financial Service BP Service
Function Modules

Event DSAVB BUT000


(Collect data)

Transfer BUT000 BUT000 FSBUB1

Event DTAKE BUT000 in Global Memory


(Transfer data)
FSBUB1 in Global Memory

Event DSAVE
(Save data)

SAP AG 2002

All the necessary function modules in event DSAVE are carried out.
The event DSAVE is available only to table-owning applications.

SAP AG CR590 5-47


Example B - Save Data 07

Applications: SAP BP
Financial Service BP Service
Function Modules

Event DSAVB BUT000


(Collect data)

Transfer BUT000 BUT000 FSBUB1

Event DTAKE BUT000 in Global Memory


(Transfer data)
FSBUB1 in Global Memory

Event DSAVE BUT000 in DB


(Save data)

SAP AG 2002

The application SAP BP saves the structure BUT000 in the database.

SAP AG CR590 5-48


Example B - Save Data 08

Applications: SAP BP
Financial Service BP Service
Function Modules

Event DSAVB BUT000


(Collect data)

Transfer BUT000 BUT000 FSBUB1

Event DTAKE BUT000 in Global Memory


(Transfer data)
FSBUB1 in Global Memory

Event DSAVE BUT000 in DB


(Save data)
FSBUB1 in DB

SAP AG 2002

The application FS BP saves the structure FSBUB1.

SAP AG CR590 5-49


Program Logic: Unit Summary

You are now able to:

Trace the processing flow of the BDT


program flow.
Name events and their tasks in the BDT
Describe the processing of table-
participating applications
Describe the processing of table-owning
applications and the differences with regard
to table-participating applications
Differentiate between the current and global
memory and their tasks

SAP AG 2002

SAP AG CR590 5-50


Extensions with Table-Participating Applications

Contents:
Create Table Append
Create Screen
Create Events for Screen
Create Events for Program Logic
Add Additional Checks
Special Case: Data Fields

SAP AG 2002

SAP AG CR590 6-1


Extensions with Table-Participating Applications:
Unit Objectives

At the conclusion of this unit, you will be able to:

Explain the extension of the SAP BP by means of


table appends
Describe the aim of encapsulating screen
events in function modules
Describe the aim of the program logic and its function
Explain the adding of additional checks in the BDT
Describe the special features of date fields in the BDT

SAP AG 2002

SAP AG CR590 6-2


Extensions with Table-Participating Applications:
Overview Diagram

Course Overview Program Logic

Extensions with Table-


Introduction to the BDT
Participating Applications

Extensions with Table-


BDT Basics
Owning Applications

Service Programs and


Dialog
Functionality

SAP AG 2002

SAP AG CR590 6-3


Extensions with Table-Participating Applications:
Business Scenario

You are required to extend the SAP BP by way


of two additional fields: date and rating of the
first contact.
You are required to add additional checks to
a standard BP view. The last name has to be
checked for vowels.

SAP AG 2002

SAP AG CR590 6-4


Overview of Development with the BDT

Applications
SAP
SAP SAP
SAP Customer
Customer
Application
Application II Application
Application IIII Application
Application 77
SAP BP
(BUPA)

Development

Development
DDIC BDT Control Tables
Workbench

SAP AG 2002

In table-participating applications, you have development areas Data Dictionary (DDIC),


Development Workbench and the BDT control tables. The same development areas are also needed
for developing the table-owning applications.

SAP AG CR590 6-5


Step 1: Data Dictionary

Applications
SAP
SAP SAP
SAP Customer
Customer
Application
Application II Application
Application IIII Application
Application

Table BUT000 Table ZZ_...


... ...
... ...
... ...
Append structure ...
ZZ_... ...
ZZ_... ...

Development in the DDIC


SAP AG 2002

In the first step, an existing table is extended with the help of an append structure in the DDIC. In
the following exercise the SAP Business Partner standard table, BUT000, is extended.

SAP AG CR590 6-6


Step 2: Create Screen

Function
Function Modules
Group
ISSTA
ISDAT Events for each
application
ISDST
PBO Module
...

Program Logic
PBO ..._PBO_..
...
Screen ..._PAI_.. Events for each
PAI Module view
..._POV_..
0010 First Contact
PAI ...
...

POV-Modul
POV
...
SAP AG 2002

In the second step, a screen with Process Before Output (PBO) and Process After Input (PAI)
modules is created. In these modules the BDT service function modules are called up. In order to be
able to provide a suitable input help (F4 help) for entering the date in our scenario, an additional
Process On Value Request (POV) module is created.

SAP AG CR590 6-7


Step 3: Create Function Modules

Function
Function Modules
Group
ISSTA
ISDAT Events for each
application
DSAVE
PBO Module
...

Program Logic
PBO ..._PBO_..
...
Screen ..._PAI_.. Events for each
PAI Module view
..._POV_..
0010 First Contact
PAI ...
...

POV Module
POV
...
SAP AG 2002

In the third step, the function modules are created for the events per application and view.

SAP AG CR590 6-8


Mandatory Events

ISSTA Initialization

ISDST Distribute data to participating application

FCODE Carry out own function code

XCHNG Check whether data has been changed

DCHCK Cross-screen check of data

DSAVB Return of data to table-owning application

DLVE1 Initialize current memory

SAP AG 2002

The BDT defines several events for an application object. In these events, assigned function
modules are available for the functions of reading, checking and saving. Assigned function modules
are called dynamically by the BDT.
The events represented by the darker blocks are absolutely necessary for table-participating
applications.

SAP AG CR590 6-9


BDT Development: DWB - Events for Each Table

Communication:
via GET and
COLLECT modules
Table-Owning
Table-
Applications
Call Participating
Applications
Flow
Data
..._GET

..._COLLECT Table-
Participating
Applications

Call Data Flow

SAP AG 2002

Tables may have


one owning application and
several participating applications.
Tables are assigned to development classes. In a development class, there is one responsible (table-
owning) application for each table. Only this application reads the table from and updates the table
at the database. The application that adds table fields by means of append structures is defined as
the participating application.
Communication between the possessing and participating application takes place via so-called GET
and COLLECT function modules.
If a table-owning application allows a table-participating application an append structure, the table-
owning application must have these two function modules for communication with other
applications. In this way the table-participating application is able to exchange the current table
content with the owning application.
Read data (GET-FB): with this function module, the participating applications can determine the
current content of the table.
Collect data (COLLECT-FB): this function module allows a table-participating application to
transfer to the table-owning application, the values of fields it has attached.

SAP AG CR590 6-10


Data Administration: Participating Application

Function Group Function Group


Table-Owning Appl. Table-Participating Appl.
Appl.
(GET FM)

ISDST
Current new old Current new old
Memory Memory
DSAVB
DTAKE (COLLECT FM)

Global
ISDAT new old
Memory

DSAVE

DB
SAP AG 2002

Table-participating and table-owning applications have in each case their own function groups with
decoupled memory areas. For this reason, the table-participating application gets, in event ISDST,
the current memory of the table-owning application by calling the GET function module. Old and
new data is saved.
In event DSAVB, data is transferred by the table-participating application to the table-owning
application by calling the COLLECT function module. Only new data from the current memory and
the table append is transferred.
The table-owning application is responsible for writing the data to the database in event DSAVE.

SAP AG CR590 6-11


Additional Checks

View 1
Screen

View 1 Application / Screen


Section 1
View 2

View 3 PBC PBO PAI

View 4 Section 2

View 5

View 6 Additional Checks


Appl.
Appl. 1 FuMo A (PAI)
View 7 Section 3
Appl.
Appl. 2 FuMo A (PAI)
Sicht 8
... ...

SAP AG 2002

In addition to the Process Before Call (PBC), Process Before Output (PBO) and Process After Input
(PAI) function modules of the views, any number of additional function modules can be attached to
each view.
The function modules included under "additional checks" are called up in the Process After Input
(PAI) event of the view.
This allows a modification-free check of the data from "external" views.

SAP AG CR590 6-12


Standard Date Fields

ABAP Processing Block Screen

Date
20010701 01.07.2001
DATS CHAR10

Automatic functions in the


screen
- Date formatting
- Check
- F4 Help

Automatic functions linked to the screen


Other interfaces cannot use these functions

SAP AG 2002

Date fields are a special case. Internally, a date is represented in the format "YYYYMMDD" (field type
DATS).
This format is suitable not only for representation on the screen. For this reason, screens contain
service functions that carry out the automatic conversion of date fields in the required format for
representation.
The check functions can only be used for the dialog interfaces.

SAP AG CR590 6-13


Date Fields in the BDT

ABAP Screen
Date
No conversion
01/07/2001 01/07/2001
CHAR10 CHAR10

_PBO _PAI
_POV (F4)
20010701
DATS

Conversion and check encapsulated in function modules


Other interfaces can use the same coding

SAP AG 2002

In order to make the program code usable for different interfaces, the code must be encapsulated in
function modules.
The BDT events Process Before Output (PBO) and Process After Input (PAI) are used to convert the
internal format "DATS" into "CHAR10".
No data conversion takes place between screen processes and ABAP processes.
To provide an input help (F4 help), you have to call a BDT service function module, Process On
Value Request (POV), within the screen.

SAP AG CR590 6-14


Extensions with Table-Participating Applications:
Unit Summary

You are now able to:

Explain the extension of the SAP BP by


means of table appends
Describe the aim of encapsulating
screen events in function modules
Describe the aim of the program logic
and its function
Describe the adding of additional checks
in the BDT
Explain the special features of date fields
in the BDT

SAP AG 2002

SAP AG CR590 6-15


Exercises

Unit: Extensions with Table-participating Applications


Topic: Extension of a BDT object via a table

At the conclusion of this exercise, you will be able to:


Extend BDT objects without modifications using a table append.

You need to extend the application object BUPA (Business Partner) by


way of attributes and functions.

During the first contact between a processor and a customer, the processor
has to enter the date and his rating of the first contact. He should be able to
save the first contact date and the rating.

1-1 Look at the prepared DDIC extensions.


Additional attributes have to be maintained in the SAP Basis (DDIC). These could be
table appends or tables.
(SE11) SAP Menu Tools ABAP Workbench Development Data Dictionary
1-1-1 Write down the name of the append of the customer table BUT000.
_______________________________
1-1-2 Write down the name of the check table for the field rating.
_______________________________

SAP AG CR590 6-16


1-2 Create the first contact screen.
You have to create new screens for the dialog, as there were previously no screens with
the new attributes.

(SE80) SAP Menu Tools ABAP Workbench Overview Object Navigator


1-2-1 Create the function group ZBUPA## in the development class ZBUPA.
1-2-2 To save time, copy the top include of function group ZBUPAXX into the top
include of your function group.
1-2-3 Create the screen.
Screen number 0010
Description First contact
Screen type Subscreen
Text field BUT000-ZZCNT_FIRST
In-/Output field ZBUSFLDS-CNT_FIRST
Text field BUT000-ZZCNTID
In-/Output field BUT000-ZZCNTID
Output only ZTB001T-TEXT

1-2-4 Create the flow logic in the screen.


1-2-5 Look at your screen in test mode.

1-3 Creation of the screen event function modules


Specific SAP Basis functions unfortunately do not work in the dialog and batch / direct
input mode. . Because of this, you have to format and date fields for example for the
dialog. The event PBO converts the format DATS into CHAR 10. Event PAI carries out
a reconversion and check. That is also the reason for using a help structure for the data
field and not the database field.
1-3-1 Create event function module Z_ZC##_BUPA_PBO_ZC##10 for event
Process Before Output in your function group. Use the Coding Appendix as a
template.
1-3-2 Create event function module Z_ZC##_BUPA_PAI_ZC##10 for event Process
After Input in your function group. Use the Coding Appendix as a template.

SAP AG CR590 6-17


1-4 Add the screen in the Customizing in the BDT.
You have created your screen in the Development Workbench. It is not yet known to the
BDT. The Customizing for this still has to be carried out.
1-4-1 Navigate to the Easy Access Menu:
/n Enter /nbupt Use the area menu and not the Easy Access Tree.
BP Control Screen Layout
1-4-2 Create the field group for the view.

Field group 620 + ## group


(for example 620+11=field group 631)
Description Rating of first contact
Table BUT000
Field name ZZCNTID
Input field X

Field group 640 + ## group number


(for example 640+11=Field group
651)
Description Date of first contact
Table ZBUSFLDS
Field name CNT_FIRST
Input field X
1-4-3 Create and activate the application ZC##.
An application is only a Customizing entry, which groups elements of the SAP
Basis (e.g. screens, function modules).
BP Control Application
1-4-4 Create dataset ZD##10.
Datasets serve the purpose of grouping views. Later views are assigned within
the divisibility to the object part. (e.g. in the case of BP, this is the role.) You
determine which attributes are displayed in the dialog.
BP Control Divisibility Datasets

SAP AG CR590 6-18


1-4-5 Create the view ZS##10 for your screen 0010.
This view groups the relevant screen and event function modules together for
the screen and makes these elements known to the BDT.
BP Control Screen Layout Views
Description First contact
Application ZC##
Diff.Type 0
Dataset ZD##10
Entry View X
Dialog View X
Subscreen SAPLZBUPA##
0010
Data screen X
1-4-6 Enter the event function modules PAI and PBO in your view.
Process Before Output Z_ZC##_BUPA_PBO_ZC##10
Process After Input Z_ZC##_BUPA_PAI_ZC##10
1-4-7 Assign the field groups to your view ZS##10.
Fields groups are for controlling field status (display, required entry, optional
entry, hide) via the BDT.
BP Control Screen Layout Views
Assign field groups 620 + Group ##
640 + Group ##

1-5 Create a new section.


A section groups a number of views together in the dialog, and draws a frame with a title
around the views.
BP Control Screen Layout Sections
1-5-1 Create a new section.
Section ZA##10
Description Additional partner data ##
Title Additional partner data ##
1-5-2 Assign the section to your view.
Position number 1000010
View ZS##10

SAP AG CR590 6-19


1-6 Create a screen.
A screen includes one or more sections and represents one tab page in the dialog. The
position numbers in the screen sequence control the sequence of screens.
BP Control Screen Layout Screens
1-6-1 Create a new Screen.
Screen ZB##10
Description Additional partner data ##
Data screen X
BDT X
Screen type normal
1-6-2 Assign the section to the screen.

Position number 1000010


Section BUP009
Position number 2000010
Section ZA##10
1-6-3 Assign the screen to the screen sequence.
BP control Screen Sequence

Screen Sequence ZF##


Position number 800010
Screen ZB##10

SAP AG CR590 6-20


1-6-4 Check the assigned datasets and calling applications in the object part ZC##10.
The call of an object part (role) triggers the execution of the views (screens) and
function modules, which are assigned to the datasets and applications.
BP Control Divisibility Roles
Datasets BUA010
BUB010
BUP010
BUP020
BUP030
ZD##10
Calling Applications BUA
BUB
BUP
BUS
ZC##
1-6-5 Look at the result under:
Application Business Partner Create Role ZC##10

1-7 Create the following event function modules for the tables append. You will find
example coding in the Coding Appendix.
The function modules are created for the different events in function group. These
objects from the Development Workbench Objects are made known by the Customizing
to the BDT.
(SE80) SAP Menu Tools ABAP Workbench Overview Object Navigator

Event Function Module


ISSTA Initialize Z_ZC##_BUPA_EVENT_ISSTA
ISDAT Distribute/read data Z_ZC##_BUPA_EVENT_ISDAT
XCHNG Data changed? Z_ZC##_BUPA_EVENT_XCHNG
DSAVB Collect Data Z_ZC##_BUPA_EVENT_DSAVB
DLVE1 Initialize current memory. Z_ZC##_BUPA_EVENT_DLVE1

SAP AG CR590 6-21


1-8 Add the function modules to the Customizing in the BDT.
BUPT Menu BP Control Events

ISSTA
Position 7000## +10
Function module Z_ZC##_BUPA_EVENT_ISSTA
Call X
Application ZC##

ISDAT
Position 7000## +10
Function module Z_ZC##_BUPA_EVENT_ISDAT
Call X
Application ZC##

XCHNG
Position 7000## +10
Function module Z_ZC##_BUPA_EVENT_XCHNG
Call X
Application ZC##

DSAVB
Position 7000## +10
Function module Z_ZC##_BUPA_EVENT_DSAVB
Call X
Application ZC##

DLVE1
Position 7000## +10
Function module Z_ZC##_BUPA_EVENT_DLVE1
Call X
Application ZC##

SAP AG CR590 6-22


Exercises

Unit: Extensions with Table-participating Applications


Topic: Extended Check

At the conclusion of this exercise, you will be able to:


Add additional checks for fields, without having to make modifications

Entries made by processors should be verified to ensure that at least one


vowel is in the name.

2-1 Create a function module for the additional check of view BUP300.
(SE80) SAP Menu Tools ABAP Workbench Overview Object Navigator
Function Group ZC##

2-2 Define the additional check in the Customizing.


Menu BUPT BP control Screen Layout Views Additional Checks

2-3 Check the result in the dialog. Process a word without vowels and try to switch the
screen. An error message will be displayed.
BUPT Menu Application Business Partner Create Role ZC##10

SAP AG CR590 6-23


Solutions

Unit: Extensions with Table-participating Applications


Topic: Extension of a BDT object via a table append

1-1 Look at the prepared DDIC extensions.


(SE11) SAP Menu Tools ABAP Workbench Development Data Dictionary
1-1-1 The name of the table append for the customer table BUT000 is ZBUT000.
1-1-2 The name of the check table for the field Rating is ZTB001.

1-2 Create the first contact screen.


(SE80) SAP Menu Tools ABAP Workbench Overview Object Navigator
1-2-1 Create the function group ZBUPA## in the development class ZBUPA. Select
the development class and the type ZBUPA. The structure of the development
class ZBUPA is visible. Choose with the right button on the mouse ZBUPA,
function group and create.
1-2-2 Copy the top include of function group ZBUPAXX into the top include of your
function group. Select function group ZBUPAXX and mark all data definitions
in IncludesTop include LZBUPAXXTOP. Copy all definitions including the
message-ID into your function group LZBUPA##TOP.
1-2-3 Create the screen.
(SE80) SAP Menu Tools ABAP Workbench Overview Object
Navigator Choose with right mouse button ZBUPA## Create Screen
Screen number 0010
Description First contact
Screen type Subscreen
Text field BUT000-ZZCNT_FIRST
In-/Output field ZBUSFLDS-CNT_FIRST
Text field BUT000-ZZCNTID
In-/Output field BUT000-ZZCNTID
Output only ZTB001T-TEXT

SAP AG CR590 6-24


1-2-4 The screen flow logic is created. The service function modules BUS_PAI and
BUS_PBO are called in PAI and PBO. To support the F4-help, you have to
create a process-on-value request as described in the Coding Appendix. After
exercise 2-4-2, you have to change the field group in the coding to the field
group of the date field.
1-2-5 Look at your screen in test mode.
(SE80) SAP Menu Tools ABAP Workbench Overview Object
Navigator Screens Choose Screen Number with right mouse button
Test

1-3 Event function modules are created for the screen.


1-3-1 Create event function module Z_ZC##_BUPA_PBO_ZC##10 for event
Process Before Output in your function group. Use the Coding Appendix as a
template.
1-3-2 Create event function module Z_ZC##_BUPA_PAI_ZC##10 for event Process
After Input in your function group. Use the Coding Appendix as a template.

1-4 Add the screen to the Customizing in the BDT.


Navigate to the Easy Access Menu:
/n Enter /nbupt Use the area menu and not the Easy Access Tree.
BP Control Screen Layout
1-4-1 Create the field group for the view.

Field group 620 + ## group


(for example 620+11=field group
631)
Description Rating of first contact
Table BUT000
Field name ZZCNTID
Input field X

Field group 640 + ## group number


(for example 640+11=Field group
651)
Description Date of first contact
Table ZBUSFLDS
Field name CNT_FIRST
Input field X

SAP AG CR590 6-25


1-4-2 Create and activate the application ZC##.
BP Control Application
1-4-3 Create dataset ZD##10 with description dataset ##.
BP Control Divisibility Datasets
1-4-4 Create the view ZS##10 for your screen 0010.
BP Control Screen Layout Views
Description First contact
Application ZC##
Diff.Type 0
Dataset ZD##10
Entry View X
Dialog View X
Subscreen SAPLZBUPA##
0010
Data screen X
1-4-5 Enter the event function modules PAI and PBO in your view.
Process Before Output Z_ZC##_BUPA_PBO_ZC##10
Process After Input Z_ZC##_BUPA_PAI_ZC##10
1-4-6 Assign the field groups to your view ZS##10.
BP Control Screen Layout Views Assign View to Field Groups
Assign field groups 620 + Group ##
640 + Group ##

1-5 Create a new section.


BP Control Screen Layout Sections
1-5-1 Create a new section.
Section ZA##10
Description Additional partner data ##
Title Additional partner data ##
1-5-2 Assign the views to the section.
BP Control Screen Layout Sections Assign Sections to Views
Position number 1000010
View ZS##10

SAP AG CR590 6-26


1-6 Create a screen.
BP Control Screen Layout Screens
1-6-1 Create a new Screen.
Screen ZB##10
Description Additional partner data ##
Data screen X
BDT X
Screen type normal
1-6-2 Assign the views to the section.
BP Control Screen Layout Screens Assign Screen to Sections

Position number 1000010


Section BUP009
Position number 2000010
Section ZA##10
1-6-3 Assign the screen to the screen sequence.
BP Control Screen Sequences Assign Screen Sequence to Screens

Screen Sequence ZF##


Position number 800010
Screen ZB##10
1-6-4 Check the assigned datasets and calling applications in role ZC##10
BP Control Divisibility Roles
Datasets BUA010
BUB010
BUP010
BUP020
BUP030
ZD##10
Calling Applications BUA
BUB
BUP
BUS
ZC##
1-6-5 Look at the result under:
Application Business Partner Create Role ZC##10

SAP AG CR590 6-27


1-7 Create the following event function modules for the tables append. You will find
example coding in the Coding Appendix.
(SE80) SAP Menu Tools ABAP Workbench Overview Object Navigator
Choose Function Group with right Mouse Button Function Module Create

Event Function Module


ISSTA Initialize Z_ZC##_BUPA_EVENT_ISSTA
ISDAT Distribute/read data Z_ZC##_BUPA_EVENT_ISDAT
XCHNG Data changed? Z_ZC##_BUPA_EVENT_XCHNG
DSAVB Collect Data Z_ZC##_BUPA_EVENT_DSAVB
DLVE1 Initialize current memory. Z_ZC##_BUPA_EVENT_DLVE1

SAP AG CR590 6-28


1-8 Add the function modules to the Customizing in the BDT.
BUPT Menu BP Control Events Select Event Assign Events to Function
Modules

ISSTA
Position 7000## +10
Function module Z_ZC##_BUPA_EVENT_ISSTA
Call X
Application ZC##

ISDAT
Position 7000## +10
Function module Z_ZC##_BUPA_EVENT_ISDAT
Call X
Application ZC##

XCHNG
Position 7000## +10
Function module Z_ZC##_BUPA_EVENT_XCHNG
Call X
Application ZC##

DSAVB
Position 7000## +10
Function module Z_ZC##_BUPA_EVENT_DSAVB
Call X
Application ZC##

DLVE1
Position 7000## +10
Function module Z_ZC##_BUPA_EVENT_DLVE1
Call X
Application ZC##

SAP AG CR590 6-29


Solutions

Unit: Extensions with Table-participating Applications


Topic: Extended Check

2-1 Create a function module for the additional check of view BUP300.
(SE80) SAP Menu Tools ABAP Workbench Overview Object Navigator
Function Group ZC## Choose Function Modules with Right Mouse Button
Create
Use Z_ZC##_BUPA_PAI_BUP300 in the Coding Appendix as a template.

2-2 Define the additional check in the Customizing.


Menu BUPT BP control Screen Layout Views Additional Checks

2-3 If you try to save a business partner in your role without vowels the in name field, an
error message will be displayed.
BUPT Menu Application Business Partner Create Role ZC##10

SAP AG CR590 6-30


Extensions with Table-Owning Applications:

Contents:
Create Table
Create Screen
Create Events for the Screen
Create Events for the Program Logic
GUI Menu

SAP AG 2002

SAP AG CR590 7-1


Extensions with Table-Participating Applications:
Unit Objectives

At the conclusion of this unit, you will be able to:

Explain the extension of the SAP BP by means of


own tables
Describe the BDT Customizing for tables
Describe the aim of the program logic and its function
Explain the possibilities for extending the GUI menu

SAP AG 2002

SAP AG CR590 7-2


Extensions with Table-Owning Applications:
Overview Diagram

Course Overview Program Logic

Extensions with Table-


Introduction to the BDT
Participating Applications

Extensions with Table-Owning


BDT Basics
Applications

Service Programs and


Dialog
Functionality

SAP AG 2002

SAP AG CR590 7-3


Extensions with Table-Owning Applications:
Business Scenario

You need to extend the SAP BP by way


of a table control. The table control should
include business partner hobbies.

SAP AG 2002

SAP AG CR590 7-4


Overview of Development with the BDT

Applications
SAP
SAP SAP
SAP Customer
Customer
Application
Application II Application
Application IIII Application
Application 77
SAP BP
(BUPA)

Development

Development
DDIC BDT-Control Tables
Workbench

SAP AG 2002

For table-participating applications, you have the same development areas as you have for table-
owning applications -Data Dictionary (DDIC), Development Workbench and BDT control tables.

SAP AG CR590 7-5


Step 1: Data Dictionary

Applications
SAP
SAP SAP
SAP Customer
Customer
Application
Application II Application
Application IIII Application
Application

Table BUT000 Table ZZ_...


... ...
... ...
... ...
Append structure ...
ZZ_... ...
ZZ_... ...

Development in the DDIC


SAP AG 2002

In the first step an own table is created in the data dictionary (DDIC).

SAP AG CR590 7-6


Step 2: Create Screen

Function
Function Modules
Group
ISSTA
ISDAT Events for each
application
ISDST
PBC Module
...

Program Logic
PBC GET
... Events for each
COLLECT table
PBO Module ...
Screen ..._PBC_..
PBO
...
..._PBO_.. Events for each
0020 Hobby
PAI Module view
..._PAI_..

PAI ...
...
SAP AG 2002

In the second step, a screen with Process Before Output (PBO) and Process After Input (PAI)
modules is created. In these modules the BDT service function modules are called up.
A Process Before Call (PBC) module is still needed for sorting the data for the table control.

SAP AG CR590 7-7


Step 3: Create Function Modules

Function
Function Modules
Group
ISSTA
ISDAT Events for each
application
ISDST
PBC Module
...

Program Logic
PBC GET
... Events for each
COLLECT table
PBO Module ...
Screen ..._PBC_..
PBO
...
..._PBO_.. Events for each
0020 Hobby
PAI Module view
..._PAI_..

PAI ...
...
SAP AG 2002

In the third step, the function modules are created for the events for each application and view.
If the table-owning application allows a table-participating application an append structure, the
table-owning application must make available a so-called GET and COLLECT function module
(events per table) for communication with other applications. In this way the table-participating
application is able to exchange the current table content with the owning application.
Read data (GET FunMod):
With this function module, the table-participating applications are able to determine the current
content of the table.
Collect data (COLLECT FunMod):
With this function module, a table-participating application is able to export to the table-owning
application, the data of fields that it has attached.

SAP AG CR590 7-8


Mandatory Events

ISSTA Initialization

ISDAT Read data from DB

FCODE Carry out own function code

XCHNG Check whether data has been changed

DCHCK Check data before saving

DTAKE Note data in global memory

DSAVC Complete data (internal number)

DSAVE Save data on DB

DLVE1 Initialize current memory

DLVE2 Initialize global memory

SAP AG 2002

All the events represented by the dark blocks are necessary events.

SAP AG CR590 7-9


Global Memory versus Current Memory

Current Memory
Table-owning applications
All table-participating applications
Global Memory
Only table-owning applications

SAP AG 2002

Service functions like direct input or the transfer mode make it necessary to differentiate between
the current and global memory.
The current memory works with the structure or internal table of the current object. Table-owning
and participating applications also have a current memory.
The global memory works with the internal table of one or more objects. Only table-owning
applications have a global memory.

SAP AG CR590 7-10


Data Administration: Participating Application

Current new old


Memory
Function Group

DTAKE

Global new old


ISDAT Memory

DSAVE

DB
SAP AG 2002

The current memory contains the data of the instance (for example, Business Partner) that is
currently being processed. Old and new data statuses are separated. The old status is taken from the
data that is read at event ISDAT (table-owning application). At this point new and old data are
identical. During maintenance, the new current memory is updated after each entry.
The global memory contains the data for all instances that you have processed but not yet saved in
the database. For each table, there is only one global memory. Data of table-participating
applications is also included. Also in the case of the global memory, a differentiation is made
between the old and new status, and they are stored separately. The old data represents the current
database status. For this reason the current database status is created for an instance only when data
is maintained for the first time. This is done in the event DTAKE. If the same instance is maintained
again without saving, the old status may no longer be changed. The new data is transferred from the
new status of the current memory into the new status of the global memory.
Events
In event ISDAT, you look for data in the global memory. If no data for the current instance has
been stored in the global memory, the data is read from the database.
In event DTAKE, the table-owning application writes the data from the old and new current
memory to the global memory.
In event DSAVE, you check if there are differences between the new and old global memory. If
this is the case, changes have taken place and the database must be updated.

SAP AG CR590 7-11


Data Administration: Participating Application

Function Group Function Group


Table-Owning Application Table-Participating
(GET FM) Application

ISDST
Current new old Current new old
Memory Memory
DSAVB
DTAKE (COLLECT FM)

Global
ISDAT new old
Memory

DSAVE

DB
SAP AG 2002

Table-participating and table-owning applications have in each case their own function groups with
decoupled memory areas. For this reason, the table-participating application gets, at event ISDST,
the current memory of the table-owning application by calling the GET function module. Old and
new data is saved.
In event DSAVB, data is transferred by the table-participating application to the table-owning
application by calling the COLLECT function module. Only new data from the current memory and
the table append is transferred.
The table-owning application is responsible for writing the data to the database in event DSAVE.

SAP AG CR590 7-12


Extension of the GUI Menu

DCUAD Set menu


BDT Events
DCUAC Change menu

Add own menu


Add additional functions
Activate / deactivate functions
Create link menu function <-> pushbutton

SAP AG 2002

The BDT provides the events DCUAD (set menu) and DCUAC (change menu) for adding GUI
menus and functions.
By means of these events it is possible to
add own menus and functions to the standard menus and functions
activate / deactivate functions
create links between pushbuttons and menu functions

SAP AG CR590 7-13


Extensions with Table-Owning Applications: Unit
Summary

You are now able to:

Explain the extension of the SAP BP by


means of own tables
Describe the BDT Customizing for
tables
Describe the aim of the program logic
and its function
Explain the possibilities for extending
the GUI menu

SAP AG 2002

SAP AG CR590 7-14


Exercises

Unit: Extension with Table-owning Application


Topic: Extension of a BDT object via a table

At the conclusion of this exercise, you will be able to:


Extend existing BDT objects with the help of tables.

The processor should be able to save hobbies of a business partner. The


standard SAP Business Partner should be extended without modification
for this purpose.

1-1 Look at the prepared DDIC extensions.


(SE11) SAP Menu Tools ABAP Workbench Development Data Dictionary
1-1-1 Write down the fields of table ZBUTHOBBY.
_______________________________
1-1-2 Are there any peculiarities in structure ZBUSHOBBY?
_______________________________
1-1-3 How does BDT know about the table?
_______________________________

SAP AG CR590 7-15


1-2 Create the screen Hobby.
You have to create a screen to display the extended attributes of table ZBUTHOBBY.
The additional attributes of table ZBUTHOBBY should be displayed at table control. It
should be possible to delete individual lines via a function.
(SE80) SAP Menu Tools ABAP Workbench Overview Object Navigator

1-2-1 Create a Screen in your function group ZC##.


Properties
Screen number 0020
Description Hobby ##
Screen type Subscreen

SAP AG CR590 7-16


Screen Elements:
Table Control TCTRL_ZBUTHOBBY
Table type Entry
with Column heading
Configurable
Separators vertical
horizontal
Line selection Multiple
Column selection None
with selection column GT_ZBUTHOBBY-XMARK

Text field/Title in Table Control ZBUTHOBBY-HOBBY


(out of DDIC)

In-/Output field in Table Control GT_ZBUTHOBBY-HOBBY

Pushbutton PUSH_ZC##_HOBBY_DELE
ICON-Name ICON_DELETE_ROW
Function code ZC##_HOBBY_DELE

In-/Output field ZBUSFLDS-POSTXT_ZBUTHOBBY


Output only

1-2-2 Create the event function module Z_ZC##_BUPA_PBC_ZC##20 according to


the template in the coding appendix.
(SE80) SAP Menu Tools ABAP Workbench Overview Object
Navigator

SAP AG CR590 7-17


1-3 Make the necessary entries in the BDT.
1-3-1 Create a field group.
BUPT Menu BP Control Screen Layout Field Groups
Field group 660 + ## group number
Description Hobby ##
Table Control X

Table GT_ZBUTHOBBY
Field name HOBBY
Input field X

Table ZBUTHOBBY
Field name HOBBY
Input field O
1-3-2 Create a view.
BUPT Menu BP Control Screen Layout Views
View ZS##20
Description Hobby ##
Application ZC##
Diff-Typ 0
Dataset ZD##10
Entry View X
Dialog View X
Subscreen SAPLZBUPA##
0020
Process Before Call Z_ZC##_BUPA_PBC_ZC##20
Data screen X
1-3-3 Assign the field group to a view.

SAP AG CR590 7-18


1-3-4 Create section ZA##20 and assign the view.
BUPT Menu BP Control Screen Layout Sections

Description Additional partner data ##


Title Additional partner data ##
Position number 100001
View ZS##20
1-3-5 Assign screen to section.

Screen ZB##10
Position number 100010
Section BUP009

Position number 200010


Section ZA##10

Position number 300010


Section ZA##20

SAP AG CR590 7-19


1-4 Create the necessary event function modules.
(SE80) SAP Menu Tools ABAP Workbench Overview Object Navigator

Event Function module


ISSTA Initialize already done in exercise 1
Z_ZC##_BUPA_EVENT_ISSTA
ISDAT Distribute/read data extend from exercise 1
Z_ZC##_BUPA_EVENT_ISDAT
XCHNG Data changed? Extend from exercise 1
Z_ZC##_BUPA_EVENT_XCHNG
FCODE Own function code Z_ZC##_BUPA_EVENT_FCODE
DTAKE From current into global Z_ZC##_BUPA_EVENT_DTAKE
memory
DSAVC Complete data Z_ZC##_BUPA_EVENT_DSAVC
DSAVE Save data Z_ZC##_BUPA_EVENT_DSAVE
Update module:
Z_ZC##_BUPA_UPDATE
DLVE1 Initialize current memory. extend from exercise 1
Z_ZC##_BUPA_EVENT_DLVE1
DLVE2 Initialize global memory Z_ZC##_BUPA_EVENT_DLVE2

1-5 Make the necessary entries in the BDT. The position numbers are (7000## + 10) and
application ZC##.
BUPT Menu BP Control Events

SAP AG CR590 7-20


1-6 Store the function code in the BDT.
BUPT Menu BP Control GUI-functions Additional functions
The pushbutton on your screen triggers the function code. The function is recognized by
the BDT. The BDT reads the Customizing and executes the function module of your
application ZC## in event FCODE.
Function code ZC##_HOBBY_DELE
Function text Delete hobby
Application ZC##
Menu 2
Save Mode X
Create
Save Mode X
Change
Transfer Mode X
Create
Transfer Mode X
Change

1-7 Check the result in the Business Partner dialog.


BUPT Menu Application Business Partner Create Role ZC##10

SAP AG CR590 7-21


Exercises

Unit: Extension with Table-owning Application


Topic: Change GUI menu

At the conclusion of this exercise, you will be able to:


Change the standard GUI menu by using a BDT event

The processor should be able to call up the function delete hobby via the
GUI menu.

2-1 Explain the function of the function module. Z_ZCXX_BUPA_EVENT_DCUAC.


(SE80) SAP Menu Tools ABAP Workbench Overview Object Navigator

2-2 Create function module Z_ZC##_BUPA_EVENT_DCUAC for event DCUAC for


changing the GUI-Menu.
(SE80) SAP Menu Tools ABAP Workbench Overview Object Navigator

2-3 Performe the Customizing in the BDT.


BUPT Menu BP Control Events

2-4 Check the result in the dialog.


BUPT Menu Application Business Partner Create Role ZC##10

SAP AG CR590 7-22


Solutions

Unit: Extension with Table-owning Application


Topic: Extension of a BDT object via a table

1-1 Look at the prepared DDIC extensions.


(SE11) SAP Menu Tools ABAP Workbench Development Data Dictionary
1-1-1 Client, partner and hobby are the fields in table ZBUTHOBBY.
1-1-2 The peculiarity in the structure ZBUSHOBBY is a character field KZ to store
the activity (update, delete, insert) for each record. Depending on the activity,
the records in direct input are updated, deleted and inserted in the corresponding
table by the BDT.
1-1-3 The table ZBUTHOBBY and other attributes are customized as follows:
Menu BUPT BP control Tables

SAP AG CR590 7-23


1-2 Create the screen hobby.
(SE80) SAP Menu Tools ABAP Workbench Overview Object Navigator

1-2-1 Create the screen in your function group ZC##.


(SE80) SAP Menu Tools ABAP Workbench Overview Object
Navigator Choose screen with right mouse button Create
Properties
Screen number 0020
Description Hobby ##
Screen type Subscreen

SAP AG CR590 7-24


Screen Elements:
Table Control TCTRL_ZBUTHOBBY
Table type Entry
with Column heading
Configurable
Separators vertical
horizontal
Line selection Multiple
Column selection None
with selection column GT_ZBUTHOBBY-XMARK

Text field/Title in Table Control ZBUTHOBBY-HOBBY


(out of DDIC)

In-/Output field in Table Control GT_ZBUTHOBBY-HOBBY

Pushbutton PUSH_ZC##_HOBBY_DELE
ICON name ICON_DELETE_ROW
Function code ZC##_HOBBY_DELE

In-/Output field ZBUSFLDS-


POSTXT_ZBUTHOBBY
Output only

1-2-2 Create the event function module Z_ZC##_BUPA_PBC_ZC##20 according to


the template in the coding appendix.
(SE80) SAP Menu Tools ABAP Workbench Overview Object
Navigator Choose function modules with right mouse button Create

SAP AG CR590 7-25


1-3 Make the necessary entries in the BDT.
1-3-1 Create a field group.
BUPT Menu BP Control Screen Layout Field Groups Field
Groups Assignment Field Group -> Fields
Field group 660 + ## group number
Description Hobby ##
Table Control X

Table GT_ZBUTHOBBY
Field name HOBBY
Input field X

Table ZBUTHOBBY
Field name HOBBY
Input field O
1-3-2 Create a view.
BUPT Menu BP Control Screen Layout Views
View ZS##20
Description Hobby ##
Application ZC##
Diff-Typ 0
Dataset ZD##10
Entry View X
Dialog View X
Subscreen SAPLZBUPA##
0020
Process Before Call Z_ZC##_BUPA_PBC_ZC##20
Data screen X
1-3-3 Assign the field group to a view.
BUPT Menu BP Control Screen Layout Views Assign View to
Field Group

SAP AG CR590 7-26


1-3-4 Create section ZA##20 and assign the view.
BUPT Menu BP Control Screen Layout Sections

Description Additional partner data ##


Title Additional partner data ##
Position number 100001
View ZS##20
BUPT Menu BP Control Screen Layout Sections Assign section
to View
1-3-5 Assign screen to section.
BUPT Menu BP Control Screen Layout Screens Assign Screen to
sectionse

Screen ZB##10
Position number 100010
Section BUP009

Position number 200010


Section ZA##10

Position number 300010


Section ZA##20

SAP AG CR590 7-27


1-4 Create the necessary event function modules.
(SE80) SAP Menu Tools ABAP Workbench Overview Object Navigator
Choose function modules with right mouse button Create

Event Function Module


ISSTA Initialize already done in Exercise 1
Z_ZC##_BUPA_EVENT_ISSTA
ISDAT Distribute/read data extend from exercise 1
Z_ZC##_BUPA_EVENT_ISDAT
XCHNG Data changed? Extend from exercise 1
Z_ZC##_BUPA_EVENT_XCHNG
FCODE Own function code Z_ZC##_BUPA_EVENT_FCODE
DTAKE From current into global Z_ZC##_BUPA_EVENT_DTAKE
memory
DSAVC Complete data Z_ZC##_BUPA_EVENT_DSAVC
DSAVE Save Data Z_ZC##_BUPA_EVENT_DSAVE
Update module:
Z_ZC##_BUPA_UPDATE
DLVE1 Initialize current memory. extend from exercise 1
Z_ZC##_BUPA_EVENT_DLVE1
DLVE2 Initialize global memory Z_ZC##_BUPA_EVENT_DLVE2

1-5 Make the necessary entries in the BDT. The position numbers are (7000## + 10) and
application ZC##. Select events and assign function modules to them. You only have to
assign the same function module once.
BUPT Menu BP Control Events Select Event Assign Events to Function
Modules

SAP AG CR590 7-28


1-6 Store the function code in the BDT.
BUPT Menu BP Control GUI Functions Additional Functions
Function code ZC##_HOBBY_DELE
Function text Delete hobby
Application ZC##
Menu 2
Save Mode X
Create
Save Mode X
Change
Transfer Mode X
Create
Transfer Mode X
Change

1-7 Check the result in the Business Partner dialog.


BUPT Menu Application Business Partner Create Role ZC##10

SAP AG CR590 7-29


Solutions

Unit: Extension with Table-Owning Application


Topic: Change GUI menu

2-1 The Function Module Z_ZCXX_BUPA_EVENT_DCUAC is for reading the current


status of all function modules and for setting the status of the deletion of a hobby
depending on coding rules.
(SE37) SAP Menu Tools ABAP Workbench Development Function
Builder

2-2 Create function module Z_ZC##_BUPA_EVENT_DCUAC for event DCUAC for


changing the GUI menu.
(SE80) SAP Menu Tools ABAP Workbench Overview Object Navigator
Choose function modules with right mouse button Create

Be sure, that the global constant for the pushbutton in the top include
GC_FCODE_HOBBY_DELE are changed into your Pushbutton name
PUSH_ZC##_HOBBY_DELE, and that the parameter for calling
'BUS_FMOD_STATUS_GET' is the function group of the table control.

2-3 Perform the Customizing in the BDT and assign the event DCUAC to the function
module.
Menu BUPT BP control Events Assign Event DCUAC to
Z_ZC##_BUPA_EVENT_DCUAC

2-4 Check the result in the dialog.


BUPT Menu Application Business Partner Create Role ZC##10

SAP AG CR590 7-30


Service Programs and Functionality

Contents:
Processing Modes
Interfaces
Field Groupings
Search Help
Change Documents
Archiving
Visual Configuration Tool
Where-Used Lists

SAP AG 2002

SAP AG CR590 8-1


Service Programs and Functionality: Unit
Objectives

At the conclusion of this unit, you will be able to:

Explain the different processing modes of the BDT


Explain the steps for extending the field groupings
Explain the steps for extending an existing search
help
Describe change documents in the BDT
Describe the concept of archiving in the BDT
Work with the Visual Configuration Tool
Work with and customize where-used lists

SAP AG 2002

SAP AG CR590 8-2


Service Programs and Functionality: Overview
Diagram

Course Overview Program Logic

Extensions with Table-


Introduction to the BDT
Participating Applications

Extensions with Table-


BDT Basics
Owning Applications

Service Programs and


Dialog
Functionality

SAP AG 2002

SAP AG CR590 8-3


Processing Modes: Topic Objectives

At the conclusion of this topic, you will be able to:

Explain the different processing modes of the BDT

SAP AG 2002

SAP AG CR590 8-4


Targets of the Processing Modes

Save Mode
Changes to a BP are either saved or discarded before leaving
the maintenance
Transfer Mode
Maintenance via dialog, save is triggered by external application
Example:
Contract calls BP maintenance
BP data is noted
The BP data is not saved until the contract is saved
Direct Input
Mass insert / update!!

SAP AG 2002

There are several prerequisites for data maintenance:


1. Direct and online maintenance via dialog. (SAVE mode)
2. Maintenance via dialog with external trigger for saving. (Transfer mode)
3. Maintenance via direct input without dialog. (Direct Input)
Direct input enables mass insert/updates. Databases create an index anew after each DB commit. A
DB commit is carried out after a few hundred instances for better performance.

SAP AG CR590 8-5


Processing Modes: Save Mode

Owning Participating
Application Application
Save Function Current
Memory

Event DSAVB Current DSAVB Current


Collect data Memory Memory

DTAKE
Event DTAKE
Note data
Current
Memory
Event DSAVC
Complete data
DSAVC

Event DSAVE DSAVE


Save data

DB
SAP AG 2002

Program logic events in the save mode when performing save.

SAP AG CR590 8-6


Processing Modes: Transfer Mode

Contract Transfer Function


Contract No.
SAP-
Contract type
GP Event DSAVB
Policyholder Change Collect data
Beneficiary Change
Event DTAKE
Note data

Event DSAVC
Save
Complete data

Event DSAVE
Save data

SAP AG 2002

The transfer mode allows you to jump to a BDT object, into creation / maintenance, without saving
the data directly on the database. The trigger for saving or discarding comes from the leading
application. In case of saving, the events DSAVC and DSAVE are performed.

SAP AG CR590 8-7


Processing Modes: Direct Input (Flow)

Dialog Direct Input

Initial screen: Entries Initial screen: Data from file

Initial Screen: PAI Initial Screen: PAI

Event ISDAT (Read data) Event ISDAT (Read data)

Event ISDST (Distribute data) Event ISDST (Distribute data)

Data screen: Entries Data screen: Data from file

Data screen PAI Data screen PAI

Event DSAVB (Collect data) Event DSAVB (Collect data)

Event DTAKE (Transfer data) Event DTAKE (Transfer data)

Event DSAVE (Save data) Event DSAVE (Save data)


Important: Mass insert / update!!

SAP AG 2002

Note: Direct input is not used in CRM. Instead, mass data is processed via the Middleware.
The two diagrams compare events of the dialog and of direct input with each other.
The direct input mode calls the same events, however without running through screens.
Event DSAVE will only be performed in direct input after a few hundred objects (for example, BP),
while this takes place in the dialog mode after each maintained object (for example, BP).

SAP AG CR590 8-8


Interfaces: Topic Objectives

At the conclusion of this topic, you will be able to:

Explain what is involved in working with


direct input
Name additional interfaces

SAP AG 2002

SAP AG CR590 8-9


Direct Input (Events)

DINP1 Get header data


DINP2 Get and note data records

SAP AG 2002

Note:
Direct input is not used in CRM. Instead, mass data is processed via the Middleware.
To enhance the batch input procedure, the system offers the direct input technique, especially for
transferring large amounts of data. In contrast to batch input, this technique does not create sessions,
but stores the data directly. No screens are processed. To directly enter the data into the
corresponding database tables, the system calls a number of function modules that carry out any
necessary checks. In case of errors, the direct input technique provides a restart mechanism.
However, to be able to activate the restart mechanism, direct input programs must only be executed
in the background.
The BDT uses the event technique to work with direct input.
DINP1 gets the header data of an application object in a file-structure. This technique no longer
needs to be programmed for extensions.
DINP2 reads data records and checks / saves data in corresponding applications. To extend direct
input by an own table, you only have to create DINP2 for table-owning application. Table-
participating applications do not have to extend DINP2, because save processes are carried out the
by table-owning application.

SAP AG CR590 8-10


Direct Input: Flow without the BDT

Sender
Sender Receiver
Receiver
structure
structure structure
structure

Conversion part Function part Log: incorrect


and currency records
conversion Prelim. run
Data pool:
Frontend Unix Check incorrect
or 1 Sender Structure 1 records
Data selec Excel
Read data 2 SF1 SF2 SF3 SF4 2 Save INDX:current
-tion file
record status
program Commit
n n UNIX file:
EF1 EF2 EF3 EF4
Subs. run incorrect
Receiver Structure records

Restart

Customer
SAP

SAP AG 2002

This diagram represents direct input flow without the BDT. The customer creates a file for import
into the SAP System. The sender structure in the file is identical to the sender structure for reading
in the SAP System. The sender structure will be mapped to the receiver structure (BUS_DI). In the
DI function part, the data will be checked by five events and loaded into the system. Several log files
are written and incorrect records are stored in a separate file.

SAP AG CR590 8-11


Direct Input: Flow with the BDT I

Mapping
File DI BDT

Sender Structure

Automatic Integration
Receiver Structure
Prelim.
Prelim. run
run ISSTA
ISSTA

Check
Check DINP1
DINP1

Save
Save ISDAT
ISDAT

Commit
Commit DINP2
DINP2
...
Subs.
Subs. run
run DSAVE
DSAVE

SAP AG 2002

The BDT uses the functions of DI while using all event function modules. For direct input there are
the additional events DINP1 (header data) and DINP2 (detailed data of applications).

SAP AG CR590 8-12


Direct Input: Flow with the BDT II

Start A
B

ISSTA no
Change?

ja
DINP1
DCHCK

After entry
(header views)
yes
Error?

no
ISDAT

DTAKE
ISDST

DLVE1
DINP2

After entry
(data views) Block end no
or last data B
record?

DSAVB yes

DSAVE
AUTH1

DLVE2
XCHNG

Last no
A
data record? B

yes

End

Diagram 3: Events for maintenance without dialog

SAP AG 2002

In the events, direct input uses the same coding as in the dialog mode. DINP1 and DINP2 are
additional events for working with direct input.

SAP AG CR590 8-13


Direct Input (Data Transfer)

Entry File
Rec. type Table Del. Flag Data
2 BUT000 SPACE 0030001234567...
2 BUT020 SPACE 0030001234567...
2 BUT021 SPACE 0031122334455...
2 BUT0BK SPACE 0030001234567...

BDT
Distribute data records to applications

Application 1 Application 2

SAP BP Data SAP BP Addresses


2 BUT000 SPACE 0030001234567... 2 BUT020 SPACE 0030001234567...
2 BUT0BK SPACE 0030001234567... 2 BUT021 SPACE 0031122334455...

SAP AG 2002

The complete file structure is separated into DI structures for each application. Each application
carries out a DINP2 function module to check / save the data.

SAP AG CR590 8-14


Steps for Extending the Direct Input

Create a structure with field type CHAR


Append structure to main structure (in BP BUS_DI)
Customize append name (not structure name) in the BDT
(control->tables)
Create the function module DINP2
Customize the BDT

SAP AG 2002

SAP AG CR590 8-15


Other Interfaces

All kinds of interfaces allowed


Other interfaces call the BDT and use data
Use of BDT function modules beginning with BUS_FOREIGN_... )
The external interface is used in IBU Utilities for incoming
documents

SAP AG 2002

External interfaces are designed solely in external maintenance transactions (abbreviation: external
maintenance). There are no restricting factors for the distribution of data fields on the screens of this
maintenance transaction.
External maintenance and BDT maintenance can be fully integrated. You can call the BDT
maintenance in transfer mode from the external maintenance. Data can be changed in both types of
maintenance. Changes are also visible in each type of maintenance.
Each external interface is allowed to call the BDT via the "BUS_FOREIGN_..." function modules.

SAP AG CR590 8-16


Field Grouping: Topic Objectives

At the conclusion of this topic, you will be able to:

Explain the steps for extending field groupings


by own criteria

SAP AG 2002

SAP AG CR590 8-17


Targets of Field Grouping

Field Status
Hide
Display
Required entry
Optional entry
Determine field status of related fields together
Different field grouping criteria
Field grouping criteria can be added by the applications
(Examples from BP: Co.Code by FI: Sales Org. by SD)
Programmed field grouping

SAP AG 2002

Field groupings can be made using criteria of your choosing. The BDT supports the application
when creating a maintenance transaction for one criterion and links the settings for various criteria
during the runtime using predefined rules.

SAP AG CR590 8-18


Field Grouping: Field Groups

Field Groups Fields


Name
Name 11 NAME_ORG1
NAME_ORG1
SORT
SORT 11
Search terms
SORT
SORT 22

Group fields into field groups if they


belong together logically
are displayed / hidden together
Field grouping per field group
Function module for programmed field grouping
Assignment view --> field groups
Assignment field group --> screen fields

SAP AG 2002

SAP AG CR590 8-19


Field Grouping: Field Status Bar

Field status bar 1 (200 characters) Field status bar 2 Field status bar 3

+ * . - * ......... .........

Field group: 1 2 3

Field Status
+ Required entry
. Optional entry
* Display
- Hide
SPACE Not specified
Position in status bar corresponds to field group number
(at present:maximum of 1750 field groups)

SAP AG 2002

Each instance of the field grouping criterion is stored in the database for one record. Each position in
the record represents one field group number. There are five values allowed (+, ., *,- and SPACE).
Radio buttons facilitate the Customizing in the maintenance view.

SAP AG CR590 8-20


Search Help: Topic Objectives

At the conclusion of this topic, you will be able to:

Explain the steps for extending an existing


search help

SAP AG 2002

SAP AG CR590 8-21


Targets for Search Help

Each application can add elementary search helps


Activate / deactivate elementary search helps
Direct selection possible via '= ...'
Extensions without changes to objects
of the BDT
of other applications

SAP AG 2002

SAP AG CR590 8-22


Search Help

The search help of a different application can be extended via


the Data Dictionary without changing the original search help
Append the additional search help to the main search help
of the application
The elementary search help supports the extension of the
collective search help

SAP AG 2002

SAP AG CR590 8-23


Steps for Extending the Search Help

Create elementary search help


Append elementary search help to main search help
(for example, BP -> BUPA)
Transaction SE11
Function Goto --> APPEND search helps

SAP AG 2002

The elementary search help of customers or development partners extends the existing collective
search help (BP BUPA).

SAP AG CR590 8-24


Change Document Evaluation: Topic Objectives

At the conclusion of this topic, you will be able to:

Explain change documents in the BDT

SAP AG 2002

SAP AG CR590 8-25


Targets of Change Document Evaluation

Central object service of the BDT


Evaluation variants
In the dialog
Changes per object instance (such as partner changes)
Changes per object instance and field (field changes)
As a report
Change history (over several instances)
Divisibility
Add new tables
Add additional fields to existing tables
No changes to objects
of the BDT
of other applications

SAP AG 2002

SAP AG CR590 8-26


Change Document Evaluation: Realization

Write Change Documents


Change document object per application (if own table exists!)
Write change documents in event DSAVE
Evaluate Change Documents
Events
Event CHGD1 Transfer selection values
Event CHGD2 Collect change doc. objects with IDs
Event CHGD3 Change doc. header relevant?
Event CHGD4 Change doc. item relevant?
Call
Changes per object instance GUI function BUSA
Changes per obj.instance & field GUI function BUSI
Change history Report BUSCHDOC

SAP AG 2002

Change documents are a generic service within the BDT.


Change documents are written to the database in event DSAVE.
Evaluation processing takes place in event CHGD1-4.

SAP AG CR590 8-27


Archiving: Topic Objectives

At the conclusion of this topic, you will be able to:

Describe the concept of archiving in the context


of the BDT
Understand the events for archiving.

SAP AG 2002

SAP AG CR590 8-28


Archiving in the Context of the BDT

Standard SAP Archiving


Archiving object
Use of the ADK function modules (Archive Development Kit)
Archive administration with transaction SARA
Service Programs in the BDT
Program logic in reports
Processing of application data by
event function modules

SAP AG 2002

SAP standard archiving procedure. Advantages:


Infrastructure of the Archive Development Kit (ADK)
Log files of all archiving runs
Table checking and Customizing are easily integrated
Service programs in the BDT. Advantages:
The applications can be easily connected
Can be extended without the need for modifications

SAP AG CR590 8-29


Archiving: Program Flow in the BDT

without the BDT with the BDT Applications

Data
Data Input
Input Data
Data Input
Input

Check
Check Data
Data ARCH1
ARCH1 Check
Check Data
Data

Sort
Sort Data
Data Sort
Sort Data
Data

Create
Create Archive
Archive Create
Create Archive
Archive

Create
Create Archive
Archive ARCH2/3
ARCH2/3 Write
Write Archive
Archive

Close
Close Archive
Archive Close
Close Archive
Archive

Log
Log Log
Log

SAP AG 2002

Archiving without the BDT is extensive because various functions have to be developed.
Archiving with the BDT provides all generic functions for archiving processing. Only application-
related function modules have to be programmed.

SAP AG CR590 8-30


Archiving: Event Function Modules

ARCH1
Application-specific Uniqu
e Call
of AD
K FMs
ARCH2
.
.
*------ Write Data in Archive ----------
call function 'ARCHIVE_PUT_RECORD
exporting
archive_handle = p_archive_handle
record = lt_but000
record_flags = et_chart-del_flag
record_structure = 'BUT000'.

Endfunction.

SAP AG 2002

SAP AG CR590 8-31


Archiving: Reports

BUSOBARCH for archiving data


ARCH1 Check if data can be archived
ARCH2/3 Archive header data and dependent data
BUSOBARCH_DELETE for consistent deletion from the
completed archive
ARCH4 interpret and delete archive data on database
BUSOBARCH_RELOAD for reloading from archives
ARCH5 interpret archive data and check that it can be reloaded
ARCH6 interpret transferred data and write to the DB

SAP AG 2002

Start the archiving processes with reports.


During the program flow of the report, several event function modules are carried out.

SAP AG CR590 8-32


Visual Configuration Tool: Topic Objectives

At the conclusion of this topic, you will be able to:

Display the Customizing with the Visual Configuration


Tool (VCT)
Discuss the use of the VCT.

SAP AG 2002

SAP AG CR590 8-33


Visual Configuration Tool

Configuration via
Drag&Drop
(Visual Basic)
Screen layout and
screen sequence
Techniques
Subscreens
Generation of
subscreen
containers

SAP AG 2002

An administrator is able to customize the screen layout and screen sequence via Drag&Drop.
The BDT standard Customizing table may be reactivated via the "SAP Standard" in the VCT.

SAP AG CR590 8-34


Where-Used List: Topic Objectives

At the conclusion of this topic, you will be able to:

Discuss the functions of where-used lists


List examples for the use of where-used lists

SAP AG 2002

SAP AG CR590 8-35


Where-Used List for BP
Where-used List Process Goto System Help

Where-Used List

Valid All Future Past

Usage Valid from Valid to


RIPERS01 Rheinhold Mchter
Relationships
Is contact person for
0000000061 John Weaden/Cheltenham 19.08.1999
Is identical to
UVR1 Volker Jonas/40024 Dsseldorf
Policyholder
1995/12345DE (PRIVATE LIABILITY)
VL 555/143/141144 (WEALTH-FORMING LIFE INSURANCE) 12.12.2002 13.12.1994
Premium Payer
1995/12345DE (PRIVATE LIABILITY)
Insured Person
Account Holder
Correspondence Recipient.
1996/12459fr (Wealth-forming) 31.12.1999
Claimant
Payee
Witness
KH 1996/13/3134555 (MOTOR LIABILITY CLAIM) 31.12.9999

SAP AG 2002

Where-used lists give an overview of where other components are using the object currently
displayed . In this example you can see where the business partner is used.
Nodes can be extended. You are able to move into the corresponding application via double-click.
The overview consists of different screens that are time-dependent. These screens show the actual,
future and past status of all the items in the where-used list.

SAP AG CR590 8-36


Where-Used List Functions

Can be extended by own object nodes


Customizing of view variants
Integration of own data function modules for data reading
Standard table (BUT030) for reading data of external systems
Function modules for events of the tree control
Link to other components via executing tree elements

SAP AG 2002

SAP AG CR590 8-37


Steps for Customizing the Where-Used List

Define tree nodes


Customize a view variant for the tree
Assign the view variant to a context
(for example, in the BP role)
Customize the screen in the BDT

SAP AG 2002

SAP AG CR590 8-38


BDT Internal

Dialog Part Function Part


Dialog DI + Dialog

Screen Sequence m n m
Object
Object Part
Part Application
Application
Screen n
(e.g.
(e.g. Role)
Role) 1
1 Data
Data 1
Section
Sets
Sets
Section n
View n
View 1
1
View
Field group

Field group

3 n

FM
FM PAI/PBO/PBC
PAI/PBO/PBC
Event
Event FMs
FMs
1 PAI
PAI
Screen
Screen
PBO
PBO SAP BASIS

SAP AG 2002

This is an overview of the BDT Customizing. It can also provide support and be used as a check
during the Customizing. However, this is not a final list.
BDT Customizing is divided into a dialog part and a function part.
The starting point for carrying out the BDT is always the application object or object part.

SAP AG CR590 8-39


Service Programs and Functionality: Unit Summary

You are now able to:

Explain the different processing modes


of the BDT and their effects
Explain the steps for extending the
field grouping
Explain the steps for extending an
existing search help
Describe change documents in the BDT
Describe the concept of archiving in the
context of the BDT
Work with the Visual Configuration Tool
Adapt the where-used list

SAP AG 2002

SAP AG CR590 8-40


Exercises

Unit: Service Programs and Functionality


Topic: Direct Input

At the conclusion of this exercise, you will be able to:


Make the extensions that have been carried out, direct input-enabled.

The technical consultants have to enable your extensions for Direct Input.

1-1 Control structure extensions for direct input.


1-1-1 What is the name of the prepared append structure to the structure BUS_DI?
(SE11) SAP Menu Tools ABAP Workbench Development Data
Dictionary
_________________________________________________
1-1-2 Are there any new fields in the structure compared with table ZBUTHOBBY?
__________________________________________________
1-1-3 Why do you need this field?
__________________________________________________
1-1-4 Check the Customizing for BDT tables, whether the name of append (not the
structure name) is defined.
Menu BUPT BP Control Tables

1-2 Create the program logic for event DINP2 and carry out the Customizing.
(SE80) SAP Menu Tools ABAP Workbench Overview Object Navigator

1-3 Customize the BDT control tables.


BUPT Menu BP Control Events

SAP AG CR590 8-41


Exercises

Unit: Service Programs and Functionality


Topic: Visual Configuration Tool (VCT)

At the conclusion of this exercise, you will be able to:


Customize screen sequences and screens using the VCT.

A business process has changed at short notice To improve support by the


dialog, the administrator/application consultant was charged with
changing existing screen sequences and screens.

2-1 Change the screen sequence and screen layout of your BP role ZC##10.
BUPT Menu Customizing Basic Settings Screen Configuration Main
Screen Sequence
2-1-1 Change sequence of the tables Hobby and Date/Rating
2-1-2 Change screen sequence.
(Address, Central Data, Additional Data, Bank and Credit Cards, Relationships)
2-1-3 Check the result in the Business Partner dialog.
BUPT Menu Application Business Partner Create Role ZC##10
2-1-4 Reset the VCT settings.
BUPT Menu Customizing Basic Settings Screen Configuration
Main Screen Sequence
Reset by SAP Standard and Save

All visible control tables in the screen layout are switched off if
someone has saved the VCT changes.

SAP AG CR590 8-42


Exercises

Unit: Service Programs and Functionality


Topic: Where-Used List

At the conclusion of this exercise, you will be able to:


Extend the object part (BP role) by way of the where-used list in the
dialog.

The IT department is charged with displaying in the BP, all applications


where the BP is used.

3-1 Customize the application object BUPA for the tree of the where-used list.
Transaction SM30
3-1-1 Create your own node in the tree.
Customizing View V_TBZ5
Current node ZC##
Node text Object Group ##
3-1-2 Define a view variant for the objects of the where-used list.
Customizing View V_TBZ5E
View variant ZC##
Variant text Variant Group ##

You must double-click on the variant to reach the tree


selection.

3-1-3 Assign your view variant to your object part.


Customizing View V_TBZ5A
View variant ZC##
Context (Role) ZC##10

SAP AG CR590 8-43


3-2 Make the where-used list known to the BDT through the Customizing.
Menu BUPT BP Control Screen layout
3-2-1 Create a field group for the where-used list.
Field group 730 + ##
Description Where-used list ##
3-2-2 Create the view for the where-used list and assign your field group.
View ZS##30
Description Where-used list ##
Application ZC##
Differentiation type 0
Dataset ZD##10
Entry View X
Program name SAPLBUD0
Screen number 1800
Data screen X
Assigned Field Group 730 + ##
3-2-3 Create a section and assign it to the view.
Section ZA##30
Description Where-used list Group ##
Title Where-used list ##
Assigned View ZS##30
Position number 100010
3-2-4 Assign the screen to the section.
Screen ZB##10
Position 400001
Section ZA##30

SAP AG CR590 8-44


Solutions

Unit: Service Programs and Functionality


Topic: Direct Input

1-1 Control structure extensions for direct input.


1-1-1 The name of the appended structure of BUS_DI is ZHOBBY_DI.
(SE11) SAP Menu Tools ABAP Workbench Development Data
Dictionary
1-1-2 There is a field CHIND for setting the change indicators Insert, Update, Modify
or Delete.
1-1-3 These change indicators are for the flow control during the coding of the
application. Depending on the indicator in event DINP2, you can insert, update,
modify or delete a record in the global memory.
1-1-4 The Append structure of direct input structure is customized in table
ZBUTHOBBY for BDT processing.
Menu BUPT BP Control Tables

1-2 Create a function module in the object navigator. Z_ZC##_BUPA_EVENT_DINP2 for


event DINP2 by using the Coding Appendix.
(SE80) SAP Menu Tools ABAP Workbench Overview Object Navigator
Choose Function Module with right Mouse Button Create

1-3 Customize the BDT control tables.


Menu BUPT BP control Events Events Assign Event to Function Modules

SAP AG CR590 8-45


Solutions

Unit: Service Programs and Functionality


Topic: Visual Configuration Tool (VCT)

2-1 Change the screen sequence and screen layout of your BP role ZC##10.
BUPT Menu Customizing Basic Settings Screen Configuration General
Data

If you are using the old dialog or you are not working in a CRM-
System, use the path Screen ConfigurationMain Screen Sequence.

2-1-1 Change sequence of the tables Hobby and Date/Rating. Call up the screen in the
lower part of the VCT. Select the entry Date / Rating in the section and move it
via Drag&Drop into the section Hobby.
2-1-2 Change the screen sequence via Drag&Drop of the screens.
Goto Screen Sequence
2-1-3 Check the result in the Business Partner dialog. Transfer the data from the VCT
to the SAP System and save.
Screen Configuration Transfer
BUPT Menu Application Business Partner Create Role ZC##10
2-1-4 Reset the VCT settings.
BUPT Menu Customizing Basic Settings Screen Configuration
General Data
Reset via Edit SAP Standard and Transfer

All visible control tables in the screen layout are switched off if
someone has saved the VCT changes.

SAP AG CR590 8-46


Solutions

Unit: Service Programs and Functionality


Topic: Where-Used List

3-1 Customize the application object BUPA for the tree of the where-used list.
Transaction SM30
3-1-1 Create your own node in the tree. Select V_TBZ5 for the Customizing and press
the button maintain. Select the application object BUPA. Click the pushbutton
new entry and create the node ZC##.
Customizing View V_TBZ5
Current node ZC##
Node text Object Group ##
3-1-2 Select V_TBZ5E for the Customizing and click the pushbutton maintain.
Select the application object BUPA. Choose New Entry and create the view
variant ZC##. Select the view variant and compose your screen.
Customizing View V_TBZ5E
View variant ZC##
Variant text Variant Group ##

You must double-click on the variant to reach the tree selection.

3-1-3 Select V_TBZ5A for the Customizing and click the pushbutton maintain.
Select the application object BUPA. Select New Entry and create the
Assignment for the object part (role) or in field context or transaction.
Customizing View V_TBZ5A
View variant ZC##
Transaction/Context ZC##10

SAP AG CR590 8-47


3-2 Make the where-used list known to the BDT through the Customizing.
Menu BUPT BP Control Screen layout
3-2-1 Create a field group for the where-used list.
BUPT Menu BP Control Screen Layout Field Groups
Field group 730 + ##
Description Where-used list ##
3-2-2 Create the view for the where-used list and assign your field group.
BUPT Menu BP Control Screen Layout Views
View ZS##30
Description Where-used list ##
Application ZC##
Differentiation type 0
Dataset ZD##10
Entry View X
Program name SAPLBUD0
Screen number 1800
Data screen X
Assigned Field Group 730 + ##

Menu BUPT BP Control Screen layout Views Assign View to


Field Group
3-2-3 Create a section and assign it to the view.
BUPT Menu BP Control Screen Layout Sections
Section ZA##30
Description Where-used list Group ##
Title Where-used list ##
Assigned View ZS##30
Position number 100010

Menu BUPT BP Control Screen layout Sections Assign Section to


Views

SAP AG CR590 8-48


3-2-4 Assign the screen to the section.
Menu BUPT BP Control Screen layout Screen Assign Screen to
Sections
Screen ZB##10
Position 400001
Section ZA##30

SAP AG CR590 8-49


Appendix

z Coding

SAP AG 2001

SAP AG CR590 A-1


Coding Appendix
Exercise 2: Function Pool

FUNCTION POOL ZBUPA MESSAGE-ID R1.

************************************************************************
* Tables *
************************************************************************
TABLES: BUT000,
ZBUSFLDS,
ZBUTHOBBY,
ZTB001,
ZTB001T.

************************************************************************
* Constants *
************************************************************************
CONSTANTS:
GC_ACTVT_DELETE LIKE BUS000FLDS-CHAR1 VALUE 'D',
GC_ACTVT_INSERT LIKE BUS000FLDS-CHAR1 VALUE 'I',
GC_ACTVT_UPDATE LIKE BUS000FLDS-CHAR1 VALUE 'U',
GC_AKTYP_CHANGE LIKE TBZ0K-AKTYP VALUE '02',
GC_AKTYP_DISPLAY LIKE TBZ0K-AKTYP VALUE '03',
GC_FCODE_HOBBY_DELE LIKE TBZ4-FCODE VALUE
'ZC##_HOBBY_DELE',
GC_FSTAT_OPTIONAL LIKE BUS000FLDS-FLDSTAT VALUE '.',
GC_FSTAT_REQUIRED LIKE BUS000FLDS-FLDSTAT VALUE '+',
GC_FSTAT_DISPLAY LIKE BUS000FLDS-FLDSTAT VALUE '*',
GC_FSTAT_NONSPECIF LIKE BUS000FLDS-FLDSTAT VALUE ' ',
GC_FSTAT_SUPPRESSED LIKE BUS000FLDS-FLDSTAT VALUE '-',
GC_MESSG_ARBGB LIKE MESG-ARBGB VALUE 'ZBUPA',
GC_MESSG_CANCEL LIKE MESG-MSGTY VALUE 'A',
GC_MESSG_ERROR LIKE MESG-MSGTY VALUE 'E',
GC_OBJAP_PARTNER LIKE TBZ1-OBJAP VALUE 'BUPA',
GC_STATUS_DISPLAY LIKE TBZ0K-AKTYP VALUE '*',
GC_X LIKE BOOLE-BOOLE VALUE 'X'.

************************************************************************
* Variables *
************************************************************************
DATA:
GV_AKTYP LIKE TBZ0K-AKTYP,
GV_ZBUTHOBBY_LINACT LIKE SY-INDEX,
GV_CNT_FIRST_OLD LIKE ZBUSFLDS-CNT_FIRST,
GV_XSAVE LIKE BOOLE-BOOLE,
GV_XUPDTASK LIKE BOOLE-BOOLE.

************************************************************************
* Structure *
************************************************************************
DATA:
GL_BUT000_OLD LIKE BUT000.

SAP AG CR590 A-2


************************************************************************
* Internal Tables *
************************************************************************
Current memory, new status ---------------------------------------------
DATA:
BEGIN OF GT_ZBUTHOBBY OCCURS 0.
INCLUDE STRUCTURE ZBUTHOBBY.
DATA: XMARK LIKE BOOLE-BOOLE,LIKE BOOLE-BOOLE,
END OF GT_ZBUTHOBBY,

Current memory, old status ---------------------------------------------


GT_ZBUTHOBBY_OLD LIKE ZBUTHOBBY OCCURS 0 WITH HEADER LINE,

*------ Role categories ------------------------------------------------


GT_RLTYP LIKE BUS0RLTYP OCCURS 0 WITH HEADER LINE,

*------ ZBUTHOBBY: Global memory, new status ---------------------------


MEM_ZBUTHOBBY LIKE ZBUSHOBBY OCCURS 0 WITH HEADER LINE,

*------ ZBUTHOBBY: Global memory, old status ---------------------------


MEM_ZBUTHOBBY_OLD LIKE MEM_ZBUTHOBBY OCCURS 0 WITH HEADER LINE

*------ Processed Partner ----------------------------------------------


BEGIN OF MEM_PARTNER OCCURS 0,
PARTNER LIKE BUT000-PARTNER,
END OF MEM_PARTNER.

************************************************************************
* Controls: *
************************************************************************
CONTROLS: TCTRL_ZBUTHOBBY TYPE TABLEVIEW USING SCREEN '0020'.

SAP AG CR590 A-3


Exercise 2: Screen 0010
Name Type Line Clmn Def.Length Vis.Length Inbound Outbound
BUT000-ZZCNT_FIRST Text 1 1 20 20
ZBUSFLDS-CNT_FIRST I/O 1 22 10 10 X X
BUT000-ZZCNTID Text 2 1 20 20
BUT000-ZZCNTID I/O 2 22 4 4 X X
ZTB001T-CNTTX I/O 2 29 40 40 X

Flow
PROCESS BEFORE OUTPUT.
MODULE PBO.
*
PROCESS AFTER INPUT.
MODULE PAI.
*
PROCESS ON VALUE-REQUEST.
FIELD ZBUSFLDS-CNT_FIRST MODULE F4_CNT_FIRST.

Flow
*--------------------------------------------------------------------------*
* Module PBO OUTPUT *
*--------------------------------------------------------------------------*
* *
*--------------------------------------------------------------------------*
MODULE PBO OUTPUT.
CALL FUNCTION 'BUS_PBO'.
ENDMODULE.

*--------------------------------------------------------------------------*
* Module PAI *
*--------------------------------------------------------------------------*
* *
*--------------------------------------------------------------------------*
MODULE PAI.
CALL FUNCTION 'BUS_PAI'.
ENDMODULE.
*--------------------------------------------------------------------------*
* Module F4_CNT_FIRST *
*--------------------------------------------------------------------------*
* F4 for the fieldDate of the first contact *
*--------------------------------------------------------------------------*
MODULE F4_CNT_FIRST.
PERFORM F4_CNT_FIRST.
ENDMODULE.

SAP AG CR590 A-4


*-------------------------------------------------------------------------*
* Form F4_CNT_FIRST *
*-------------------------------------------------------------------------*
* F4 for the field First contact *
*------------------------------------------------------------------------ *
FORM F4_CNT_FIRST.

*------ Local data declarations ------------------------------------------


CONSTANTS: LC_DYNAME LIKE D020S-PROG VALUE 'SAPLZBUPA',
LC_DYNAME LIKE D020S-PROG VALUE '0010',
LC_FLDNM LIKE FELD-NAME VALUE 'ZBUSFLDS-CNT_FIRST'.
DATA: LV_AKTYP LIKE TBZ0K-AKTYP,
LV_STATUS LIKE BUS000FLDS-CHAR1.

*------ Determine field status -------------------------------------------


CALL FUNCTION 'BUS_FMOD_STATUS_GET'
EXPORTING
I_FLDGR = '700'
* ATTENTION FIELD GROUP NUMBER: note
IMPORTING
E_STATUS = LV_STATUS

*------ Determine activity for input help ------------------------------


IF LV_STATUS = GC_STATUS_DISPLAY.
LV_AKTYP = GC_AKTYP_DISPLAY.
ELSE.
LV_AKTYP = GC_AKTYP_CHANGE.
ENDIF.

*------ F4 for the date of birth ---------------------------------------


CALL FUNCTION 'BUS_DATEFIELD_POV'
EXPORTING
I_ACTIVITY = lv_aktyp
I_DYNAME = LC_DYNAME
I_DYNUMB = LC_DYNUMB
I_FLDNM = LC_FLDNM
CHANGING
C_FLDVAL = ZBUSFLDS-CNT_FIRST.
ENDFORM.

SAP AG CR590 A-5


Exercise 2: Event Function Module

FUNCTION Z_ZC##_BUPA_PBO_ZC##10.
*--------------------------------------------------------------------------*
*"*"Local interface:
*--------------------------------------------------------------------------*

*------ Date of the first contact ------------------------------------------


PERFORM ZZCNT_FIRST_PBO.

*------ Rating of the first contact ----------------------------------------


PERFORM ZZCNTID_PBO.
ENDFUNCTION.

*--------------------------------------------------------------------------*
* Form ZZCNT_FIRST_PBO *
*--------------------------------------------------------------------------*
* Represent date of the first contact
*--------------------------------------------------------------------------*
FORM ZZCNT_FIRST_PBO.
CALL FUNCTION 'BUS_DATEFIELD_PBO'
EXPORTING
I_VALUE_DB = BUT000-ZZCNT_FIRST
CHANGING
C_VALUE_DYNP = ZBUSFLDS-CNT_FIRST
C_VALUE_DYNP_OLD = GV_CNT_FIRST_OLD.
ENDFORM.

SAP AG CR590 A-6


*--------------------------------------------------------------------------*
* Form ZZCNTID_PBO *
*--------------------------------------------------------------------------*
* Determine text for rating *
*--------------------------------------------------------------------------*
FORM ZZCNTID_PBO.

*------ Local data declarations --------------------------------------------


DATA: LV_STATUS LIKE BUS000FLDS-CHAR1.

*------ Do not read text if field hidden------------------------------------


CALL FUNCTION 'BUS_FMOD_STATUS_GET'
EXPORTING
I_FLDGR = '701'
*ATTENTION FIELD GROUP NUMBER: note
IMPORTING
E_STATUS = LV_STATUS
CHECK LV_STATUS <> GC_FSTAT_SUPPRESSED.

*------ Rating not filled: Text initial ------------------------------------


IF BUT000-ZZCNTID IS INITIAL.
CLEAR ZTB001T-CNTTX.

*------ Rating filled: determine text---------------------------------------


ELSE.
IF ZTB001T-SPRAS <> SY-LANGU
OR ZTB001T-CNTID <> BUT000-ZZCNTID.
SELECT SINGLE * FROM ZTB001T WHERE SPRAS = SY-LANGU
AND CNTID = BUT000-ZZCNTID.
IF SY-SUBRC <> 0.
CLEAR ZTB001T-CNTTX.
ENDIF.
ENDIF.
ENDIF.
ENDFORM.

SAP AG CR590 A-7


FUNCTION Z_ZC##_BUPA_PAI_ZC##10.
*--------------------------------------------------------------------------*
*"*"Local interface:
*--------------------------------------------------------------------------*

*------ Check date of first contact-----------------------------------------


PERFORM ZZCNT_FIRST_PAI.

*------ Check rating of first contact---------------------------------------


PERFORM ZZCNTID_PAI.
ENDFUNCTION.

*--------------------------------------------------------------------------*
* Form ZZCNT_FIRST_PAI *
*--------------------------------------------------------------------------*
* Check date of first contact *
*--------------------------------------------------------------------------*

FORM ZZCNT_FIRST_PAI.
*------ Check date of first contact-----------------------------------------
*------ ... Call up BDT FM for checking ------------------------------------
CALL FUNCTION 'BUS_DATEFIELD_PAI'
EXPORTING
I_PAST_ALLOWED = GC_X
I_FUTURE_ALLOWED = SPACE
IMPORTING
E_VALUE_DB = BUT000-ZZCNT_FIRST
CHANGING
C_VALUE_DYNP = ZBUSFLDS-CNT_FIRST
EXCEPTIONS
OTHERS = 1.

*------ ... Incorrect entry: issue error message----------------------------


IF SY-SUBRC <> 0.
PERFORM EXCEPTION_MESSAGE_SEND USING SY-MSGTY
'ZBUSFLDS-CNT_FIRST'.
ENDIF.
ENDFORM.

SAP AG CR590 A-8


*&-------------------------------------------------------------------------*
*& Form EXCEPTION_MESSAGE_SEND *
*&-------------------------------------------------------------------------*
* Issue exception message via message handler *
*--------------------------------------------------------------------------*
* --> I_MSGTY Message type *
* --> I_TBFLD_STRG Cursor field or highlighted fields *
*--------------------------------------------------------------------------*
FORM EXCEPTION_MESSAGE_SEND USING I_MSGTY
I_TBFLD_STRG.
CALL FUNCTION 'BUS_MESSAGE_STORE'
EXPORTING
ARBGB = SY-MSGID
MSGTY = I_MSGTY
TXTNR = SY-MSGNO
MSGV1 = SY-MSGV1
MSGV2 = SY-MSGV2
MSGV3 = SY-MSGV3
MSGV4 = SY-MSGV4
TBFLD_STRG = I_TBFLD_STRG.
ENDFORM.

SAP AG CR590 A-9


*--------------------------------------------------------------------------*
* Form ZZCNTID_PAI *
*--------------------------------------------------------------------------*
* Check rating of first contact *
*--------------------------------------------------------------------------*
FORM ZZCNTID_PAI.

*------ Local data declarations---------------------------------------------


DATA: LV_STATUS LIKE BUS000FLDS-CHAR1.

*------ Do not carry out check----------------------------------------------


*------ ... if field not included
CALL FUNCTION 'BUS_FMOD_STATUS_GET'
EXPORTING
I_FLDGR = '701'
* *ATTENTION FIELD GROUP NUMBER: note
IMPORTING
E_STATUS = LV_STATUS.
CHECK LV_STATUS <> GC_FSTAT_SUPPRESSED
AND LV_STATUS <> GC_FSTAT_DISPLAY.

*------ ... If field is not filled------------------------------------------


CHECK NOT BUT000-ZZCNTID IS INITIAL.

*------ Check rating--------------------------------------------------------


IF ZTB001-CNTID <> BUT000-ZZCNTID.
SELECT SINGLE * FROM ZTB001 WHERE CNTID = BUT000-ZZCNTID.
IF SY-SUBRC <> 0.
IF 1 = 2. MESSAGE E002. ENDIF.
CALL FUNCTION 'BUS_MESSAGE_STORE'
EXPORTING
ARBGB = GC_MESSG_ARBGB
MSGTY = GC_MESSG_ERROR
TXTNR = '002'
MSGV1 = BUT000-ZZCNTID
TBFLD_STRG = 'BUT000-ZZCNTID'.
ENDIF.
ENDIF.
ENDFORM.

SAP AG CR590 A-10


Exercise 2 Event Function Modules

FUNCTION Z_ZC##_BUPA_EVENT_ISSTA.
*--------------------------------------------------------------------------*
*"*"Local interface:
*--------------------------------------------------------------------------*

*------ Get start parameter ------------------------------------------------


CALL FUNCTION 'BUS_PARAMETERS_ISSTA_GET'
IMPORTING
E_AKTYP = gv_aktyp
E_XSAVE = GV_XSAVE
E_XUPDTASK = GV_XUPDTASK
TABLES
T_RLTYP = GT_RLTYP.
ENDFUNCTION.

FUNCTION Z_ZC##_BUPA_EVENT_ISDAT.
*--------------------------------------------------------------------------*
*"*"Local interface:
*--------------------------------------------------------------------------*

*------ Table BUT000 -------------------------------------------------------


PERFORM BUT000_ISDAT.
ENDFUNCTION.

*--------------------------------------------------------------------------*
* Form BUT000_ISDAT *
*--------------------------------------------------------------------------*
* Table BUT000: Event ISDAT *
*--------------------------------------------------------------------------*
FORM BUT000_ISDAT.

*------ Get data from owning application------------------------------------


CALL FUNCTION 'BUP_BUPA_BUT000_GET'
IMPORTING
E_BUT000 = BUT000.

*------ Note status in current memory--------------------------------------


GL_BUT000_OLD = BUT000.
ENDFORM.

SAP AG CR590 A-11


FUNCTION Z_ZC##_BUPA_EVENT_XCHNG.
*--------------------------------------------------------------------------*
*"*"Local interface:
*" EXPORTING
*" VALUE(E_XCHNG) LIKE BUS000FLDS-XCHNG
*--------------------------------------------------------------------------*

*------ Initialize return parameters ---------------------------------------


CLEAR E_XCHNG.

*------Check BUT000 --------------------------------------------------------


PERFORM BUT000_XCHNG CHANGING E_XCHNG.
ENDFUNCTION.

*--------------------------------------------------------------------------*
* Form BUT000_XCHNG *
*--------------------------------------------------------------------------*
* Table BUT000: Changes? *
*--------------------------------------------------------------------------*
* <-- E_XCHNG Set indicator: Changes exist *
*--------------------------------------------------------------------------*
FORM BUT000_XCHNG CHANGING E_XCHNG LIKE BUS000FLDS-XCHNG.

*------ Initialize return parameters----------------------------------------


CLEAR E_XCHNG.

*------ Set indicator: Changes exist -------------------------------------


IF BUT000 <> GL_BUT000_OLD.
E_XCHNG = GC_X.
ENDIF.
ENDFORM.

SAP AG CR590 A-12


FUNCTION Z_ZC##_BUPA_EVENT_DSAVEB.
*--------------------------------------------------------------------------*
*"*"Local interface:
*--------------------------------------------------------------------------*

*------ Table BUT000 -------------------------------------------------------


PERFORM BUT000_DSAVB.
ENDFUNCTION.

*--------------------------------------------------------------------------*
* Form BUT000_DSAVB *
*--------------------------------------------------------------------------*
* Table BUT000: EventDSAVB *
*--------------------------------------------------------------------------*
FORM BUT000_DSAVB.

*------ Local data declarations -------------------------------------------


CONSTANTS: LC_SUBNAME LIKE DD02D-TABNAME VALUE 'ZBUT000'.

*------ Return data to existing application--------------------------------


CALL FUNCTION 'BUP_BUPA_BUT000_COLLECT
EXPORTING
I_SUBNAME = LC_SUBNAME
I_BUT000 = BUT000.
ENDFORM.

SAP AG CR590 A-13


FUNCTION Z_ZC##_BUPA_EVENT_DLVE1.
*--------------------------------------------------------------------------*
*"*"Local interface:
*--------------------------------------------------------------------------*

*------ Table BUT000 -------------------------------------------------------


PERFORM BUT000_DLVE 1.
ENDFUNCTION.

*--------------------------------------------------------------------------*
* Form BUT000_DLVE1 *
*--------------------------------------------------------------------------*
* Table BUT000: Event DLVE1 *
*--------------------------------------------------------------------------*
FORM BUT000_DLVE1.
CLEAR BUT000.
CLEAR GL_BUT000_OLD.
ENDFORM.

SAP AG CR590 A-14


Exercise 3 Extended Check

FUNCTION Z_ZC##_BUPA_PAI_BUP300.
*--------------------------------------------------------------------------*
*"*"Local interface:
*--------------------------------------------------------------------------*

*------ Last name ----------------------------------------------------------


PERFORM NAME_LAST_PAI.
ENDFUNCTION.

*--------------------------------------------------------------------------*
* Form NAME_LAST_PAI *
*--------------------------------------------------------------------------*
* Check Last name *
*--------------------------------------------------------------------------*
FORM NAME_LAST_PAI.

*------ Local data declarations --------------------------------------------


DATA: LL_BUT000 LIKE BUT000,
LV_LENGTH TYPE I,
LV_NAME(40) TYPE C,
LV_STATUS LIKE BUS000FLDS-CHAR1.

*------ Do not carry out test ----------------------------------------------


*------ ... if field not ready for input
CALL FUNCTION 'BUS_FMOD_STATUS_GET'
EXPORTING
I_FLDGR = '025'
IMPORTING
E_STATUS = LV_STATUS.
CHECK LV_STATUS <> GC_FSTAT_SUPPRESSED
AND LV_STATUS <> GC_FSTAT_DISPLAY.

*------ ... if field is not filled -----------------------------------------


CALL FUNCTION 'BUP_BUPA_BUT000_GET'
IMPORTING
E_BUT000 = LL_BUT000.
CHECK NOT LL_BUT000-NAME_LAST IS INITIAL.

SAP AG CR590 A-15


*------ Check if at least one vowel is present in last name-----------------
IF LL_BUT000-NAME_LAST NA 'AEIOUaeiou'.
IF 1 = 2. MESSAGE E001. ENDIF.
CALL FUNCTION 'BUS_MESSAGE_STORE'
EXPORTING
ARBGB = GC_MESSG_ARBGB
MSGTY = GC_MESSG_ERROR
TXTNR = '001'
MSGV1 = LL_BUT000-NAME_LAST
TBFLD_STRG = 'BUT000-NAME_LAST'.
ENDIF.
ENDFORM.

SAP AG CR590 A-16


Exercise 4 - Screen
Screen 0020

Flow logic
PROCESS BEFORE OUTPUT.
MODULE PBO_0020.
LOOP AT GT_ZBUTHOBBY WITH CONTROL TCTRL_ZBUTHOBBY
CURSOR GV_ZBUTHOBBY_LINACT.
MODULE GT_ZBUTHOBBY_INIT.
ENDLOOP.
*
PROCESS AFTER INPUT.
MODULE PAI.
LOOP AT GT_ZBUTHOBBY.
MODULE GT_ZBUTHOBBY_MODIFY.
ENDLOOP.
MODULE GT_ZBUTHOBBY_LINACT_DETERMINE.

Program flow
*--------------------------------------------------------------------------*
* Module PBO_0020 OUTPUT *
*--------------------------------------------------------------------------*
* Carry out control actions on the subscreen for PBO *
*--------------------------------------------------------------------------*
MODULE PBO_0020 OUTPUT.
CALL FUNCTION 'BUS_PBO'.
CHANGING
C_TC1 = TCTRL_ZBUTHOBBY.
ENDMODULE.

SAP AG CR590 A-17


*--------------------------------------------------------------------------*
* Module GT_ZBUTHOBBY_INIT OUTPUT *
*--------------------------------------------------------------------------*
* Note number of lines *
*--------------------------------------------------------------------------*
MODULE GT_ZBUTHOBBY_INIT OUTPUT.
PERFORM GT_ZBUTHOBBY_INIT.
ENDMODULE.
*--------------------------------------------------------------------------*
* Form GT_ZBUTHOBBY_INIT *
*---------------------------------------------------------------------------
* Detemine number of lines *
*---------------------------------------------------------------------------
FORM GT_ZBUTHOBBY_INIT.

------ Local data declarations---------------------------------------------


DATA: LV_NUMBER(3) TYPE C,
LV_LINES LIKE SY-TFILL,
LV_LINES_MAX LIKE SY-TFILL,
LV_TEXT(30) TYPE C.

*------ Determine number of lines in work table---------------------------


DESCRIBE TABLE GT_ZBUTHOBBY LINES LV_LINES.
IF LV_LINES = 0.
LV_LINES_MAX = LV_LINES + SY-LOOPC.
ELSE.
LV_LINES_MAX = LV_LINES + SY-LOOPC - 1.
ENDIF.
*------ All visible lines of the step loop must be ready for input--------
*------ are visible if necessary under blanklines-------------------------
IF SY-STEPL = 1.
TCTRL_ZBUTHOBBY-LINES = GV_ZBUTHOBBY_LINACT + SY-LOOPC - 1.
IF TCTRL_ZBUTHOBBY-LINES > LV_LINES_MAX.
TCTRL_ZBUTHOBBY-LINES = LV_LINES_MAX.
ENDIF.
*------ Issue status text 'entry X of Y' -------------------------------
LV_TEXT = TEXT-XX1.
LV_NUMBER = GV_ZBUTHOBBY_LINACT.
REPLACE '&1' WITH LV_NUMBER INTO LV_TEXT.
LV_NUMBER = LV_LINES.
REPLACE '&2' WITH LV_NUMBER INTO LV_TEXT.
WRITE LV_TEXT TO ZBUSFLDS-POSTXT_ZBUTHOBBY RIGHT-JUSTIFIED.
ENDIF.
ENDFORM.

SAP AG CR590 A-18


*--------------------------------------------------------------------------*
* MODULE GT_ZBUTHOBBY_MODIFY. *
*--------------------------------------------------------------------------*
* Save changes
*--------------------------------------------------------------------------*
MODULE GT_ZBUTHOBBY_MODIFY.
PERFORM GT_ZBUTHOBBY_MODIFY.
ENDMODULE.

*--------------------------------------------------------------------------*
* Form GT_ZBUTHOBBY_MODIFY
*--------------------------------------------------------------------------*
* Save changes
*--------------------------------------------------------------------------*
FORM GT_ZBUTHOBBY_MODIFY.
MODIFY GT_ZBUTHOBBY INDEX GV_ZBUTHOBBY_LINACT.
IF SY-SUBRC <> 0
AND NOT GT_ZBUTHOBBY IS INITIAL.
GT_ZBUTHOBBY-CLIENT = SY-MANDT.
GT_ZBUTHOBBY-PARTNER = BUT000-PARTNER.
INSERT GT_ZBUTHOBBY INDEX GV_ZBUTHOBBY_LINACT.
ENDIF.
ENDFORM.

*--------------------------------------------------------------------------*
* MODULE GT_ZBUTHOBBY_LINACT_DETERMINE. *
*--------------------------------------------------------------------------*
* Note new index
*--------------------------------------------------------------------------*
MODULE GT_ZBUTHOBBY_LINACT_DETERMINE.
PERFORM GT_ZBUTHOBBY_LINACT_DETERMINE.
ENDMODULE.

*--------------------------------------------------------------------------*
* Form GT_ZBUTHOBBY_LINACT_DETERMINE *
*--------------------------------------------------------------------------*
* Hobbys: note new index
*--------------------------------------------------------------------------*
FORM GT_ZBUTHOBBY_LINACT_DETERMINE.
GV_ZBUTHOBBY_LINACT = TCTRL_ZBUTHOBBY-TOP_LINE.
ENDFORM.

SAP AG CR590 A-19


Exercise 4 Event Function Modules

FUNCTION Z_ZC##_BUPA_PBO_ZC##20.
*"----------------------------------------------------------------------
*"*"Local interface:
*" IMPORTING
*" VALUE(I_ACTION) LIKE BUS000FLDS-CHAR1 OPTIONAL
*"----------------------------------------------------------------------

*------ Do not carry out actions during return from additional screen---
CHECK I_ACTION = '1'
OR I_ACTION = '2'.

*------ Sort entries according to hobby---------------------------------


SORT GT_ZBUTHOBBY BY PARTNER HOBBY.

*------ Output begins with the first entry------------------------------


GV_ZBUTHOBBY_LINACT = 1.
ENDFUNCTION.

SAP AG CR590 A-20


Exercise 4 Event Function Modules

FUNCTION Z_ZC##_BUPA_EVENT_ISDAT.
*--------------------------------------------------------------------------*
*"*"Local interface:
*--------------------------------------------------------------------------*

*------ Table BUT000 -------------------------------------------------------


PERFORM BUT000_ISDAT.

*------ Table ZBUTHOBBY ----------------------------------------------------


PERFORM ZBUTHOBBY_ISDAT.
ENDFUNCTION.

*--------------------------------------------------------------------------*
* Form ZBUTHOBBY_ISDAT *
*--------------------------------------------------------------------------*
* Table ZBUTHOBBY: Event ISDAT *
*--------------------------------------------------------------------------*
FORM ZBUTHOBBY_ISDAT.

*------ Partner was already being processed: read local memory-


READ TABLE MEM_PARTNER WITH KEY but000 partner.
IF SY-SUBRC = 0.
REFRESH GT_ZBUTHOBBY.
LOOP AT MEM_ZBUTHOBBY WHERE PARTNER = BUT000-PARTNER.
CLEAR GT_ZBUTHOBBY.
MOVE-CORRESPONDING MEM_ZBUTHOBBY TO GT_ZBUTHOBBY.
APPEND GT_ZBUTHOBBY.
ENDLOOP.

*------ Partner was not being processed: read database---------------------


ELSE.
SELECT * FROM ZBUTHOBBY
INTO TABLE GT_ZBUTHOBBY
WHERE PARTNER = BUT000-PARTNER.
ENDIF.

*------ Note old status of the current processing---------------------------


GT_ZBUTHOBBY_OLD[] = GT_ZBUTHOBBY[].
ENDFORM.

SAP AG CR590 A-21


FUNCTION Z_ZC##_BUPA_EVENT_XCHNG.
*--------------------------------------------------------------------------*
*"*"Local interface:
*" EXPORTING
*" VALUE(E_XCHNG) LIKE BUS000FLDS-XCHNG
*--------------------------------------------------------------------------*

*------ Initialize return parameter-----------------------------------------


CLEAR E_XCHNG.

*------Check BUT000 -------------------------------------------------------


PERFORM BUT000_XCHNG CHANGING E_XCHNG.
CHECK E_XCHNG IS INITIAL.

*------ Check ZBUTHOBBY ----------------------------------------------------


PERFORM ZBUTHOBBY_XCHNG CHANGING E_XCHNG.
ENDFUNCTION.
*--------------------------------------------------------------------------*
* Form ZBUTHOBBY_XCHNG
*--------------------------------------------------------------------------*
* Table ZBUTHOBBY: Changes? *
*--------------------------------------------------------------------------*
* <-- E_XCHNG Indicator: Changes exist *
*--------------------------------------------------------------------------*
FORM ZBUTHOBBY_XCHNG CHANGING E_XCHNG LIKE BUS000FLDS-XCHNG.

*------ Local data declarations---------------------------------------------


DATA: LT_ZBUTHOBBY LIKE ZBUTHOBBY OCCURS 0 WITH HEADER LINE.

*------ Intialize return parameters-----------------------------------------


CLEAR E_XCHNG.

*------ Note new status in LT_ZBUTHOBBY ------------------------------------


REFRESH GT_ZBUTHOBBY.
LOOP AT GT_ZBUTHOBBY.
CLEAR LT_ZBUTHOBBY.
MOVE-CORRESPONDING GT_ZBUTHOBBY TO LT_ZBUTHOBBY.
APPEND LT_ZBUTHOBBY.
ENDLOOP.

*------ Set indicator: Changes exist ------------------------------------


IF LT_ZBUTHOBBY[] <> GT_ZBUTHOBBY_OLD[].
E_XCHNG = GC_X.
ENDIF.
ENDFORM.

SAP AG CR590 A-22


FUNCTION Z_ZC##_BUPA_EVENT_FCODE.
*--------------------------------------------------------------------------*
*"*"Local interface:
*" IMPORTING
*" VALUE(I_FCODE) LIKE TBZ4-FCODE OPTIONAL
*" EXPORTING
*" VALUE(E_XHANDLE) LIKE BOOLE-BOOLE
*--------------------------------------------------------------------------*

*------ E_XHANDLE Set to X by default-------------------------------------


E_XHANDLE = 'X'.

*------ Process own functions-----------------------------------------------


*------ ... Delete hobby ---------------------------------------------------
CASE I_FCODE.
WHEN GC_FCODE_HOBBY_DELE.
PERFORM GT_ZBUTHOBBY_DELETE.

*------ ... Other function codes: do not handle-----------------------------


WHEN OTHERS.
CLEAR E_XHANDLE.
ENDCASE.
ENDFUNCTION.

*--------------------------------------------------------------------------*
* Form GT_ZBUTHOBBY_DELETE *
*--------------------------------------------------------------------------*
* Function Delete hobbys *
*--------------------------------------------------------------------------*
FORM GT_ZBUTHOBBY_DELETE.
DELETE GT_ZBUTHOBBY WHERE XMARK = GC_X.
ENDFORM.

SAP AG CR590 A-23


FUNCTION Z_ZC##_BUPA_EVENT_DTAKE.
*--------------------------------------------------------------------------*
*"*"Local interface:
*--------------------------------------------------------------------------*

*------ Table ZBUTHOBBY ----------------------------------------------------


PERFORM ZBUTHOBBY_DTAKE.
ENDFUNCTION.

*--------------------------------------------------------------------------*
* Form ZBUTHOBBY_DTAKE
*--------------------------------------------------------------------------*
* ZBUTHOBBY in local memory
*--------------------------------------------------------------------------*
FORM ZBUTHOBBY_DTAKE.

*------ Transfer new status-------------------------------------------------


DELETE MEM_ZBUTHOBBY WHERE PARTNER = BUT000-PARTNER.
LOOP AT GT_ZBUTHOBBY.
CLEAR MEM_ZBUTHOBBY.
MOVE-CORRESPONDING GT_ZBUTHOBBY TO MEM_ZBUTHOBBY.
APPEND MEM_ZBUTHOBBY.
ENDLOOP.

*------ Transfer old status-------------------------------------------------


READ TABLE MEM_PARTNER WITH KEY PARTNER = BUT000-PARTNER.
IF SY-SUBRC <> 0.
LOOP AT GT_ZBUTHOBBY_OLD.
CLEAR MEM_ZBUTHOBBY_OLD.
MOVE-CORRESPONDING GT_ZBUTHOBBY_OLD TO MEM_ZBUTHOBBY_OLD.
APPEND MEM_ZBUTHOBBY_OLD.
ENDLOOP.

*------ Note partner number in the directory of the processed partners -----
DELETE MEM_PARTNER-Partner where partner = BUT000-Partner
MEM_PARTNER-PARTNER = BUT000-PARTNER.
APPEND MEM_PARTNER.
ENDIF.
ENDFORM.

SAP AG CR590 A-24


FUNCTION Z_ZC##_BUPA_EVENT_DSAVC.
*--------------------------------------------------------------------------*
*"*"Local interface:
*--------------------------------------------------------------------------*

*------ Local data declarations---------------------------------------------


DATA: LT_PARTNER LIKE BUS_PARTNR OCCURS 0 WITH HEADER LINE.

*------ Get assignments 'temporary number->final number' -------------------


CALL FUNCTION 'BUP_BUPA_NUMBERS_READ'
TABLES
T_PARTNER = LT_PARTNER.
*------ Table ZBUTHOBBY ----------------------------------------------------
PERFORM ZBUTHOBBY_DSAVC TABLES LT_PARTNER.
ENDFUNCTION.

*--------------------------------------------------------------------------*
* Form ZBUTHOBBY_DSAVC *
*--------------------------------------------------------------------------*
* Complete data for table ZBUTHOBBY *
*--------------------------------------------------------------------------*
* --> T_PARTNER Assignment of temp.no. -> final no. for partner *
*--------------------------------------------------------------------------*
FORM ZBUTHOBBY_DSAVC TABLES T_PARTNER STRUCTURE BUS_PARTNR.

*------ Local data declarations---------------------------------------------


CONSTANTS: LC_TABLE_HOBBIES LIKE CDPOS-TABNAME VALUE 'ZBUTHOBBY'.
DATA: LV_INDEX LIKE SY-TABIX.

*------ Note final number--------


LOOP AT MEM_ZBUTHOBBY.
READ TABLE T_PARTNER WITH KEY PARTNR_TMP = MEM_ZBUTHOBBY-PARTNER.
IF SY-SUBRC = 0.
MEM_ZBUTHOBBY-PARTNER = T_PARTNER-PARTNER.
MODIFY MEM_ZBUTHOBBY.
ENDIF.
ENDLOOP.

SAP AG CR590 A-25


*------ Detemine type of change per data record-----------------------------
SORT MEM_ZBUTHOBBY BY PARTNER HOBBY.
SORT MEM_ZBUTHOBBY_OLD BY PARTNER HOBBY.
CALL FUNCTION 'CHANGEDOCUMENT_PREPARE_TABLES'
EXPORTING
TABLENAME = LC_TABLE_HOBBIES
TABLES
TABLE_NEW = MEM_ZBUTHOBBY
TABLE_OLD = MEM_ZBUTHOBBY_OLD
EXCEPTIONS
NAMETAB_ERROR = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
PERFORM EXCEPTION_MESSAGE_SEND USING GC_MESSG_CANCEL
SPACE.
ENDIF.
ENDFORM.

SAP AG CR590 A-26


FUNCTION Z_ZC##_BUPA_EVENT_DSAVE.
*--------------------------------------------------------------------------*
*"*"Local interface:
*--------------------------------------------------------------------------*

*------ Save data on database-----------------------------------------------


*------ ... Asynchronous (with update) -------------------------------------
IF GV_XUPDTASK = GC_X.
CALL FUNCTION 'Z_ZC##_BUPA_UPDATE' IN UPDATE TASK
TABLES
T_ZBUTHOBBY = MEM_ZBUTHOBBY
T_ZBUTHOBBY_OLD = MEM_ZBUTHOBBY_OLD.

*------ ... Synchronous (without update) ---------------------------------


ELSE.
CALL FUNCTION 'Z_ZC##_BUPA_UPDATE'
TABLES
T_ZBUTHOBBY = MEM_ZBUTHOBBY
T_ZBUTHOBBY_OLD = MEM_ZBUTHOBBY_OLD.
ENDIF.
ENDFUNCTION.

SAP AG CR590 A-27


FUNCTION Z_ZC##_BUPA_UPDATE.
*--------------------------------------------------------------------------*
*"*"Update module:
*"
* ATTENTION: Propertiess Update module

*"*"Local interface:
*" TABLES
*" T_ZBUTHOBBY STRUCTURE ZBUSHOBBY
*" T_ZBUTHOBBY_OLD STRUCTURE ZBUSHOBBY
*--------------------------------------------------------------------------*
*------ Update table ZBUTHOBBY ---------------------------------------------
PERFORM ZBUTHOBBY_UPDATE TABLES T_ZBUTHOBBY
T_ZBUTHOBBY_OLD.
ENDFUNCTION.

*--------------------------------------------------------------------------*
* Form ZBUTHOBBY_UPDATE *
*--------------------------------------------------------------------------*
* Update table ZBUTHOBBY *
*--------------------------------------------------------------------------*
* --> T_ZBUTHOBBY New status *
* --> T_ZBUTHOBBY_OLD Old status *
*--------------------------------------------------------------------------*
FORM ZBUTHOBBY_UPDATE TABLES T_ZBUTHOBBY STRUCTURE ZBUSHOBBY
T_ZBUTHOBBY_OLD STRUCTURE ZBUSHOBBY.

*------ Local data declarations---------------------------------------------


DATA: LT_ZBUTHOBBY LIKE ZBUSHOBBY OCCURS 0 WITH HEADER LINE.

*------ Add new data records------------------------------------------------


REFRESH GT_ZBUTHOBBY.
LOOP AT T_ZBUTHOBBY WHERE KZ = GC_ACTVT_INSERT.
LT_ZBUTHOBBY = T_ZBUTHOBBY.
APPEND LT_ZBUTHOBBY.
ENDLOOP.
INSERT ZBUTHOBBY FROM TABLE LT_ZBUTHOBBY ACCEPTING DUPLICATE KEYS.
IF SY-SUBRC <> 0.
UPDATE ZBUTHOBBY FROM TABLE LT_ZBUTHOBBY.
ENDIF.

SAP AG CR590 A-28


*------ Change existing data records----------------------------------------
REFRESH GT_ZBUTHOBBY.
LOOP AT T_ZBUTHOBBY WHERE KZ = GC_ACTVT_UPDATE.
LT_ZBUTHOBBY = T_ZBUTHOBBY.
APPEND LT_ZBUTHOBBY.
ENDLOOP.
UPDATE ZBUTHOBBY FROM TABLE LT_ZBUTHOBBY.
IF SY-SUBRC <> 0.
INSERT ZBUTHOBBY FROM TABLE LT_ZBUTHOBBY ACCEPTING DUPLICATE KEYS.
ENDIF.

*------ Delete existing data records----------------------------------------


REFRESH GT_ZBUTHOBBY.
LOOP AT T_ZBUTHOBBY_OLD WHERE KZ = GC_ACTVT_DELETE.
LT_ZBUTHOBBY = T_ZBUTHOBBY_OLD.
APPEND LT_ZBUTHOBBY.
ENDLOOP.
DELETE ZBUTHOBBY FROM TABLE LT_ZBUTHOBBY.
ENDFORM.

FUNCTION Z_ZC##_BUPA_EVENT_DLVE1.
*--------------------------------------------------------------------------*
*"*"Local interface:
*--------------------------------------------------------------------------*
*------ Table BUT000 -------------------------------------------------------
PERFORM BUT000_DLVE 1.

*------ Table ZBUTHOBBY ----------------------------------------------------


PERFORM ZBUTHOBBY_DLVE1.
ENDFUNCTION.
*--------------------------------------------------------------------------*
* Form ZBUTHOBBY_DLVE1
*--------------------------------------------------------------------------*
* Table ZBUTHOBBY: Event DLVE1 *
*--------------------------------------------------------------------------*
FORM ZBUTHOBBY_DLVE1.
CLEAR GT_ZBUTHOBBY REFRESH GT_ZBUTHOBBY.
CLEAR GT_ZBUTHOBBY_OLD. REFRESH GT_ZBUTHOBBY_OLD.
ENDFORM.

SAP AG CR590 A-29


FUNCTION Z_ZC##_BUPA_EVENT_DLVE2.
*--------------------------------------------------------------------------*
*"*"Local interface:
*--------------------------------------------------------------------------*

*------ Table ZBUTHOBBY ----------------------------------------------------


PERFORM ZBUTHOBBY_DLVE2.
ENDFUNCTION.

*--------------------------------------------------------------------------*
* Form ZBUTHOBBY_DLVE2 *
*--------------------------------------------------------------------------*
* Table ZBUTHOBBY: event DLVE2 *
*--------------------------------------------------------------------------*
FORM ZBUTHOBBY_DLVE2.
CLEAR MEM_ZBUTHOBBY. REFRESH MEM_ZBUTHOBBY.
CLEAR MEM_ZBUTHOBBY_OLD. REFRESH MEM_ZBUTHOBBY_OLD.
CLEAR MEM_PARTNER. REFRESH MEM_PARTNER.
ENDFORM.

SAP AG CR590 A-30


Exercise 5 Menu Function Module

FUNCTION Z_ZC##_BUPA_EVENT_DCUAC.
*--------------------------------------------------------------------------*
*"*"Local interface:
*--------------------------------------------------------------------------*

*------ Local data declarations---------------------------------------------


DATA: LT_CUA_EXC LIKE BUS000CUAF "Standard functions to be hidden
OCCURS 10 WITH HEADER LINE,
LT_CUA_EXC LIKE BUS000CUAF "Standard functions to be
displayed
OCCURS 10 WITH HEADER LINE,
LV_STATUS(1) TYPE C.

*------ Read GUI functions for current screen------------------------------


CALL FUNCTION 'BUS_CUA_FUNCTIONS_GET'
TABLES
T_STND_EXCL = LT_CUA_EXC
T_FRTH_INCL = LT_CUA_INC.

*------ Function 'Delete hobby':


*------ Inactive, if hobbies not ready for input------------------------
*------ ... *------ Read field status ------------------------------------
READ TABLE LT_CUA_INC WITH KEY FCODE = GC_FCODE_HOBBY_DELE.
IF SY-SUBRC = 0.
CALL FUNCTION 'BUS_FMOD_STATUS_GET'
EXPORTING
I_FLDGR = '702'
* ATTENTION Field group
IMPORTING
E_STATUS = LV_STATUS

*------ ... Field group hidden: deactivate functions----------------------


IF LV_STATUS = GC_FSTAT_SUPPRESSED
ODER LV_STATUS = GC_FSTAT_DISPLAY.
DELETE LT_CUA_INC WHERE FCODE = GC_FCODE_HOBBY_DELE.
ENDIF.
ENDIF.

*------ Set GUI functions for current screen-----------------------------


CALL FUNCTION 'BUS_CUA_FUNCTIONS_SET'
TABLES
T_STND_EXCL = LT_CUA_EXC
T_FRTH_INCL = LT_CUA_INC.
ENDFUNCTION.

SAP AG CR590 A-31

Das könnte Ihnen auch gefallen