Nothing Special   »   [go: up one dir, main page]

S4HANA Utilities For CM Extensibility 2022

Download as pdf or txt
Download as pdf or txt
You are on page 1of 94

Extensibility Guide

Best Practice for S/4HANA Utilities for customer


engagement 2022
Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

© 2022 SAP SE or an SAP affiliate company. 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 SE or an
SAP affiliate company. SAP and other SAP products and services mentioned herein as well as their
respective logos are trademarks or registered trademarks of SAP SE (or an SAP affiliate company) in
Germany and other countries. All other product and service names mentioned are the trademarks of their
respective companies. Please see https://www.sap.com/trademark for additional trademark information and
notices.

Introduction Page 2 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

TABLE OF CONTENTS
INTRODUCTION .............................................................................................................................................. 4
EXTEND CONTRACT ACCOUNT .................................................................................................................. 5
EXTEND OBJECT: POINT OF DELIVERY..................................................................................................... 7
DDIC: ............................................................................................................................................................7
PROCESS FRAMEWORK ............................................................................................................................ 11
Forced Move-Out - SAP Workflow ............................................................................................................ 11
Damage Control Process Framework (SAP Workflow) .......................................................................... 18
Supply Start Date ....................................................................................................................................... 21
New Step – Supply End Date .................................................................................................................... 35
KUT (add new field) ................................................................................................................................. 35
Business Layer......................................................................................................................................... 36
User Interface ........................................................................................................................................... 38
Customizing (Form) ................................................................................................................................. 46
BAdI Implementation ............................................................................................................................... 47
Demo ......................................................................................................................................................... 49
Source Code ............................................................................................................................................. 50
NEW BUSINESS LAYER OBJECT .............................................................................................................. 50
DDIC ............................................................................................................................................................ 51
Create CDS-View(s) using ADT .............................................................................................................. 51
Create DDIC Structures ........................................................................................................................... 53
Classes ........................................................................................................................................................ 54
Create Classes ......................................................................................................................................... 54
Customizing (GenIL/BOL) ......................................................................................................................... 56
Customizing (BL) ....................................................................................................................................... 60
Customizing (data environment / BOL-Tree's)........................................................................................ 64
Test .............................................................................................................................................................. 67
UI WITH FORM CUSTOMIZING ................................................................................................................... 69
Add New Form with Mask and Navigate/Show it .................................................................................... 69
Add Sections to Overview Page ............................................................................................................... 74
Add Actions/Toolbar Buttons to a Form.................................................................................................. 76
Handle Actions in Form ............................................................................................................................. 78
ATTACHMENTS ............................................................................................................................................ 83
Result handler class (sample) ................................................................................................................ 83
BAdI Implementation (sample) ............................................................................................................... 84
Component Controller (Context) ............................................................................................................ 89
Window (Controller) ................................................................................................................................. 89
Window (Context)..................................................................................................................................... 91
View (Controller) ...................................................................................................................................... 91
View (Context) .......................................................................................................................................... 93
View (Layout/HTML) ................................................................................................................................. 94

Introduction Page 3 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

INTRODUCTION
SAP S/4HANA Utilities for customer engagement is a simplified version of SAP CRM embedded into SAP
S/4HANA. While its first versions were technically delivered as an add-on (as software component
S4CRM). It has been fully embedded into S/4HANA with the 1909 release.

With Release 1909 the Customizing node of Customer Management was moved under SAP
Utilities and renamed to Customer Engagement. If you are missing Customizing entries under SAP
Utilities please see Customizing node Service.

Within SAP S/4HANA Utilities for customer engagement, the S/4HANA Interaction Center serves as central
entry point for customer service specialists of a utility company, allowing them to access numerous industry
processes and functions. Technically the Interaction Center leverages SAP’s proven CRM Web UI
Framework technology, and new UI themes offer a harmonized Fiori user experience following SAP Fiori
user interface strategy.

This guide is intended for developers who make customer-specific enhancements in the coding.
It describes in more detail how to implement special extensions.

Introduction Page 4 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

EXTEND CONTRACT ACCOUNT


The extensibility of the contract account makes it possible to add customer-specific Z-fields, in the table
FKKVKP, and to use them in the WebUI.

UtilsContrAcctPartner
1. Extend DDIC via the Key User Tool (KUT) for Business Context FICA_CONTRACT_ACCOUNT_PART_REL
(Contract Accounting: Contract Account Partner Relationship)
2. Extend CDS-Views
2.1. Extend I-View (CRMS4_IU_I_CAP)
@AbapCatalog.sqlViewAppendName: 'ZCRMS4IUEICAP'
@EndUserText.label: 'Extension Contract Account Partner'
extend view CRMS4_IU_I_CAP with ZCRMS4_IU_E_I_CAP {
_UtilitiesFields.zz1_test_text_vkp
}

2.2. Extend C-View (CRMS4_IU_C_CAP)


@AbapCatalog.sqlViewAppendName: 'ZCRMS4IUECCAP'
@EndUserText.label: 'Extension Contract Account Partner'
extend view CRMS4_IU_C_CAP with ZCRMS4_IU_E_C_CAP {
CRMS4_IU_I_CAP.zz1_test_text_vkp
}

3. Add field to BL Customizing


3.1. Add attribute to the BL Layer via IMG > SAP Utilities > Customer Engagement > General
Functions > Override the Definition of the Utilities Business Layer Objects

Extend Contract Account Page 5 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

3.2. BL Object: UtilsContrAcctPartner

Figure 1: Define BL Object Attribute Properties - BL Object: UtilsContrAcctPartner

4. Add field to UI

Figure 2: View Configuration

Extend Contract Account Page 6 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

Figure 3: View Configuration - new field added

Figure 4: New field - Demo Text

EXTEND OBJECT: POINT OF DELIVERY

DDIC:
1. Create the customer includes CI_EUIHEAD from the table EUIHEAD

Figure 5: Structure CI_EUIHEAD

Extend Object: Point Of Delivery Page 7 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

2. Appending the structure CRMS4S_IU_POD_ATTR


2.1. Include CI_EUIHEAD in the append structure
2.2. Enhancement category of the append structure must have the same category as the structure to
be enhanced (e.g. CRMS4S_IU_POD_ATTR).

Figure 6: Structure CRMS4S_IU_POD_ATTR

3. Appending the structure CRMS4S_IU_POD_BL_DATA


3.1. Include CI_EUIHEAD in the append structure
3.2. Enhancement category of the append structure must have the same category as the structure to
be enhanced (e.g. CRMS4S_IU_POD_BL_DATA).

Figure 7: Structure CRMS4S_IU_POD_BL_DATA

4. Append Query structure if attribute should be used as query parameter


5. Extend CDS-Views
5.1. Extend I-View (CRMS4_IU_I_POD)
@AbapCatalog.sqlViewAppendName: 'ZCRMS4IUEIPOD'
@EndUserText.label: 'Extension Point of Delivery'
extend view CRMS4_IU_I_POD with ZCRMS4_IU_E_I_POD {
euihead.zz_description
}

5.2. Extend C-View (CRMS4_IU_C_POD)


@AbapCatalog.sqlViewAppendName: 'ZCRMS4IUECPOD'
@EndUserText.label: 'Extension Point of Delivery'
extend view CRMS4_IU_C_POD with ZCRMS4_IU_E_C_POD {
CRMS4_IU_I_POD.zz_description
}

Extend Object: Point Of Delivery Page 8 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

6. Business Layer
6.1. Add attribute to the BL Layer via IMG > SAP Utilities > Customer Engagement > General
Functions > Override the Definition of the Utilities Business Layer Objects
6.2. BL Object: PointOfDelivery

Figure 8: Define BL Object Attribute Properties - BL Object PointOfDelivery

Extend Object: Point Of Delivery Page 9 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

7. User Interface
7.1. Add attribute to UI View configuration

Figure 9: View configuration - add new attribute

Figure 10: Point of Delivery - new attribute added

8. Master Data Template (MDT)


The Master Data Template allows you to allocate fixed values to fields in any given object. This
enables you to create data with minimum data entry.
8.1. Find the used MDT (IMG > SAP Utilities > Customer Engagement > Technical Objects > Assign
Master Data Template for Technical Objects)
8.2. TX: EPRODCUST
8.2.1.Edit MDT and add attribute
IMG > SAP Utilities > Customer Engagement > Technical Objects > Assign Master Data
Template for Technical Objects

Extend Object: Point Of Delivery Page 10 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

Figure 11: Assign Master Data Template

9. Class (BL)
9.1. Implicitly enhance method INIT_MDG_SPEC in the corresponding BL-Class
9.2. Add the attribute to internal table GT_MDG_FIELDNAME_MAPPING

Figure 12: Add attribute to table GT_MDG_FIELDNAME_MAPPING

PROCESS FRAMEWORK

Forced Move-Out - SAP Workflow


The forced move-out is to be checked by an administrator via a workflow. The administrator should then
decide whether the forced move-out should be carried out.

In this example a workflow is created when a new contract process with forced move-out is performed.
Enhancement spot CRMS4_IU_CM_PROCESS_FRAMEWORK with BAdI definition CRMS4_IU_CM_PF_PROCESS is
used.

1. Define SAP-Workflow
1.1. define step(s)

Process Framework Page 11 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

Figure 13: Define Steps

1.2. define decision

Figure 14: Define decision

Process Framework Page 12 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

1.3. assign and 'register' result handler

Figure 15: Assign/register result handler

1.4. implement result handling


see Result handler class (sample)

2. Create BAdI Implementation


2.1. Enhancement Spot: CRMS4_IU_CM_PROCESS_FRAMEWORK

Figure 16: Enhancement Spot: CRMS4_IU_CM_PROCESS_FRAMEWORK

2.2. BAdI Definition: CRMS4_IU_CM_PF_PROCESS

Figure 17: BAdI Definition: CRMS4_IU_CM_PF_PROCESS

Process Framework Page 13 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

2.3. Filter: PFPROCESSKIND = NEW_CNTR (optional)

Figure 18: Filter: PFPROCESSKIND

3. Implement logic in BAdI Impl.


3.1. Define method IF_CRMS4_IU_CM_PF_PROCESS_BADI~BEFORE_EXECUTE_STEP
3.2. Check if current step is forced move-out
3.3. Create Workflow
3.4. Set additional value to process
3.4.1.stored in database table CRMS4D_IU_PFPV
3.5. Suspend process with current step
3.6. Add message (optional)
see BAdI Implementation (sample)

4. Demo
For a better understanding of process execution, the following demo compares an approved and a
rejected move-out.
4.1. Create Utilities Sales Contract
Demo – Approve

Figure 19: Approve - Create Utilities Sales Contract

Process Framework Page 14 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

Demo – Reject

Figure 20: Reject - Create Utilities Sales Contract

4.2. Check message log for added information that workflow was created
Demo – Approve

Figure 21: Approve - message log

Demo – Reject

Figure 22: Reject - message log

Process Framework Page 15 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

Figure 23: Reject - Workflow created

4.3. Go to transaction 'SBWP - SAP Business Workplace'


Demo – Approve

Figure 24: Approve - SBWP - SAP Business Workplace

4.4. Execute SAP Workflow / Decide

Process Framework Page 16 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

Demo – Approve

Figure 25: Approve - Decide

4.5. Check result in the Utilities Sales Contract Overview (based on decision)
Demo – Approved
Process for Sales Contract was continued, and the Sales Contract was created

Figure 26: Approve - Sales contract created

Process Framework Page 17 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

Demo – Rejected
Process for Sales Contract was aborted, and the Sales Contract was not created

Figure 27: Reject - Sales Contract NOT created

Figure 28: Reject - Forced move-out was rejected

Damage Control Process Framework (SAP Workflow)


In this example the BAdI is implemented to handle damage control after a new contract process failed,
where a SAP Workflow is created after the process failed.
Enhancement spot CRMS4_IU_CM_PROCESS_FRAMEWORK with BAdI definition CRMS4_IU_CM_PF_PROCESS is
used.
1. Define SAP Workflow
2. Create BAdI Implementation
2.1. Enhancement Spot: CRMS4_IU_CM_PROCESS_FRAMEWORK

Process Framework Page 18 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

Figure 29: Enhancement Spot - CRMS4_IU_CM_PROCESS_FRAMEWORK

2.2. BAdI Definition: CRMS4_IU_CM_PF_PROCESS

Figure 30: BAdI Definition - CRMS4_IU_CM_PF_PROCESS

2.3. Filter: PFPROCESSKIND = NEW_CNTR (optional)

Figure 31: Filter - PFPROCESSKIND

3. Implement logic in BAdI Impl.


3.1. Define method IF_CRMS4_IU_CM_PF_PROCESS_BADI~BEFORE_DAMAGE_CONTROL
3.2. Create Workflow
3.3. Set additional value to process
3.3.1.Stored in database table CRMS4D_IU_PFPV
3.4. Add message (optional)
see BAdI Implementation (sample)

4. Demo

Process Framework Page 19 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

4.1. Create Utilities Sales Contract

Figure 32: Damage Control - Create Utilities Sales Contract

4.2. Check message log for added information that workflow was created

Figure 33: Damage Control - message log

4.3. Go to transaction 'SBWP - SAP Business Workplace'

Figure 34: Damage Control - SBWP - SAP Business Workplace

Process Framework Page 20 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

Supply Start Date


Add a new field for the supply start date and use this entered value as move-in date.

1. Add new field to Sales Contract Item via Key-User-Tool (KUT)


1.1. Add SUPPLY_START via 'Custom Fields' Application

Figure 35: Start Custom Fields app

1.2. Select Business Context 'CRMS4_IUCI_I'

Figure 36: Add Business Context

1.3. Define Label


1.4. Define Type

Process Framework Page 21 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

Figure 37: Define Label and Type

1.5. Go to newly create field > User Interface > CDS Views
1.5.1.enable CDS-View extension via 'Enabled' checkbox

Figure 38: Enable CDS-View

1.6. Change label

Process Framework Page 22 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

Figure 39: Change Label

1.7. Save
1.8. Publish

Figure 40: Publish

Process Framework Page 23 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

2. Add attribute to the Business Layer (BL)


2.1. Add attribute to the BL Layer via IMG > SAP Utilities > Customer Engagement > General
Functions > Override the Definition of the Utilities Business Layer Objects
2.2. BL Object: UtilitiesContractItem

Figure 41: Add attribute to the Business Layer

3. Add field to UI
3.1. Start transaction WUI
3.2. Select Business Role
3.3. Go to UI where you want to add the field
3.3.1.e.g. execute process 'New Contract' on 'Utilities Sales Contracts'
3.4. Add field via configuration adjustment
3.4.1.Show Configurable Areas
3.4.2.Choose area to configure

Process Framework Page 24 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

Figure 42: Add field to UI – configuration area

Figure 43: Add field to UI – Show Available Fields

Process Framework Page 25 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

Figure 44: Add field to UI - New Field

4. Add field to data environment (BOL-Tree)


4.1. IMG > SAP Utilities > Customer Engagement > Settings for the Object Workbench > Define
Object Hierarchy and Object Attributes
4.2. Create Presentation Node

Figure 45: Create Presentation Node

Process Framework Page 26 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

4.2.1.Add field

Figure 46: Add field to column

4.3. Create Profile (you can copy the profile used in standard delivery and adjust accordingly)

Figure 47: Create Profile

4.3.1.Define Columns

Figure 48: Define Columns

4.3.2.Change Presentation ID of Node ID with the newly created presentation (S4CUTCTMCI)

Process Framework Page 27 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

Figure 49: Change Presentation ID

4.4. Create Profile Group

Figure 50: Create Profile Group

4.4.1.assign newly created profile to the profile group

Process Framework Page 28 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

Figure 51: Assign to Profile Group

5. Change profile group in Forms customizing


5.1. IMG > SAP Utilities > Customer Engagement > General Functions > Override the Form Definition
5.2. Go to 'Define Form Tree'
5.3. Add entry for the form that you want to override/change
5.4. Insert newly created profile group in field 'Group ID'

Figure 52: Define Form Tree

6. BAdI Implementation for CRMS4_IU_CM_UI_PROCESS


6.1. Implement VALIDATE method to prefill attribute (optional)

Figure 53: BAdI Implementation for CRMS4_IU_CM_UI_PROCESS

Process Framework Page 29 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

Figure 54: BAdI Implementing Class

7. BAdI Implementation for CRMS4_IU_CM_PI_PROCESS


7.1. Implement method IF_CRMS4_IU_CM_PI_PROCESS_BADI~CREATE_MOVEIN
7.2. Read UtilitiesContractItem entity via BL Factory/Handler
7.3. Adjust move-in date in changing parameter CS_INTERFACE_PARAMS

Figure 55: BAdI Implementation for CRMS4_IU_CM_PI_PROCESS

class ZCL_CRMS4_IU_UIP_NEW_CONTRACT definition


public
final
create public .

public section.

interfaces IF_BADI_INTERFACE .
interfaces IF_CRMS4_IU_CM_UI_PROCESS_BADI .
protected section.
private section.
ENDCLASS.

CLASS ZCL_CRMS4_IU_UIP_NEW_CONTRACT IMPLEMENTATION.

Process Framework Page 30 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

* <SIGNATURE>------------------------------------------------------------------
---------------------+
* | Instance Public Method ZCL_CRMS4_IU_UIP_NEW_CONTRACT-
>IF_CRMS4_IU_CM_UI_PROCESS_BADI~BEGIN_PROCESS
* +----------------------------------------------------------------------------
---------------------+
* | [--->] IR_PROCESS TYPE REF TO
IF_CRMS4_IU_CM_UI_PROCESS_ACS
* +----------------------------------------------------------------------------
----------</SIGNATURE>
method IF_CRMS4_IU_CM_UI_PROCESS_BADI~BEGIN_PROCESS.
endmethod.

* <SIGNATURE>------------------------------------------------------------------
---------------------+
* | Instance Public Method ZCL_CRMS4_IU_UIP_NEW_CONTRACT-
>IF_CRMS4_IU_CM_UI_PROCESS_BADI~VALIDATE
* +----------------------------------------------------------------------------
---------------------+
* | [--->] IR_PROCESS TYPE REF TO
IF_CRMS4_IU_CM_UI_PROCESS_ACS
* +----------------------------------------------------------------------------
----------</SIGNATURE>
method IF_CRMS4_IU_CM_UI_PROCESS_BADI~VALIDATE.
data(LR_CTI) = IR_PROCESS->GET_BOL_ENTITY(
CL_CRMS4_IU_CM_UI_PROCESS_CTXT=>C_CONTEXT_NODES-CONTRACTITEM ).

if LR_CTI is bound.
data(LV_SUPPLY_START) = cast DATS( LR_CTI->GET_PROPERTY(
'ZZ1_SUPPLY_START_UCI' ) )->*.
if LV_SUPPLY_START is initial.
data(LV_IL_CONTSTART) = cast CRMS4_IU_CTI_IL_CONTSTART( LR_CTI-
>GET_PROPERTY( 'IL_CONTSTART' ) )->*.
LV_SUPPLY_START = conv DATS( LV_IL_CONTSTART + 1 ).

LR_CTI->SET_PROPERTY( IV_ATTR_NAME = 'ZZ1_SUPPLY_START_UCI' IV_VALUE =


LV_SUPPLY_START ).
CL_CRM_BOL_CORE=>GET_INSTANCE( )->MODIFY( ).
endif.
endif.
endmethod.
ENDCLASS.

Process Framework Page 31 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

Figure 56: BAdI Implementing Class

class ZCL_CRMS4_IU_PI_NEW_CONTRACT definition


public
final
create public .

public section.

interfaces IF_BADI_INTERFACE .
interfaces IF_CRMS4_IU_CM_PI_PROCESS_BADI .
protected section.
private section.
ENDCLASS.

CLASS ZCL_CRMS4_IU_PI_NEW_CONTRACT IMPLEMENTATION.

* <SIGNATURE>------------------------------------------------------------------
---------------------+
* | Instance Public Method ZCL_CRMS4_IU_PI_NEW_CONTRACT-
>IF_CRMS4_IU_CM_PI_PROCESS_BADI~CREATE_MOVEIN
* +----------------------------------------------------------------------------
---------------------+
* | [--->] IS_PARAMETERS TYPE
CL_CRMS4_IU_CM_PI_PROCESS=>TS_CREATE_MOVE_IN_PARAMS
* | [<-->] CS_RESULT TYPE
CL_CRMS4_IU_CM_PI_PROCESS=>TS_CREATE_MOVE_IN_RESULT
* | [<-->] CS_INTERFACE_PARAMS TYPE
CL_CRMS4_IU_CM_PI_PROCESS=>TS_CREATE_MOVE_IN_INTF
* | [<-->] CV_EV_HANDLED TYPE ABAP_BOOLEAN
* | [<-->] CV_EV_FAILED TYPE ABAP_BOOLEAN
* +----------------------------------------------------------------------------
----------</SIGNATURE>
method IF_CRMS4_IU_CM_PI_PROCESS_BADI~CREATE_MOVEIN.
data:
LS_CONTRACT_ITEM type CRMS4S_IU_CTI_BL.

try.
data(LR_HANDLER) = CL_CRMS4_IU_BL_FACTORY=>GET( IV_BLOBJECTNAME =

Process Framework Page 32 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

CL_CRMS4_IU_IL_META=>C_OBJECTS-CTM-CONTRACTITEM ).
LR_HANDLER->READ_ATTR( exporting IS_KEY = IS_PARAMETERS-
CONTRACTITEM_KEY
importing ES_DATA = LS_CONTRACT_ITEM ).

if LS_CONTRACT_ITEM-ZZ1_SUPPLY_START_UCI is not initial.


CS_INTERFACE_PARAMS-X_AUTO-DATA-EEIN_DATA-EINZDAT =
LS_CONTRACT_ITEM-ZZ1_SUPPLY_START_UCI.
CS_INTERFACE_PARAMS-X_AUTO-DATA-T_C_DATA[ 1 ]-EINZDAT =
LS_CONTRACT_ITEM-ZZ1_SUPPLY_START_UCI.
CS_INTERFACE_PARAMS-X_AUTO-T_AUTOC[ 1 ]-EVERD-EINZDAT =
LS_CONTRACT_ITEM-ZZ1_SUPPLY_START_UCI.
else.
CV_EV_FAILED = ABAP_TRUE.
endif.
catch CX_CRMS4_IU_BASE.
CV_EV_FAILED = ABAP_TRUE.
endtry.
endmethod.
ENDCLASS.

8. Demo

Process Framework Page 33 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

8.1. Create new contract

Figure 57: New Contract

Figure 58: Start Date

Figure 59: New Contract created

Process Framework Page 34 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

8.2. Check Move-In date on Utilities Contract

Figure 60: Check Move-In Date

New Step – Supply End Date


Add a new process step to an existing process. This step is used to define the supply end date which than
will be set as move-out date when the Sales Contract is ended.

KUT (add new field)


1. Add new field SUPPLY_END via Key-User-Tool
1.1. Add SUPPLY_START via 'Custom Fields' Application
1.2. Select Business Context 'CRMS4_IUCI_I'
1.3. Define Label

Figure 61: Define General Information

1.4. Define Type


1.5. Go to newly create field > User Interface > CDS Views
1.5.1.enable CDS-View extension via 'Enabled' checkbox

Process Framework Page 35 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

Figure 62: Enable CDS-View

1.6. Change label


1.7. Save
1.8. Publish

Business Layer
1. Add attribute to the BL Layer via IMG > SAP Utilities > Customer Engagement > General Functions
> Override the Definition of the Utilities Business Layer Objects
2. BL Object: UtilitiesContractItem

Figure 63: Select UtilitiesContractItem

Process Framework Page 36 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

Figure 64: Add attributes

Process Framework Page 37 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

User Interface
1. Create new component via transaction BSP_WD_CMPWB
2. Component Controller
2.1. Component Controller context
2.1.1. change superclass of component controller context > CL_CRMS4_IU_CM_UI_PROCESS_CTXT

Figure 65: change superclass

Process Framework Page 38 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

Figure 66: Component Controller

3. Create Window
3.1. change superclass of superclass of window implementation class >
CL_CRMS4_IU_CM_UI_PROCESS_WCO
3.2. add inbound plug 'DEFAULT'
3.2.1.insert following source code
method IP_DEFAULT.
SUPER > IP_DEFAULT( IV_COLLECTION = IV_COLLECTION ).
try.
FORWARD_INBOUND_CALL(
exporting

Process Framework Page 39 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

IV_INBOUND_PLUG = |DEFAULT| ##NO_TEXT


IV_VIEWAREA = CO_VIEWAREA_MAIN
IV_COLLECTION = IV_COLLECTION
).
catch CX_CRM_IU_IL_S4OP_BASE.
raise exception type CX_BSP_WD_INCORRECT_IMPLEMENT.
endtry.
endmethod.

3.3. Window Context


3.3.1.delete redefinition CONNECT_NODES
3.3.2.delete redefinition CREATE_CONTEXT_NODES

Figure 67: Window Context

4. Create View
4.1. basis view controller implementation to CL_CRMS4_IU_CM_UI_PROCESS_VCO
4.1.1. change superclass to CL_CRMS4_IU_CM_UI_PROCESS_VCO

Process Framework Page 40 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

Figure 68: change superclass

4.1.2. add friend IF_CRM_IU_IL_S4OP_BBF


4.1.3. delete redefinition DO_HANDLE_DATA
4.1.4. delete redefinition DO_HANDLE_EVENT
4.1.5. delete redefinition WD_DESTROY_CONTEXT
4.1.6. delete redefinition SET_MODELS
4.2. view controller implementation
4.2.1. add inbound plug 'DEFAULT'
4.2.2. add friend IF_CRM_IU_IL_S4OP_BBF to view implementation class
4.3. view context
4.3.1. inheritance/superclass to CL_CRMS4_IU_CM_UI_PROCESS_CT

Figure 69: change superclass

Process Framework Page 41 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

4.3.2. add context node as attribute

Figure 70: add context node as attribute

4.3.2.1. use type for context nodes available through component controller

4.3.3. delete redefinition CONNECT_NODES


4.3.4. change source code of CREATE_CONTEXT_NODES

Figure 71: CREATE_CONTEXT_NODES

method CREATE_CONTEXT_NODES.
SUPER > CREATE_CONTEXT_NODES( exporting CONTROLLER = CONTROLLER ).

try.
data(LT_MODEL_ITEMS) = CL_CRM_IU_IL_S4OP_BSP_UTILS=>GET_CONTEXT_MODEL_ITE
MS( IV_INSTANCE = ME ).
loop at LT_MODEL_ITEMS assigning field-symbol(<MODEL_ITEM>) where IS_INHE
RITED is initial.
data(LV_PATH) = |{ <MODEL_ITEM>-NAME case = upper }|.
assign (LV_PATH) to field-symbol(<PROPERTY>).
<PROPERTY> ?= CREATE_MODEL(
IV_MODEL_ID = <MODEL_ITEM>-NAME
IV_CLASS_NAME = <MODEL_ITEM>-CLASSNAME
).
endloop.
catch CX_CRM_IU_IL_S4OP_BASE ##NO_HANDLER.

Process Framework Page 42 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

endtry.
endmethod.

4.4. View Layout / HTML Page


4.4.1. adjust Layout source code

Figure 72: HTML Page

Figure 73: Layout source code

<%@page language="abap" %>


<%@extension name="thtmlb" prefix="thtmlb" %>
<%@extension name="chtmlb" prefix="chtmlb" %>
<%@extension name="bsp" prefix="bsp" %>

Process Framework Page 43 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

<chtmlb:config mode = "RUNTIME"


xml = "<%= controller > configuration_descr > get_config
_data( ) %>"
displayMode = "<%= controller > view_group_context > is_view_in_
display_mode( controller ) %>" />

4.4.2.add page attribute


4.4.2.1. add context node attribute (defined in view context class)

Figure 74: Add Page attribute

4.5. create configuration

Figure 75: Customer Default Configuration

5. Runtime Repository Browser

Process Framework Page 44 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

5.1. add model (IUICALL)


5.2. assign view to window
5.3. add context
5.4. add Interface view

Figure 76: Runtime Repository Browser

Process Framework Page 45 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

Customizing (Form)
1. IMG > SAP Utilities > Customer Engagement > Sales Contract Management > Modify Process
Definition (Client-Specific)
2. Add UI Process View
2.1. fill all fields accordingly to the newly created view

Figure 77: UI Process View

3. Add UI Process (this entry will be merged at runtime with the existing UI process)
3.1. use the existing UI process name when creating new entry to extend the standard delivered
process
3.2. leave entries empty if you don’t want to change them

Figure 78: Add UI Process

Process Framework Page 46 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

4. Add UI Process Step


4.1. use the newly create UI Process View entry as 'Name UI Proc. View'

Figure 79: Add UI Process Step

BAdI Implementation
1. Create BAdI Implementation for CRMS4_IU_PI_PROCESS
2. Implement method CREATE_MOVEOUT

Figure 80: BAdI Implementation for CRMS4_IU_PI_PROCESS

Process Framework Page 47 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

Figure 81: BAdI Implementing Class

class ZCL_CRMS4_IU_PROCESS_INTEG definition


public
final
create public .

public section.

interfaces IF_BADI_INTERFACE .
interfaces IF_CRMS4_IU_CM_PI_PROCESS_BADI .
protected section.
private section.
ENDCLASS.

CLASS ZCL_CRMS4_IU_PROCESS_INTEG IMPLEMENTATION.

* <SIGNATURE>------------------------------------------------------------------
---------------------+
* | Instance Public Method ZCL_CRMS4_IU_PROCESS_INTEG-
>IF_CRMS4_IU_CM_PI_PROCESS_BADI~CREATE_MOVEOUT
* +----------------------------------------------------------------------------
---------------------+
* | [--->] IS_PARAMETERS TYPE
CL_CRMS4_IU_CM_PI_PROCESS=>TS_CREATE_MOVE_OUT_PARAMS
* | [<-->] CS_RESULT TYPE
CL_CRMS4_IU_CM_PI_PROCESS=>TS_CREATE_MOVE_OUT_RESULT
* | [<-->] CS_INTERFACE_PARAMS TYPE
CL_CRMS4_IU_CM_PI_PROCESS=>TS_CREATE_MOVE_OUT_INTF
* | [<-->] CV_EV_HANDLED TYPE ABAP_BOOLEAN
* | [<-->] CV_EV_FAILED TYPE ABAP_BOOLEAN
* +----------------------------------------------------------------------------
----------</SIGNATURE>
method IF_CRMS4_IU_CM_PI_PROCESS_BADI~CREATE_MOVEOUT.
data:
LS_CONTRACT_ITEM type CRMS4S_IU_CTI_BL.

Process Framework Page 48 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

try.
data(LR_HANDLER) = CL_CRMS4_IU_BL_FACTORY=>GET( IV_BLOBJECTNAME =
CL_CRMS4_IU_IL_META=>C_OBJECTS-CTM-CONTRACTITEM ).
LR_HANDLER->READ_ATTR( exporting IS_KEY = IS_PARAMETERS-CONTRACTITEM_KEY
importing ES_DATA = LS_CONTRACT_ITEM ).

if LS_CONTRACT_ITEM-ZZ1_SUPPLY_END_UCI is not initial.


CS_INTERFACE_PARAMS-X_AUTO-MO_D-AUSZDAT = LS_CONTRACT_ITEM-
ZZ1_SUPPLY_END_UCI.
CS_INTERFACE_PARAMS-X_AUTO-T_MO_D[ 1 ]-AUSZDAT = LS_CONTRACT_ITEM-
ZZ1_SUPPLY_END_UCI.
CS_INTERFACE_PARAMS-TX_VERTRAG[ 1 ]-AUSZDAT = LS_CONTRACT_ITEM-
ZZ1_SUPPLY_END_UCI.
else.
CV_EV_FAILED = ABAP_TRUE.
endif.
catch CX_CRMS4_IU_BASE.
CV_EV_FAILED = ABAP_TRUE.
endtry.
endmethod.
ENDCLASS.

Demo
1. End contract via Sales Contract Overview
1.1. Start process 'End Contract'

Figure 82: Start process End Contract

1.2. Maintain 'Supply End Date' in the newly added step

Figure 83: Maintain 'Supply End Date'

1.3. Save

Process Framework Page 49 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

Figure 84: Utilities Sales Contract Overview

Figure 85: Saved Contract

Source Code
- See Component Controller (Context)
- See Window (Controller)
- See Window (Context)
- See View (Controller)
- See View (Context)
- See View (Layout/HTML)

NEW BUSINESS LAYER OBJECT


Creation of a Business Layer Object in customer namespace.

New Business Layer Object Page 50 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

DDIC
Create all required DDIC elements. It is recommended to use CDS-Views to retrieve data. Later, the CDS-
View is assigned to the BL Object via customizing.
If required implement an access control for the CDS-View.

Create CDS-View(s) using ADT


1. I-View (ZCRMS4_IU_I_UBD)
1.1. select from underlying CDS-View or database table

Figure 86: ZCRMS4_IU_I_UBD

2. C-View (ZCRMS4_IU_C_UBD)
2.1. select from the I-View

New Business Layer Object Page 51 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

Figure 87: ZCRMS4_IU_C_UBD

3. DCL (ZCRMS4_IU_C_UBD)
3.1. access control on the C-View (if required)

Figure 88: access control on ZCRMS4_IU_C_UBD

New Business Layer Object Page 52 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

Create DDIC Structures


1. KEY (ZCRMS4S_IU_UBD_KEY)
1.1. defines key of the entity (recommended is to use same key as in database table)

Figure 89: ZCRMS4S_IU_UBD_KEY

2. DATA (ZCRMS4S_IU_UBD_BL_DATA)
2.1. defines data/attributes of the entity

Figure 90: ZCRMS4S_IU_UBD_BL_DATA

3. ATTR (ZCRMS4S_IU_UBD_ATTR)
3.1. used in the BOL Root Entity

Figure 91: ZCRMS4S_IU_UBD_ATTR

4. BL (ZCRMS4S_IU_UBD_BL)
4.1. used in the BL Object
4.2. should consist of key and the data structure

Figure 92: ZCRMS4S_IU_UBD_BL

5. QUERY (ZCRMS4S_IU_UBD_QRY)
5.1. used in the BOL Query

New Business Layer Object Page 53 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

Figure 93: ZCRMS4S_IU_UBD_QRY

Classes

Create Classes
1. Interaction Layer (IL)
1.1. ZCL_CRMS4_IU_IL_UBD > Superclass: CL_CRMS4_IU_IL_ABSTR_ROOT

Figure 94: Change Superclass

2. Interaction Layer (IL) Query


2.1. ZCL_CRMS4_IU_IL_UBD_QUERY > Superclass: CL_CRMS4_IU_IL_ABSTR_QUERY

New Business Layer Object Page 54 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

Figure 95: Change Superclass

3. Business Layer (BL)


3.1. ZCL_CRMS4_IU_BL_UBD > Superclass: CL_CRMS4_IU_BL_BASE

New Business Layer Object Page 55 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

Figure 96: Change Superclass

Customizing (GenIL/BOL)
You can either create the new entity in an existing delivered component or create a new component in
customer namespace and add this component to the component set IUICALL.
1. Create Component (optional)
1.1. IMG > Service > UI Framework > Generic Interaction Layer/Object Layer > Basic Settings
1.2. SM30: CRMV_GIL_COMP
1.3. Impl. Class: CL_CRMS4_IU_IL_COMP_GENERAL

Figure 97: Component Definition

2. Add Component to Component Set 'IUICALL' (optional)

New Business Layer Object Page 56 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

Figure 98: Component Assignment

3. Create Root Object Entity


3.1. SM34: CRMC_IUIL_OBJPROP / TX: CRM_ISU_IL_MODEL_C
3.2. select component
3.3. enter entity attributes
3.3.1.Object Type
3.3.2.Root Object
3.3.3.Key Structure
3.3.4.Data Structure
3.3.5.Impl. Class

Figure 99: Create Entities

4. Create Query Entity of type 'D Search Object' (Query)


4.1. see 3. Create Root Object Entity
5. Create DQuery Entity of type 'G Dynamic Search Object' (DQuery)
5.1. see 3. Create Root Object Entity
6. Create relations (from new entity to existing delivered entities)

New Business Layer Object Page 57 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

Figure 100: Relations Overview

7. Create relations (from existing delivered entities to new entity)


7.1. SM34: CRMC_IUIL_OBJPROP / TX: CRM_ISU_IL_MODEL_C
7.2. select component where the already existing entity is maintained
7.2.1.i.e. ISUMDE to create relation from UtilitiesUtilsContr to the new entity

Figure 101: Component ISUMDE

New Business Layer Object Page 58 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

7.2.2.i.e. BP to create relation from BuilHeader to the new entity

Figure 102: Component BP

New Business Layer Object Page 59 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

Customizing (BL)
IMG > SAP Utilities > Customer Engagement > Default Functions > Override the Definition of the Utilities
Business Layer Objects
1. Define Business Layer Object
1.1. same name as BOL object

Figure 103: Define Business Layer Object

2. Define BL Object Methods (optional)


2.1. define methods implemented in BL handler class

Figure 104: Define BL Object Methods

3. Assign Packages to BL Object


3.1. packages of used database, CDS-View must be assigned (i.e. used to retrieving texts > defined
as property level)

New Business Layer Object Page 60 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

Figure 105: Assign Packages to BL Object

4. Define BL Object Attribute Properties

Figure 106: Define BL Object Attribute Properties

5. Define Queries
5.1. same name as BOL Object Queries

Figure 107: Define Queries

6. Define Relations
6.1. same name as BOL Object relations
6.2. define external relations from delivered to new object (i.e. BuilHeader)

New Business Layer Object Page 61 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

Figure 108: Define Relations

7. Define Relation Key Assignments


7.1. define keys used to establish the relation

Figure 109: Define Relation Key Assignments

8. Define Relation Parameters


8.1. define parameters if relation type is 'O Object'

New Business Layer Object Page 62 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

Figure 110: Define Relation Parameters

New Business Layer Object Page 63 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

Customizing (data environment / BOL-Tree's)


Add the new entity into the data environment
IMG > SAP Utilities > Customer Engagement > Settings for the Object Workbench > Define Object
Hierarchy and Object Attributes
1. Define Presentation Nodes

Figure 111: Presentation of Nodes

Figure 112:Presentation of Columns

2. Define Profile

New Business Layer Object Page 64 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

Figure 113: Profiles Overview

Figure 114: Hierarchy Overview

Figure 115: Hierarchy Overview - New Nodes added

3. Assign Profile to Profile Group

New Business Layer Object Page 65 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

Figure 116: Profile Group Assignment

New Business Layer Object Page 66 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

Test

1. Test using e.g. ISU_BOL_BROWSER

Figure 117: Test in BOL_BROWSER 1

New Business Layer Object Page 67 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

Figure 118: Test in BOL_BROWSER 2

2. Test UI (data environment)

Figure 119: Test in UI

New Business Layer Object Page 68 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

UI WITH FORM CUSTOMIZING

Add New Form with Mask and Navigate/Show it


IMG > SAP Utilities > Customer Engagement > General Functions > Define Forms
1. Go To: "Define Form"
2. Add Entry with the Form you want to add, a title, a mode for editing restrictions and a title.
2.1. Simple Forms

Figure 120: Simple Form

UI with form customizing Page 69 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

3.2 Overview Forms

Figure 121: Overview Form

3. Depending on the Form Type, use the corresponding section


3.1. Simple Form
Add an Entry for this type fill in a BSP-Component, a Window of the BSP-Component and the
name of a Context Node.

Figure 122: Define Form Mask

UI with form customizing Page 70 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

3.2. Overview Form


Add an Entry with the Layout of the Overview Page

Figure 123: Define Form Overview

4. To navigate to one of these forms, there needs to be an action available.


5. Path: IMG > SAP Utilities > Customer Engagement > General Functions > Define Action Profiles
6. Select an already existing Action profile or create a new one.
7. Go to section Define Action and Add a new Action of type Formular Navigation.

Figure 124: Define Action

UI with form customizing Page 71 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

8. Fill in the Action Parameters (Form Name and the Context that is used for Form Data)

Figure 125: Refresh Actions

Demo:

Search for a Business Partner

Figure 126: Search for Business Partner

UI with form customizing Page 72 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

Trigger the Action to display the Form.

Figure 127: Trigger Action to display form

For presentation reasons a display form is already added to the overview page.

Figure 128: Display Form

UI with form customizing Page 73 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

Add Sections to Overview Page


1. Choose a formular you want to attach as a section for the overview page (Create a new one/ Choose
an existing one)
2. Path: SAP Customizing Implementation Guide > SAP Utilities > Customer Engagement > General
Functions > Define Forms
3. Go To: "Define Form Overview"
4. Select the Overview Page you want to add another section.

Figure 129: Define Form Overview

5. Go To: "Define Form Overview Assignment"


6. Add a new Entry with the Section as the Sub_Form_Name you want to add.

Figure 130: Define Form Overview Assignment

UI with form customizing Page 74 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

Demo:

Search for an existing Business Partner:

Figure 131: Search existing Business Partner

The Corresponding section is displayed:

Figure 132: Trigger Action to display form

UI with form customizing Page 75 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

Figure 133: Display Form

Add Actions/Toolbar Buttons to a Form


1. Select an existing or create an Action Profile with actions you want to include to your Form.
2. Select an existing or create a Form action you want to add the Actions
3. Path: IMG > SAP Utilities > Customer Engagement > General Functions > Override the Form
Definition
4. Go To: "Define Form"
5. Add the Action profile to your Formular

UI with form customizing Page 76 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

Figure 134: Define Form

Demo:

1. Display the Formular, the Toolbar Buttons were added.


2. The Buttons are displayed.

UI with form customizing Page 77 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

Figure 135: Display Form with Toolbar

These actions can now be executed.

Figure 136: Display Individual Business Partner

Handle Actions in Form


In order to use Actions, that don´t just navigate to other formulars, but e.g. calculate values for the current
formular, the following steps are necessary.
1. Select a formular, where the action will be executed.

UI with form customizing Page 78 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

2. Attach an Action Profile to this formular or take an Action Profile already existing at this formular.
3. Path: SAP Customizing Implementation Guide > SAP Utilities > Customer Engagement > General
Functions > Define Action Profiles
4. Go to: "Define Action Profile"
5. Select the Action Profile
6. Go to: "Define Action"
7. Add a new Entry of the type of Class Method

Figure 137: Define Action

8. Go to: "Define Action Parameter"


9. Define at least the Parameters CLASSNAME, METHODNAME, IR_FORM
10. Class name and Class method refer to an Action Handler Class you need to implement.

UI with form customizing Page 79 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

Figure 138: Define Action Parameter

11. This class inherits from the Superclass CL_CRMS4_IU_FM_ACTION_HANDLER.

Figure 139: Handler Class

12. The Actions can use Instance Attributes filled by a previous action.

Demo:

Scenario:
Creating a premise

UI with form customizing Page 80 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

The new buttons get displayed.


A popup gets displayed to ask the user for an amount.

Figure 140: Set Amount popup

This value is set into the instance attribute. By this amount the No. of Persons is now in-/ decreased

Figure 141: Increase No. of people

UI with form customizing Page 81 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

Figure 142: No. of people increased

Figure 143: No. of people decreased

UI with form customizing Page 82 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

ATTACHMENTS

Result handler class (sample)


class ZCL_CRMS4_IU_WORKFLOW_NEWCONTR definition
public
create public .

public section.

interfaces BI_OBJECT .
interfaces BI_PERSISTENT .
interfaces IF_WORKFLOW .

class-methods HANDLE_RESULT
importing
!_WORKITEM type SWW_WIID optional
!_RESULT type CHAR255 optional
!PROCESS_ID type CRMS4_IU_PFPROCESS_ID optional .
protected section.
private section.
ENDCLASS.

CLASS ZCL_CRMS4_IU_WORKFLOW_NEWCONTR IMPLEMENTATION.

* <SIGNATURE>------------------------------------------------------------------
---------------------+
* | Static Public Method ZCL_CRMS4_IU_WORKFLOW_NEWCONTR=>HANDLE_RESULT
* +----------------------------------------------------------------------------
---------------------+
* | [-- > ] _WORKITEM TYPE SWW_WIID(optional)
* | [-- > ] _RESULT TYPE CHAR255(optional)
* | [-- > ] PROCESS_ID TYPE
CRMS4_IU_PFPROCESS_ID(optional)
* +----------------------------------------------------------------------------
----------</SIGNATURE>
method HANDLE_RESULT.
data:
LS_WORKITEM type SWLC_WORKITEM,
LS_WI_HEADER type SWWWIHEAD,
LT_WI_CONTAINER type SWCONTTAB.

call function 'SWL_WI_READ'


exporting
WI_ID = _WORKITEM
changing
WORKITEM = LS_WORKITEM
exceptions
WORKITEM_NOT_FOUND = 1
others = 2.
if SY-SUBRC <> 0.
endif.

call function 'SWW_WI_CONTAINER_READ'


exporting
WI_ID = LS_WORKITEM-WI_HEADER-PARENT_WI
tables
WI_CONTAINER = LT_WI_CONTAINER
changing

Attachments Page 83 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

WI_HEADER = LS_WI_HEADER
exceptions
CONTAINER_DOES_NOT_EXIST = 1
READ_FAILED = 2
others = 3.
if SY-SUBRC <> 0.
endif.

if LINE_EXISTS( LT_WI_CONTAINER[ ELEMENT = 'PROCESS_ID' ] ).


data(LV_PROCESS_ID) = conv CRMS4_IU_PFPROCESS_ID( LT_WI_CONTAINER[
ELEMENT = 'PROCESS_ID' ]-VALUE ).
endif.

if LV_PROCESS_ID is not initial.


if _RESULT = '0001'. "approved
"continue process
CL_CRMS4_IU_CM_PF_PROCESS_MGR=>CL_EXECUTE_PROCESS( IV_PFID =
LV_PROCESS_ID ).
elseif _RESULT = '0002'. "rejected^
"add message
try.
data(LR_PROCESS) = CL_CRMS4_IU_CM_PF_PROCESS_MGR=>CL_GET_MANAGER( )
> GET_PROCESS( IV_PFID = LV_PROCESS_ID ).
LR_PROCESS > IF_CRMS4_IU_CM_PF_PROCESS_ACS~PREPARE( ).
LR_PROCESS > IF_CRMS4_IU_CM_PF_PROCESS_ACS~ADD_MESSAGE(
IV_MSGID = 'ZCRMS4_IU_EXTENSION'
IV_MSGNO = '002'
IV_MSGV1 = conv #( |{ LS_WORKITEM-WI_HEADER-PARENT_WI alpha = out
}| )
).
if 1 = 2.
message E002(ZCRMS4_IU_EXTENSION) into data(LV_MESSAGE) with
LS_WORKITEM-WI_HEADER-PARENT_WI.
endif.
LR_PROCESS > IF_CRMS4_IU_CM_PF_PROCESS_ACS~SAVE( ).
catch CX_ROOT.
endtry.
"abort process
CL_CRMS4_IU_CM_PF_PROCESS_MGR=>CL_ABORT_PROCESS( IV_PFID =
LV_PROCESS_ID ).
endif.
endif.
endmethod.
ENDCLASS.

BAdI Implementation (sample)


class ZCL_CRMS4_IU_PFP_NEW_CONTRACT definition
public
create public .

public section.

interfaces IF_BADI_INTERFACE .
interfaces IF_CRMS4_IU_CM_PF_PROCESS_BADI .
protected section.
private section.
ENDCLASS.

Attachments Page 84 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

CLASS ZCL_CRMS4_IU_PFP_NEW_CONTRACT IMPLEMENTATION.

* <SIGNATURE>------------------------------------------------------------------
---------------------+
* | Instance Public Method ZCL_CRMS4_IU_PFP_NEW_CONTRACT >
IF_CRMS4_IU_CM_PF_PROCESS_BADI~BEFORE_DAMAGE_CONTROL
* +----------------------------------------------------------------------------
---------------------+
* | [-- > ] IR_PROCESS TYPE REF TO
IF_CRMS4_IU_CM_PF_PROCESS_ACS
* | [<- > ] CV_FAILED TYPE ABAP_BOOLEAN
* | [<- > ] CV_HANDLED TYPE ABAP_BOOLEAN
* +----------------------------------------------------------------------------
----------</SIGNATURE>
method IF_CRMS4_IU_CM_PF_PROCESS_BADI~BEFORE_DAMAGE_CONTROL.
data:
LV_WI_ID type SWWWIHEAD-WI_ID,
LV_WI_TASK type SWW_TASK value 'WS90200002',
LT_WI_CONTAINER type SWCONTTAB,
LT_PARAMETERS type CL_CRMS4_IU_CM_CUSTOMIZING=>TT_PF_PROCESS_PARAMETERS,
LS_CTI_ATTR type CRMS4S_IU_CTI_ATTR.

data(LV_CURRENT_STEP) = IR_PROCESS > GET_CURRENT_STEP( ).

data(LS_PROCESS_KEY) = conv CRMS4S_IU_PFPR_KEY( IR_PROCESS > GET_PROCESS_KEY(


) ).
data(LS_PROCESS_CONFIG) = IR_PROCESS > GET_PROCESS_CONFIG( ).

LT_PARAMETERS = value #( ( ATTRIBUTENAME = 'CONTRACTITEM_KEY' ) ).


IR_PROCESS > GET_PARAMETERS( changing CT_PARAMETERS = LT_PARAMETERS ).

data(LS_CTI_KEY) = value CRMS4S_IU_CTI_KEY( LT_PARAMETERS[ ATTRIBUTENAME =


'CONTRACTITEM_KEY' ]-ATTRIBUTEVALUE optional ).

data(LR_CTI) = CL_CRMS4_IU_BL_FACTORY=>GET( IV_BLOBJECTNAME =


CL_CRMS4_IU_IL_META=>C_OBJECTS-CTM-CONTRACTITEM ).
if LR_CTI is bound.
LR_CTI > READ_ATTR( exporting IS_KEY = LS_CTI_KEY
importing ES_DATA = LS_CTI_ATTR ).
endif.

describe field LS_PROCESS_CONFIG-TEXT_DATA-TEXT length


data(LV_LENGT_BYTE_PROCESS_TEXT) in byte mode.
describe field LS_CTI_ATTR-OBJECT_ID length
data(LV_LENGT_BYTE_OBJECT_ID) in byte mode.
describe field LS_CTI_ATTR-NUMBER_INT length
data(LV_LENGT_BYTE_NUMBER_INT) in byte mode.
describe field LS_PROCESS_KEY-ID length
data(LV_LENGT_BYTE_PROCESS_ID) in byte mode.

LT_WI_CONTAINER = value #( ( ELEMENT = 'OBJECT_ID'


VALUE = LS_CTI_ATTR-OBJECT_ID
TAB_INDEX = '000001'
TYPE = 'C'
ELEMLENGTH = LV_LENGT_BYTE_OBJECT_ID )
( ELEMENT = 'NUMBER_INT'
VALUE = LS_CTI_ATTR-NUMBER_INT
TAB_INDEX = '000002'
TYPE = 'C'
ELEMLENGTH = LV_LENGT_BYTE_NUMBER_INT )
( ELEMENT = 'LV_PROCESS_TEXT'

Attachments Page 85 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

VALUE = LS_PROCESS_CONFIG-TEXT_DATA-TEXT
TAB_INDEX = '000003'
TYPE = 'C'
ELEMLENGTH = LV_LENGT_BYTE_PROCESS_TEXT )
( ELEMENT = 'LV_PROCESS_ID'
VALUE = LS_PROCESS_KEY-ID
TAB_INDEX = '000004'
TYPE = 'C'
ELEMLENGTH = LV_LENGT_BYTE_PROCESS_ID )

).

call function 'SWW_WI_START'


exporting
CREATOR = conv SWW_OBJID( SY-UNAME )
TASK = LV_WI_TASK
CALLED_IN_BACKGROUND = ABAP_TRUE
importing
WI_ID = LV_WI_ID
tables
WI_CONTAINER = LT_WI_CONTAINER
exceptions
ID_NOT_CREATED = 1
READ_FAILED = 2
IMMEDIATE_START_NOT_POSSIBLE = 3
EXECUTION_FAILED = 4
INVALID_STATUS = 5
others = 6.
if SY-SUBRC <> 0.
endif.
IR_PROCESS > SET_ADDITIONAL_VALUE(
IV_NAME = 'WORKFLOW_ID'
IV_VALUE = conv #( LV_WI_ID )
).

* IR_PROCESS > SET_ABORTABLE( ABAP_FALSE ).


* IR_PROCESS > SUSPEND( conv #( IR_PROCESS > GET_CURRENT_STEP( ) ) ).
* CV_HANDLED = ABAP_TRUE.

"add message
IR_PROCESS > ADD_MESSAGE(
IV_MSGID = 'ZCRMS4_IU_EXTENSION'
IV_MSGNO = '003'
IV_MSGV1 = conv #( |{ LV_WI_ID alpha = out }| )
IV_ADD_TO_EXTERNAL = ABAP_TRUE
).
if 1 = 2.
message E003(ZCRMS4_IU_EXTENSION) into data(LV_MESSAGE) with LV_WI_ID.
endif.
endmethod.

* <SIGNATURE>------------------------------------------------------------------
---------------------+
* | Instance Public Method ZCL_CRMS4_IU_PFP_NEW_CONTRACT >
IF_CRMS4_IU_CM_PF_PROCESS_BADI~BEFORE_EXECUTE_STEP
* +----------------------------------------------------------------------------
---------------------+
* | [-- > ] IR_PROCESS TYPE REF TO
IF_CRMS4_IU_CM_PF_PROCESS_ACS
* | [<- > ] CV_FAILED TYPE ABAP_BOOLEAN
* | [<- > ] CV_HANDLED TYPE ABAP_BOOLEAN
* +----------------------------------------------------------------------------

Attachments Page 86 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

----------</SIGNATURE>
method IF_CRMS4_IU_CM_PF_PROCESS_BADI~BEFORE_EXECUTE_STEP.
data:
LV_WI_ID type SWWWIHEAD-WI_ID,
LV_WI_TASK type SWW_TASK value 'WS90200001',
LT_WI_CONTAINER type SWCONTTAB,
LT_PARAMETERS type
CL_CRMS4_IU_CM_CUSTOMIZING=>TT_PF_PROCESS_PARAMETERS.

"check if current step is forced move-out


"check if no workflow exists for this process
if IR_PROCESS > GET_CURRENT_STEP( ) = 'FORCED_MOVEOUT'
and IR_PROCESS > GET_PARAMETER( 'FORCE_MOVE_OUT' ) is not initial
and IR_PROCESS > GET_ADDITIONAL_VALUE( 'WORKFLOW_ID' ) is initial.

data(LS_PROCESS_KEY) = conv CRMS4S_IU_PFPR_KEY( IR_PROCESS >


GET_PROCESS_KEY( ) ).
"fill container
LT_PARAMETERS = value #( ( ATTRIBUTENAME = 'CONTRACTITEM_KEY' ) ).
IR_PROCESS > GET_PARAMETERS( changing CT_PARAMETERS = LT_PARAMETERS ).
data(LS_CTI_KEY) = value CRMS4S_IU_CTI_KEY( LT_PARAMETERS[ ATTRIBUTENAME
= 'CONTRACTITEM_KEY' ]-ATTRIBUTEVALUE optional ).
data(LV_NUMBER_INT) = conv CRMS4_IU_NUMBER_INT( |{ LS_CTI_KEY-NUMBER_INT
alpha = out }| ).

describe field LS_CTI_KEY-OBJECT_ID length data(LV_LENGT_BYTE_OBJECT_ID)


in byte mode.
describe field LV_NUMBER_INT length
data(LV_LENGT_BYTE_NUMBER_INT) in byte mode.
describe field LS_PROCESS_KEY-ID length
data(LV_LENGT_BYTE_PROCESS_ID) in byte mode.

LT_WI_CONTAINER = value #( ( ELEMENT = 'OBJECT_ID'


VALUE = LS_CTI_KEY-OBJECT_ID
TAB_INDEX = '000001'
TYPE = 'C'
ELEMLENGTH = LV_LENGT_BYTE_OBJECT_ID )
( ELEMENT = 'NUMBER_INT'
VALUE = LV_NUMBER_INT
TAB_INDEX = '000002'
TYPE = 'C'
ELEMLENGTH = LV_LENGT_BYTE_NUMBER_INT )
( ELEMENT = 'PROCESS_ID'
VALUE = LS_PROCESS_KEY-ID
TAB_INDEX = '000003'
TYPE = 'C'
ELEMLENGTH = LV_LENGT_BYTE_NUMBER_INT )
).

"create workflow
call function 'SWW_WI_START'
exporting
CREATOR = conv SWW_OBJID( SY-UNAME )
TASK = LV_WI_TASK
CALLED_IN_BACKGROUND = ABAP_TRUE
importing
WI_ID = LV_WI_ID
tables
WI_CONTAINER = LT_WI_CONTAINER
exceptions
ID_NOT_CREATED = 1
READ_FAILED = 2
IMMEDIATE_START_NOT_POSSIBLE = 3

Attachments Page 87 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

EXECUTION_FAILED = 4
INVALID_STATUS = 5
others = 6.
if SY-SUBRC <> 0.
endif.

"set workflow id as additional value to the process


IR_PROCESS > SET_ADDITIONAL_VALUE(
IV_NAME = 'WORKFLOW_ID'
IV_VALUE = conv #( LV_WI_ID )
).

IR_PROCESS > SET_ABORTABLE( ABAP_FALSE ).

"suspend current step


IR_PROCESS > SUSPEND( conv #( IR_PROCESS > GET_CURRENT_STEP( ) ) ).
CV_HANDLED = ABAP_TRUE.

"add message
IR_PROCESS > ADD_MESSAGE(
IV_MSGTY = 'I'
IV_MSGID = 'ZCRMS4_IU_EXTENSION'
IV_MSGNO = '001'
IV_MSGV1 = conv #( |{ LV_WI_ID alpha = out }| )
IV_ADD_TO_EXTERNAL = ABAP_TRUE
).
if 1 = 2.
message I001(ZCRMS4_IU_EXTENSION) into data(LV_MESSAGE) with LV_WI_ID.
endif.
endif.
endmethod.

* <SIGNATURE>------------------------------------------------------------------
---------------------+
* | Instance Public Method ZCL_CRMS4_IU_PFP_NEW_CONTRACT >
IF_CRMS4_IU_CM_PF_PROCESS_BADI~BEFORE_UNDO_STEP
* +----------------------------------------------------------------------------
---------------------+
* | [-- > ] IR_PROCESS TYPE REF TO
IF_CRMS4_IU_CM_PF_PROCESS_ACS
* | [<- > ] CV_FAILED TYPE ABAP_BOOLEAN
* | [<- > ] CV_HANDLED TYPE ABAP_BOOLEAN
* | [<- > ] CV_OMITTED TYPE ABAP_BOOLEAN
* +----------------------------------------------------------------------------
----------</SIGNATURE>
method IF_CRMS4_IU_CM_PF_PROCESS_BADI~BEFORE_UNDO_STEP.
* if IR_PROCESS > GET_CURRENT_STEP( ) = 'FORCED_MOVEOUT'.
* CV_FAILED = ABAP_TRUE.
* CV_HANDLED = ABAP_TRUE.
* endif.
endmethod.
ENDCLASS.

Attachments Page 88 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

Component Controller (Context)


class ZL_ZIUCMSTP_BSPWDCOMPONEN_CTXT definition
public
inheriting from CL_CRMS4_IU_CM_UI_PROCESS_CTXT
create public .

public section.
protected section.
private section.
ENDCLASS.

CLASS ZL_ZIUCMSTP_BSPWDCOMPONEN_CTXT IMPLEMENTATION.


ENDCLASS.

Window (Controller)
class ZL_ZIUCMSTP_WSUPPLYENDDAT_IMPL definition
public
inheriting from ZL_ZIUCMSTP_WSUPPLYENDDAT
create public .

public section.

methods IP_DEFAULT
redefinition .
protected section.
private section.
ENDCLASS.

CLASS ZL_ZIUCMSTP_WSUPPLYENDDAT_IMPL IMPLEMENTATION.

* <SIGNATURE>------------------------------------------------------------------
---------------------+
* | Instance Public Method ZL_ZIUCMSTP_WSUPPLYENDDAT_IMPL->IP_DEFAULT
* +----------------------------------------------------------------------------
---------------------+
* | [--->] IV_COLLECTION TYPE REF TO IF_BOL_BO_COL(optional)
* +----------------------------------------------------------------------------
----------</SIGNATURE>
method IP_DEFAULT.
SUPER->IP_DEFAULT( IV_COLLECTION = IV_COLLECTION ).
try.
FORWARD_INBOUND_CALL(
exporting
IV_INBOUND_PLUG = |DEFAULT| ##NO_TEXT
IV_VIEWAREA = CO_VIEWAREA_MAIN
IV_COLLECTION = IV_COLLECTION
).
catch CX_CRM_IU_IL_S4OP_BASE.
raise exception type CX_BSP_WD_INCORRECT_IMPLEMENT.
endtry.
endmethod.
ENDCLASS.

Attachments Page 89 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

class ZL_ZIUCMSTP_WSUPPLYENDDAT definition


public
inheriting from CL_CRMS4_IU_CM_UI_PROCESS_WCO
create public

global friends IF_CRM_IU_IL_S4OP_BBF .

public section.

data TYPED_CONTEXT type ref to ZL_ZIUCMSTP_WSUPPLYENDDAT_CTXT read-only .

methods IP_DEFAULT
importing
!IV_COLLECTION type ref to IF_BOL_BO_COL optional .
protected section.

methods WD_CREATE_CONTEXT
redefinition .
methods WD_DESTROY_CONTEXT
redefinition .
private section.
ENDCLASS.

CLASS ZL_ZIUCMSTP_WSUPPLYENDDAT IMPLEMENTATION.

* <SIGNATURE>------------------------------------------------------------------
---------------------+
* | Instance Public Method ZL_ZIUCMSTP_WSUPPLYENDDAT->IP_DEFAULT
* +----------------------------------------------------------------------------
---------------------+
* | [--->] IV_COLLECTION TYPE REF TO IF_BOL_BO_COL(optional)
* +----------------------------------------------------------------------------
----------</SIGNATURE>
method IP_DEFAULT.
"#EC NEEDED
* Added by wizard: Inbound plug 'DEFAULT'

endmethod.

* <SIGNATURE>------------------------------------------------------------------
---------------------+
* | Instance Protected Method ZL_ZIUCMSTP_WSUPPLYENDDAT->WD_CREATE_CONTEXT
* +----------------------------------------------------------------------------
---------------------+
* +----------------------------------------------------------------------------
----------</SIGNATURE>
method WD_CREATE_CONTEXT.

* create the context


CONTEXT = CL_BSP_WD_CONTEXT=>GET_INSTANCE(
IV_CONTROLLER = ME
IV_TYPE = 'ZL_ZIUCMSTP_WSUPPLYENDDAT_CTXT' ).

TYPED_CONTEXT ?= CONTEXT.

endmethod.

Attachments Page 90 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

* <SIGNATURE>------------------------------------------------------------------
---------------------+
* | Instance Protected Method ZL_ZIUCMSTP_WSUPPLYENDDAT->WD_DESTROY_CONTEXT
* +----------------------------------------------------------------------------
---------------------+
* +----------------------------------------------------------------------------
----------</SIGNATURE>
method WD_DESTROY_CONTEXT.

clear ME->TYPED_CONTEXT.
SUPER->WD_DESTROY_CONTEXT( ).

endmethod.
ENDCLASS.

Window (Context)
class ZL_ZIUCMSTP_WSUPPLYENDDAT_CTXT definition
public
inheriting from CL_BSP_WD_CONTEXT
create public .

public section.
protected section.
private section.
ENDCLASS.

CLASS ZL_ZIUCMSTP_WSUPPLYENDDAT_CTXT IMPLEMENTATION.


ENDCLASS.

View (Controller)
class ZL_ZIUCMSTP_VSUPPLYENDDAT_IMPL definition
public
inheriting from ZL_ZIUCMSTP_VSUPPLYENDDAT
create public

global friends IF_CRM_IU_IL_S4OP_BBF .

public section.

methods IP_DEFAULT
redefinition .
protected section.
private section.
ENDCLASS.

CLASS ZL_ZIUCMSTP_VSUPPLYENDDAT_IMPL IMPLEMENTATION.

* <SIGNATURE>------------------------------------------------------------------
---------------------+
* | Instance Public Method ZL_ZIUCMSTP_VSUPPLYENDDAT_IMPL->IP_DEFAULT
* +----------------------------------------------------------------------------

Attachments Page 91 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

---------------------+
* | [--->] IV_COLLECTION TYPE REF TO IF_BOL_BO_COL(optional)
* +----------------------------------------------------------------------------
----------</SIGNATURE>
method IP_DEFAULT.
SUPER->IP_DEFAULT( IV_COLLECTION = IV_COLLECTION ).
endmethod.
ENDCLASS.
class ZL_ZIUCMSTP_VSUPPLYENDDAT definition
public
inheriting from CL_CRMS4_IU_CM_UI_PROCESS_VCO
create public

global friends IF_CRM_IU_IL_S4OP_BBF .

public section.

methods IP_DEFAULT
importing
!IV_COLLECTION type ref to IF_BOL_BO_COL optional .
methods CONSTRUCTOR .
protected section.

data TYPED_CONTEXT type ref to ZL_ZIUCMSTP_VSUPPLYENDDAT_CTXT .

methods WD_CREATE_CONTEXT
redefinition .
private section.

constants VIEW type STRING value 'VSupplyEndDate.htm' ##NO_TEXT.


ENDCLASS.

CLASS ZL_ZIUCMSTP_VSUPPLYENDDAT IMPLEMENTATION.

* <SIGNATURE>------------------------------------------------------------------
---------------------+
* | Instance Public Method ZL_ZIUCMSTP_VSUPPLYENDDAT->CONSTRUCTOR
* +----------------------------------------------------------------------------
---------------------+
* +----------------------------------------------------------------------------
----------</SIGNATURE>
method CONSTRUCTOR.

SUPER->CONSTRUCTOR( ).

VIEW_NAME = VIEW. "decomment to activate locale view"

endmethod.

* <SIGNATURE>------------------------------------------------------------------
---------------------+
* | Instance Public Method ZL_ZIUCMSTP_VSUPPLYENDDAT->IP_DEFAULT
* +----------------------------------------------------------------------------
---------------------+
* | [--->] IV_COLLECTION TYPE REF TO IF_BOL_BO_COL(optional)
* +----------------------------------------------------------------------------

Attachments Page 92 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

----------</SIGNATURE>
method IP_DEFAULT.
"#EC NEEDED
* Added by wizard: Inbound plug 'DEFAULT'

endmethod.

* <SIGNATURE>------------------------------------------------------------------
---------------------+
* | Instance Protected Method ZL_ZIUCMSTP_VSUPPLYENDDAT->WD_CREATE_CONTEXT
* +----------------------------------------------------------------------------
---------------------+
* +----------------------------------------------------------------------------
----------</SIGNATURE>
method WD_CREATE_CONTEXT.

* create the context


CONTEXT = CL_BSP_WD_CONTEXT=>GET_INSTANCE(
IV_CONTROLLER = ME
IV_TYPE = 'ZL_ZIUCMSTP_VSUPPLYENDDAT_CTXT' ).

TYPED_CONTEXT ?= CONTEXT.

endmethod.
ENDCLASS.

View (Context)
class ZL_ZIUCMSTP_VSUPPLYENDDAT_CTXT definition
public
inheriting from CL_CRMS4_IU_CM_UI_PROCESS_CT
create public .

public section.

data CONTRACTITEM type ref to CL_CRMS4_IU_CM_CN_CTI read-only .


protected section.

methods CREATE_CONTEXT_NODES
redefinition .
private section.
ENDCLASS.

CLASS ZL_ZIUCMSTP_VSUPPLYENDDAT_CTXT IMPLEMENTATION.

* <SIGNATURE>------------------------------------------------------------------
---------------------+
* | Instance Protected Method ZL_ZIUCMSTP_VSUPPLYENDDAT_CTXT-
>CREATE_CONTEXT_NODES
* +----------------------------------------------------------------------------
---------------------+
* | [--->] CONTROLLER TYPE REF TO
CL_BSP_WD_CONTROLLER(optional)
* +----------------------------------------------------------------------------
----------</SIGNATURE>
method CREATE_CONTEXT_NODES.

Attachments Page 93 from 94


Extensibility Guide - Best Practice for S/4HANA Utilities for customer engagement 2022

SUPER->CREATE_CONTEXT_NODES( exporting CONTROLLER = CONTROLLER ).

try.
data(LT_MODEL_ITEMS) =
CL_CRM_IU_IL_S4OP_BSP_UTILS=>GET_CONTEXT_MODEL_ITEMS( IV_INSTANCE = ME ).
loop at LT_MODEL_ITEMS assigning field-symbol(<MODEL_ITEM>) where
IS_INHERITED is initial.
data(LV_PATH) = |{ <MODEL_ITEM>-NAME case = upper }|.
assign (LV_PATH) to field-symbol(<PROPERTY>).
<PROPERTY> ?= CREATE_MODEL(
IV_MODEL_ID = <MODEL_ITEM>-NAME
IV_CLASS_NAME = <MODEL_ITEM>-CLASSNAME
).
endloop.
catch CX_CRM_IU_IL_S4OP_BASE ##NO_HANDLER.
endtry.
endmethod.
ENDCLASS.

View (Layout/HTML)
<%@page language="abap" %>
<%@extension name="thtmlb" prefix="thtmlb" %>
<%@extension name="chtmlb" prefix="chtmlb" %>
<%@extension name="bsp" prefix="bsp" %>
<chtmlb:config mode = "RUNTIME"
xml = "<%= controller->configuration_descr->get_config_data( )
%>"
displayMode = "<%= controller->view_group_context-
>is_view_in_display_mode( controller ) %>" />

Attachments Page 94 from 94

You might also like