48
Enhancement Guide SAP Process Object Builder Document Version: 1.0 – 2016-03-23 PUBLIC Enhancement of Process Object Types For SAP Process Object Builder 1.0 SP5

Enhancement of Process Object Types - SAP Help Portal · PDF file4.3.2 Selection Screen of Archiving Write Program ... This guide doesnot cover enhancements that require changes to

Embed Size (px)

Citation preview

Enhancement GuideSAP Process Object BuilderDocument Version: 1.0 – 2016-03-23

PUBLIC

Enhancement of Process Object TypesFor SAP Process Object Builder 1.0 SP5

Enhancement of Process Object TypesPreface

PUBLIC© 2016 SAP SE or an SAP affiliate company. All rights reserved. 2

Typographic Conventions

Type Style Description

Example Words or characters quoted from the screen. These include field names, screen titles,pushbuttons labels, menu names, menu paths, and menu options.

Textual cross-references to other documents.

EXAMPLE Technical names of system objects. These include report names, program names,transaction codes, table names, and key concepts of a programming language when theyare surrounded by body text, for example, SELECT and INCLUDE.

Example Output on the screen. This includes file and directory names and their paths, messages,names of variables and parameters, source text, and names of installation, upgrade anddatabase tools.

Example Exact user entry. These are words or characters that you enter in the system exactly asthey appear in the documentation.

<Example> Variable user entry. Angle brackets indicate that you replace these words and characterswith appropriate entries to make entries in the system.

Enhancement of Process Object TypesPreface

PUBLIC© 2016 SAP SE or an SAP affiliate company. All rights reserved. 3

Document History

Version Date Change

1.0 2016-03-23 First Public Version

CautionBefore you start the implementation, make sure that you have the latest version of this documentrelevant for your release. You can always find the latest version on the SAP Help Portal athttp://help.sap.com/pobuilder.

Enhancement of Process Object TypesPreface

PUBLIC© 2016 SAP SE or an SAP affiliate company. All rights reserved. 4

Table of Contents

1 Preface ................................................................................................................................ 6

1.1 About this Document ............................................................................................................................... 6

1.2 Target Audience ....................................................................................................................................... 6

1.3 Related Information.................................................................................................................................. 6

1.4 Disclaimer .................................................................................................................................................. 7

2 Introduction ........................................................................................................................ 8

2.1 How to Use this Guide .............................................................................................................................. 8

2.2 Reasons for Enhancing a POT ................................................................................................................. 8

2.3 Sample Business Process ....................................................................................................................... 8

3 Enhancing Enterprise Services ...................................................................................... 10

3.1 Reasons for Enhancing an Enterprise Service .................................................................................... 10

3.2 Standard Procedure ............................................................................................................................... 10

3.3 Sample Service ....................................................................................................................................... 11

4 Building Enhanceable Process Object Types .............................................................. 14

4.1 Overview of Enhancement Spots and BAdIs ....................................................................................... 144.1.1 Phase Implementation .................................................................................................................... 144.1.2 Archiving ........................................................................................................................................... 144.1.3 Editing UI........................................................................................................................................... 154.1.4 Others ............................................................................................................................................... 154.1.5 Technical Settings for BAdIs .......................................................................................................... 164.1.6 Naming Conventions ....................................................................................................................... 16

4.2 How to Make POT Phase Implementations Enhanceable .................................................................. 164.2.1 Enhancement Spot and BAdI Definitions ...................................................................................... 164.2.2 Call BAdIs in Phase Implementations ............................................................................................ 18

4.3 How to Make POT Archiving Enhanceable ........................................................................................... 184.3.1 Enhancement Spots ........................................................................................................................ 184.3.2 Selection Screen of Archiving Write Program .............................................................................. 194.3.3 Additional Fields for Determination of Residence Time .............................................................. 20

Enhancement of Process Object TypesPreface

PUBLIC© 2016 SAP SE or an SAP affiliate company. All rights reserved. 5

4.3.4 Archive Search UI ............................................................................................................................ 21

4.4 How to Make the Editing UI Enhanceable ............................................................................................ 224.4.1 Adding Fields to Search and Search Result .................................................................................. 234.4.2 Adding Fields to List and Form Feeders ........................................................................................ 244.4.3 Adding Buttons to Feeders ............................................................................................................. 254.4.4 Adding Buttons to the Global Application Toolbar ....................................................................... 28

5 Enhancing Process Object Types .................................................................................. 30

5.1 Enhancement Options ........................................................................................................................... 305.1.1 POT Object Model ............................................................................................................................ 305.1.2 Custom Checks in Check Phase .................................................................................................... 315.1.3 Archiving ........................................................................................................................................... 325.1.4 Authorization .................................................................................................................................... 325.1.5 Editing UI........................................................................................................................................... 33

5.2 How to Enhance POT Services and Object Model............................................................................... 335.2.1 Enhance POT Services in ESR ........................................................................................................ 345.2.2 Generate Enhancement Proxy Structure ...................................................................................... 355.2.3 Create Append Structure for Internal Types ................................................................................ 365.2.4 Implement BAdI(s) .......................................................................................................................... 38

5.3 How to Consume an Enhanced Enterprise Service in a POT ............................................................. 395.3.1 Enhance Counterpart Services in ESR .......................................................................................... 395.3.2 Generate Enhancement Proxy Structure ...................................................................................... 405.3.3 Create Append Structure for Internal Types ................................................................................ 415.3.4 Implement BAdI(s) .......................................................................................................................... 43

5.4 Summary ................................................................................................................................................. 43

References ............................................................................................................................. 45

Terms and Abbreviations ..................................................................................................... 46

Enhancement of Process Object TypesPreface

PUBLIC© 2016 SAP SE or an SAP affiliate company. All rights reserved. 6

1 Preface

1.1 About this Document

This guide explains how process object types (POTs) built with SAP Process Object Builder (POB) can beenhanced by customers and partners. It also explains what aspects have to be addressed when developing POTsthat should be enhanceable.

Scope of this Document

The scope of this guide are the following enhancements:

Additional fields in existing Details, Private Details, and Process Control Constraints (PCCs)

Consideration of additional fields in the Editing UI and Archiving UI

Consumption of enhanced back-end services that are already consumed

Implementation of BAdIs for the Check phase

Not in Scope of this Document

This guide does not cover enhancements that require changes to a POT configuration, including:

New Details, Private Details, or Process Control Constraints (PCCs)

Introduction of new node types

Consumption of other back-end services than the already consumed ones

1.2 Target Audience

Customers and partners who want to extend POTs developed by SAP or other partners

Development teams who implement POTs that should allow for later enhancements

1.3 Related Information

All referenced documents are listed in the References section of this guide.

This guide assumes that you have read the following documents:

Product documentation and developer's guide for SAP Process Object Builder

Instructions on how to enhance enterprise services in the Enterprise Services Enhancement Guide

Enhancement of Process Object TypesPreface

PUBLIC© 2016 SAP SE or an SAP affiliate company. All rights reserved. 7

1.4 Disclaimer

The processes described in this guide are used as examples and merely serve to illustrate specific aspects ofprocess object types from a learning perspective. No claims are made as to the business validity of these samplebusiness processes. SAP assumes no responsibility for errors or omissions in this document.

Enhancement of Process Object TypesIntroduction

PUBLIC© 2016 SAP SE or an SAP affiliate company. All rights reserved. 8

2 Introduction

2.1 How to Use this Guide

If you want to start without further ado, go to

Chapter 4 to build a process object type that is enhanceable

Chapter 5 to enhance an existing process object type

If you think a little background info would do no harm, read

Chapter 2's remaining sections to find reasons for enhancing a POT, and to recapitulate the sample businessprocess used in this guide

Chapter 3 for a quick introduction to the enhancement of enterprise services, and to the sample service usedin this guide

2.2 Reasons for Enhancing a POT

Customers and partners may want to enhance a process object type for the following reasons:

To implement additional checks in the Check phase via BAdI

To add additional fields to existing Details, Private Details, and Process Control Constraints (PCCs)

To use additional fields of a (possibly enhanced) back-end service that is consumed by the POT

To fill the back-end service requests with different (default) values in the code slots

To display additional fields of the POT in the Editing UI

To use additional fields of the POT in the Archive Search UI

NoteIn the context of this guide enhancement of a structure (ESR or DDIC data type) means adding anadditional, optional field at the end of this structure.For details on the concept of enhancements in the context of enterprise services refer to the EnterpriseServices Enhancement Guide [ES].

2.3 Sample Business Process

The sample business process used in this guide is the same as in the POT Developer's Guide [DEV]. A companyemployee needs to go on a business trip. To do so, the employee needs to book a flight ticket and up to twoshuttle transfers, one from his/her home address to the airport of departure, and another one from the airport ofarrival to the destination address.

Enhancement of Process Object TypesIntroduction

PUBLIC© 2016 SAP SE or an SAP affiliate company. All rights reserved. 9

This simplified business process is shown in Figure 2-1:

Figure 2-1: Sample Business Process – Travel Booking

In the context of this guide this process is enhanced by the possibility to request a VIP shuttle transfer. In chapter3 we explain how the shuttle booking service has been extended by an additional field. This service serves as anexample of a standard service that has been enhanced by a customer. Chapter 4 describes what has to be doneby a POT developer to enable later enhancements of a POT. How the sample POT can be enhanced to incorporatethe optional VIP transfer is described in chapter 5.

DestinationAirport DestinationHome

AirportHome

Enhancement of Process Object TypesEnhancing Enterprise Services

PUBLIC© 2016 SAP SE or an SAP affiliate company. All rights reserved. 10

3 Enhancing Enterprise Services

3.1 Reasons for Enhancing an Enterprise Service

The Enterprise Services Enhancement Guide [ES] lists the following reasons (amongst others) why a customermay want to enhance an enterprise service:

Customers or partners have enhanced SAP‘s business functionality and want to offer additional elements inexisting services

A standard service does not expose all fields of a business object and additional fields are required in theservice signature

3.2 Standard Procedure

This document only gives a brief summary of the required steps in order to explain the enhancement of POTs lateron. For details on how to enhance enterprise services see the Enterprise Services Enhancement Guide [ES].

Figure 3-1 provides an overview of all steps that are required to enhance an enterprise service:

Enhancement of Process Object TypesEnhancing Enterprise Services

PUBLIC© 2016 SAP SE or an SAP affiliate company. All rights reserved. 11

Figure 3-1: Steps for Enhancing an Enterprise Service

3.3 Sample Service

This chapter describes how we enhanced the shuttle booking service in the Enterprise Services Repository (ESR)in order to motivate the enhancement of the sample POT in chapter 5.

The shuttle booking service is an asynchronous service. The request and the response message types aredisplayed below:

Enhancement of Process Object TypesEnhancing Enterprise Services

PUBLIC© 2016 SAP SE or an SAP affiliate company. All rights reserved. 12

Figure 3-2: Shuttle Booking – Request Message Type

Figure 3-3: Shuttle Booking – Response Message Type

Exemplarily, we enhanced the service signature with an indicator to request a VIP transfer. The enhanced datatypes for the request and for the response are displayed below, with the enhancements being highlighted inyellow:

Enhancement of Process Object TypesEnhancing Enterprise Services

PUBLIC© 2016 SAP SE or an SAP affiliate company. All rights reserved. 13

Figure 3-4: Request Data Type with Enhancement

Figure 3-5: Data Type for Business Object with Enhancement (Response)

Enhancement of Process Object TypesBuilding Enhanceable Process Object Types

PUBLIC© 2016 SAP SE or an SAP affiliate company. All rights reserved. 14

4 Building Enhanceable Process ObjectTypes

4.1 Overview of Enhancement Spots and BAdIs

The following tables show which code slots should be considered when making a POT enhanceable and whichenhancement spots and BAdIs should be created for which situation. Details will be described in the followingsubchapters. Details about BAdIs that are generated as part of the POT generation can be found in the ApplicationHelp [POB].

4.1.1 Phase Implementation

Code Slot Enhancement Spot BAdIs BAdI isgenerated

INIT method of PIMPLclass

Custom Enhancement Spot forBPON Phase Implementations

INIT method

Create Phase Custom Enhancement Spot forBPON Phase Implementations

One BAdI per serviceoperation andrequest/response

Check Phase Generated Enhancement Spot<MLB>ENH

Generated BAdI<MLB>CHK_BADI

X (ifselected)

Execute Phase Custom Enhancement Spot forBPON Phase Implementations

One BAdI per serviceoperation andrequest/response

Post Process Confirmation Custom Enhancement Spot forBPON Phase Implementations

One BAdI per asynchronousinbound service operation

4.1.2 Archiving

Code Slot Enhancement Spot BAdIs BAdI isgenerated

Archiving Write Report Custom Enhancement Spot forArchiving

No BAdI but EnhancementSections

Enhancement of Process Object TypesBuilding Enhanceable Process Object Types

PUBLIC© 2016 SAP SE or an SAP affiliate company. All rights reserved. 15

Code Slot Enhancement Spot BAdIs BAdI isgenerated

Archivability Check Generated Enhancement Spot<MLB>A_ENH

Generated BAdI <MLB>A_CHK X

Archiving UI Search Custom Enhancement Spot forArchiving

BAdI for Archiving UI

Archiving UI Search Result Custom Enhancement Spot forArchiving

BAdI for Archiving UI

Archiving Get Field Values Enhancement Spot for Archiving BAdI for additional fields forresidence time determination

Archiving Register Fields Enhancement Spot for Archiving BAdI for additional fields forresidence time determination

4.1.3 Editing UI

Code Slots Enhancement Spot BAdIs BAdI isgenerated

Mappings for Search and SearchResult

Custom Enhancement Spotfor Editing UI

BAdI for Editing UISearch

Mappings for List and Form Feeders Custom Enhancement Spotfor Editing UI

One BAdI per FeederClass

Feeder Classes:

GET_DEFINITION

GET_DATA

PROCESS_EVENT

Custom Enhancement Spotfor Editing UI

One BAdI per FeederClass

Application Controller:

HANDLE_EVENT

SET_BUTTON_PARAMETER

Custom Enhancement Spotfor Editing UI

BAdI for ApplicationController

4.1.4 Others

Code Slot Enhancement Spot BAdIs BAdI isgenerated

Authorization check Generated Enhancement Spot forAuthorization Checks<MLB>ATH_ENH

BAdI for CustomAuthorization Checks<MLB>ATH_CHK

X

Enhancement of Process Object TypesBuilding Enhanceable Process Object Types

PUBLIC© 2016 SAP SE or an SAP affiliate company. All rights reserved. 16

4.1.5 Technical Settings for BAdIs

When creating a BAdI there are two important settings that you have to make:

Usability: Select Multiple Use

Instance Creation Mode: Select Newly Creating Instantiation

4.1.6 Naming Conventions

Usually, the guide suggests names for enhancement spots and BAdI definitions that you have to create. You canchoose different names if you like. However, always adhere to the naming conventions for custom artifacts tomake sure that these artifacts are not overwritten by the builder:

Caution

Make sure to comply with the naming convention <MLB>*_C_* for custom artifacts, with _C_ denoting acustom artifact, when creating enhancement spots, BAdIs, class attributes etc.

For further details refer to the Developer's Guide [DEV], chapter 7.1 Custom Phase Implementation.

4.2 How to Make POT Phase Implementations Enhanceable

4.2.1 Enhancement Spot and BAdI Definitions

The enterprise services provided by a POT can be enhanced in the standard way (see chapter 3). You only have totake care of the phase implementations of the POT:

1. Create an enhancement spot <MLB>_C_PIMPL_ENH for the phase implementation in the custom package(<MLB>CUST) of the POT.

2. Create a BAdI definition and a corresponding interface for each node type. The interfaces should containmethods for all back-end services of a node, one per phase and service call. For synchronous service callsthere should be one method per direction (request and response).

The following are examples for the method signatures of the BAdI methods.

Method signature for the request of a synchronous message:

Method Name <METHOD_NAME>, e.g. <PHASE>_<BO>_<OP>_RQ

ShortDescription

<Provide a description>

What to do Change the service request, if required

Preconditions None

Enhancement of Process Object TypesBuilding Enhanceable Process Object Types

PUBLIC© 2016 SAP SE or an SAP affiliate company. All rights reserved. 17

Result The service request is filled correctly

Parameter name ParameterType

Ref. Data Type

I_BPON Importing <MLB>IF_IT_COMP=>TS_BPON_<BPON>_PUBLIC_COMPLETE

I_PHASE_HELPER Importing <MLB>IF_PHSH

C_REQUEST Changing <SERVICE_REQUEST_TYPE>

Exception X <MLB>CX_IM

Method signature for the response of a synchronous message:

Method Name <METHOD_NAME>, e.g. <PHASE>_<BO>_<OP>_RS

ShortDescription

<Provide a description>

What to do Change the mapping of the response, if required

Preconditions None

Result The service request is filled correctly

Parameter name ParameterType

Ref. Data Type

I_RESPONSE Importing <SERVICE_RESPONSE_TYPE>

I_PHASE_HELPER Importing <MLB>IF_PHSH

C_BPON(S) Changing <MLB>IF_N_<BPON>_PIMPL=><TYPE_DEPENDENT_ON_PHASE> (e.g. TY_REF_TO_CREATE_REQUEST)

Exception X <MLB>CX_IM

Error! Reference source not found. contains naming suggestions for all artifacts concerned in the enhancement ofthe phase implementations:

Artifact Suggested Name Example

Enhancement spot <MLB>ES_C_PIMPL /PL9/ES_GXX_FE01_C_PIMPL

BAdI definition <MLB>BD_C_PIMPL_<BPON> /PL9/BD_GXX_FE01_C_PIMPL_SB

BAdI interface <MLB>IF_C_PIMPL_<BPON>_BD /PL9/IF_GXX_FE01_C_PIMPL_SB_BD

BAdI method forsynchronous request

<PHASE>_<BO>_<OP>_RQ EXECUTE_SBO_CRT_RQ

BAdI method forsynchronous response

<PHASE>_<BO>_<OP>_RS EXECUTE_SBO_CRT_RS

BAdI method forasynchronous request

<PHASE>_<BO>_<OP> EXECUTE_SBO_CRT

Enhancement of Process Object TypesBuilding Enhanceable Process Object Types

PUBLIC© 2016 SAP SE or an SAP affiliate company. All rights reserved. 18

Table 1: Suggested Artifact Names

4.2.2 Call BAdIs in Phase Implementations

Instantiate the BAdIs in the INIT methods of the phase implementation classes (<MLB>CL_N_<NODE>_PIMPL):

Figure 4-1: BAdI Instantiation in INIT

In the code slots of the phase implementation classes insert a call to the corresponding BAdI methods before(request) and after (response) each back-end service call.

Error! Reference source not found. shows the call of the BAdI method for the shuttle booking service in the codeslot of the Execute phase. As this service is an asynchronous one, the BAdI is only called before the back-endservice.

Figure 4-2: BAdI Call before Back-end Service Call in EXECUTE

4.3 How to Make POT Archiving Enhanceable

4.3.1 Enhancement Spots

The enhancement options for archiving have to be covered by two enhancement spots, because two differentenhancement technologies come into play: ABAP source code enhancements and BAdIs. For details on bothtechnologies refer to [ENH].

Enhancement of Process Object TypesBuilding Enhanceable Process Object Types

PUBLIC© 2016 SAP SE or an SAP affiliate company. All rights reserved. 19

Create an enhancement spot <MLB>_C_ARCH_ENH for the BAdI technology in the custom package. The otherenhancement spot is created together with the enhancement section in chapter 4.3.2 below.

4.3.2 Selection Screen of Archiving Write Program

The archiving write program can be made enhanceable to enable the possibility to enhance the selection byprovider IDs and / or reference IDs. Details about these possibilities in general can be found in [DEV].

To make the program enhanceable an enhancement spot and two enhancement sections have to be created (onefor each code slot). The enhancement spot can be created together with the first enhancement section.

The following example shows the steps to create an enhancement section for the selection screen of the archivingwrite program:

1. Place the cursor inside the code slot and select Edit > Enhancement Operations > Create Option from themenu.

2. Enter <MLB>_C_A_SELECTION as name for the enhancement section and <MLB>_C_A_ARCH_PROG_ENH asname for the enhancement spot (it will be created if not yet existing). For Inclusion in Source Code select asunconditional call.

Figure 4-3: Creation of Enhancement Section

The result looks as follows:

Figure 4-4: Enhancement Section for Selection

Repeat the two steps to create another enhancement section <MLB>_C_A_MAPPING for the mapping code slot.

Enhancement of Process Object TypesBuilding Enhanceable Process Object Types

PUBLIC© 2016 SAP SE or an SAP affiliate company. All rights reserved. 20

4.3.3 Additional Fields for Determination of Residence Time

As described in [DEV] it is possible to define additional fields to determine the residence time based on any valuecontained in the POT object model .For that a POT provides the class <MLB>CL_A_FVD_C with the two methodsGET_FIELD_VALUES and REGISTER_FIELDS.

Create a BAdI definition with the name <MLB>_C_A_FLDVAL. The BAdI should contain two methods with the samename and the same signature as the methods of the mentioned class. In addition, you should add the data helper(MR_DATA_HELPER of <MLB>CL_A_FVD_C) as importing parameter to the GET_FIELD_VALUES method. Themethod should also raise the exception for archiving <MLB>CX_ARC.

The following examples show the BAdI calls in the code slots of the two methods:

Figure 4-5: Code Slot in REGISTER_FIELDS

Enhancement of Process Object TypesBuilding Enhanceable Process Object Types

PUBLIC© 2016 SAP SE or an SAP affiliate company. All rights reserved. 21

Figure 4-6: Code Slot in GET_FIELD_VALUES

The commented code is pre-generated into the code slots. Adapt it according to your requirements and insert theBAdI calls at the indicated places.

The initialization of the instance variable MR_C_ARCH_FIELDS_BADI should be done in the INIT method of theclass.

4.3.4 Archive Search UI

To allow the enhancement of the archive search UI the code slots in class <MLB>CL_A_SEA_C should contain BAdIcalls that allow to adopt the standard mapping (see [DEV]).

Create a BAdI definition with the name <MLB>C_A_SEARCH. It should contain two methods with the same namesas the methods of the mentioned class:

MAP_SELECTION_TO_SEARCH

MAP_SEARCH_RESULT_TO_FEEDER

Enhancement of Process Object TypesBuilding Enhanceable Process Object Types

PUBLIC© 2016 SAP SE or an SAP affiliate company. All rights reserved. 22

The interfaces of the BAdI methods should be similar to the interfaces of the methods where they are called, withthe difference that instead of the returning parameter R_CUSTOM_SEARCH of methodMAP_SELECTION_TO_SEARCH a changing parameter (C_CUSTOM_SEARCH) should be used.

The following examples show the BAdI calls in the code slots of the two methods:

Figure 4-7: Code Slot in MAP_SELECTION_TO_SEARCH

Figure 4-8: Code Slot in MAP_SEARCH_RESULT_TO_FEEDER

The initialization of the instance variable MR_C_ARCHIVE_SEARCH_BADI should be done in the INIT method ofthe class.

4.4 How to Make the Editing UI Enhanceable

The implementation of the Editing UI is described in detail in [DEV]. Based on the most common use cases thefollowing subchapters describe where enhancement options for the Editing UI should be implemented.

All BAdIs described here can be assigned to a single enhancement spot <MLB>_C_UI_ENH that is to be created inthe custom package (<MLB>CUST).

Enhancement of Process Object TypesBuilding Enhanceable Process Object Types

PUBLIC© 2016 SAP SE or an SAP affiliate company. All rights reserved. 23

4.4.1 Adding Fields to Search and Search Result

The custom feeder class for the search (<MLB>CL_FS_SBA_C) contains two code slot methods to map the feederdata from the selection screen to the search structure (MAP_SELECTION_TO_SEARCH) and to map the searchresult to the result feeder (MAP_SEARCH_RESULT_TO_FEEDER). To allow a customer to map fields in addition tothe fields provided by the standard implementation these two methods should be made enhanceable.

Create a BAdI with the name <MLB>_C_UI_SBA and a corresponding interface <MLB>IF_C_UI_SBA_BD within theabove mentioned enhancement spot. The BAdI should contain two methods that correspond to the methods ofthe feeder class:

MAP_SELECTION_TO_SEARCH:

o The signature of the method should look similar to the signature of the method where it is called. Achanging parameter C_CUSTOM_SEARCH should be used instead of the returning parameterR_CUSTOM_SEARCH.

MAP_SEARCH_RESULT_TO_FEEDER:

o The signature of the method should look like the signature of the method where it is called.

The BAdI methods should be called at the end of the corresponding code slot implementation.

Figure 4-9 andFigure 4-10 show the calls of the BAdI methods in the code slots of the custom search feeder class:

Figure 4-9: BAdI Call in MAP_SELECTION_TO_SEARCH

Figure 4-10: BAdI Call in MAP_SEARCH_RESULT_TO_FEEDER

The initialization of the instance variable MR_C_SEARCH_BADI should be done in the INIT method of the class:

Enhancement of Process Object TypesBuilding Enhanceable Process Object Types

PUBLIC© 2016 SAP SE or an SAP affiliate company. All rights reserved. 24

Figure 4-11: BAdI Instantiation in INIT

4.4.2 Adding Fields to List and Form Feeders

A customer might want to add additional fields to a list or a form feeder of the Editing UI. Besides enhancing theFPM UI configuration and the feeder structures he has to enhance the mappings "model to feeder" and "feeder tomodel".

Every generated custom feeder class contains corresponding methods for each assignment of the feeder in theobject hierarchy. In each code slot within these methods a BAdI method has to be called.

1. Create a BAdI for each generated class using the following naming convention:<MLB>_C_UI_<SUFFIX_OF_CORRESPONDING_FEEDER_WITHOUT_C>.Examples (list feeder of Shuttle Booking node):

o Name of the feeder class: <MLB>CL_FL_SBOKL_C

o Name of the BAdI: <MLB>_C_UI_FL_SBOKL

o Name of the BAdI Interface: <MLB>IF_C_UI_FL_SBOKL_BD

2. In each BAdI interface create the same MAP_MODEL2FEEDER and MAP_FEEDER2MODEL methods as in thecorresponding feeder class. In the MAP_MODEL2FEEDER methods use a changing parameter C_FEEDER_DATAinstead of a returning parameter (R_FEEDER_DATA).

3. Call the BAdI at the end of the corresponding code slot.

The following examples are taken from the custom list feeder class (<MLB>CL_FL_SBOKL_C) of the ShuttleBooking node:

Enhancement of Process Object TypesBuilding Enhanceable Process Object Types

PUBLIC© 2016 SAP SE or an SAP affiliate company. All rights reserved. 25

Figure 4-12: BAdI Call in MAP_MODEL2FEEDER_XX

Figure 4-13: BAdI Call in MAP_FEEDER2MODEL_XX

The initialization of the instance variable MR_C_FEEDER_BADI should be done in the INITIALIZE method of thefeeder class.

4.4.3 Adding Buttons to Feeders

In order to add new buttons to a UIBB a customer requires the possibility to define and handle new FPM actions.To define a new action a BAdI method has to be called in method GET_DEFINITION of the feeder class. To changean action (e.g. to disable it) a BAdI method has to be called in method GET_DATA. Finally, a BAdI method call isrequired in method PROCESS_EVENT to handle the event.

Within the BAdIs for the feeder classes (see chapter 4.4.3) create the following methods:

GET_DEFINITION

GET_DATA

PROCESS_EVENT

The signatures of the methods should be exactly the same as for the corresponding methods in the feeder class.Call the BAdI methods at the end of the corresponding code slot implementation.

Enhancement of Process Object TypesBuilding Enhanceable Process Object Types

PUBLIC© 2016 SAP SE or an SAP affiliate company. All rights reserved. 26

The following examples are taken from the custom list feeder class (<MLB>CL_FL_SBOKL_C) of the ShuttleBooking node:

Figure 4-14: Code Slot in GET_DEFINITION

Enhancement of Process Object TypesBuilding Enhanceable Process Object Types

PUBLIC© 2016 SAP SE or an SAP affiliate company. All rights reserved. 27

Figure 4-15: Code Slot in GET_DATA

Enhancement of Process Object TypesBuilding Enhanceable Process Object Types

PUBLIC© 2016 SAP SE or an SAP affiliate company. All rights reserved. 28

Figure 4-16: Code Slot in PROCESS_EVENT

The initialization of the instance variable MR_C_FEEDER_BADI should be done in the INITIALIZE method of thefeeder class.

4.4.4 Adding Buttons to the Global Application Toolbar

The generated overview page of the Editing UI provides a standard set of buttons. A customer can add additionalbuttons to the UIBB configuration. To implement the event handler for a button and to change its behavior duringruntime the following two methods of the custom application controller class <MLB>CL_FPM_ACC_C require aBAdI method call. Create a BAdI with name <MLB>_C_UI_ACC and add the following methods to its interface:

HANDLE_EVENT:The interface of the BAdI method should be similar to the interface of the corresponding application controllermethod (including the exception).

SET_BUTTON_PARAMETER:The interface of the BAdI method should be similar to the interface of the corresponding application controllermethod (including the exception). However, use a changing parameter C_BUTTON_PARAMETER instead of thereturning parameter R_BUTTON_PARAMETER.

Call the BAdI methods at the end of the corresponding code slot implementation.

NoteOnly actions with the prefixes PL1 (for generation actions) and CPL1 (for custom actions) are forwardedto the custom application controller. Therefore define and document a naming convention for actionsdefined as part of an enhancement. For example, you could use CPL1_Z as prefix for such actions.

Enhancement of Process Object TypesBuilding Enhanceable Process Object Types

PUBLIC© 2016 SAP SE or an SAP affiliate company. All rights reserved. 29

Examples:

Figure 4-17: Code Slot in HANDLE_EVENT

Figure 4-18: Code Slot in SET_BUTTON_PARAMETER

The initialization of the instance variable MR_C_ACC_BADI should be done in the INIT method of the customcontroller class.

Enhancement of Process Object TypesEnhancing Process Object Types

PUBLIC© 2016 SAP SE or an SAP affiliate company. All rights reserved. 30

5 Enhancing Process Object Types

CautionWhen you enhanced a POT and want to make changes to these enhancements after you used your POTproductively, keep in mind that the same rules as for changing the structure of a POT apply. In particular itmight not be possible to read old instances anymore.

5.1 Enhancement Options

5.1.1 POT Object Model

When the POT developer has foreseen enhancements to the POT object model, these enhancements concern thedetails of the root and child nodes (if details are available), the private details of the child nodes (if private detailsare available), as well as the PCC of the root and child nodes (if PCC are available). Figure 5-1 shows the POTobject model template with possible enhancement options highlighted in yellow:

Enhancement of Process Object TypesEnhancing Process Object Types

PUBLIC© 2016 SAP SE or an SAP affiliate company. All rights reserved. 31

Figure 5-1: POT Object Model with Enhancement Options

5.1.2 Custom Checks in Check Phase

In step "Define Process Object Nodes" of the POB Modeling Wizard a POT developer can select for which nodes(including the root node) a BAdI definition should be generated for the Check phase. If this was done for your POTthere will be an enhancement spot and a BAdI in the package <MLB>API for additional custom checks:

Enhancement spot: <MLB>ENH

BAdI definition: <MLB>CHK_BADI

BAdI interface:<MLB>IF_CHK_BADI

The BAdI interface contains one check method for each selected node.

Enhancement of Process Object TypesEnhancing Process Object Types

PUBLIC© 2016 SAP SE or an SAP affiliate company. All rights reserved. 32

5.1.3 Archiving

A POT provides a BAdI for custom archivability checks. The enhancement spot and the BAdI can be found in theAPI package <MLB>API:

Enhancement spot: <MLB>A_ENH

BAdI definition: <MLB>A_CHK

BAdI Interface: <MLB>IF_A_CHK_BD

The interface provides the method IS_ARCHIVABLE which is called per POT instance during the archiving run.Within the implementation you can overrule the decision if an instance is archivable. However, you can only setinstances to not archivable which were set to archivable by the standard implementation. The implementation willnot be called for an instance that has been set to not archivable already by the standard implementation.

Apart from that the generated code for the POT archiving integration is not enhanceable. If your specific POTprovides additional BAdIs for enhancing the archiving write report, archiving search UI, or the additional fields forresidence time determination, you can enhance the functionality accordingly. Refer to the documentation of yourPOT for further details.

5.1.4 Authorization

In step "Define Authorization Checks" of the POB Specification Wizard a POT developer can select to generate aBAdI for custom authorization checks. If this was done for your POT you will find the following BAdI in the generalpackage <MLB>GENRL:

Enhancement spot: <MLB>ATH_ENH

BAdI definition: <MLB>ATH_CHK

BAdI interface: <MLB>IF_ATH_CHK_B

The interface contains the method CHECK_AUTHORIZATION:

Method Name CHECK_AUTHORIZATION

ShortDescription

Performs authorization check

What to do Execute a custom authorization check according to your requirements

Preconditions None

Result An exception is thrown or not

Parameter name ParameterType

Ref. Data Type

I_ACTIVITY Importing <MLB>CE_ATH_ACT

I_NODE_TYPE Importing <MLB>CE_NODE_TY_C

I_OPERATION Importing <MLB>CE_OP_PURP

I_REQUEST_DATA Importing DATA

I_BPO_TOTAL Importing <MLB>IF_IT_COMP=>TS_BPO_PUBLIC_TOTAL

Enhancement of Process Object TypesEnhancing Process Object Types

PUBLIC© 2016 SAP SE or an SAP affiliate company. All rights reserved. 33

Exception X <MLB>CX_ATH

This method is called for every service call. If a user has no authorization an exception has to be thrown. With thismethod the authorization checks of the standard can only be restricted further. So if the standard authorizationcheck fails the method will not be called.

5.1.5 Editing UI

The generated DDIC structures for the feeder classes are enhanceable. Apart from that, the generated code of theEditing UI is not enhanceable as no BAdIs are generated to adopt the mapping between the UI model and thefeeder classes, to add new buttons to feeders or the overview page, or any other change of the UI behavior.

If your specific POT provides BAdIs for enhancing the Editing UI, you can enhance it accordingly. Refer to thedocumentation of your POT for further details. For details on enhancing FPM configuration using the ApplicationEnhancement Tool (AET), please refer to [AET].

CautionIf you have the option to enhance the Editing UI of your specific POT and define actions for additionalbuttons, make sure to adhere to the naming convention for additional actions described in thedocumentation of your POT. Do not use the prefix PL1 as this prefix is reserved for the generated actions.

5.2 How to Enhance POT Services and Object Model

Enhancing a POT comprises similar steps as enhancing an enterprise service, because enhancing a POT first of allmeans enhancing its services. Figure 5-2 depicts all steps that are required to enhance a POT. You might noticethat the diagram is very similar to the one showing the standard enhancement procedure for enterprise servicesin chapter 3.2.

Enhancement of Process Object TypesEnhancing Process Object Types

PUBLIC© 2016 SAP SE or an SAP affiliate company. All rights reserved. 34

Figure 5-2: Steps for Enhancing a POT

The steps highlighted in gray are considered a prerequisite and only the steps depicted in yellow will be describedin the following subsections.

5.2.1 Enhance POT Services in ESR

The enhancement of a POT starts in the ESR. When you want to enhance the details of the process object itself,you have to create an enhancement for the Details data type. When you want to enhance the details of a node, youhave to create an enhancement for the <Node>Details data type. Accordingly, when you want to enhance the(<Node>)Process Control Constraints or <Node>PrivateDetails, you have to enhance the (<Node>)PCC or<Node>PrivateDetails data type.

Table 2 contains the relationship between enhancements and corresponding data types:

Enhancement of Data Type to Enhance

Details <BPO><Version><Application>_BPO_Details

<Node>Details <BPO><Version><Application>_BPON_<Node>_Details

Enhancement of Process Object TypesEnhancing Process Object Types

PUBLIC© 2016 SAP SE or an SAP affiliate company. All rights reserved. 35

Enhancement of Data Type to Enhance

<Node>PrivateDetails <BPO><Version><Application>_BPON_<Node>_PrivateDetails

PCC <BPO><Version><Application>_BPO_PCC

<Node>PCC <BPO><Version><Application>_BPON_<Node>_PCC

Table 2: Enhancements and Corresponding Data Types

In our example we enhance the details of the shuttle booking node. Figure 5-3 shows the corresponding data typeenhancement:

Figure 5-3: Enhancement for Details of Shuttle Booking

5.2.2 Generate Enhancement Proxy Structure

As a next step you have to generate the proxy structure for the enhancement using transaction SPROXY. After thatthe enhancement is visible as an append structure of the enhanced proxy structure:

Enhancement of Process Object TypesEnhancing Process Object Types

PUBLIC© 2016 SAP SE or an SAP affiliate company. All rights reserved. 36

Figure 5-4: Enhanced Proxy Structure with Append Structure

5.2.3 Create Append Structure for Internal Types

Internally, a POT uses so-called internal types instead of the generated proxy data types. Refer to chapter 7.4Internal Types of the Developer's Guide for more details. Therefore, you also have to enhance the internalequivalent of the enhanced proxy data type. The internal type is named like the proxy type with the proxy prefixbeing replaced by the prefix for common internal types.

CautionIt is important that you give the components of the append structure exactly the same names as thecomponents of the enhancement proxy structure. Otherwise the mappings in the POT services do notwork.In the example the name given by SPROXY is /PL9/FEXXVIPTRANSFER_INDICATOR. The same name isused for the component of the internal type.

Figure 5-5 shows the internal types structure from our example together with its append structure:

Enhancement of Process Object TypesEnhancing Process Object Types

PUBLIC© 2016 SAP SE or an SAP affiliate company. All rights reserved. 37

Figure 5-5: Internal Types Structure with Append Structure

How to Find the Corresponding Internal Type for an SPROXY Type

Start transaction SPROXY, look up the enhanced proxy type and note down the proxy prefix (blue box in Figure5-6):

Figure 5-6: Prefix of Proxy Type in SPROXY

Start transaction SE11, enter the name of the proxy type and replace the prefix with an asterisk (*). Press F4 andselect Search for Structures. You will get a list with two or three types that looks like the following:

Enhancement of Process Object TypesEnhancing Process Object Types

PUBLIC© 2016 SAP SE or an SAP affiliate company. All rights reserved. 38

Figure 5-7: Search Result in SE11

In this case the type we are looking for is the first entry, because the second one is our enhancement and the thirdone the proxy type we used for searching. In case you get more hits you can restrict the result by specifying apackage after pressing "New selection":

Figure 5-8: Restrict Search by Package

5.2.4 Implement BAdI(s)

So far the additional data from the enhancement arrives in the code slots of the phase implementation classes.Now you have to implement one or more BAdIs to map this data to the request types of the concerned back-endservices. To do so, create an enhancement implementation, a BAdI implementation and a corresponding BAdIimplementation class. For details on BAdI implementations refer to [BADI]. Then implement the required BAdImethods and map the additional fields.

Figure 5-9 shows the implementation of the BAdI method for the call of the shuttle booking service in the Executephase:

Enhancement of Process Object TypesEnhancing Process Object Types

PUBLIC© 2016 SAP SE or an SAP affiliate company. All rights reserved. 39

Figure 5-9: Implemented BAdI Method

In the example the POT was enhanced to make use of a field that had previously been added to the shuttlebooking back-end service by an enhancement itself.

5.3 How to Consume an Enhanced Enterprise Service in aPOT

When you enhanced an enterprise service (see chapter 3 for details) that is consumed by a POT and want to usethese enhancements in the POT, you have to enhance the corresponding counterpart services of the POT. Theprocedure is the same as described in the previous chapter. The only difference is that the field name of the POTenhancement cannot be chosen freely but has to match the field name of the enhancement of the enterpriseservice.

5.3.1 Enhance Counterpart Services in ESR

Again, the enhancement starts in the ESR. In our example we want to use the enhancement of the shuttle bookingservice from chapter 3.3 in our POT. In order to do this we have to enhance the counterpart services of the shuttlebooking back-end service.

Figure 5-10 shows the data type enhancement for the create request of the shuttle booking service:

Enhancement of Process Object TypesEnhancing Process Object Types

PUBLIC© 2016 SAP SE or an SAP affiliate company. All rights reserved. 40

Figure 5-10: Enhancement for Shuttle Booking Create Request

Figure 5-11 shows the enhancement for the business object as contained in the service response:

Figure 5-11: Enhancement for Shuttle Booking

As you can see, the enhancements exactly match the enhancements of the back-end service.

5.3.2 Generate Enhancement Proxy Structure

Next, you have to generate the proxy structures for the enhancements using transaction SPROXY.

After that the enhancements are visible as append structures of the enhanced proxy structures:

Enhancement of Process Object TypesEnhancing Process Object Types

PUBLIC© 2016 SAP SE or an SAP affiliate company. All rights reserved. 41

Figure 5-12: Create Request with Append Structure

Figure 5-13: Business Object with Append Structure

5.3.3 Create Append Structure for Internal Types

Next, you have to enhance the internal types that correspond to the enhanced proxy data types. The internaltypes are named like the proxy types with the proxy prefix being replaced by the prefix for common internal types(see chapter 5.2.3. for help on finding the corresponding internal type for a proxy type).

Enhancement of Process Object TypesEnhancing Process Object Types

PUBLIC© 2016 SAP SE or an SAP affiliate company. All rights reserved. 42

CautionIt is important that you give the components of the append structures exactly the same names as thecomponents of the enhancement proxy structures. Otherwise the mappings in the POT services do notwork.In the example the name given by SPROXY is /PL9/FEXXVIPTRANSFER_INDICATOR. The same name isused for the component of the internal type.

The following figures show the internal types structures from our example together with their append structures:

Figure 5-14: Internal Representation of Request with Append Structure

Enhancement of Process Object TypesEnhancing Process Object Types

PUBLIC© 2016 SAP SE or an SAP affiliate company. All rights reserved. 43

Figure 5-15: Internal Representation of Business Object with Append Structure

5.3.4 Implement BAdI(s)

Finally, you have to fill the additional service fields in the phase implementation by implementing thecorresponding BAdI methods.

In our example we implement the BAdI method for the call of the shuttle booking service in the Execute phase. It isthe same implementation as in chapter 5.2.4:

Figure 5-16: Implemented BAdI Method

5.4 Summary

You can enhance a POT in the following places, if the POT developer has foreseen the correspondingenhancement points (BAdIs):

Services and object model

Enhancement of Process Object TypesEnhancing Process Object Types

PUBLIC© 2016 SAP SE or an SAP affiliate company. All rights reserved. 44

Custom checks in the Check phase

Additional authorization checks

Archiving integration

Editing UI

For concrete information on available enhancement possibilities refer to the documentation of your POT.

Enhancement of Process Object TypesReferences

PUBLIC© 2016 SAP SE or an SAP affiliate company. All rights reserved. 45

References

Reference Document Type Document

[AET] Application Help Application Enhancement Tool

[BADI] Application Help Enhancement Concept: BAdIs

[DEV] Guide Design & Implementation of Process Object Types

[ENH] Application Help Enhancement Concept

[ES] SCN Enterprise Services Enhancement Guide

[ESR] Application Help SAP NetWeaver Process Integration

[GDT] SCN SAP Global Datatype Catalog

[POB] Product Page SAP Process Object Builder

[SPROXY] Application Help Working with ABAP Proxies

Enhancement of Process Object TypesTerms and Abbreviations

PUBLIC© 2016 SAP SE or an SAP affiliate company. All rights reserved. 46

Terms and Abbreviations

Term/Abbreviation Full Name/Definition

PCC Process Control Constraints

ESR Enterprise Services Repository

POB SAP Process Object Builder

POT Process Object Type

www.sap.com/contactsap

© 2016 SAP SE or an SAP affiliate company. All rights reserved.No part of this publication may be reproduced or transmitted in anyform or for any purpose without the express permission of SAP SEor an SAP affiliate companySAP and other SAP products and services mentioned herein as wellas their respective logos are trademarks or registered trademarks ofSAP SE (or an SAP affiliate company) in Germany and othercountries. All other product and service names mentioned are thetrademarks of their respective companies. Please seewww.sap.com/corporate-en/legal/copyright/index.epx#trademarkfor additional trademark information and notices.