Sunteți pe pagina 1din 129

2013

Based on
SAP Solutions OnDemand Studio r1302

Solutions OnDemand Studio Tutorial
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 1 of 128
Table of Contents

Table of Contents .................................................................................................................................... 1
Getting Started with Solutions OnDemand Studio ................................................................................. 3
Step 1: Creating a development user for the SDK ............................................................................... 3
Step 2: Configure backend system details .......................................................................................... 3
Step 3: Log on to the backend system to connect to the repository .................................................. 4
Creating a custom business object .......................................................................................................... 5
Step 1: Create a new customer specific solution ................................................................................ 5
Step 2: Create a new custom business object called Contract_<suffix> ............................................. 6
Step 3: Create a work center, work center view, OWL, QAF, OIF for the new business object
Contract_<suffix> ................................................................................................................................ 9
Step 4: Change the generated UI ...................................................................................................... 11
Step 5: Add Attachments EC ............................................................................................................. 18
Step 6: Add Notes EC ......................................................................................................................... 20
Testing UIs with Business Users ............................................................................................................ 22
Step 1: Assign work centers and work center views to the business users ...................................... 22
Step 2: Test the work centers with the business users ..................................................................... 23
Performing the Lifecycle of a Solution .................................................................................................. 24
Step 1: Create a BAC Element ........................................................................................................... 24
Step 2: Assemble and download the solution ................................................................................... 25
Step 3: Upload your solution ............................................................................................................. 26
Step 4: Create a patch for your solution ........................................................................................... 29
Step 5: Assemble and download your patch ..................................................................................... 32
Step 6: Upload your patch ................................................................................................................. 33
Extensibility: Create extension fields .................................................................................................... 36
Step 1: Extend account standard BO ................................................................................................. 36
Step 2: Extend Account screen .......................................................................................................... 38
Linking custom business object to standard business object ............................................................... 43
Step 1: Create new embedded component for Contract_<suffix> BO ............................................. 43
Step 2: Add New button for contract creation and Refresh button for contract list refreshing in
embedded component for Contract_<suffix> BO ............................................................................. 50
Step 3: Extend opportunity with new tab ......................................................................................... 57
Step 4: Enable embedded component for personalization .............................................................. 60
Service Integration - XML File Input ...................................................................................................... 63
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 2 of 128
Step 1: Create service integration ..................................................................................................... 63
Step 2: Create XML payload .............................................................................................................. 67
Step 3: Uploading data file ................................................................................................................ 68
Step 4: Configure File Input ............................................................................................................... 69
Create a new web service ..................................................................................................................... 71
Step 1: Create a web service for the Contract_<suffix> BO .............................................................. 71
Step 3: Create the web service authorization ................................................................................... 75
Create an external web service integration scenario ........................................................................... 77
Step 1: Create an exchange rate web service on another system to simulate external web service77
Step 2: Create an external web service integration .......................................................................... 84
Step 3: Create a communication scenario ........................................................................................ 87
Step 4: Create a communication system. .......................................................................................... 89
Step 5: Create a communication arrangement ................................................................................. 91
Step 6: Calling the web service in an action ...................................................................................... 94
Tracing and Debugging .......................................................................................................................... 95
Step 1: Set up tracing, run tracing and check the traces ................................................................... 95
Step 2: Set up breakpoints and debug at runtime ............................................................................ 99
Analytics .............................................................................................................................................. 102
Step 1: Create a data source for the Contract_<suffix> BO ............................................................ 102
Step 2: Create a new report on the data source ............................................................................. 105
Step 3: Allow assignment of the report to the contract View ........................................................ 109
Step 4: Perform the assignment of the report in the runtime ........................................................ 112
Create Mashups .................................................................................................................................. 114
Step 1: Create a custom Port Type Package .................................................................................... 114
Step 2: Create a custom Mashup Port Binding ............................................................................... 115
Step 3: Create a custom HTML Mashup .......................................................................................... 116
Step 4: Create a custom Data Mashup ............................................................................................ 119
Step 5: Add a custom Mashup to your UI ....................................................................................... 122
Appendix ............................................................................................................................................. 125
Code snippet for Contract_<suffix>.bo ........................................................................................... 125
Code snippet for Contract_<suffix>.bo -> After-Modify ................................................................. 126
Code snippet for Contract_<suffix>.bo -> Action_CalculateReportAmount ................................... 126
Code snippet for Account_<suffix>.xbo .......................................................................................... 127
Code snippet for Account_<suffix>.xbo -> Before-Save.................................................................. 128
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 3 of 128
Getting Started with Solutions OnDemand Studio
Step 1: Creating a development user for the SDK
Procedure
1. Create a new service agent and request user on view Service Agents under work center
Business Partner Data.
2. Go to view Business Users under work center Application and User management and find
your user (search by name).
3. Edit user Attributes:
a. Change the User ID (optional).
b. Change Password to Initial1.
4. Edit user Access Rights:
a. Add WC Partner Development.
b. Add WC Business Analytics.
c. Add WC Business Configuration.
d. Add WC Application and User Management.
5. Save the changes and login once to change the password to Welcome1.
Step 2: Configure backend system details
Procedure
1. In the studio menu go to Administration->Options and Settings.
2. In the popup, click SAP->General.
3. In a blank line enter the system Name and the system Host address, and press the Save
button. (Ask the trainer for the systems. In this document, we use S2A/004 as the
development system and S2A/003 as the testing system.)
Name: XXXX (S2A004)
Host: YYYY.dev.sapbydesign.com (s2a-cust004.dev.sapbydesign.com)

Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 4 of 128
Step 3: Log on to the backend system to connect to the repository
Procedure
1. In the My Solutions View, click Log On.

2. In the pop-up Connect to repository, do:
a. Select your system for the workshop.
b. Enter your user name and password.
c. Click OK.

Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 5 of 128
Creating a custom business object
Step 1: Create a new customer specific solution
Procedure
1. In the Solutions OnDemand Studio Repository View, right-click on My Solutions and choose
Create Solution.


2. In the pop-up Create Solution, do:
a. Enter the name: BYD_Contract_<suffix>. (If you are using the tenant provided by
your trainer, then use the suffix assigned to you. If it is your own tenant, use your
initials.)
b. Choose the type: Customer-Specific Solution.
c. Choose deployment unit: Customer Relationship Management.
d. Press OK.


Back to Top

Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 6 of 128
Step 2: Create a new custom business object called Contract_<suffix>
Procedure
1. In the Solution Explorer view, right-click on your project and choose Add -> New Item.

2. In the pop-up Add New Item, do:
a. Select the Business Object template and enter Contract_<suffix>.bo in the Name
field.
b. Press Add.



3. On the Contract_<suffix>.bo tab, enter the business object definition.

Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 7 of 128
Import the following namespaces:
Namespace
AP.Common.GDT as apCommonGDT

AP.FO.BusinessPartner.Global

AP.PC.IdentityManagement.Global


Add the following elements to the Root node:
Element Name Data Type Alternative
Key
ContractID

ID Yes
ContractDescription

AP.Common.GDT:MEDIUM_Description

No
WorkspaceID ID No

AccountID BusinessPartnerInternalID

No
OpportunityID

ID No
ContractAmount

Amount No
ReportAmount Amount No

AgreementDate

Date

No
EffectiveDate

Date

No
ExpirationDate

Date No
ContractOwnerName

LONG_Name

No
ContractOwnerID AP.Common.GDT:EmployeeID No
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 8 of 128



Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 9 of 128
Add the following association to the root node:
Association Name BO
ToResponsibleEmployee

Employee

Add the following action to the root node:
Action Name
CalculateReportAmount




Hint: The code snippet with the complete business object definition can be found here.

4. Click Save and Activate.

Step 3: Create a work center, work center view, OWL, QAF, OIF for the
new business object Contract_<suffix>
Procedure
1. In the Solution Explorer view, right-click on the Contract_<suffix>.bo and choose Create
Screens.
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 10 of 128

Hint: In case the Create Screens option is grayed out, press icon Refresh in Solution
Explorer or log on freshly to you solution. It also might be that the BO is not active yet.
Check for the activation status of the BO in the properties.
2. In the pop-up Create Screens, do:
a. Give screen name as Contract_<suffix>.
b. Select Devices Supported as Desktop Only.
c. For the Screen Creation, select the radio-button Screen Scenario with Navigation.
d. Extend the Short ID to CT_<suffix>.
e. Press OK.
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 11 of 128


Hint: Use the Devices Supported combo box to create screens e.g. for mobile/tablet devices.

Step 4: Change the generated UI
Task 1: Change the Floorpan title of QAF
Procedure
1. In the Solution Explorer view of Customer OnDemand studio, double-click on
Contract_<suffix>_QA.QA.uicomponent.
2. In the UI Designer, click Display <-> Edit.
3. Change the Floorpan Title
a. Click on the Floorpan Title in the IdentificationRegion.


b. In the Properties tab select the FloorpanTitle property and press the small arrow.
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 12 of 128


c. In the DependentProperty Editor popup select the TextPool radio button at the top.
d. Select Overridden Text for TextPool and click Advanced.

e. Change the first field to Contract:.
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 13 of 128

f. Add another field and select the ContractID in the Select Data Field popup window,
then press OK.
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 14 of 128

Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 15 of 128



Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 16 of 128

4. Click on Save and Activate button.


Task 2: Assign value help to customer and opportunity in the QAF Floorpan.
Procedure
1. Select the Customer field on QAF.
a. In the Properties tab, go to Appearance section and change the DisplayType to
ObjectValueSelector.
b. In the Properties tab, go to ValueHelp section, and select OVS component:
/SAP_BYD_APPLICATION_UI/publicovs/businesspartnerid/Account.OVS.uicompone
nt.




Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 17 of 128

2. Select the Opportunity field on QAF and repeat the same steps except now link to opportunity
OVS as show in below path.

3. Specify the BusinessTransactionDocumentTypeCode as 72 to filter opportunities.

Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 18 of 128

4. Finish by performing the Save and Activate.
Task 3: Repeat above changes for OIF Floorpan.
Step 5: Add Attachments EC
Procedure
1. In the Solution Explorer view of Customer OnDemand studio, double-click on
Contract_<suffix>_OIF.OIF.uicomponent.
2. In the UI Designer, click Display <-> Edit.
3. Select the Attachments facet.
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 19 of 128

4. Select the Configuration Explorer.

5. Navigate through the repository structure to documentlist as shown below
(/SAP_BYD_APPLICATION_UI/Reuse/Attachments/documentlist.EC.uicomponent) and drag
and drop the component to the attachments facet.


6. Click on the Bind button on the attachment embedded component that you drag and dropped
into Attachments facet.
7. Select the Root and Node Reference Binding as show below and click on Bind. And then click
OK.
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 20 of 128

8. Save and Activate.
9. To be done when DO (dependent object) are not yet included in the BO definition: open the
Contract_<suffix>.bo tab that you used to model the Custom BO in Step 1 and add the
following snippet. This creates persistence for the Attachments. Save and Activate.
[DependentObject(AttachmentFolder)] node Attachment;
Step 6: Add Notes EC
Procedure
1. Select the Notes facet.
2. Select the Configuration Explorer.

3. Navigate through the repository structure to singletextedit
(/SAP_BYD_APPLICATION_UI/Reuse/Notes/singletextedit.EC.uicomponent) as shown below
and drag and drop the component to the Notes facet.
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 21 of 128

4. Click on the Bind button on the embedded component that you drag and dropped into Notes
facet.
5. Select the Root and Node Reference Binding as already done for attachments and click on
Bind. And then click OK.
6. Select the newly added embedded component and in Properties tab change the
TextTypeCode in Parameters session to 10011.

7. Save and Activate.
8. If not yet done in the BO definition, now open the Contract_<suffix>.bo tab that you used to
model the custom BO in Step 1 and add the following snippet. This creates persistence for the
Note. Save and Activate.
[DependentObject(TextCollection)] node TextCollection;

9. Save and Activate.

Back to Top


Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 22 of 128
Testing UIs with Business Users
Step 1: Assign work centers and work center views to the business
users
Procedure
1. Create a test user (e.g. service agent or employee) without the Partner Development work
center assigned.
2. Assign the work center of the new custom solution Contract_<suffix> to your business user
(not PDI development user).




Hint: Go the User and Application Management work center and assign access rights (Work
Center) to the users via the work center view User and Access Management ->Business
Users.
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 23 of 128
Hint: In order to identify your work centers look for the work center that corresponds to
you suffix number. The Work Center ID should also contain the solution name.
Step 2: Test the work centers with the business users
Procedure
1. Login to the web UI with your business user for testing (not PDI development user).
2. Go to the work center for the Contract_<suffix>.
3. Check the list shown on OWL view.
4. Click New on OWL view.
5. Check the opened QAF view. For example, check whether the OVS works.
6. Click View All on the QAF view.
7. Check the opened OIF view. For example, check whether the attachments tab and notes tab
work.
Back to Top

Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 24 of 128
Performing the Lifecycle of a Solution
Step 1: Create a BAC Element
Procedure
1. In the Project Explorer view, click on New Item icon.

2. In the pop-up Add New Item, do:
a. Select the BAC Elements template and enter Contract_<suffix>.bac in the Name
field.
b. Press Add.

3. In the popup Business Configuration Wizard, do:
a. Fill the required fields: for the Scoping Question enter Activate Contract_<suffix>.
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 25 of 128
b. Select the anchor where your BAC element should be placed. (e.g. Sales -> Account
and Activity Management -> Account Management)

c. Save and activate.

Step 2: Assemble and download the solution
Procedure
1. Open the Implementation Manager via menu Administration ->Implementation Manager.
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 26 of 128
2. In case the status of your solution is In Development you can click on the icon Assemble and
Download and confirm the popup.

3. Choose the local path where the assembled solution should be saved.
Step 3: Upload your solution
Procedure
1. Create development user (service agent) and business user for testing in the following test
tenant. (in the document, we use S2A/003, Host: s2a-cust003.dev.sapbydesign.com)
2. Logon to the test tenant via the SDK (setup the connection accordingly).
3. Open the Implementation Manager via menu Administration ->Implementation Manager.
4. Click on the icon Upload.
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 27 of 128

5. Agree to the Upload Disclaimer.
6. Check the status of your solution. In case the upload was successful it will be In Deployment
7. Activate the solution (use the active icon in the implementation manager). In case the
activation was successful, the solution will have the status Deployed.
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 28 of 128

Hint: In case of errors during the upload process press icon Clean and Reactivate.
8. Perform scoping of your solution in test system.
a. Logon to the UI of your test tenant with a user that has sufficient access rights to
change the scoping in work center Business Configuration.
b. Go to work center Business Configuration and view Implementation Projects.
c. Select the project First Implementation.
d. Press button Edit Project Scope.
e. Continue to step Questions.
f. Select scoping element Sales -> Account and Activity Management -> Account
Management.
g. Add question Activate Contract of group Contract to the scope.
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 29 of 128

Hint: In the tabs Overview and Relevance you will see the data as maintained in the SDK.
h. Continue to the Review step and press Finish button.
9. Test your solution in the test tenant as already described in chapter Testing UIs with Business
Users.

Step 4: Create a patch for your solution
Procedure
1. Logon to your development tenant (S2A/004).
2. Open the Implementation Manager via menu Administration ->Implementation Manager.
3. Click on the Icon Create Patch.

Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 30 of 128
4. Open the patch solution.


5. Check that the patch solution has the status In Development and that all source files are
created correctly. The first patch solution should have the version 3.
6. Create an script file for the AfterModify event for the Contract_<suffix> BO. Right click on
the .bo file and select Create Script Files.

7. In the Create Script Files popup, select the AfterModify event and press OK.
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 31 of 128


8. Enter the ABSL code from the appendix. Save and activate the BO.
9. Test the patch solution in the runtime. For this, the patch solution has to be enabled for the
business user.


10. To scope the patch solution for testing in the development tenant, also deploy the business
configuration (via right click on the solution you can choose the option Deploy Business
Configuration).
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 32 of 128


11. Assign the patch solution work center for the Contract_<suffix> BO to the business user and
test the patch solution in the runtime of the development tenant.
Step 5: Assemble and download your patch
Procedure
1. Open the Implementation Manager via menu Administration ->Implementation Manager
2. Assemble and download the patch solution. Press OK on the popup.

3. Save the ZIP file of the assembled solution locally on your PC. Check that the ZIP file name
has the original solution name and the version number as name.
4. Check that the patch solution has the status assembled.
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 33 of 128


Step 6: Upload your patch
Procedure
1. Logon to your test tenant. (S2A/003)
2. Open the Implementation Manager via menu Administration ->Implementation Manager.
3. Click on the icon Upload and upload the patch version of the original solution.
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 34 of 128

4. Agree to the Upload Disclaimer.
5. In the Implementation Manager check the version and the status.

6. Activate the solution and check the status. When the activation was successful, the solution
has the status Deployed.
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 35 of 128

7. Perform a runtime test of the patch in the test tenant with your business user.



Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 36 of 128
Extensibility: Create extension fields
Step 1: Extend account standard BO
Procedure

1. Click the Add New Item icon, select Business Object Extension and enter name Account_<suffix>
with extension .xbo.

2. In the pop-up that appears, select Customer from namespace
http://sap.com/xi/AP/FO/BusinessPartner/Global as the business object to extend.


Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 37 of 128
3. Add the following element to the Common node:
Element Name Data Type Alternative
Key
NumberOfEmployees

LANGUAGEINDEPENDENT_EXTENDED_Text

No
Hint: The code snippet with the complete business object extension definition can be found in
the Appendix.

4. Right click the Account_<suffix>.xbo item in Solution Explorer and click menu item Create Script
Files.


5. In the popup select BeforeSave event of node Root.


Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 38 of 128
6. Add logic to set the element NumberOfEmployees on the current instance of node Common to
Not Specified in case the value is unset.
Hint: The code snippet with the complete event logic can be found in the Appendix.
7. Activate the Business Object Extension.


Step 2: Extend Account screen
Procedure

1. Right click the Account_<suffix>.xbo item in Solution Explorer and click menu item Enhance
Screen.
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 39 of 128

Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 40 of 128
2. In the popup select the accountoverviewqafeco screen and press OK.

3. Wait until the UI Designer is opened.
4. In the Extensibility Explorer find the anchor as shown below and press button Add Extension Field
to Section Group.
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 41 of 128

5. In the popup select the extension field Number of Employees and press button Apply.
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 42 of 128

6. Confirm the popup and press Save and Activate.

Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 43 of 128
Linking custom business object to standard business
object
Step 1: Create new embedded component for Contract_<suffix> BO
Procedure

1. Right click on the solution and add a new item called Embedded Component.

2. Enter name as ContractEC_<suffix>.
3. Open the created embedded component (EC) in UI designer.
4. Go to edit mode.
5. Select the tab Toolbox in the right section and drag and drop the UI component
AdvancedListPane into the new EC.

6. Now bind the 3 columns to the following Contract_<suffix> data model elements.
a. Contract Description:
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 44 of 128

b. Contract Amount:
I. Change DisplayType to CompoundField first.

II. Check the data binding.


III. Bind the data to BO field.
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 45 of 128

c. Expiration Date:

7. Set the list as read only.

Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 46 of 128
8. Add new data structure to create a query on Contract_<suffix> based on opportunity ID
and rename it to SearchByOppty.

9. Add new data field inside the data structure and rename it to OpportunityID.

10. Go to tab Controller and add a new query, select /Root/DataList as Result List and bind the query
QueryByElements.
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 47 of 128


11. Subsequently map the search parameter in QueryByElements -> OpportunityID to the data field
OpportunityID that was added in previous step.

Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 48 of 128

12. Go to tab Controller and add a new Inport.

13. Associate the inport to the search parameter OpportunityID.
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 49 of 128

14. Select inport InPort and ensure that the properties are set as shown below.

15. Save and Activate.





Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 50 of 128
Step 2: Add New button for contract creation and Refresh button for
contract list refreshing in embedded component for Contract_<suffix>
BO
Procedure

1. Select the AdvancedListPane of the embedded component.

2. Set the Use Integrated Toolbar property to True and click on the button as shown below in the
Properties tab.

3. Click on the highlighted button.
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 51 of 128

4. In the popup add an action Add Row button and remove all other buttons. Rename button text
to New.

Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 52 of 128

5. Configure the New button and add a new event handler CreateEventHandler.

6. Go to Controller tab and configure the CreateEventHandler.
a. Add an OBN navigation.

Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 53 of 128
b. Configure the associate outport and rename it as OutportCreate. Save and activate.

c. Configure the OBN navigation and rename it as OBNCreate. Save and activate.

d. Open UI Contract_<suffix>_QA.QA.uicomponent. Go to Controller tab and add a new
inport named OBNInportCreateLink. Configure the properties as follows (Input
OBN_Contract_<suffix>_Create_Link in Select Operation). Save and activate.
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 54 of 128

e. Go back to UI ContractEC_<suffix>.EC.uicomponent. Go to Controller tab and select OBN
navigation OBNCreate. Set Select Operation as OBN_Contract_<suffix>_Create_Link. Save
and activate.

f. Go to Controller tab and configure event handler as follows.
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 55 of 128

g. Save and activate.
7. Configure the toolbar to add an application specific refresh button and add a new event handler
RefershEventHandler.

Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 56 of 128

8. Configure the event handler for refresh button.
a. 1
st
entry fires the event handler for query.
b. 2
nd
entry to refresh the list.


9. Save and Activate.


Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 57 of 128
Step 3: Extend opportunity with new tab
Procedure
1. Open the standard opportunity OIF in the UI designer
(/SAP_BYD_APPLICATION_UI/crm/opp/opportunityoifeco.OIF.uicomponent).

2. Go to Controller tab and search the outport with name: PublicXXXX.

3. Switch to Extensibility Explorer and click Add embedded Component to referenced Pane.
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 58 of 128

4. In the popup, select the Embedded Component as ContractEC_<suffix> and configure the binding
as bellow.

Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 59 of 128

7. Save and Activate.
8. Test your EC.



Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 60 of 128
Step 4: Enable embedded component for personalization
Procedure

1. Select the UI element that should be enabled for personalization as shown below.

2. Add a list anchor and maintain a meaningful name.

3. Add anchors with meaningful names while moving up the hierarchy.
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 61 of 128

4. At last add an anchor to the EC itself.

Hint: There has to be an anchor on every possible level to fully enable personalization.
5. Personalization in UI can be tested as shown below.

Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 62 of 128

Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 63 of 128
Service Integration - XML File Input
Step 1: Create service integration
Procedure

1. Open the contract solution.
2. Right click on the Contract<suffix>.bo and select Create Service Integration.

3. Give the name as Contract_<suffix>_File_Input and select XML File Input and press Next.

4. Select the Contract_<suffix> BO and ensure a unique Code.
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 64 of 128

Hint: The code is used as ServiceInterfaceCode for the A2A ServiceInterface.
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 65 of 128
5. Select the elements that should be available in the service and the Alternative Key that can be
used for Instance Identification.


6. Press next to see the Review page and press Continue to create the service and open it in the
editor.

Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 66 of 128


7. Activate the newly created Service Integration via right click on it and select item Activate.


8. Close and reopen the editor to get the link of the generated XML schema definition (.xsd).

Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 67 of 128

9. Download the .xsd file by clicking the Schema Definition link.
Hint: via tab Schema Definition the XML can also be viewed in the editor directly
Step 2: Create XML payload
Procedure
1. Open Microsoft Excel.
2. Follow description to enable Developer Ribbon tab.
3. Select the Developer Ribbon tab.
4. Click on Source button.
5. Click the XML Maps button.
6. Click Add button and select the downloaded schema definition file (.xsd).
7. Click OK.
8. Drag and drop CreationDateTime in MessageHeader into cell A1.
9. Fill the field with a date time having the following schema: 2010-01-01T12:00:00.0000000Z
must end with a Z.
10. Drag and drop the node Contract_<suffix> to cell A2.

Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 68 of 128
11. Fill some example data.
12. On the Developer Ribbon tab click Export.
13. Give an XML file name and save.

Step 3: Uploading data file
Procedure
1. Uploading can be done via BYD UI.
a. Select show view Unprocessed Files and press button Add.

b. In the popup select your Service Interface Code, upload your created XML from step 2
and press OK.

c. Press button Refresh and to see the uploaded XML.

2. Alternatively uploading can also be done via WebDAV folder.
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 69 of 128
a. WebDAV URL can be found as shown below.

b. Mount WebDAV folder to windows file explorer:
1. In Windows Explorer.
2. Press ALT key and select menu item Tools Map Network Drive.
3. Enter WevDAV URL in folder field
https:// s2a-cust004.dev.sapbydesign.com:443/sap/a1s/cd/fileio/docs/in.
4. Check Reconnect at logon.
5. Check Connect using different credentials.
6. Press Finish.
7. Use credentials of a BYD UI administration user.
8. Open the partner namespace folder.
9. Open the Service Interface Code folder.
10. Upload your created XML from step 2.
Step 4: Configure File Input
Procedure
1. Log on to BYD UI with an administration user.
2. Go to work center view as shown below.

3. In the OWL click button New.
4. Maintain ID and Description for the run and select your Service Interface Code
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 70 of 128

5. Activate the run by pressing button Actions -> Set to Active and press Save and Close.
6. Press button Schedule.
7. In the popup select Start Immediately and press button Save and Close

8. Select show view Unprocessed Files, wait some time and press button Refresh until the list is
empty.
9. Check that the expected instances of your contract BO are visible in your contract OWL.




Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 71 of 128
Create a new web service
Step 1: Create a web service for the Contract_<suffix> BO
Procedure
1. Right click on the Contract_<suffix> Bo and select Create Service Integration.

2. In the Service Integration Wizard select Web Service and press Next.

3. Keep the name and press next on step 1/9.
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 72 of 128

4. Select following fields on step 2/9.

5. On the next steps press next without selecting the operations. Only select the Query on
step 6/9 and press next. Also press next on 7/9 without selecting an action.
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 73 of 128


6. On step 8/9, press the Add button and create a new work center view named WS_AUTH.

7. Press the add button and assign the query to the new work center.
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 74 of 128

8. Press Next. Then review the WS creation in step 9/9 and press Finish.

9. In the solution explorer, active the new web service.
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 75 of 128

10. Download the WSDL file and save the file locally.


Step 3: Create the web service authorization
Procedure
1. Open the WOC in the UI designer and drag and drop the WS_AUTH WOC view into the
WOC.
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 76 of 128

2. Save and activate the WOC.
3. Assign the WOC for the Contract_<suffix> BO to the business user and create two
instances with the following values:
a. Contract ID = CT0A; Contract description = Contract A.
b. Contract ID = CT0B; Contract description = Contract B.
4. Test the web service within the freeware tool SOAPUI and use for the authorization of
the web service the business user and its password. For testing the service in SOAPUI,
you need to define the processing conditions only.



Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 77 of 128
Create an external web service integration scenario
Step 1: Create an exchange rate web service on another system to
simulate external web service
Procedure
1. Create a new customer specific solution in system S2A/003 in deployment unit
Foundation. Use as name ExchangeRate_<suffix>.
2. Create a new business object called ExchangeRate_<suffix> via button Add New Item.

3. Define the business object with just one element Rate of type ExchangeRate. Specify the
deployment unit: Foundation.

4. Save and activate the BO. Check in the content.
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 78 of 128
5. Create screens for the BO.

6. Adopt the UIs in the UI designer. The data element Rate is a structured element,
containing the attributes UnitCurrency, QuotedCurrency and Rate. Bring these three
fields on the UIs by selecting the BO fields and then copying and pasting them into the
UIs.

Hint: do this step for the QAF, OIF, then save and activate.
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 79 of 128
11. Right click on the ExchangeRate_<suffix> BO and select Create Service Integration.

12. In the Service Integration Wizard select Web Service and press next.

13. Keep the name and press next on step 1/9.
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 80 of 128

14. Select the Rate element on step 2/9.

15. On the next steps press next without selecting the operations. Only select the query on
step 6/9 and press next. Also press next on 7/9 without selecting an action.
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 81 of 128


16. On step 8/9, press the add work center view Add button and create a new work center
view named WS_AUTH_EX. If WS_AUTH_EX is used, just give it another name.

17. Press the add button and assign the query to the ExhangeRate_<suffix> work center.
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 82 of 128

18. Press Next. Then review the WS creation in step 9/9 and press Finish.

19. In the solution explorer, active the new web service.
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 83 of 128

20. Download the WSDL file and save the file locally.

21. Open the work center in the UI designer and drag and drop the WS_AUTH_EX work
center view into the ExhangeRate_<suffix> work center.
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 84 of 128

5. Save and activate the work center.
6. Assign the work center for the ExhangeRate_<suffix> BO to the business user and create
two instances with the following values:
a. UnitCurrency = USD; QuotedCurrency = EUR; Rate = 0.76.
b. UnitCurrency = EUR, QuotedCurrency = USD, Rate = 1.31.
7. Test the web service within the freeware tool SOAPUI just as the web service for
Contract_<suffix>.
Step 2: Create an external web service integration
Procedure

1. Open the patch solution of the Contract_<suffix> BO in the development tenant which is
in status In Development.
2. Right click on the patch solution and add a new item called External Web Service
Integration. Name the integration ExchangeRateIntegration.wsid.
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 85 of 128

3. In the wizard, upload the WSDL for the ExchangeRate_<suffic> web service created
previously.


4. Press Next.
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 86 of 128

5. Press also Next on step 2.
6. Finish step 3.

7. Activate the external web service integration and check in the content.
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 87 of 128


Step 3: Create a communication scenario
Procedure
1. Right click on the patch solution and add a new item called Communication Scenario.
Name the communication scenario ExchangeRateCommunicationScenario.csd.

2. In the wizard, select the communication type Application integration and press Next.
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 88 of 128

3. In step 2, select the outbound service ExchangeRateIntegration and its operation and
press Next.

4. Review in step 3 and press Finish.
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 89 of 128

5. Activate the ExchangeRateCommunicationScenario.csd file and check in the content.
Step 4: Create a communication system.
Procedure

1. Right click on the communication scenario ExchangeRateCommunicationScenario.csd
and press Manage Communication System.
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 90 of 128

2. On the Communication System OWL, press New.

3. On the QAF for the communication system, enter as ID S2A003_<suffix>. As host enter
s2a-cust003.dev.sapbydesign.com. As System Access Type choose Internet and select SAP
System.
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 91 of 128

4. Save the communication system and the set it to active. Close the QAF and also the OWL
for the communication systems.
Step 5: Create a communication arrangement
Procedure

1. Right click on the communication scenario ExchangeRateCommunicationScenario.csd
and press Manage Communication Arrangement.

2. On the OWL for the communication arrangements, press New.
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 92 of 128

3. On the GAF for the new communication arrangement, select in step 1 the
communication scenario ExchangeRateCommunicationScenario and press Next.

4. In step 2, select the communication system S2A003_<suffix> as system instance ID and
press Next.

Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 93 of 128
5. On step 3, change the authentication method to User ID and Password and use the user
ID of your business user and the password (from the system S2A/003).

6. On step 3, press Edit Advanced Settings and enter as path
/sap/bc/srt/scs/sap/yyuxt1qvmy_manageexchangerate_?sap-
vhost=s2a-cust003.dev.sapbydesign.com. Press Check Service and check that
the service is well defined. Also check the completeness. Then press Next.

7. On step 4, review the new communication arrangement and press Finish.
8. Edit the communication arrangement again and check whether you can successfully ping
the end point.
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 94 of 128

Step 6: Calling the web service in an action
Procedure

1. Define the script for the action CalculateExchangeRate of the Contract BO. The script can
be found in the appendix.
2. Test the action in the runtime with the business user. Define the contract amount in
USD, when you enter the data, the reporting amount should be calculated in EUR.
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 95 of 128
Tracing and Debugging
Step 1: Set up tracing, run tracing and check the traces
Procedure
1. Open the Options and Settings and enable the business user for debugging and tracing.

2. Start tracing.

3. Log on the runtime with the business user. The trace mode should be active.
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 96 of 128

4. Create a new Contract_<suffix> BO instance by clicking the New button on OWL.


5. Stop the trace in the SDK.
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 97 of 128


6. Open the trace explorer view in the SDK.

7. In the Trace explorer, select Local Traces, press the refresh option and select the newly
created trace for the business user. Press Get Trace Details.
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 98 of 128

8. Check the trace details and double click into one event. Then you will see the details of
the trace.


Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 99 of 128
Step 2: Set up breakpoints and debug at runtime
Procedure
1. Open the Options and Settings and enable the business user for debugging and tracing.

2. Set a breakpoint in ABSL code for the after modify event of the Contract_<suffix> BO.

3. Start the debugger.

4. Logon to the runtime with the business user. The trace mode should be active.
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 100 of 128

5. Create a new Contract_<suffix> BO instance by clicking the New button on OWL. The
debugger will stop at the breakpoint in the SDK.

6. Step through the code with Step Over (F10) and check the Locals and Output messages.
7. Stop the debugger.
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 101 of 128

8. Check the trace recorded during the debug session in the trace explorer.




Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 102 of 128

Analytics
Step 1: Create a data source for the Contract_<suffix> BO
Procedure
1. Open the contract solution and right click the Contract_<suffix> BO. Select the option
Create Data Source.

2. Enter a name for the data source in step 1/6 of the wizard and press next.
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 103 of 128

3. Select the fields you want to include in the data source in step 2/6 of the wizard and
press next.
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 104 of 128

4. Step through the upcoming steps of the wizard until you reach the final review step and
press finish. Activate the newly created data source.
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 105 of 128




Step 2: Create a new report on the data source
Procedure
1. Switch on the admin mode for your user.

Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 106 of 128
2. Right click on the newly created data source and select Create Report.

3. Logon to the key user tool with your development user and define a name for the report.
Press then Next.

3. Select the key figures and press Next.
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 107 of 128

4. Select the characteristics and press Next.

5. On step 4, choose the AccountID for value selection and press Next.
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 108 of 128

6. Press Next on step 5.

7. Review the report and press Finish.

Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 109 of 128
8. Select Create Layout for this Report in a Web Browser on step 7.

9. Test the report in the web browser.


Step 3: Allow assignment of the report to the contract View
Procedure
1. Assign a stable anchor to the work center view to which you want your report to be assigned. For
this open the Contract work center view in the UI designer and define a new anchor on the
floorplan.
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 110 of 128

2. Add the List and Gallery standard reports list views to your work center. These views list all reports
that are assigned to the views of the work center.
Open the contract work center in the UI designer. Add a new view to the work center by
maintaining the view switch collection. Name the new view Report.

3. Add two subviews to the Report view by selecting the Subview switch.
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 111 of 128

4. Select the ana_reports_view_wc for subview one and drag and drop it onto the subview.

5. Select the ana_reports_carousel_view and drag and drop it to the second subview.

6. Save and activate the work center.
7. Adjust when necessary the names of the view and the subviews to the following:
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 112 of 128

Step 4: Perform the assignment of the report in the runtime
Procedure
1. Logon to the runtime with the development user and open the Design Reports view in the Business
Analytics work center. Select your newly created report. Assignment to any work center view will
not be possible with the development user.

2. Log off.
3. Log on with the BC key user (which does have the Business Analytics work center assigned but
has NOT assigned the Partner Development work center). Start also the Design Reports view in
the Business Analytics work center and select the newly created report. Press the Assign button.

Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 113 of 128
REMARK: this activity is not part of the solution and will not be delivered. The assignment has to
be done again in the productive tenant by the analytics key user.
4. Select your work center view and assign the report to it. Press Save and then Close.

5. Log off and log on with the business user for testing. Check that the report is visible in the List or
Gallery views of the Contract work center. Also test the report.




Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 114 of 128
Create Mashups
Step 1: Create a custom Port Type Package
Procedure
1. Open the Contract solution.
2. Right click on solution and click Add -> New Item.
3. Go to Screens and choose Port Type Package.
4. Assign a name (e.g. PortTypePackage).

5. Open the new Port Type Package with the UI Designer.
6. Create a new Port Type called Inport.
7. Create a parameter called InPortParameter.
8. Repeat step 6 and 7 for an OutPort if necessary.
9. Save and Activate.



Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 115 of 128


Step 2: Create a custom Mashup Port Binding
Procedure
1. Right click on solution and click Add -> New Item.
2. Go to Mashups and Web Services and choose Mashup Port Binding.
3. Assign a name for the port binding.

4. Open the new Mashup Port Binding with the UI Designer. It is located in MashupConfiguration ->
PortBinding.

Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 116 of 128
5. Go into edit mode.
6. Select a matching category like Social & Communication.
7. As InPort Type Package, select the one you have created earlier in your solution.
8. As InPort Type Reference, select the InPort you defined for your mashup. In our example it is
called Inport.
9. Repeat step 8 and 9 for the OutPort definition if it is required that your mashup returns data.
10. Save and Activate.


Step 3: Create a custom HTML Mashup
Procedure
1. Right click on solution and click Add -> New Item.
2. Go to Mashups and Web Services and choose HTML Mashup.
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 117 of 128

3. Assign a name for the HTML Mashup and click Add A browser will now open where you can
maintain the Mashup.
4. Select the same Mashup Category as in the Mashup Port Binding.
5. As Port Binding, select the one you already created (MashupPortBinding).
Note: To assign the custom Mashup Port Binding you have to click on it and press ESC.
6. Within Configuration Information you have to select the type HTML Code.
7. Now you can enter the necessary HTML in the Editor.
Note: The editor does only work with Internet Explorer.
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 118 of 128

8. Code snipped for how to show a Twitter Timeline.

<html>
<body>
<a class="twitter-timeline" height="400" href="https://twitter.com/twitterapi" data-widget-
id="243046062967885824">Tweets by @twitterapi</a>
<script>!function(d,s,id){var
js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;j
s.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script",
"twitter-wjs");</script>
</body>
</html>
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 119 of 128
9. Code snipped for how to access the InPort parameter.

10. Save your Mashup.
Step 4: Create a custom Data Mashup
Procedure
1. Right click on solution and click Add -> New Item.
2. Go to Mashups and Web Services and choose Data Mashup.

3. Assign a name for the Data Mashup and click Add A browser will now open where you can
maintain the Mashup.
4. Select the same Mashup Category as in the Mashup Port Binding.
<html>
<head>
<script>
sap.byd.ui.mashup.onContextUpdate = function() {
document.getElementById('content').innerHTML =
sap.byd.ui.mashup.context.inport.InPortParameter;
}
</script>
</head>
<body>
<div id="content"></div>
</body>
</html>
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 120 of 128
5. As Port Binding select the one you already created (MashupPortBinding).
Note: To assign the custom Mashup Port Binding you have to click on it and press ESC.

6. Click on Next to go to the definition of the Data Mashup.
7. Add a Source with the left panel, select Source and add RSS/ATOM.
8. A dialog is shown where you have to select the corresponding web service For our example we
choose the existing Twitter Search (SW00040).

Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 121 of 128
9. Connect the output of the Mashup In-Port with the input of the source Twitter Search.

10. Edit the display settings, as we want to have only the Speech Bubble View mark it as Default View
and uncheck all other views.

11. To test the service, you have to enter a test value to the Mashup Inport parameter
InPortParameter and click on Preview Result.
12. Click on Next and Finish.

Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 122 of 128
Step 5: Add a custom Mashup to your UI
Procedure
1. Open your UI component where you want to add the Mashups.
2. Go to Controller and create a new Outport which uses the defined Port Type Package and Port
Type Reference.
3. Map the Outport parameter InPortParameter to one of your data fields. In our example we use
/Root/ID.

4. Go to Designer and open the Configuration Explorer, open the Folder of your solution and
navigate to SRC/Mashups/Pipes and Drag the Mashup you like to add into your UI Model.
Note: You can find the Pipe Name of your mashup as Mashup ID in the Authoring when you
configure your mashup.
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 123 of 128

5. Now select Bind to map the Inport of the Mashup with the Outport of your UI component.
6. Click on Navigation Configuration.
7. Right click on Navigations -> Add Navigation.
8. Do the Port mapping between source and target component and parameter.

9. Save and Activate.
10. The Mashup is no connected with your UI component and will show up in the browser.

Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 124 of 128






Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 125 of 128
Appendix
Code snippet for Contract_<suffix>.bo
import AP.Common.GDT as apCommonGDT;
import AP.FO.BusinessPartner.Global;
import AP.PC.IdentityManagement.Global;

businessobject Contract_<suffix> raises CommunicationFault
{

// Root node must not be specified, it is created implicitly
//
// Add elements here.
//
// To declare an element as alternative key, use the [AlternativeKey]
annotation.
// Please note:
// - An alternative key of type UUID exists implicitly for each node, enabling
the node
// to be used as an association target.
// - The QueryByElements query is created automatically for each node.
// - Code completion is available with CTRL + SPACE.

message CommunicationFault text "Logical Port Does not Exist";
[Label("Contract ID")] [AlternativeKey] element ContractID : ID;
[Label("Contract Description")] element ContractDescription :
AP.Common.GDT:MEDIUM_Description;
[Label("Workspace ID")] element WorkspaceID : ID;
[Label("Customer")] element AccountID : BusinessPartnerInternalID;
[Label("Opportunity")] element OpportunityID : ID;
[Label("Contract Amount")] element ContractAmount : Amount;
[Label("Reporting Ammount")] element ReportAmount : Amount;
[Label("Agreement Date")] element AgreementDate : Date;
[Label("Effective Date")] element EffectiveDate : Date;
[Label("Expiration Date")] element ExpirationDate : Date;
[Label("Contract Owner")] element ContractOwnerName : LONG_Name;
[Label("Contract Owner ID")] element ContractOwnerID :
apCommonGDT:EmployeeID;
[Label("Manager")] element ManagerName : LONG_Name;
[Label("Manager ID")] element ManagerID : apCommonGDT:EmployeeID;

[DependentObject(AttachmentFolder)] node Attachment;
[DependentObject(TextCollection)] node TextCollection;

association ToResponsibleEmployee to Employee;

action CalculateReportAmount;


}


Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 126 of 128
Code snippet for Contract_<suffix>.bo -> After-Modify

import ABSL;

import AP.PC.IdentityManagement.Global;
import AP.FO.BusinessPartner.Global;


// set employee informtion
if (!this.ToResponsibleEmployee.IsSet()) {
Trace.Info("I", "Responsible Employee not set");
var identity = Identity.Retrieve(Context.GetCurrentIdentityUUID());
if (identity.IsSet() ){
Trace.Info("I", "Identity found");
var employee =
BusinessObject::Employee.Retrieve(identity.BusinessPartnerUUID);
if (employee.IsSet() ){
Trace.Info("I", "Employee found");
this.ToResponsibleEmployee = employee;
this.ContractOwnerID.content =
employee.employee.IdentificationEmployeeID.EmployeeID.content
;
var name = employee.Common.GetFirst().Person.Name;
this.ContractOwnerName.content = name.GivenName + " " +
name.FamilyName;
}
}
}

// calculate reporting amount
if (this.ReportAmount.currencyCode.IsInitial()) {
this.CalculateReportAmount();
}

Code snippet for Contract_<suffix>.bo ->
Action_CalculateReportAmount

/*
Add your SAP Business ByDesign scripting language implementation for:
Business Object: Contract_Demo
Node: Root
Action: CalculateReportAmount

Note:
- To access the elements of the business object node,
use path expressions, for example, this.<element name>.
- To use code completion, press CTRL+J.
*/

import ABSL;

var Request: Library::ExchangeRateIntegration.QueryByElements.Request;

Request.ExchangeRate_DemoEXViewQueryByElementsSimpleByRequest_sync.ProcessingCondition
s.QueryHitsMaximumNumberValue = Numeric.ParseFromString("100");
Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 127 of 128
Request.ExchangeRate_DemoEXViewQueryByElementsSimpleByRequest_sync.ProcessingCondition
s.QueryHitsUnlimitedIndicator = false;

var Response = Library::ExchangeRateIntegration.QueryByElements(Request, " ",
"ExchangeRateCommunicationScenario");

var CommFault = Response.CommunicationFault;

// Address the individual fault items and raise messages
var commFaultItem = CommFault.Item;

foreach ( var item in commFaultItem ){
raise CommunicationFault.Create("E");
return;
}

foreach (var ExchangeRate in
Response.ExchangeRate_DemoEXViewQueryByElementsSimpleByConfirmation_sync.ExchangeRate_
Demo) {
if (this.ContractAmount.currencyCode == ExchangeRate.Rate.QuotedCurrency) {
this.ReportAmount.currencyCode = ExchangeRate.Rate.UnitCurrency;
this.ReportAmount.content = ExchangeRate.Rate.Rate *
this.ContractAmount.content;
}
}

Code snippet for Account_<suffix>.xbo
import AP.Common.GDT;
import AP.FO.BusinessPartner.Global;

[Extension] businessobject AP.FO.BusinessPartner.Global:Customer {

// You must activate this business object before you can access the extension
fields
// or messages in script files, forms, and screens.

node BankDetails {
}

node Common {
[Label("Number of Employees")] element NumberOfEmployees :
LANGUAGEINDEPENDENT_EXTENDED_Text;
}

}

Solutions OnDemand Studio Tutorial
2013 SAP AG. All Rights Reserved. Page 128 of 128
Code snippet for Account_<suffix>.xbo -> Before-Save

/*
Add your SAP Business ByDesign scripting language implementation for:
Business Object: Customer
Node: Root
Event: BeforeSave

Note:
- To access the elements of the business object node,
use path expressions, for example, this.<element name>.
- To use code completion, press CTRL+J.
*/

import ABSL;

if (this.CurrentCommon.NumberOfEmployees.IsInitial()) {
this.CurrentCommon.NumberOfEmployees = "Not specified";
}

S-ar putea să vă placă și