Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
bajwakool7
Explorer
5,529
In this SAP blog, we dive into the realm of SAP RAP with CDS and metadata extensions to embark on a journey to enhance the Workflow Work-item's information screen in My inbox App.

it is common to find UI-based visualization options in most SAP standard workflows, allowing for better readability and navigation of business object information. This is managed through the SWFVISU transaction in SAP, where the service path and parameters exposed to the UI are maintained. In this blog, we will explore how to extend the information screen in My Inbox for the Settlement Document Workflow, using it as an example. Please note that while the example focuses on a flexible workflow, the enhancement can be applied to both classical and flexible workflows in a similar manner.

Before we proceed, let's examine the screen provided by SAP standard for the Settlement Document Workflow WS02000445.

Workflow Work-item Information screen in My Inbox App:


Fig 1: Before- Settlement Document Work-item Information in My Inbox


 

Standard SWFVISU Configuration


Fig 2: SWFVISU Configuration for Settlement Document Work-item Information in My Inbox


 

To enhance the screen to have additional parameters on the screen shown in Fig 1, we will extend the CDS C_SETTLMTDOCWRKFLWDET (as it's the CDS related to service LO_SETMAN_SDOC_WRKFLW as shown in Fig 2). The below field will be added to the screen (Fig 1) under the following headers:

Basic Data:

  • Payment Method with Description

  • Settlement Period (In format DD.MM.YYYY - DD.MM.YYYY)


Condition Contract:

  • Company Code with Description

  • Sales Office with Description

  • Condition Contract Type with Description

  • Condition Contract Customer with Name

  • Sales Manager Name (Extended Field in Table WCOCO - Condition Contract)


 

Extended Screen (Workflow Work-item Information screen in My Inbox App:):


Fig 3After- Settlement Document Work-item Information in My Inbox App


 

CDS C_SETTLMTDOCWRKFLWDET to be extended with name ZEXT_C_SETTLMTDOCWRKFLWDET (or any relevant name can be given name) to add the below fields in the CDS. Metadata extension ZMDEXT_C_SETTLMTDOCWRKFLWDET to be implemented to have the below fields on the above screen (in green boxes in Fig 3) on the work item information in My Inbox screen. Details of Fields added:

 

Payment Method

  • Text added in CDS I_SETTLMTDOC via CDS extension ZEXT_I_SETTLMTDOC

  • Field added in CDS C_SETTLMTDOCWRKFLWDET via CDS extension ZEXT_C_SETTLMTDOCWRKFLWDET along with text.

  • Annotations added via Metadata Extension ZMDEXT_C_SETTLMTDOCWRKFLWDET


Settlement Period

  • Field added in CDS C_SETTLMTDOCWRKFLWDET via CDS extension ZEXT_C_SETTLMTDOCWRKFLWDET along with text.

  • Annotations added via Metadata Extension ZMDEXT_C_SETTLMTDOCWRKFLWDET


Company Code:

  • Field added in CDS C_SETTLMTDOCWRKFLWDET via CDS extension ZEXT_C_SETTLMTDOCWRKFLWDET along with Company code text.

  • Annotations added via Metadata Extension ZMDEXT_C_SETTLMTDOCWRKFLWDET


Sales Office

  • Field added in CDS C_SETTLMTDOCWRKFLWDET via CDS extension ZEXT_C_SETTLMTDOCWRKFLWDET along with Sales Office text.

  • Annotations added via Metadata Extension ZMDEXT_C_SETTLMTDOCWRKFLWDET


Condition Contract Type

  • Field added in CDS C_SETTLMTDOCWRKFLWDET via CDS extension ZEXT_C_SETTLMTDOCWRKFLWDET along with text.

  • Annotations added via Metadata Extension ZMDEXT_C_SETTLMTDOCWRKFLWDET


Condition Contract Customer

  • Field added in CDS C_SETTLMTDOCWRKFLWDET via CDS extension ZEXT_C_SETTLMTDOCWRKFLWDET along with text.

  • Annotations added via Metadata Extension ZMDEXT_C_SETTLMTDOCWRKFLWDET


Sales Manager

  • Field ZZ1_SALES_MANAGER_CCH added in CDS E_CONDITIONCONTRACT via CDS extension ZEXT_E_CONDITIONCONTRACT

  • Field added in CDS I_CONDITIONCONTRACT via CDS extension ZEXT_I_CONDITIONCONTRACT

  • Field added in CDS C_SETTLMTDOCWRKFLWDET via CDS extension ZEXT_C_SETTLMTDOCWRKFLWDET

  • Annotations added via Metadata Extension ZMDEXT_C_SETTLMTDOCWRKFLWDET


CDS Extensions:

 



























ZEXT_I_SETTLMTDOC: 'Extension of CDS I_SETTLMTDOC'

@AbapCatalog.sqlViewAppendName: 'ZEXT_I_STLMDOC'
@EndUserText.label: 'Extension of CDS I_SETTLMTDOC'
extend view I_SettlmtDoc with ZEXT_I_SETTLMTDOC
association [0..1] to I_PaymentMethod as _PaymentMethod on $projection.customerpaymentmethod = _PaymentMethod.PaymentMethod
and $projection.taxdestinationcountry = _PaymentMethod.Country
{
//Payment Method Description
_PaymentMethod.PaymentMethodName as PaymentMethodName
}

ZEXT_E_CONDITIONCONTRACT: 'Extension of CDS E_CONDITIONCONTRACT'

@AbapCatalog.sqlViewAppendName:'ZE_O2C_E_CONDCTR'
@EndUserText.label: 'Extension of CDS E_CONDITIONCONTRACT'
extend view E_ConditionContract with ZE_O2C_E_CONDITIONCONTRACT_01
association [0..1] to I_BusinessPartner as _ZZ_SalesManagerBP on $projection.ZZ_SalesManager = _ZZ_SalesManagerBP.BusinessPartner
{ // Sales Manager ID (Business partner Number)
Persistence.zz1_sales_manager_cch as ZZ_SalesManager,

// Sales Manager Name (First and Last Name)
_ZZ_SalesManagerBP.BusinessPartnerName as ZZ_SalesManagerName
}

ZEXT_I_CONDITIONCONTRACT: 'Extension of CDS I_CONDITIONCONTRACT'

@AbapCatalog.sqlViewAppendName: 'ZE_O2C_CONDCTR'
@EndUserText.label: 'Extension of CDS I_CONDITIONCONTRACT'
extend view I_ConditionContract with ZE_O2C_I_CONDITIONCONTRACT_01
{
_Extension.ZZ_SalesManager,
_Extension.ZZ_SalesManagerName
}

ZEXT_C_SETTLMTDOCWRKFLWDET: 'Extension of CDS C_SETTLMTDOCWRKFLWDET'      

@AbapCatalog.sqlViewAppendName:'ZE_O2C_SETTMTWF'
@AbapCatalog.viewEnhancementCategory: #PROJECTION_LIST
extend view C_SettlmtDocWrkflwDet with ZE_O2C_C_SETTLMTDOCWRKFLWDE_01
{ /* Field 1: Company Code( Description Text ) */
concat_with_space(_PayerPartyCompany.CompanyCode,
concat('(',concat(_PayerPartyCompany._CompanyCode[1: Language='E'].CompanyCodeName,
')' )
),1
) as CompanyCodeInfo,

/* Field 2: Sales Office( Description Text ) */
concat_with_space(SalesOffice,
concat('(',concat(_SalesOffice._Text[1: Language='E'].SalesOfficeName,
')' )
),1
) as SalesOfficeInfo,

/* Field 3: Customer ID( Customer Name) */
concat_with_space(_ConditionContract.Customer,
concat('(', concat(_ConditionContract._Customer.CustomerName,
')' )
),1
) as Customer_ID,

/* Field 4: Condition Contract Type( Description Text ) */
concat_with_space( _ConditionContract._CndnContrType.CndnContrType,
concat('(',
concat(_ConditionContract._CndnContrType._Text[1: Language='E'].CndnContrTypeDesc,
')' )
),1
) as CndnContrType,

/* Field 5: Payment Method (Description) */
concat_with_space( I_SettlmtDoc.CustomerPaymentMethod,
concat('(', concat(I_SettlmtDoc.PaymentMethodName,
')' )
), 1
) as PaymentMethod,

/* Field 6: Settlement Period ( StartDate - EndDate ) */
//Settlement Period End Date
concat_with_space( cast(
Concat(
Concat(
Concat(substring(SettlmtPeriodStartDate, 5, 2), '.'), //Day
Concat(substring(SettlmtPeriodStartDate, 7, 2), '.') //Month
), Substring(SettlmtPeriodStartDate, 1, 4) //Year
) as char10 preserving type
) ,


concat_with_space( '-',

//Settlement Period End Date
cast(
Concat(
Concat(
Concat(substring(SettlmtPeriodEndDate, 5, 2), '.'), //Day
Concat(substring(SettlmtPeriodEndDate, 7, 2), '.') //Month
), Substring(SettlmtPeriodEndDate, 1, 4) //Year
) as char10 preserving type
)

, 1 ) , 1 ) as SettlementPeriod,

/* Field 7: Sales Manager */
_ConditionContract.ZZ_SalesManagerName

};


 

Metadata Extensions:









ZMDEXT_C_SETTLMTDOCWRKFLWDET_01

@Metadata.layer: #CORE
@UI.headerInfo:{
title.value: 'Metadata Extension of C_SETTLMTDOCWRKFLWDET'
}
annotate view C_SettlmtDocWrkflwDet
with
{ // Company Code
@UI.fieldGroup: [{ qualifier: 'cc', groupLabel: 'Company Code', position: 8, importance: #MEDIUM }]
@EndUserText.label: 'Company Code'
@Consumption.semanticObject: 'CustSettlmtCompanyCode'
CompanyCodeInfo;

// Sales Office
@UI.fieldGroup: [{ qualifier: 'cc', groupLabel: 'Sales Office', position: 9, importance: #MEDIUM }]
@EndUserText.label: 'Sales Office'
@Consumption.semanticObject: 'SalesOffice'
SalesOfficeInfo;

// Condition contract customer ID
@UI.fieldGroup: [{ qualifier: 'cc', groupLabel: 'Customer', position: 40, importance: #MEDIUM }]
@EndUserText.label: 'Customer ID'
@Consumption.semanticObject: 'CustomerID'
Customer_ID;

// Condition contract type
@UI.fieldGroup: [{ qualifier: 'cc', groupLabel: 'Condition Contract Type', position: 50, importance: #MEDIUM }]
@EndUserText.label: 'Condition Contract Type'
@Consumption.semanticObject: 'CndnContrType'
CndnContrType;

// Sales manager
@UI.fieldGroup: [{ qualifier: 'cc', groupLabel: 'Condition Contract Type', position: 60, importance: #MEDIUM }]
@EndUserText.label: 'Sales Manager'
@Consumption.semanticObject: 'ZZ_SalesManager'
ZZ_SalesManagerName;

// Payment method
@UI.identification: [{position: 40}]
@EndUserText.label: 'Payment Method'
@Consumption.semanticObject: 'PaymentMethod'
PaymentMethod;

// Settlement period

@UI.identification: [{position: 50}]
@EndUserText.label: 'Settlement Period'
@Consumption.semanticObject: 'SettlementPeriod'
SettlementPeriod;
}


 

In conclusion, our exploration of enhancing the Work item information screen in My inbox through CDS and metadata extensions (RAP) has shed light on the immense potential for optimizing workflow efficiency and improving user experience. By leveraging these powerful tools and techniques, SAP users can unlock new levels of productivity and seamlessly manage their work items. We hope this blog has provided valuable insights and inspired you to embark on your own journey of enhancement within SAP.

To know more about Metadata Extensions, follow the link Explaining Metadata Extension
Labels in this area