Вы находитесь на странице: 1из 25

LIVE INPUT FROM XCELSIUS DASHBOARD VIA SAP R/3 TABLE, FUNCTION MODULE

AND WEB SERVICES

Table of Contents
Overview ....................................................................................................................................................... 2
1. Activating Services .................................................................................................................................... 3
Step 1: Enabling Services in SICF............................................................................................................... 3
Step 2: Traversing Hierarchy Nodes.......................................................................................................... 4
2. Create ZTable ............................................................................................................................................ 5
Step 1: Create custom table SE11............................................................................................................. 5
3. Create RFC enabled Function Module ...................................................................................................... 6
Step 1: Create Function Group ................................................................................................................. 6
Step 2: Create Function Module ............................................................................................................... 6
Step 3: Redo for Reading Module ............................................................................................................. 9
4. Expose Function Module as Web Service ...............................................................................................11
Step 1: Create Web Service SE80............................................................................................................ 11
Step 2: Configuration Screens.................................................................................................................12
Step 3: Repeat for Reading Module........................................................................................................ 15
5. SOAMANGER........................................................................................................................................... 15
Step 1: SOAMANAGER ............................................................................................................................15
Step 2: Configuring SOA Management ................................................................................................... 15
Step 3: Web Service Administration ....................................................................................................... 18
Step 4: Configure Specific Web Service .................................................................................................. 18
Step 5: Create Service To Bind To ........................................................................................................... 19
Step 6: Add Authentication Information ................................................................................................20
Step 7: Retrieve WSDL URL .....................................................................................................................21
Xcelsius........................................................................................................................................................22
Step 1: Add Xcelsius Connection............................................................................................................. 22
REFERENCE LIST .......................................................................................................................................... 25

Overview
This is a document created from a few sources I found on the internet and some personal experiences while trying
to get this solution working. I would like to give credit to Steve Parks for his tutorials on the subject as they were a
great help.
This project was done to be able to give live commentary from a dashboard. This was completed by writing two
functions modules (one for reading and one for writing), exposing these function modules as web services and
calling them from Xcelsius.
So down to the nuts and bolts of it.

1. Activating Services
Step 1: Enabling Services in SICF

Go to transaction SICF
Click execute
Activate the following services in transaction code SICF
1. /default_host/sap/bc/srt/
2. /sap/bc/webdynpro/sap/appl_soap_management
3.
4.
5.

6.

/sap/public/bc/icons
/sap/public/bc/icons_rtl
/sap/public/bc/pictograms
/sap/public/bc/webdynpro/

Step 2: Traversing Hierarchy Nodes

Navigate through the hierarchy until you reach the desired node. (as defined above)

Right click on the node and select the Activate Service Option.

Do this for all the nodes specified above.

2. Create ZTable
Step 1: Create custom table SE11

Go to transaction SE11
Input table name and press the Create button

An example of the commentary table used is given below. The main thing you must remember when
creating this table is to have a unique key (that we generate in Xcelsius and pass to the table).

NOTE: When using data type LCHR you must include an INT2/INT4 field before as done below with
ZLEN, else you will not be able to use the field in the function module source code.

3. Create RFC enabled Function Module


Step 1: Create Function Group

Go to transaction SE80
Create a function group to contain the solution
In this case I called mine ZDASH_COMMENT.

NOTE: You will need a developers key in SAP to be able to do these steps.

Step 2: Create Function Module

Go to transaction SE37.
Enter the name of your function module

Press create

On the Attributes tab, make sure that the Remote Enabled button is ticket. This enables the
function module to be used from an external source

Define the fields you want to import from Xcelsius under the import tab.

Because this is a writing function module I am not defining anything in the export tab.

Under the Source Code tab write the code as per your functional requirements. The code below
just accepts the import parameters and writes them to a table.
The reason for the use of a structure is because you cant reference the table directly in a table
definition.

FUNCTION ZDASH_COMMENT_WRITE.
*"---------------------------------------------------------------------*"*"Local Interface:
*" IMPORTING
*"
VALUE(ZKEY_INPUT) TYPE CHAR0064
*"
VALUE(ZCOMMENT_INPUT) TYPE CHAR4000
*"
VALUE(ZPROJECT) TYPE CHAR6
*"
VALUE(ZDASHBOARD) TYPE CHAR8
*"
VALUE(ZLEGAL_ENTITY) TYPE CHAR7
*"
VALUE(ZBU) TYPE CHAR6
*"
VALUE(ZPRODUCT) TYPE CHAR13
*"
VALUE(ZVERSION) TYPE CHAR5
*"
VALUE(ZMEASURE) TYPE CHAR11
*"
VALUE(ZYEAR) TYPE NUMC04
*"
VALUE(ZPERIOD) TYPE NUMC3
*"
VALUE(ZUSERCHANGED) TYPE CHAR32
*"---------------------------------------------------------------------TYPES: BEGIN OF ZDASHBOARD_COMMENT_type,
ZKEY type CHAR64,
ZPROJECT type CHAR6,
ZDASHBOARD type CHAR8,
ZLEGAL_ENTITY type CHAR7,
ZBU type CHAR6,
ZPRODUCT type CHAR13,
ZVERSION type CHAR5,
ZMEASURE type CHAR11,

ZYEAR type NUMC04,


ZPERIOD type NUMC3,
ZTIMESTAMP type TIMESTAMP,
ZUSERCHANGED type CHAR32,
ZLEN type int2,
ZCOMMENT(4000) type c,
END OF ZDASHBOARD_COMMENT_type.
DATA : lt_ZGCRR_COMMENTRY type table of ZDASHBOARD_COMMENT_type,
wa_ZGCRR_COMMENTRY type ZDASHBOARD_COMMENT_type,
s_tst TYPE timestamp,
tzone TYPE timezone.
GET TIME STAMP FIELD s_tst.
tzone = 'UTC+2'.
*WRITE:

"short form
"time zone

s_tst TIME ZONE tzone.

wa_ZGCRR_COMMENTRY-ZKEY = ZKEY_INPUT.
wa_ZGCRR_COMMENTRY-ZLEN = strlen( ZCOMMENT_INPUT ).
wa_ZGCRR_COMMENTRY-ZPROJECT = ZPROJECT.
wa_ZGCRR_COMMENTRY-ZDASHBOARD = ZDASHBOARD.
wa_ZGCRR_COMMENTRY-ZLEGAL_ENTITY = ZLEGAL_ENTITY.
wa_ZGCRR_COMMENTRY-ZBU = ZBU.
wa_ZGCRR_COMMENTRY-ZPRODUCT = ZPRODUCT.
wa_ZGCRR_COMMENTRY-ZVERSION = ZVERSION.
wa_ZGCRR_COMMENTRY-ZMEASURE = ZMEASURE.
wa_ZGCRR_COMMENTRY-ZYEAR = ZYEAR.
wa_ZGCRR_COMMENTRY-ZPERIOD = ZPERIOD.
wa_ZGCRR_COMMENTRY-ZTIMESTAMP = s_tst.
wa_ZGCRR_COMMENTRY-ZUSERCHANGED = ZUSERCHANGED.
wa_ZGCRR_COMMENTRY-ZCOMMENT = ZCOMMENT_INPUT.
modify ZBO_DASH_COMMENT from wa_ZGCRR_COMMENTRY.
ENDFUNCTION.

Step 3: Redo for Reading Module


Follow the same steps as in step 2 for your reading function module. Screenshots below

Import tab only receives the key from the dashboard to use in the select
statement.

Export tab contains the field I want to display in the dashboard.

Source Code
FUNCTION ZDASH_COMMENT_READ.

*"---------------------------------------------------------------------*"*"Local Interface:
*" IMPORTING
*"
VALUE(ZKEY_INPUT) TYPE CHAR64
*" EXPORTING
*"
VALUE(ZCOMMENTRY_OUT) TYPE STRING
*"---------------------------------------------------------------------SELECT ZCOMMENT FROM ZBO_DASH_COMMENT
INTO ZCOMMENTRY_OUT
WHERE ZKEY = ZKEY_INPUT.
ENDSELECT.
ENDFUNCTION.

Remember to save and activate the function modules after creation.

4. Expose Function Module as Web Service


Step 1: Create Web Service SE80

Go back to transaction SE80.


Expand the function module node in the hierarchy
Right click on the function module -> Create -> Web Service

Step 2: Configuration Screens

Enter service definition name


Kurzbeschreibung : Enter short description for the service definition
Enpoint Type : Function Module

Click continue

On the next screen you need to select the authorization level you will be using for the web service. The
selection you make here will put the lowest level that the administrator can set it to when deploying it
on SOAMANAGER. In my example Im using no authentication.

Enter your companies deployment package


Either select local object if you are testing or create a transport request

Select complete

When the next screen appears, select activate

Step 3: Repeat for Reading Module


Repeat the steps in Step 2 for the other function module

5. SOAMANGER
Step 1: SOAMANAGER
Enter transaction code SOAMANAGER in SAP

Step 2: Configuring SOA Management


A web page will open in IE (Internet Explorer).

Select System Global Settings from the Technical Configuration tab

Navigate to the Access Information J2EE Server tab

Enter your hostname of the server (look in your IE address bar if you dont know this)
Port number: This information was setup by your basis team. You can look at which port they
used for the java stack by going to transaction SMICM.

Select the highlighted icon. (The third icon from the left)
The port number we are looking for is displayed in the screen that follows

Step 3: Web Service Administration

Go to the Business Administration tab in SOA Management


Select the Web Service Administration link

Step 4: Configure Specific Web Service

Enter the service name defined when you deployed. Example ZDASH_COMMENT_WRITE_TEST3
Press Go to find it. (you can also enter a wild card (*))
Select the service as indicated by the red block in picture below.
Select Apply Selection

Step 5: Create Service To Bind To

Select the configuration tab

Select create service

Enter the service name : ZDASH_COMMENT_WRITE_TEST3


Enter description for the service : This is a description of service
Enter the binding name you wish to use : ZDASH_COMMENT_WRITE_TEST3_BIND
Select apply settings

Step 6: Add Authentication Information

Select the authentication mode you want to use. The lowest setting you will be able to select
here is the level that you chose when deploying the web service in transaction SE80
If you dont want the user to be asked for the ABAP service user every time they use the
connection, fill in that username and password as requested below
Press Save after all the information has been edited

Step 7: Retrieve WSDL URL

Select Open WSDL document for selected bindings

A page like the following should appear


Copy the address (URL) at the top of the screen. The server name has been edited out

Xcelsius
Step 1: Add Xcelsius Connection

Select the Data -> Connections node in Xcelsius

Select Add -> Web Service Connection

Paste the WSDL URL you copied in step 7


Click the Import button

After you press import you should see the function module, Import and Export Values, in the
respective blocks

Bind the fields to the blocks as you would with normal Xcelsius connections

After each of the fields have been bound to the specific cells, add input text blocks to dashboard
Here is a screenshot of how dashboard looks with a save button to trigger write function module

To check if the data is saving correctly go to transaction SE16 -> enter table name -> execute

REFERENCE LIST
Author(s): Marco Salazar S.
http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/b043ef4e-e8d1-2c10-7d888077b209ce55?QuickLink=index&overridelayout=true
Author(s): Steve Park
Turn any SAP remote-enabled function module into a Web Service

Вам также может понравиться