Skip to Content

Purpose

As the title suggests, this document explains workflow for scheduling a Webi document with prompts using RESTful SDK.

This is a very commonly used functionality which is no longer possible using BI 4.X .NET or Java SDKs.

Scenario

The entire REST workflow is written for a sample Webi document designed off eFashion universe and contains two prompts ‘Year’ and ‘Month’.

Restful call sequence

This section lists the restful calls and sequence to be followed.

Logon to Enterprise

Type of call: POST
URL: http://localhost:6405/biprws/logon/long

Headers:
Accept: application/xml

Payload:
<attrs>
     <attr name=”userName” type=”string” >Administrator</attr>
     <attr name=”password” type=”string” >MyPassword</attr>
     <attr name=”auth” type=”string” possibilities=”secEnterprise,secLDAP,secWinAD,secSAPR3″>secEnterprise</attr>
</attrs>

Expected Response:

<entry>

<author>

     <name>@BIPW08R2:6400</name>

</author>

<id>tag:sap.com,2010:bip-rs/logon/long</id>

<title type=”text”>Logon Result</title>

<updated>2014-07-18T14:15:00.476Z</updated>

<content type=”application/xml”>

     <attrs>

         <attr name=”logonToken” type=”string”>BIPW08R2:6400@{3&2=7949,U3&2v=BIPW08R2:6400,UP&66=60,U3&68=secEnterprise:Administrator,UP&S9=12,U3&qe=100,U3&vz=h4DBaNe2fTK1vL3.fjRivwXPn9aTKTvj_DGsk8CHvWE,UP}          </attr>

     </attrs>

</content>

</entry>

Add LogonToken

Take the Resulting logontoken and add it to the header as

X-SAP-LogonToken: “BIPW08R2:6400@{3&2=7949,U3&2v=BIPW08R2:6400,UP&66=60,U3&68=secEnterprise:Administrator,UP&S9=12,U3&qe=100,U3&vz=h4DBaNe2fTK1vL3.fjRivwXPn9aTKTvj_DGsk8CHvWE,UP}”

Retrieve prompts properties

Note: 7090 is the ID of the Webi document.

Type of call: GET
URL: http://localhost:6405/biprws/raylight/v1/documents/7090/parameters

Headers:
Accept: application/xml

Expected Response:

<?xml version=”1.0″ encoding=”UTF-8″ standalone=”yes”?>

<parameters>

    <parameter dpId=”DP0″ type=”prompt” optional=”false”>

        <id>0</id>

        <technicalName>Enter values for Year:</technicalName>

        <name>Enter values for Year:</name>

        <answer type=”Text” constrained=”false”>

            <info cardinality=”Multiple”>

                <lov refreshable=”true” partial=”false” hierarchical=”false”>

                    <id>UNIVERSELOV_DS0.DObc</id>

                    <values>

                        <value>2004</value>

                        <value>2005</value>

                        <value>2006</value>

                    </values>

                    <columns mappingId=”0″>

                        <column type=”String” id=”0″>Year </column>

                    </columns>

                </lov>

                <previous>

                    <value>2004</value>

                </previous>

            </info>

            <values>

                <value>2004</value>

            </values>

        </answer>

    </parameter>

    <parameter dpId=”DP0″ type=”prompt” optional=”false”>

        <id>1</id>

        <technicalName>Enter values for Month:</technicalName>

        <name>Enter values for Month:</name>

        <answer type=”Numeric” constrained=”false”>

            <info cardinality=”Multiple”>

                <lov refreshable=”true” partial=”false” hierarchical=”false”>

                    <id>UNIVERSELOV_DS0.DOb9</id>

                    <values>

                        <value>1</value>

                        <value>2</value>

                        <value>3</value>

                        <value>4</value>

                        <value>5</value>

                        <value>6</value>

                        <value>7</value>

                        <value>8</value>

                        <value>9</value>

                        <value>10</value>

                        <value>11</value>

                        <value>12</value>

                    </values>

                    <columns mappingId=”0″>

                        <column type=”Numeric” id=”0″>Month </column>

                    </columns>

                </lov>

                <previous>

                    <value>2</value>

                </previous>

            </info>

            <values>

                <value>2</value>

            </values>

        </answer>

    </parameter>

</parameters>

Note: Above response shows that the document has two prompts “Enter values for Year:” with available values 2004, 2005, 2006. Current value set is 2004.

And “Enter values for Month:” available values are 1 to 12 with current value set as 2.

Scheduling the document by passing new prompt values

Note: Below call sets the values as 2005 for ‘Year’ and ‘5’ for month. The document is scheduled to run now.

Type of call: POST
URL: http://localhost:6405/biprws/raylight/v1/documents/7090/schedules

Headers:
Accept: application/xml

X-SAP-LogonToken: “BIPW08R2:6400@{3&2=7949,U3&2v=BIPW08R2:6400,UP&66=60,U3&68=secEnterprise:Administrator,UP&S9=12,U3&qe=100,U3&vz=h4DBaNe2fTK1vL3.fjRivwXPn9aTKTvj_DGsk8CHvWE,UP}”

Payload:

<schedule>

     <name>twoprompts</name>

     <format type=”webi”/>

     <destination><inbox/></destination>

          <parameters>

               <parameter optional=”false” type=”prompt” dpId=”DP0″>

               <id>0</id>

               <technicalName>Enter values for Year:</technicalName>

               <answer constrained=”false” type=”Text”>

                    <values>

                         <value>2005</value>

                    </values>

               </answer>

               </parameter>

               <parameter optional=”false” type=”prompt” dpId=”DP0″>

               <id>0</id>

               <technicalName>Enter values for Month:</technicalName>

               <answer constrained=”false” type=”Text”>

                    <values>

                         <value>5</value>

                    </values>

               </answer>

               </parameter>

          </parameters>

</schedule>

Expected Response:

<?xml version=”1.0″ encoding=”UTF-8″ standalone=”yes”?>

<success>

    <message>The resource of type ‘Schedule’ with identifier ‘7953’ has been successfully created.</message>

    <id>7953</id>

</success>

Note: 7953 is the ID of the instance created. In CMC you could check the history of the document that the instance is scheduled. Once it succeds it could be viewed to verify that the prompt values are successfully passed to the document. This could also be done by using below call (only after the instance is successful)

Retrieving the prompt properties of the instance

Note: 7953 is the ID of the instance returned in the response of previous call.

Type of call: GET
URL: http://localhost:6405/biprws/raylight/v1/documents/7953/parameters

Headers:
Accept: application/xml

X-SAP-LogonToken: “BIPW08R2:6400@{3&2=7949,U3&2v=BIPW08R2:6400,UP&66=60,U3&68=secEnterprise:Administrator,UP&S9=12,U3&qe=100,U3&vz=h4DBaNe2fTK1vL3.fjRivwXPn9aTKTvj_DGsk8CHvWE,UP}”

Expected Response:

<?xml version=”1.0″ encoding=”UTF-8″ standalone=”yes”?>

<parameters>

    <parameter dpId=”DP0″ type=”prompt” optional=”false”>

        <id>0</id>

        <technicalName>Enter values for Year:</technicalName>

        <name>Enter values for Year:</name>

        <answer type=”Text” constrained=”false”>

            <info cardinality=”Multiple”>

                <lov refreshable=”true” partial=”false” hierarchical=”false”>

                    <id>UNIVERSELOV_DS0.DObc</id>

                    <values>

                        <value>2004</value>

                        <value>2005</value>

                        <value>2006</value>

                    </values>

                    <columns mappingId=”0″>

                        <column type=”String” id=”0″>Year </column>

                    </columns>

                </lov>

                <previous>

                    <value>2005</value>

                </previous>

            </info>

            <values>

                <value>2005</value>

            </values>

        </answer>

    </parameter>

    <parameter dpId=”DP0″ type=”prompt” optional=”false”>

        <id>1</id>

        <technicalName>Enter values for Month:</technicalName>

        <name>Enter values for Month:</name>

        <answer type=”Numeric” constrained=”false”>

            <info cardinality=”Multiple”>

                <lov refreshable=”true” partial=”false” hierarchical=”false”>

                    <id>UNIVERSELOV_DS0.DOb9</id>

                    <values>

                        <value>1</value>

                        <value>2</value>

                        <value>3</value>

                        <value>4</value>

                        <value>5</value>

                        <value>6</value>

                        <value>7</value>

                        <value>8</value>

                        <value>9</value>

                        <value>10</value>

                        <value>11</value>

                        <value>12</value>

                    </values>

                    <columns mappingId=”0″>

                        <column type=”Numeric” id=”0″>Month </column>

                    </columns>

                </lov>

                <previous>

                    <value>5</value>

                </previous>

            </info>

            <values>

                <value>5</value>

            </values>

        </answer>

    </parameter>

</parameters>

Reference

Above workflow is just a sample to demonstrate the functionality. The payload data for schedule would change a per Webi document. It is important to know the different prompt types and schedule APIs.

The complete workflow is explained in the SAP Web Intelligence RESTful web service SDK User Guide under API reference – Scheduling documents section.

Related SCN Spaces

.NET SDK Application Development

Java SDK Application Development

To report this post you need to login first.

3 Comments

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

Leave a Reply