Вы находитесь на странице: 1из 21

How to add custom BO tabs to Account 360 in C4C

Tim Chang 5/14/14


Background:
Our Cloud professional services team recently brought the customer live on Cloud for Customer project. The
customer needed to standardize their selling process and provide greater transparency to their pipeline. One key
requirement was to provide visibility to sales history from a disparate system and to capture sales forecast all in one
place. The customer had decided that they wanted to have custom data objects that could be placed into the C4C
account 360 views as a separate facet (tab).
The team explored the capabilities of using a Cloud Data Source within the Business Analytics work center; however
the customer required additional UI functionality as well as data validation rules. Therefore, two custom objects were
created. One object was to capture Sales Actuals and the second captured Sales Budgets /Forecasts that were read
only except for forecast column that could be edited.

We will describe how to develop and deploy this Sales History and Planned Sales in SAP C4C solution.
In summary, the steps are:
1. Develop a new Work Center in C4C to manage each of the new business objects Sales History
BO and Planned Sales BO
2. Develop a list UI component to display of BO in the Accounts Tab
3. Implement the file input of each BO
4. Configure the file input job in C4C
Since both the Sales History Bo and Planned Sales BOs are quite similar, our guide will focus on the steps
for Sales History BO.
1. Develop a new Work Center for Sales History.
In the SAP Cloud Applications Studio, we started with a new solution, and added a new BO. We
defined the Sales History BO as:
import
import
import
import

AP.Common.GDT as apCommonGDT;
AP.FO.BusinessPartner.Global;
AP.PC.IdentityManagement.Global;
AP.FO.ProductDataMaintenance.Global as apProdGlobal;

businessobject SalesHistory raises MsgProductErr, MsgSoldtoErr, MsgEndUserErr, MsgEmployeeErr,


MsgProductBlank, MsgSoldtoBlank, MsgEndUserBlank, MsgEmployeeBlank {
message
message
message
message

MsgProductErr text "Product &1 does not exist" : ProductInternalID;


MsgSoldtoErr text "Sold To &1 does not exist" : BusinessPartnerInternalID;
MsgEndUserErr text "End User &1 does not exist" : BusinessPartnerInternalID;
MsgEmployeeErr text "SalesPerson ID &1 does not exist" : apCommonGDT:EmployeeID;

message
message
message
message

MsgProductBlank text "Product must be filled for record &1" : ID;


MsgSoldtoBlank text "Soldto must be filled for record &1" : ID;
MsgEndUserBlank text "EndUser must be filled for record &1" : ID;
MsgEmployeeBlank text "Employee must be filled for record &1" : ID;
[AlternativeKey]

[Label ("Sales History Key")]


element SHkey
: ID;
[Label ("Fiscal Period")]
element fiscalper
: YearMonth;
[Label ("Calendar Period")]
element calendarper
: YearMonth;
[Label ("Sold To")]
element soldto
: BusinessPartnerInternalID ;
[Label ("End User")]
element enduser
: BusinessPartnerInternalID ;
[Label ("Product Family")]
element productfamily
: ID ;
[Label ("Product Category")]
element productcategory : ID ;
[Label ("Product Type")]
element producttype
: ID ;
[Label ("Product ID")]
element productID
: apCommonGDT:ProductInternalID ;
[Label ("SalesPerson")]
element salesperson
: apCommonGDT:EmployeeID ;
[Label ("Transaction Date")]
element transactiondate :
Date;
[Label ("Weight MT Actual")]
element weight_mt_act
: DecimalValue ;
[Label ("Weight ST Actual ")]
element weight_st_act
: DecimalValue ;
[Label ("Revenue")]
element revenue_act
: Amount ;
[Label ("Est. Avg EBITDA")]
element est_avg_ebitda
: Amount ;
[Label ("Avg EBITDA")]
element avg_ebitda_percent
: Percent ;
association
association
association
association

// for end-user only


ToEndUserCustomer to Customer;
ToMaterialSH to Material ;
ToRespEmployee [0,1] to Employee;
ToCustomerSH to Customer ;

// action
action DeleteSH ;
}

In the above ABSL code, we have defined the error messages needed for validation, the structure of the
BO, the associations for related data in other master BOs, and an action to handle deletion of a row.
Once this BO is saved and activated, do a right-mouse click on the .BO and select Create Screens (see
below). We are using the automated screen creation to setup a full set of Work Center (WC), OWL, TT,
TI and other screens with navigation fully linked and working.

The screen type we want is the Screen Scenario with Thing-Based Navigation:

Once the screens are created, be sure to activate the entire solution.
The newly created WC will provide the ability to update data in the BO, add rows and delete rows
for administrative use only, especially if incorrect data was imported. The user will not have access
to this WC.
This is a good milepost to test the Sales History WC. You can edit your user id, and add the WC.
2. Develop a list UI component to display of BO in the Accounts Tab
In the Accounts 360 screen, you can add a new facet (aka tab) by using available slots in the
Studio on the Account TI screen object. In this new facet, we can place a custom UI component
called embedded component (EC) that displays a list of the Sales History rows.
Since the Account 360 screen is showing only 1 account, we will need to send current account ID
as a parameter to the EC to retrieve only the Sales history for that account.
First, lets build this EC, which is a list of the Sales history and will accept a parameter.
In the solution, we add a New Item from the Embedded Component type.

The object SalesHistoryEC.EC.uicomponent is added to the solution, and double-clicking


on the .EC.uicomponent will bring up the UI Designer.
In the UI Designer, drag and drop the Advanced List Pane to the left side into the UI
box. The Advanced List Pane is available from the Toolbox.

Afterwards, it looks like this with 3 columns:

We update the 3 columns and add the remaining ones.


Click on the upper left corner of the list box see below.
Click to go the Properties tab.

Click on ChildElements->ListColumns. It brings up the Column editor see below.

Lets map the Column to one of the data elements in the BO.
Click on Data Information->Value->./Column and it brings up the DependentProperty Editor

In the Select BO-Model prompt, select the Sales History BO. Then select the field that this UI
column maps to.
In this case, we will choose the field fiscalper which shows the fiscal period.

It will prompt to use the associated Backend Text. Click Yes.


Repeat the above association steps for the remaining 2 fields.
We will walk to add a new column and an example of showing the Product Description, available
by association we defined in the BO, since the user may not be familiar with the Product ID.
Click the Add button. It adds a generic named Column as shown below.

Click on Data Information->Value->./Column and it brings up the DependentProperty Editor


We look in the BO list of attributes one of which is the ToMaterialSH, which is our gateway to
the Material BO and the description text. See below.

We continue to add the remaining fields of the BO to the EC.


As a last step, make sure all the columns are read-only by setting the Behavior->ReadOnly value
to true, as shown here:

To complete this EC, we now need to setup the parameter to show just the Sales History records
for 1 account.
First define the parameter, which needs to be in a structure. In the DataModel tab of this EC,
We define the structure SearchByAccountID, and then the variable:

Then we add the actual parameter AccountID:

Switching to the Controller tab, we define our Query:

We set the Results List /Root/DataList, and bind the query QueryByElements. We set the query
using the down arrow to add the parameter which will use the soldto field to parameter defined
above.

We add an Inport, which is like the doorman who will take parameter from the outside caller,
and pass it to the query.

This doorman will also run the query on initialization, so we need to set the behaviors
RequestAutoRefire and RequestFireOnInitialization to true. The event OnFire needs to set to
default EventHandler. These items are on the right side in the Properties tab.

Click on Save and Activate on your EC.


Now that the EC has been created, we need to add this to a new facet of the Accounts TI screen.
Use the Configuration Explorer tab to look for the COD_Account_TI screen see path in the
screenshot:

The TI screen will start in a new tab of the UI Designer.


Click on Extensibility Explorer, and select the entity Undefined zmnx.
Click on Add View with embedded Component.
Name the Tab Title appropriately.
Select the EC you created.
Click Bind.

In the Bind setup, on the right you will use the defined outport PublicOutputECCustomerRoot
and the InPort->Parameter and bind them.

This sends the current AccountID in Account 360 to the Inport (aka doorman) of the EC, and it
will load the query showing any records from the Sales History BO for this Account ID.
Click Save and Activate. This EC will now display in a new facet for Account 360. And, thats it
for step 2.

3. Implement the file input of each BO


This step creates the interface that allows you to upload XML files of Sales History data into the
BO. The XML files can be created using a format (or schema) provided from the Studio.
In the Studio, right-mouse click on the Sales History BO, and select Create Service Integration.
It will start of a wizard of 5 steps.
a. Select the XML File Input.

b. Name the XML interface and the receiving BO


c. Select all (or the needed fields) that will be imported in.

I do not suggest UUID as an import column. Your normal key (SHkeyID) should be enough,
as long as you make it unique.
Most important, click on Mass Processing.
d. In step 4, select By Alternative Key. Choose SHkey.
e. Click Finish

The program object SalesHistory.pid wil be created.


Click Save and Activate. Its also a good idea to do a Save All.

To get the schema file, you will need to exit the Studio and re-log back in. After logging
back into the Studio, the SalesHistory.xsd will be an active link, and you can save the schema
file in a local directory.

f. To use the .XSD file as an template for data, run Microsoft Excel with a new sheet.
g. Click on Developer->Source. Click on XML Maps.

Click on Add button, and add the .XSD from the Studio. See below.

h. Upon clicking OK, you will a list of data nodes in the XML Source.
Scroll down to the node with your BO name, and drag and drop the node to row A2 (not row
1). You should see this resulting sheet:

You can delete all of the superfluous columns that start with schema or SAP_To

i.

Drag and drop the CreationDateTime to cell A1. This will bind the CreateDateTime element
to this cell, so any values entered here will be exported to the XML.
An example of the data for this cell is 2014-03-03T10:11:00.0000000Z

j.

At this point, save this document as your blank template for future data files you will create
for importing into the SalesHistory BO.

k. Heres an example of data rows.

To create the XML, click on Developer->Export

And save the XML file in your local directory.


This will be the XML file to be uploaded by the add_on in your SAP Cloud solution.

4. Configure the file input job in C4C


Now that we have setup the XML file interface in the Studio, we have a minor steps in C4C to
import the file. We want to setup a run, which is basically the queue to process this specific
BO import.
a. With an administrations login, go to Application and User Management WC.

In the Input & Output screen, click on New button:

b. Enter the Run ID and Description, and use the dropdown to select the Interface. In the example
below, Ive created it for Sales History.

c. Click Save. Then click Actions->Set to Active to make it usable.


d. Now this Run is available. Continue as normal to schedule and run the imports.