UI5-Consuming oData service & building Fiori App

lightUI5-Consuming oData service & building Fiori App

 

 


The post shows  to build a Fiori App using oData service.

The steps are:

  1. Creating a oData Service in Tx- SEGW for the flight model.
  2. Activating the oData service in Tx- /IWFND/MAINT_SERVICE
  3. Build a UI5 application(Table)  in Eclipse which uses the oData service
  4. Uploading the UI5 application as BSP application in ABAP Repository
  5. Creating Launch Pad Configuration Tx- LPD_CUST for the BSP Application
  6. Creating Semantic Objects Tx- /UI2/SEMOBJ
  7. Crating Fiori Launch Pad Configuration Tx- /UI2/FLPD_CUST to create Catalog and Group
  8. Creating Role in Tx- PFCG & assigning the Fiori Catalog & Group to the role.
  9. Testing the Fiori tile in Tx- /UI2/FLP

For the oData service, we will use flight model data- table SCARR

0


To build a oData Service go to Tx- SEGW and crate a project and create entity type by referring DDIC structure- SCARR and add only three fields.

1


Also create a entity set-ScarrSet

2


Generate the run time artifacts. It creates data provider class and modelling class and the service. Double click on the data provider extension class as marked.

3


Redefine the SCARRSET_GET_ENTITYSET method.

4


Write a simple select query on SCARR table and fill the exporting parameters.

5


So the oData service name as : ZFLIGHT_SCARR_DEMO_SRV

6


To activate the service execute the TX-

7


Here Use ADD Service button to add the above created service in Tx- SEGW. To test the service select the service and choose SAP Gateway Client button.

8


Choose Execute.

9


The return code is OK.

10


Change the url : “add the entity set name after the end of the url and execute.

11


So it gives out all the records from the scarr table.

12


Up to now we build the oData service and tested successfully.

Now lets create a UI5 application in Eclipse- The UI5 application create a table with 3 columns and consume the oData service.

Create a project “UI5_TABLE_ODATA” with initial view name as “TABLE_VIEW” ( java script view).

It created 3 files, index.html, table_view.view.js and the controller as table_view.controller.js.

In the index.hetml file, add the table library in the bootstrap section.

13


In the view, build the table with 3 columns. The column text view should match with oData service entity type fields.Build a oData model and bind to the table.

Bind the entityset to the table rows.

1415


If you run the preview, you should see the table without data because in the UI5 application , the oData model is created with the url where it doesn’t include the server name and port. This is fine for our demo.

16


The UI5 application created must be stored in the local compute in some workspace section.

In my computer is is stored in the below path. Just figure our where is the WebContent folder is located.

17


In web content folder we have the index.html file.

18


and here we have the view and controoler.js files.

19


The next part is to upload this UI5 application as a BSP application into our abap repository.

Execute Tx- SE38 and run the program-/UI5/UI5_REPOSITORY_LOAD

20


The below screen appears.

21


Provide a name here (This is the name with which it will create a BSP application bu uploading the web content file of the U5 application). Choose Upload and execute.

22


From the popup appears, here we have to provide the web content folder of the UI5 application.

23


Select the UI5 web content folder and choose OK.

24


Choose allow.

25


The program checks the web content folder and shows the list of files and folders it is going to create in abap repository as a BSP application. Now click on Green text to upload.

26


Provide a description, package and may be your Transport name. For demo i am providing $tmp package.

27

28


Continue.

29


The pop up comes multiple times for each file. Allow every time.30


Finally it creates  the bsp application with a status message as shown below.

31


Go to Tx- SE80 and open the package and open the bsp application.

32


 

Execute the BSP application.

33


It displays the table with data. Just mark the url of the bsp application.

34


The BSP application, you can see the service created in Tx- SICF in the path as highlighted and it is active.

35


Up to now we have created a BSP application out of a UI5 application that consumes the oData service.  Now we have the BSP application url.

The next step is to create a lauchpad application and map to the bsp application url.

Go to Tx- 36 Click on New Launchpad button.37


Provide a role name and instance as “TRANSACTIONAL”, a description and continue.

38


Launchpad role is created . Now create a application under it be selecting New Application button.

39


The below screen appears.

40


Provide a link text and choose application type as URL.

41


Provide the BSP application name. Only the BSP application path name. Click on Show Advanced(optional) parameters button.

42


Select the change button for the Application alias field.

 

68

Provide the Application alias name.

69


Save it.

44


Now lets create a semantic object in Tx-

45


Clink on new entries button.

46

Provide below details and save it.

47


Lets see the fiori launchad. use Tx- 48


Login with your credentials.

49


There is no tile available.

50


Now we have to do design in the fiori lauchpad to create catalog and groups.

Use Tx-51


Now we have the screen. 

Choose Catalog and select “+” button.

52


Provide the catalog tittle and ID. Save.

53


Now we have a fiori catalog. 

The next step is to create a mapping object.

The mapping basically from the semantic object to the Launcpad application(BSP Appl).

So select the Target Mapping icon.

54


Choose Create Target Mapping button.

55


Now a new line is added, just click on the line .

57


The Configure button is active now. Select Configure button.

58


The below screen appears.

59


Already we have created a semantic object. So press F4  for semantic object field.

60


Choose the one that we created for the demo.

61


Choose F4 option for the action field.

62


Choose Display.

63


Now in the target section, from the dropdown select SAP Fiori App using LPD_CUST.

64


Choose F4 option for the Launchpad role.

65


Choose the one we created for our demo in Tx- LPD_CUST

66


Choose F4 for the application alias.

67


Choose one that we have created for our BSP application.

70


So here we have done with the mapping. Choose Save.

71


Press OK.

72


Its back to this screen. So we are done with the mapping object creation.

73


Now we have to create a tile. Select the Tiles icon.

74


Choose Create Tile button.

75


Choose App Launcher-Static tile.

76


The below screen appears.

77


Provide a title, you can provide as sub title also. Choose an appropriate ICON.

In the semantic object section, press F4 and choose the semantic object and action.

Here semantic object comes from the already created mapping object. Choose Save.

78


Choose OK.

79


Now we have a tile.

80


Choose the first tile icon. So the Tile is displayed as below.

81


Up to now we create a catalog with target mapping and a tile that uses the mapping.

Lets create a group. Choose Group from the left top side panel.

82


Choose “+” button.

83


provide group title and ID. Save it.

84


The below screen appears. Clcik on the + icon.

85


In the group, it shows the title from our catalog. Choose the tile (+).

86


It turns into green. 

87


Go back.

88


Now the tile is added to the group.

89


Go to Tx- PFCG

90


Create a single role.

91


Provide the description and save it.

92


Go to the tab : Menu. From Transaction list button.

93


Choose SAP Fiori Tile Catalog.

94


Choose the catalog name that we created in the Fiori launchpad configuration.

95


Continue.

96


The fiori catalog is added to the role menu.

97


Now choose SAP Fiori Tile Group.

98


Choose the Group.

99


Continue.

100


Save. Go to the USER tab.

101


Add the user to whom you want to assign the role.

102


Now open the Fiori  lauchpad- tx- 103


Login.

104


Wow. You have custom fiori app tile. Click on the tile.

105


It launches the BSP application that shows the table with few rows.

106


 

Advertisements

2 thoughts on “UI5-Consuming oData service & building Fiori App

  1. Hi Siva,

    I really liked your post.
    But I am facing an issue.
    I get this error when I am trying to execute my BSP application in web browser. My table is empty.
    Error – Failed to load resource: the server responded with a status of 404 (Not found)

    It seems there is some issue with the Service URL that I am passing. I tried doing some changes. But it is not working.
    Can you please help me with it.

    Thanks and Regards
    Meenakshi Raina

    Like

  2. Hi Siva,

    This post is very useful(UI5-Consuming oData service & building Fiori App), can you add some addtioinal function,for example:

    selection screen/ a search button, or Delete/Modify button.

    when entering a carrid value,click search button, the table will display data according to the user input value.

    thanks a lot!

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s