Professional Documents
Culture Documents
How To Call A BW ABAP-Backend From SAC Analytic Ap... - SAP Community
How To Call A BW ABAP-Backend From SAC Analytic Ap... - SAP Community
- SAP Community
Community
We have re-enabled the option to post and create content. Email notifications are
currently still turned off while we finish up steps related to badges and content
retagging. Subscribe for more.
vitvas_gpg
Explorer
04-11-2023 11:34 PM
16 Kudos
Introduction
There are several blogs showing how to organize interaction between SAC and S/4HANA
using OData services. However, one cannot ignore the fact that SAC, as an analytical
tool, often uses data from SAP BW or BW/4HANA. This blog provides a simple example
of how an OData Service can be used to exchange information between a SAC Analytic
Application and BW over a live connection. It is important to note, that this exchange is
bi-directional.
Our scope does not include a detailed discussion of the rich features of OData, such as
https://community.sap.com/t5/technology-blogs-by-members/how-to-call-a-bw-abap-backend-from-sac-analytic-application/ba-p/13571309 1/24
1/29/24, 11:33 AM How to call a BW ABAP-Backend from SAC Analytic Ap... - SAP Community
the use of complex types in services. Only the necessary setup steps are shown. If
necessary, a specialist will be able to use much more complex Services, required in
practical tasks, following to the same scheme.
It should also be noted that described solution can be used to transfer data from SAC to
BW with subsequent processing in ABAP. This may be required in cases where the SAC
scripting language capabilities are insufficient for complex calculations. Also, this solution
is useful if the SAC Analytic Application is used as a replacement for the Web Dynpro
applications, where it was possible to initiate the execution of any actions at the
Application Server using standard ABAP tools.
Prerequisites
CORS Settings
The described scheme only works when using a live connection between SAC and BW.
When creating this connection, BASIS Team performs CORS settings on the AS ABAP
side. These settings are described in detail in the corresponding section of SAP Help. In
our example, SAC Analytic Application will be used. This will require additional CORS
settings(service path /sap/opu/odata4/ and allowed header if-match).
Authorizations
It is assumed that the developer of the OData service has the standard set of ABAP
development permissions. Including creating and editing ABAP classes and using the
debugger. Additionally, following permissions will be required:
- transaction SEGW
- transactions /IWFND/***
- transactions /IWBEP/***
https://community.sap.com/t5/technology-blogs-by-members/how-to-call-a-bw-abap-backend-from-sac-analytic-application/ba-p/13571309 2/24
1/29/24, 11:33 AM How to call a BW ABAP-Backend from SAC Analytic Ap... - SAP Community
Here the choice is made from the list in the AUTHOBJNAM field. Please, note that you
must first select the type of object in the “Type” drop-down list
Then the required values can be selected from the list or the “Full Authorization” button is
pressed. After confirming the selection, AUTHOBJTYP and AUTHPGMID fields will be
filled in automatically according to the value selected in the “Type” drop-down list.
After that you should restart transaction PFCG and add the following S_START
authorization with the same way as previous:
https://community.sap.com/t5/technology-blogs-by-members/how-to-call-a-bw-abap-backend-from-sac-analytic-application/ba-p/13571309 3/24
1/29/24, 11:33 AM How to call a BW ABAP-Backend from SAC Analytic Ap... - SAP Community
S_USER_STA authorisations are required only while editing the S_START object. When it
is done, S_USER_STA can be deactivated or removed from the role profile.
Demo Scenario
1. OData Service creation and configuration in BW. For the service, an action will be
defined that “is able to” launch a BW process chain.
4. A button will be placed in Application. An onClick-script for this button will call the
action in OData Service.
https://community.sap.com/t5/technology-blogs-by-members/how-to-call-a-bw-abap-backend-from-sac-analytic-application/ba-p/13571309 4/24
1/29/24, 11:33 AM How to call a BW ABAP-Backend from SAC Analytic Ap... - SAP Community
Select newly created Project and press the “Generate Runtime Objects” button:
https://community.sap.com/t5/technology-blogs-by-members/how-to-call-a-bw-abap-backend-from-sac-analytic-application/ba-p/13571309 5/24
1/29/24, 11:33 AM How to call a BW ABAP-Backend from SAC Analytic Ap... - SAP Community
All fields in this window will be filled in automatically, you don't have to change them.
The Model Provider Class will declare the actions available in OData Service. It also
should describe the returns produced by actions. If necessary, you can declare input
parameters for these actions. For our example, we will create a StartProcessChain action
with a ChainTechName input parameter. The SAP BW process chain technical name will
be passed to input parameter when the action is called. The action will have a string type
return, which will show the ID of the chain run that was started during the action
execution. This is an artificial example, only to demonstrate that input parameter and
return of action are provide a bi-directional data exchange between SAC and BW.
To implement the logic described, we’ll create the new method START_CHAIN in Model
Provider Class. Also, standard method /IWBEP/IF_V4_MP_BASIC~DEFINE should be
redefined. Our action will be called directly from the SAC Analytic Application without
instantiating any helper types. Therefore, it must be unbound, that is, described as an
Action Import. For explanations of this OData terminology see, for example, in
corresponding sections of SAP Help.
https://community.sap.com/t5/technology-blogs-by-members/how-to-call-a-bw-abap-backend-from-sac-analytic-application/ba-p/13571309 6/24
1/29/24, 11:33 AM How to call a BW ABAP-Backend from SAC Analytic Ap... - SAP Community
1 METHOD start_chain.
2 DATA:
3 lo_action TYPE REF TO /iwbep/if_v4_med_action,
4 lo_action_import TYPE REF TO /iwbep/if_v4_med_action_imp,
5 lo_parameter TYPE REF TO /iwbep/if_v4_med_act_param,
6 lo_return TYPE REF TO /iwbep/if_v4_med_act_return.
7
8 "Declare an Action Import to be implemented in this OData Service
9 lo_action = io_model->create_action( 'STARTCHAIN' ).
10 lo_action->set_edm_name( 'StartProcessChain' ).
11 lo_action_import = lo_action->create_action_import( iv_action_import_na
12 lo_action_import->set_edm_name( 'StartProcessChain' ).
13
14 "Declare a local parameter type from standard OData types
15 io_model->create_primitive_type( iv_primitive_type_name = 'STRING' )->s
16 "Define an import parameter of this type for action described above
17 lo_parameter = lo_action->create_parameter( 'CHAIN' ).
18 lo_parameter->set_edm_name( 'ChainTechName' ).
19 lo_parameter->set_primitive_type( 'STRING' ).
20
21 "Declare that action should have a return and of which type it will be
22 lo_return = lo_action->create_return( ).
23 lo_return->set_primitive_type( 'STRING' ).
24 ENDMETHOD.
The redefined DEFINE method first calls the ancestor class method with the same input
parameters. And then transfers control to the START_CHAIN method, specific to our task:
1 METHOD /iwbep/if_v4_mp_basic~define.
2 TRY.
3 CALL METHOD super->/iwbep/if_v4_mp_basic~define
4 EXPORTING
5 io_model = io_model
6 io_model_info = io_model_info.
7 CATCH /iwbep/cx_gateway .
8 ENDTRY.
9
10 start_chain( io_model ).
11
12 ENDMETHOD.
Data Provider Class implements the action return calculation logic. It will be enough to
https://community.sap.com/t5/technology-blogs-by-members/how-to-call-a-bw-abap-backend-from-sac-analytic-application/ba-p/13571309 7/24
1/29/24, 11:33 AM How to call a BW ABAP-Backend from SAC Analytic Ap... - SAP Community
https://community.sap.com/t5/technology-blogs-by-members/how-to-call-a-bw-abap-backend-from-sac-analytic-application/ba-p/13571309 8/24
1/29/24, 11:33 AM How to call a BW ABAP-Backend from SAC Analytic Ap... - SAP Community
METHOD /iwbep/if_v4_dp_advanced~execute_action.
TYPES: BEGIN OF s_chain_action,
chain TYPE string,
END OF s_chain_action.
DATA:
lv_action_name TYPE /iwbep/if_v4_med_element=>ty_e_med_interna
ls_done TYPE /iwbep/if_v4_requ_adv_action=>ty_s_todo_pr
ls_todo TYPE /iwbep/if_v4_requ_adv_action=>ty_s_todo_li
IF lv_action_name = 'STARTCHAIN'.
io_request->get_parameter_data(
IMPORTING
es_parameter_data = ls_chain_params "Structure with the action
).
l_response = l_logid.
io_response->set_busi_data( ia_busi_data = l_response ). "logid tra
ls_done-action_import = abap_true. "Action import was executed
io_response->set_is_done( ls_done ). "We return a list of executed
https://community.sap.com/t5/technology-blogs-by-members/how-to-call-a-bw-abap-backend-from-sac-analytic-application/ba-p/13571309 9/24
1/29/24, 11:33 AM How to call a BW ABAP-Backend from SAC Analytic Ap... - SAP Community
47
48 ENDIF.
49 ENDIF.
50 ENDMETHOD.
3. Publish Service Group, that is to make the services assigned to Group available for
use by other users with the necessary authorizations (authorization object
S_START). For that, the /IWFND/V4_ADMIN transaction is used.
Start transaction /IWBEP/V4_ADMIN and press the “Register Group” button. Enter Service
Group technical name and description:
After creating a Group, the system will prompt you to immediately assign some Service to
this Group:
https://community.sap.com/t5/technology-blogs-by-members/how-to-call-a-bw-abap-backend-from-sac-analytic-application/ba-p/13571309 10/24
1/29/24, 11:33 AM How to call a BW ABAP-Backend from SAC Analytic Ap... - SAP Community
You can choose “Assign”. If the relevant Group has already been created earlier, or if you
want to assign a Service to a Group later, you can do so using the “Assign Service”
button. Here you can simply select a Service and a Group from the list:
Service Group with the services assigned to it will be listed in the transaction:
If the Service Group has been newly created, then it must be published. To do this, go to
transaction /IWFND/V4_ADMIN and click the “Publish Service Groups” button:
https://community.sap.com/t5/technology-blogs-by-members/how-to-call-a-bw-abap-backend-from-sac-analytic-application/ba-p/13571309 11/24
1/29/24, 11:33 AM How to call a BW ABAP-Backend from SAC Analytic Ap... - SAP Community
Since we are talking about objects in the current system, select LOCAL in the System
Alias field, and then click “Get Service Groups”. A list of all unpublished groups will
appear:
Highlight the desired group and click “Publish Service Groups”. Then return to the
previous window. Now it shows the published group and the services assigned to it:
The published service can be tested. This testing, if necessary, will allow you to fix the
issues in the classes and methods described above by break-points enabling and
switching to ABAP debugger. Testing can be started by highlighting our service as shown
in the previous screenshot and selecting "Service Test -> Gateway Client":
First of all, please, note the path displayed in the Request URI field:
https://community.sap.com/t5/technology-blogs-by-members/how-to-call-a-bw-abap-backend-from-sac-analytic-application/ba-p/13571309 12/24
1/29/24, 11:33 AM How to call a BW ABAP-Backend from SAC Analytic Ap... - SAP Community
The starting part of this path upto the $ sign is the End-Point URL, which will be required
later in the SAC settings. In our example, the End-Point URL turns out to be as follows:
/sap/opu/odata4/sap/zodatav4_group/default/sap/zodatav4/0001/
To start testing, you must first switch the HTTP Method to POST. Secondly, in the
Request URI, after the End-Point URL, you need to specify the name of the action that
will be called. Thirdly, you need to pass the value of the input parameter to the action
using JSON-Syntax. To test the service, a dummy chain ZPC_ODATA4_TEST was
prepared. It simply calls a program that contains no code. Therefore, the launch of
testing in the end looks like this:
Now testing can be started by pressing the “Execute” button. The successful result looks
like this:
https://community.sap.com/t5/technology-blogs-by-members/how-to-call-a-bw-abap-backend-from-sac-analytic-application/ba-p/13571309 13/24
1/29/24, 11:33 AM How to call a BW ABAP-Backend from SAC Analytic Ap... - SAP Community
In the RSPC transaction we can verify that the service actually started the execution of
the chain and returned the run ID:
Now we can use our OData Service in the SAC Analytic Application. For the
demonstration, the simplest application was prepared. It contains three components:
OData Service named ZODATAV4, button PC_START_BUTTON (labeled "Start Process
Chain"), text field CHAIN_RUN_ID, designed to display the value of action return:
https://community.sap.com/t5/technology-blogs-by-members/how-to-call-a-bw-abap-backend-from-sac-analytic-application/ba-p/13571309 14/24
1/29/24, 11:33 AM How to call a BW ABAP-Backend from SAC Analytic Ap... - SAP Community
In the ZODATAV4 component settings you must specify the name of the Live Connection
to that BW system where the service was created. See above for the required CORS
settings for this system. You also need to specify the End-Point URL. The value of this
parameter, corresponding to our example, was also indicated earlier:
https://community.sap.com/t5/technology-blogs-by-members/how-to-call-a-bw-abap-backend-from-sac-analytic-application/ba-p/13571309 15/24
1/29/24, 11:33 AM How to call a BW ABAP-Backend from SAC Analytic Ap... - SAP Community
To check the connection to the Service, you need to click the “Refresh” button to the right
of the Metadata section. If SSO between SAC and BW is not configured, then an
additional window will appear at this moment asking for your BW credentials. If the
connection to the Service is successful, then the Metadata section will display OData
version used and a list of actions provided by this Service:
Now the action can be called with the onClick script for the PC_START_BUTTON button:
First line of the script shows how to call an action from the ZODATAV4 service connected
to the SAC, how to specify the name of this action, how to pass the technical name of the
chain to the input parameter of this action. Then, if there were no errors while calling the
action, return value from the action is stored in the logid local variable. It, in turn, is
displayed in the CHAIN_RUN_ID text field.
So, before the button is clicked, application window looks like this:
https://community.sap.com/t5/technology-blogs-by-members/how-to-call-a-bw-abap-backend-from-sac-analytic-application/ba-p/13571309 16/24
1/29/24, 11:33 AM How to call a BW ABAP-Backend from SAC Analytic Ap... - SAP Community
8 Comments
Siva_Raju
Discoverer
04-12-2023 10:25 AM
1 Kudo
Raksha_SAP
Associate
https://community.sap.com/t5/technology-blogs-by-members/how-to-call-a-bw-abap-backend-from-sac-analytic-application/ba-p/13571309 17/24
1/29/24, 11:33 AM How to call a BW ABAP-Backend from SAC Analytic Ap... - SAP Community
04-13-2023 4:48 AM
2 Kudos
Henry_Banks
Product and Topic Expert
04-20-2023 5:07 PM
1 Kudo
Thanks for this vitvas_gpg very nicely worked out, i will recommend to my customers
hemanth89k
Discoverer
08-10-2023 8:34 PM
0 Kudos
Hi Vitaly Vasilyev,
Thank you so much for the detailed blog, its very helpful. I was able to configure steps till
generating the URL.
I am stuck in adding the button in Application Designer layout. I have tested and added
the Odata service ZODATAV4 in the layout, but script functions like executeAction are not
showing(CTRL+Space) in the button, getting error message:
https://community.sap.com/t5/technology-blogs-by-members/how-to-call-a-bw-abap-backend-from-sac-analytic-application/ba-p/13571309 18/24
1/29/24, 11:33 AM How to call a BW ABAP-Backend from SAC Analytic Ap... - SAP Community
I am trying this by selecting Application Designer -> New -> Classic Design Experience.
vitvas_gpg
Explorer
08-11-2023 10:02 AM
0 Kudos
Hi Hemanth,
I tried to reproduce the issue you described. It is of critical importance that OData Action
name should be listed in 'Metadata' section of ZODATAV4 settings:
If Action name is not visible here, than indeed error messages listed by you will arise. So,
my advice is to go through the following implementation sequence:
https://community.sap.com/t5/technology-blogs-by-members/how-to-call-a-bw-abap-backend-from-sac-analytic-application/ba-p/13571309 19/24
1/29/24, 11:33 AM How to call a BW ABAP-Backend from SAC Analytic Ap... - SAP Community
https://community.sap.com/t5/technology-blogs-by-members/how-to-call-a-bw-abap-backend-from-sac-analytic-application/ba-p/13571309 20/24
1/29/24, 11:33 AM How to call a BW ABAP-Backend from SAC Analytic Ap... - SAP Community
former_member466150
Participant
08-29-2023 11:35 PM
0 Kudos
Thank you vitvas_gpg, that is very helpful, after fixing the BW Live Connection issue I
was able to get the metadata and set up the button to run the PC.
Can you please share how to setup the CSRF token validation issue in POST method.
12-20-2023 12:43 PM
0 Kudos
Hi Vitaly,
https://community.sap.com/t5/technology-blogs-by-members/how-to-call-a-bw-abap-backend-from-sac-analytic-application/ba-p/13571309 21/24
1/29/24, 11:33 AM How to call a BW ABAP-Backend from SAC Analytic Ap... - SAP Community
Unfortunately I'm struggling to fetch the metadata for the OData Service:
Access to fetch at
'https://<BW>/sap/opu/odata4/sap/zlm_gw_sacodatav4/default/sap/zlm_gw_sacodatav4/
0001/StartProcessChain/$metadata' from origin
'https://<company>.eu10.sapanalytics.cloud' has been blocked by CORS policy: No
'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque
response serves your needs, set the request's mode to 'no-cors' to fetch the resource
with CORS disabled.
Do you have any good guide for how to setup the additional configuration for CORS and
the allow if-match allow header? It looks very like adjustments are needed for the CORS
on BW, like https://userapps.support.sap.com/sap/support/knowledge/en/2748971 and
thereby
https://help.sap.com/docs/SAP_ANALYTICS_CLOUD/00f68c2e08b941f081002fd3691d86
a7/39d0e79aa6a0480a90417... so step 7 and onwards?
https://community.sap.com/t5/technology-blogs-by-members/how-to-call-a-bw-abap-backend-from-sac-analytic-application/ba-p/13571309 22/24
1/29/24, 11:33 AM How to call a BW ABAP-Backend from SAC Analytic Ap... - SAP Community
vitvas_gpg
Explorer
12-21-2023 8:51 AM
0 Kudos
Hi Rasmus,
CORS settings, from my point of view, is more subject of BASIS Team, then for BI
specialist. Unfortunately, I don't have enough BASIS knowledge to install Cloud
Connectors, configure SSO, SSL, etc. While preparing this blog, I used a Live connection
from SAC to BW, that was already created in advance by my BASIS colleagues. As I see,
there are two methods of establishing of Direct CORS Connection. Method mentioned by
you uses an ICM script. In my case method with Unified Connectivity was used. I can't
say why BASIS team considered it preferable than ICM Script. But all I had to do was edit
existing CORS settings. Initially, CORS settings were configured for usual SAC reporting
based on Live BW Models. I only added more settings that necessary to use OData
Services. For example, I added a configuration for path /sap/opu/odata4/ via transaction
UCONCOCKPIT as described for Unified Connectivity.
Comment
Data Quality 1 Data Quality Management 1 Data Value 1 Full Stack 1 GitHub 1
https://community.sap.com/t5/technology-blogs-by-members/how-to-call-a-bw-abap-backend-from-sac-analytic-application/ba-p/13571309 23/24
1/29/24, 11:33 AM How to call a BW ABAP-Backend from SAC Analytic Ap... - SAP Community
Related Content
Privacy Terms of Use
Currency Conversion
Copyright Legal Disclosure
in Technology Q&A 2 weeks ago
https://community.sap.com/t5/technology-blogs-by-members/how-to-call-a-bw-abap-backend-from-sac-analytic-application/ba-p/13571309 24/24