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 i n SAP C4C solution. In summary, the steps are: 1. Develop a new Work Center in C4C C4C to manage manage each of the the new business business object objectss – Sales History History BO and Planned Sales BO 2. Develop a list UI component component to to display display of BO in the the Accounts Accounts Tab 3. Impleme Implement nt the file file inpu inputt of of each each BO 4. Config Configure ure the file file input input job in C4C 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 Develop a new Work Work Center Center for for Sales Sales Histo History. ry. In the SAP Cloud Applications Studio, we started with a new solution, solution, and added a new BO. We defined the Sales History BO as: import AP.Common.GDT as import AP.Common.GDT as apCommonGDT; apCommonGDT; import import AP.FO.BusinessPartner.Global; import import AP.PC.IdentityManagement.Global; import import AP.FO.ProductDataMaintenance.Global as as apProdGlobal; apProdGlobal; businessobject SalesHistory businessobject SalesHistory raises raises MsgProductErr, MsgSoldtoErr, MsgEndUserErr, MsgEmployeeErr, MsgProductBlan k, MsgSoldtoBlank, MsgEndUserBlan k, MsgEmployeeBlank { message MsgProductErr text "Product &1 does not exist" : message MsgProductErr exist" : ProductInternalID; message MsgSoldtoErr message MsgSoldtoErr text "Sold To &1 does not exist" : exist" : BusinessPartnerInternalID; message MsgEndUserErr message MsgEndUserErr text "End User &1 does not exist" : exist" : BusinessPartnerInternalID; message MsgEmployeeErr message MsgEmployeeErr text "SalesPerson ID &1 does not exist" : exist" : apCommonGDT:EmployeeID; message MsgProductBlank text "Product must be filled for record &1" : message MsgProductBlank &1" : ID; message MsgSoldtoBlank message MsgSoldtoBlank text "Soldto must be filled for record &1" : &1" : ID; message MsgEndUserBlank message MsgEndUserBlank text "EndUser must be filled for record &1" : &1" : ID; message MsgEmployeeBlank message MsgEmployeeBlank text "Employee must be filled for record &1" : &1" : ID;
[AlternativeKey]
[Label ("Sales ("Sales History Key")] Key")] element SHkey : ID; [Label ("Fiscal ("Fiscal Period")] Period")] element f element fi iscalpe r : Ye arM ont h; [Label ("Calendar ("Calendar Period")] Period")] element c element ca alendar per : Ye arM ont h; [Label ("Sold ("Sold To")] To")] element s element so oldto : Bu sin ess PartnerInternalI D ; [Label ("End ("End User")] User")] element e element en nduser : Bu sin ess PartnerInternalI D ; [Label ("Product ("Product Family")] Family")] element productfamily : ID ; [Label ("Product ("Product Category")] Category")] element productcategory : ID ; [Label ("Product ("Product Type")] Type")] element p element pr roductt ype : ID ; [Label ("Product ("Product ID")] ID")] element productI D : ap Com monGDT:Pr oduc tIn ter nalID ; [Label ("SalesPerson" ("SalesPerson")] )] element salesperson : ap Com monGDT:EmployeeI D ; [Label ("Transaction ("Transaction Date")] Date")] element transactiondate : Date ; [Label ("Weight ("Weight MT Actual")] Actual")] element w element we eight_mt_act : De cim alValue ; [Label ("Weight ("Weight ST Actual ")] ")] element w element we eight_st_act : De cim alValue ; [Label ("Revenue" ("Revenue")] )] element r element re evenue_act : Am ount ; [Label ("Est. ("Est. Avg EBITDA")] EBITDA")] element e element es st_avg_ebitda : Am oun t ; [Label ("Avg ("Avg EBITDA")] EBITDA")] element a element av vg_ebitda_perc ent : Pe rcent ; // for end-user only association ToEndUserCustomer to association to Customer; Customer; association ToMaterialSH association ToMaterialSH to to Material Material ; association ToRespEmployee association ToRespEmployee [0 [0,1] to to Employee; Employee; association ToCustomerSH association ToCustomerSH to to Customer Customer ; // action action DeleteSH action DeleteSH ; }
In the above ABSL code, we have defined the error messages message s needed for validation, the structure of the BO, the associations for related data in other master B Os, 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 select Create Screens (see 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 the Screen Scenario with Thing-Based Navigation: Navigation :
Once the screens are created, be sure to activate the entire solution. The newly created WC will provide the abili ty 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 a ccount, we will need to send curren t account ID as a parameter to the EC to retrieve only the Sales history for that account. First, let’s 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 – i nto 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 l ist box – see below. Click to go the Properties tab.
Click on ChildElements->ListColumns. It brings up the Column editor – see below.
Let’s map the Column to one of the data elements in the B O. 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 fiel d 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 fiel ds. We will walk to add a new column and an ex ample of showing the Product Description, available by association we defined in the BO, since the user ma y 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 t o 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, that’s 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 s teps. 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. It’s 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. Here’s 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 SA P Cloud solution.
4. Configure the file input job in C4C Now that we have setup the XML fil e interface in the Studio, we have a m inor 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 administration’s 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, I’ve 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.