14
8/16/2019 DOC-65912 - Extend OData Services for My Travel & Expenses Fiori App - Part 1 http://slidepdf.com/reader/full/doc-65912-extend-odata-services-for-my-travel-expenses-fiori-app-part 1/14 Generated by Jive on 2016-05-31+02:00 1 Extend oData Services for My Travel & Expenses Fiori App - Part 1 1 Business Requirement - Why we need to extend standard app ? The fields delivered in standard SAP Fiori app for "My Travel & Expenses" does not suffice the business needs. 1. Changes required 1. Document No required as input on screen so that user can enter original receipt no to it and save the same 2. No of Employee is required for meal expenses so that user can enter no of employee attending the business dinner/lunch outing. Adding names of each employee is difficult job. And when you have around 150 attendees then it's kind of waste of effort. 3. %Lobby is also needed on the screen for input 4. Per diem region has to be hidden, it's no longer required 1.1 Extend Fiori App "My Travel and Expenses" Current Situation Target Situation 1. Document no. is not available in the standard screen of expenses types in My Travel & Expenses of SAP Fiori

DOC-65912 - Extend OData Services for My Travel & Expenses Fiori App - Part 1

Embed Size (px)

Citation preview

Page 1: DOC-65912 - Extend OData Services for My Travel & Expenses Fiori App - Part 1

8/16/2019 DOC-65912 - Extend OData Services for My Travel & Expenses Fiori App - Part 1

http://slidepdf.com/reader/full/doc-65912-extend-odata-services-for-my-travel-expenses-fiori-app-part 1/14

Generated by Jive on 2016-05-31+02:00

1

Extend oData Services for My Travel &Expenses Fiori App - Part 1

1 Business Requirement - Why we need to

extend standard app ?The fields delivered in standard SAP Fiori app for "My Travel & Expenses" does not suffice the business

needs.

1. Changes required

1. Document No required as input on screen so that user can enter original receipt no to it and save thesame

2. No of Employee is required for meal expenses so that user can enter no of employee attending the

business dinner/lunch outing. Adding names of each employee is difficult job. And when you havearound 150 attendees then it's kind of waste of effort.

3. %Lobby is also needed on the screen for input

4. Per diem region has to be hidden, it's no longer required

1.1 Extend Fiori App "My Travel and Expenses"

Current Situation Target Situation

1. Document no. is not available in the

standard screen of expenses types

in My Travel & Expenses of SAP

Fiori

Page 2: DOC-65912 - Extend OData Services for My Travel & Expenses Fiori App - Part 1

8/16/2019 DOC-65912 - Extend OData Services for My Travel & Expenses Fiori App - Part 1

http://slidepdf.com/reader/full/doc-65912-extend-odata-services-for-my-travel-expenses-fiori-app-part 2/14

Extend oData Services for My Travel & Expenses Fiori App - Part 1

Generated by Jive on 2016-05-31+02:00

2

2. No. of Employees  is not available in the standard

screen of

  My Travel & Expenses in SAP Fiori

3. Lobby %  is not available in the standard screen of

  My Travel & Expenses in SAP

Fiori

4. Per Diem Region  is not required as per the

business requirement

Can be handled by UI Extensibility no OData 

extension is required for hiding Per Diem Region 

Page 3: DOC-65912 - Extend OData Services for My Travel & Expenses Fiori App - Part 1

8/16/2019 DOC-65912 - Extend OData Services for My Travel & Expenses Fiori App - Part 1

http://slidepdf.com/reader/full/doc-65912-extend-odata-services-for-my-travel-expenses-fiori-app-part 3/14

Extend oData Services for My Travel & Expenses Fiori App - Part 1

Generated by Jive on 2016-05-31+02:00

3

2 Fiori app extension has two part

2.1 Extending front-end of Fiori App (UI Extensibility)

1. Screen and section to which field has to be added is identified and extended.2. Entity name which will be used to map data to new fields is also identified

 

2.2 Extending oData service on backend system

Front end developers confirm the entities which has to be extended and also the respective new custom field 

names.

 

For this scenario entity name provided by frontend developer is "EXPENSES"

Fields to be added are “DocumentNo”, “NoOfEmployees” & “LobbyPercentage”

 

2.2.1 oData service is extended using below step

1. Identify the oData service name for standard app

2. Identify the corresponding ABAP DDIC structures for entities to be extended3. Create custom gateway project & Redefine the standard oData service

4. Add custom field to entities confirmed for extension5. Implement BADI for fetching and manipulating new Data

6. Regenerate & Register the new service

3 Identify oData Service name of standard Fiori

app 

1. Go To Fiori Reference App Library

2. Search for My Travel & Expenses App (Direct Link for My Travel & Expenses Fiori App)3. Click on tab "Implementation Information"4. Navigate to Configuration

5. Check for oData service name

Page 4: DOC-65912 - Extend OData Services for My Travel & Expenses Fiori App - Part 1

8/16/2019 DOC-65912 - Extend OData Services for My Travel & Expenses Fiori App - Part 1

http://slidepdf.com/reader/full/doc-65912-extend-odata-services-for-my-travel-expenses-fiori-app-part 4/14

Extend oData Services for My Travel & Expenses Fiori App - Part 1

Generated by Jive on 2016-05-31+02:00

4

 

PAOC_TRV_SRV is oData service for "My Travel & Expenses" Fiori App

 

Note:  This information can also be provided by front end developers, they can locate it in Controller section of

fiori app .

4 Extend corresponding ABAP structureEntity name  confirmed for this requiremnt is "Expense" and fields to be added are:

1. “DocumentNo” (type=edm.String; MaxLength=20 ; )

2. “NoOfEmployees” (type=edm.Decimal; MaxLength=3 ; )

3. “LobbyPercentage” (type=edm.Decimal; MaxLength=3 ; )

4.1 Identify the corresponding abap structure

1. Go to transaction "SEGW"2. Click on open project

Page 5: DOC-65912 - Extend OData Services for My Travel & Expenses Fiori App - Part 1

8/16/2019 DOC-65912 - Extend OData Services for My Travel & Expenses Fiori App - Part 1

http://slidepdf.com/reader/full/doc-65912-extend-odata-services-for-my-travel-expenses-fiori-app-part 5/14

Extend oData Services for My Travel & Expenses Fiori App - Part 1

Generated by Jive on 2016-05-31+02:00

5

3. Enter the project name and execute (In general if we remove _SRV from technical service or oDataservive then we will get name of standard gateway project or you can do search like PAOC_TRV* afterremoving _SRV from oData service name)

4. Navigate to Data Model->Entity Types  and get structure name for EXPENSE entity

 

Page 6: DOC-65912 - Extend OData Services for My Travel & Expenses Fiori App - Part 1

8/16/2019 DOC-65912 - Extend OData Services for My Travel & Expenses Fiori App - Part 1

http://slidepdf.com/reader/full/doc-65912-extend-odata-services-for-my-travel-expenses-fiori-app-part 6/14

Extend oData Services for My Travel & Expenses Fiori App - Part 1

Generated by Jive on 2016-05-31+02:00

6

4.2 Add custom field to identified structure

 

1. Go to transaction "SE11"2. Enter structure name and click on display

3. Click on Append Structure

4. Click on create append

Page 7: DOC-65912 - Extend OData Services for My Travel & Expenses Fiori App - Part 1

8/16/2019 DOC-65912 - Extend OData Services for My Travel & Expenses Fiori App - Part 1

http://slidepdf.com/reader/full/doc-65912-extend-odata-services-for-my-travel-expenses-fiori-app-part 7/14

Extend oData Services for My Travel & Expenses Fiori App - Part 1

Generated by Jive on 2016-05-31+02:00

7

5. Enter name of new append structure and hit enter

6. Add field to new structure and activate

7. Now new fields are added to standard structure

5 Redefine oData Service1. Go to transaction "SEWG"

2. Click on Create Project

Page 8: DOC-65912 - Extend OData Services for My Travel & Expenses Fiori App - Part 1

8/16/2019 DOC-65912 - Extend OData Services for My Travel & Expenses Fiori App - Part 1

http://slidepdf.com/reader/full/doc-65912-extend-odata-services-for-my-travel-expenses-fiori-app-part 8/14

Extend oData Services for My Travel & Expenses Fiori App - Part 1

Generated by Jive on 2016-05-31+02:00

8

3. Enter Project Name, Description and Package Name. Then hit enter

4. Right Click on Data Model and select Redefine -> oData Service 

5. Enter standard oData Service name "PAOC_TRV_SRV" then hit enter

Page 9: DOC-65912 - Extend OData Services for My Travel & Expenses Fiori App - Part 1

8/16/2019 DOC-65912 - Extend OData Services for My Travel & Expenses Fiori App - Part 1

http://slidepdf.com/reader/full/doc-65912-extend-odata-services-for-my-travel-expenses-fiori-app-part 9/14

Extend oData Services for My Travel & Expenses Fiori App - Part 1

Generated by Jive on 2016-05-31+02:00

9

6. Now all the Standard project objects are copied to custom project and new Z* runtime artifacts arecreated

6 Add custom field to Entity Types1. Navigate to Data Model -> Entity Types -> Expense  . Double click on Properties

2. Click on Append Row

Page 10: DOC-65912 - Extend OData Services for My Travel & Expenses Fiori App - Part 1

8/16/2019 DOC-65912 - Extend OData Services for My Travel & Expenses Fiori App - Part 1

http://slidepdf.com/reader/full/doc-65912-extend-odata-services-for-my-travel-expenses-fiori-app-part 10/14

Extend oData Services for My Travel & Expenses Fiori App - Part 1

Generated by Jive on 2016-05-31+02:00

10

3. Blank row will added to bottom please enter Property Name ( e.g "DocumentNumber" )

1. 1. Select Edm Core Type ( You can type in Edm.String or select from F4 help )

2. Check for the operation needed on this field, refer screen shot in step 6.3 . For e.g. Creatable,Updatable, Sortable, Nullable

3. You can enter label for this field click on Label Help ( marked as red box 1 in step 6.3 )

4. Select reference ABAP field . CLick on corresponding ABAP field blank space and press F4

Page 11: DOC-65912 - Extend OData Services for My Travel & Expenses Fiori App - Part 1

8/16/2019 DOC-65912 - Extend OData Services for My Travel & Expenses Fiori App - Part 1

http://slidepdf.com/reader/full/doc-65912-extend-odata-services-for-my-travel-expenses-fiori-app-part 11/14

Extend oData Services for My Travel & Expenses Fiori App - Part 1

Generated by Jive on 2016-05-31+02:00

11

5. Save the changes

 

1. Similarly add other fields NoOfEmployee, PercentLobby and save the changes to project

2. Now select Project name and Generate Runtime Objects

7 Find & Implement BADI for My Travel and

Expenses App  Refer Section 3. there we can find details about extesniblity in extensibility node, and also link to

"My Travel & Expenses" Extensibilty Help . In this help page you can find the name of BADI.

 

1. Go to transaction "SE18" and open the BADI PAOC_MY_TRAVEL_EXPENSES_BADI  in display mode

Page 12: DOC-65912 - Extend OData Services for My Travel & Expenses Fiori App - Part 1

8/16/2019 DOC-65912 - Extend OData Services for My Travel & Expenses Fiori App - Part 1

http://slidepdf.com/reader/full/doc-65912-extend-odata-services-for-my-travel-expenses-fiori-app-part 12/14

Extend oData Services for My Travel & Expenses Fiori App - Part 1

Generated by Jive on 2016-05-31+02:00

12

2. Copy the Enhancement Spot Name and Go to "SE19" .

Create implementation for Enhancement Spot PAOC_MY_TRAVEL_EXPENSES

3. Enter Implementation Name , Description and hit enter

Page 13: DOC-65912 - Extend OData Services for My Travel & Expenses Fiori App - Part 1

8/16/2019 DOC-65912 - Extend OData Services for My Travel & Expenses Fiori App - Part 1

http://slidepdf.com/reader/full/doc-65912-extend-odata-services-for-my-travel-expenses-fiori-app-part 13/14

Extend oData Services for My Travel & Expenses Fiori App - Part 1

Generated by Jive on 2016-05-31+02:00

13

4. Enter Implementation name, implementing Class Name , Select BAdI and hit enter

5. Select Create Empty Implementation 

6. Select Sample Class and Click Copy Sample Class 

Page 14: DOC-65912 - Extend OData Services for My Travel & Expenses Fiori App - Part 1

8/16/2019 DOC-65912 - Extend OData Services for My Travel & Expenses Fiori App - Part 1

http://slidepdf.com/reader/full/doc-65912-extend-odata-services-for-my-travel-expenses-fiori-app-part 14/14

Extend oData Services for My Travel & Expenses Fiori App - Part 1

Generated by Jive on 2016-05-31+02:00

Activate BAdI implementation .7. Go to transaction SE24 and change implementing class ZCL_HR_NA_PAOC_MTE_EXTEND .

Check & remove any pre-existing unwanted code copied from sample class methods.

Activate the implementing class 

8 Logic to read & manipulate Entity

Information