Introduction
The Custom Business Configurations (CUBCO) app serves as an entry point to the Business Configuration Maintenance Object (SMBC) provided by custom applications or partners.
When you use the ADT wizard to generate a Business Configuration Maintenance Object, the singleton pattern is used when generating the draft enabled RAP BO. One attribute of this pattern is that all entities are locked, so it is not possible for multiple users to work with the same configuration at the same time.
This blog describes how to avoid this restriction by using collaborative drafts.
This blog is relevant for
Further reading:
Related blog postsLearn how you can use ABAP technology to develop innovative applications and business solutions across SAP’s portfolio on SAP Learning Site.
Example scenario
In the configuration table ZDEMO_CC, the company codes are stored.
@EndUserText.label : ‘Company Code’
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #C
@AbapCatalog.dataMaintenance : #ALLOWED
define table zdemo_cc {
key client : abap.clnt not null;
key company_code : abap.numc(4) not null;
country : land1;
last_changed_at : abp_lastchange_tstmpl;
local_last_changed_at : abp_locinst_lastchange_tstmpl;
}
Enable collaborative draft
In the generated behavior definition, add “collaborative” to the draft annotation:
managed with additional save implementation in class ZBP_I_COMPANYCODE_S unique;
strict;
with collaborative draft;
Add the draft query annotation and the share action to the singleton entity definition:
define behavior for ZI_CompanyCode_S alias CompanyCodeAll
draft table ZDEMO_CC_D_S query ZR_DEMO_CC_CD
[…]
{
draft action Share;
[…]
}
Right-click the singleton draft table and choose New Data Definition to create the CDS view for the draft query:
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: ‘Draft Query View’
define view entity ZR_DEMO_CC_CD
as select from zdemo_cc_d_s
{
key singletonid as Singletonid,
lastchangedatmax as Lastchangedatmax,
transportrequestid as Transportrequestid,
draftentitycreationdatetime as Draftentitycreationdatetime,
draftentitylastchangedatetime as Draftentitylastchangedatetime,
draftadministrativedatauuid as Draftadministrativedatauuid,
draftentityoperationcode as Draftentityoperationcode,
hasactiveentity as Hasactiveentity,
draftfieldchanges as Draftfieldchanges
}
You need to enhance the authorization of the involved users. In SAP BTP ABAP environment and SAP S/4HANA Public Cloud Edition you assign business catalog SAP_CORE_BC_RAP_DRAFT_PC to the user, in SAP S/4HANA Private Cloud Edition authorization object S_DRAFT.
User TB is creating a new company code 400 while at the same time user PW is editing company code 100. All changes are recorded on the same transport request.
Since the collaborative draft is enabled for the singleton entity, the save and discard draft action are applied to all changes. In practice, this means that discarding the draft or saving must be coordinated between the users involved.
For completely independent editing of individual objects, you must develop a RAP BO without a singleton pattern.
IntroductionThe Custom Business Configurations (CUBCO) app serves as an entry point to the Business Configuration Maintenance Object (SMBC) provided by custom applications or partners.When you use the ADT wizard to generate a Business Configuration Maintenance Object, the singleton pattern is used when generating the draft enabled RAP BO. One attribute of this pattern is that all entities are locked, so it is not possible for multiple users to work with the same configuration at the same time.This blog describes how to avoid this restriction by using collaborative drafts.This blog is relevant for Further reading:Related blog postsLearn how you can use ABAP technology to develop innovative applications and business solutions across SAP’s portfolio on SAP Learning Site.Example scenarioIn the configuration table ZDEMO_CC, the company codes are stored.@EndUserText.label : ‘Company Code’
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #C
@AbapCatalog.dataMaintenance : #ALLOWED
define table zdemo_cc {
key client : abap.clnt not null;
key company_code : abap.numc(4) not null;
country : land1;
last_changed_at : abp_lastchange_tstmpl;
local_last_changed_at : abp_locinst_lastchange_tstmpl;
}Enable collaborative draftIn the generated behavior definition, add “collaborative” to the draft annotation:managed with additional save implementation in class ZBP_I_COMPANYCODE_S unique;
strict;
with collaborative draft;Add the draft query annotation and the share action to the singleton entity definition:define behavior for ZI_CompanyCode_S alias CompanyCodeAll
draft table ZDEMO_CC_D_S query ZR_DEMO_CC_CD
[…]
{
draft action Share;
[…]
} Right-click the singleton draft table and choose New Data Definition to create the CDS view for the draft query:@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: ‘Draft Query View’
define view entity ZR_DEMO_CC_CD
as select from zdemo_cc_d_s
{
key singletonid as Singletonid,
lastchangedatmax as Lastchangedatmax,
transportrequestid as Transportrequestid,
draftentitycreationdatetime as Draftentitycreationdatetime,
draftentitylastchangedatetime as Draftentitylastchangedatetime,
draftadministrativedatauuid as Draftadministrativedatauuid,
draftentityoperationcode as Draftentityoperationcode,
hasactiveentity as Hasactiveentity,
draftfieldchanges as Draftfieldchanges
}You need to enhance the authorization of the involved users. In SAP BTP ABAP environment and SAP S/4HANA Public Cloud Edition you assign business catalog SAP_CORE_BC_RAP_DRAFT_PC to the user, in SAP S/4HANA Private Cloud Edition authorization object S_DRAFT.User TB is creating a new company code 400 while at the same time user PW is editing company code 100. All changes are recorded on the same transport request.Since the collaborative draft is enabled for the singleton entity, the save and discard draft action are applied to all changes. In practice, this means that discarding the draft or saving must be coordinated between the users involved.For completely independent editing of individual objects, you must develop a RAP BO without a singleton pattern. Read More Technology Blog Posts by SAP articles
#SAP
#SAPTechnologyblog