Skip to Content

This document is written to shown step by step guide to configure news app in Fiori. In all, there are three steps:

  1. Configure Fiori title
  2. Create Table to store news information
  3. Generate SICF service and provide RSS 2.0 format

Step one: Configure Fiori title

Click on News Tile

/wp-content/uploads/2016/01/1_876004.png

Fill in SICF service name in the Feed, Article Refresh Interval means the refresh interval of news apps. Prefer to set to 15min.

SICF service name: znews (which will later be created)

/wp-content/uploads/2016/01/1_876004.png

Step two: Create a Table to store news information

This table should contain all essential information needed for news.

/wp-content/uploads/2016/01/1_876004.png

Step three: Generate SICF service and provide RSS 2.0 format

For the news app itself we need to provide RSS document.

Please refer XML RSS for the principle of RSS 2.0.

We create a SICF service called znews to generate this kind of RSS document (This is the service name you bind in Step one).

Create a class called ZCL_NEWS_SERVICE. Fill in IF_HTTP_EXTENSION in Interface.  Fill below code in IF_HTTP_EXTENSION~HANDLE_REQUEST.  Check and active this class. 

/wp-content/uploads/2016/01/1_876004.png

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

  method IF_HTTP_EXTENSION~HANDLE_REQUEST.

    DATA action TYPE STRING .

    DATA xmlcstr TYPE STRING .

    DATA newscontent TYPE TABLE OF ZNEWSCONTENT.

    DATA newscontent_l LIKE LINE OF newscontent.

    DATA guidstr TYPE STRING.

    DATA titlestr TYPE STRING.

    DATA descriptionstr TYPE C LENGTH 400.

    DATA imagestr TYPE STRING.

    DATA linkstr TYPE STRING.

    action = server->request->get_form_field( name = ‘type’ ).

    CASE action.

      WHEN ‘news’.

        SELECT * FROM ZNEWSCONTENT INTO TABLE newscontent.

        xmlcstr = ‘<?xml version=”1.0″ encoding=”utf-8″?><rss version= “2.0”> <channel>’.

        LOOP AT newscontent INTO newscontent_l.

CLEAR: guidstr, titlestr, descriptionstr, imagestr, linkstr.

          CONCATENATE xmlcstr ‘<item>’ INTO xmlcstr.

          guidstr = newscontent_l-guid.

          titlestr = newscontent_l-title.

          descriptionstr = newscontent_l-description.

          imagestr = newscontent_l-imagelink.

          linkstr = newscontent_l-contentlink.

          CONCATENATE xmlcstr ‘<guid>’ guidstr ‘</guid>’

                              ‘<title>’ titlestr ‘</title>’

‘<description>’ descriptionstr ‘</description>’

                              ‘<image>’ imagestr ‘</image>’

                              ‘<link>’ linkstr ‘</link>’ INTO xmlcstr.

         CONCATENATE xmlcstr ‘</item>’ INTO xmlcstr.

       ENDLOOP.

       CONCATENATE xmlcstr ‘</channel></rss>’ INTO xmlcstr.

server->response->set_header_field(

       name = ‘Content-Type’

       value = ‘application/xml’ ).

server->response->set_header_field(

       name = ‘accept-origin’

       value = ‘*’ ).

       server->response->set_cdata( data = xmlcstr ).

    ENDCASE .

  endmethod.

Run traction SICF.

In path default_host/sap/bc, right click on bc and choose New Sub-Element. Fill in your SICF service name.

/wp-content/uploads/2016/01/1_876004.png

Fill in a description and Handler List, leave other as default.

/wp-content/uploads/2016/01/1_876004.png

Check and Active this service.

You can have a test the SICF service now. Right click on the service name and click Test Service.

/wp-content/uploads/2016/01/1_876004.png

Also if you have configure the Fiori Launchpad correct, you can see the real news app.

/wp-content/uploads/2016/01/1_876004.png

2.PNG

To report this post you need to login first.

3 Comments

You must be Logged on to comment or reply to a post.

  1. Simon Ludwigs

    Dear Eric,

    thank you a lot. Just one question; How did you solved the issue with the relative path?

    In the seond screenshot we can see that the Input field is red. So I can’t save it. I’m not able to insert a absolute path because of Developer and Test Domains.

    Can you help me here?

    Thank you!

    (0) 

Leave a Reply