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: 
Hi,

Below blog will take you thru on providing 'Access context 1015' to Custom BO in C4C.

What is Access Context?












The access context is a characteristic bound to the work center view/business object. It is defined by the standard set up of the business object and cannot be changed or enhanced. Hence the access control capabilities for a certain business object works in the defined structure of the access context.

The access context 1015 is also relevant for Opportunities, Sales Quotes and other business objects. Other business objects such as the product may have different access contexts assigned.

Link will explain more about Access Context in C4C:

https://blogs.sap.com/2015/07/15/access-control-management-access-restrictions-explained-access-cont...

Below is the example of : Add Access Context to already created and working custom BO. Price Approval request is a custom BO application that will be used by sales agents by selecting the Customer -> Account.












Step 1: Add elements to custom BO.


Here, Customer ID (internal ID) is the one of non-key field. You can still add key field as well.

Added another field and association as shown below.

[RelevantForAccessControl] is mandatory to be added to association object for the respective standard BO like Customer, Employee, etc.,

 

element customerID:BusinessPartnerInternalID;

element Consistent:ConsistencyStatusCode;

[RelevantForAccessControl] association For_Access_Control to Customer;

 

Save and activate the BO.

Step 2: Create a BO Query.


Right click on Custom BO and select “Create Query” .

Select only the access context fields that you created in Custom BO.

I selected "customerID" & "Consistent".

Step 3: Code in Event-BeforeSave.absl.


But you can still add this code in different events as well, if before save event not resulted as expected.

if( ! this.For_Access_Control.IsSet()){

var currUUID = Identity.Retrieve(Context.GetCurrentIdentityUUID());

if(currUUID.IsSet()){

var customerQuery = Customer.QueryByIdentification;

//var q = Employee.QueryByIdentification;

var q_selparams = customerQuery.CreateSelectionParams();

q_selparams.Add(customerQuery.InternalID,"I","EQ", this.customerID);

var q_res = customerQuery.Execute(q_selparams);

foreach(var emp_ins in q_res){

this.For_Access_Control = emp_ins;

}

}

if(this.For_Access_Control.IsSet()){

this.Consistent = "3"; // Consistent

this.customerID = this.For_Access_Control.InternalID;

}

else{

this.Consistent = "2"; // Inconsistent

}

}

Step 4: Custom BO UI Designer related enhancements


Open OWL of custom BO now to change the query to the BO query you created in the earlier step.

In Controller tab:

Create a Query and follow as per the below snap.


Query -> Default Set

In DataModel,

Create a Data List in Root (Add Data List) by right clicking on Root and add fields to it. In this case, only 2 fields to be added, like Customer ID and Consistent.

Then Bind the fields as shown below.


Save and Activate.

QC/TI/TT changes: We don’t needed the QC/TI/TT changes, as we are not using this functionality at Price Request Work Center View. We used only OWL and Work Center View UIs.

Select respective QC/TI/TT component property from the list shown in the below snap.

You will be able to see RBAMData function.

Change the properties as show below in UIs of QC, TI & TT, if not changed automatically.

  • Change the Access Check Mode to “PrivilegedExceptAccessControlBusinesssObjects”

  • Set Authorization Classification Code to “Application”

  • Select Access Controlled Business Object and make sure you see your object having Unrestricted Access unchecked.

  • Save and Activate



Work Center View (WC View) Changes:

Change the property parameters as shown below.



Step 5: Update Access Rights in C4C tenant



  • Login into C4C tenant

  • Administrator -> Business Users

  • Select User ID -> Edit -> Access Rights

  • Go to “Access Restrictions” Tab -> select your Work Center View as shown below



  • Change the Read / Write Access to “Restrict”. As shown below snap.

  • Save

  • Select Update Access Rights -> Update Selected User(s).




Step 6: Errors


Below error in popup will be raised while activating the custom BO, after adding access control elements to it. Follow the below solution steps to solve the error problems.


Solution: Usually the errors occurred due to not adapted this adding to its associated work center views, OWLs, QCs, Query (.qry).

Make sure to do the following –

  1. Update “Meta Data” for dependent UI screens of custom BO.

  2. Re-activate all UI screens, Custom BO Queries (.qry) and ABSL code.



 

Note: Save and activate in orderly.

 

Rgs,

Chandra Gajula
1 Comment
Labels in this area