Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
Hjaiswal
Explorer
Introduction

While SAP is working on a tighter integration of Datasphere and SAC there are still some features missing for advanced administrative tasks. One gap is the missing option to exchange the data source in a SAC Story with a Datasphere live connection. In case the story has to be migrated to a different Datasphere view a new story has to be (re-)created to cover the new source object. This can be very painful and time-consuming in case of complex stories.

In this blog I’d like to show a simple way to change the data source of a SAC story running on Datasphere live connection by calling the SAC API via Postman and change the path to the data source. It doesn’t matter if the new data source is just a different view in the same space or if the new view is in another space or even on another tenant.

The path to the data source consists of three elements:

  • Tenant

  • Space

  • Object


Each or all of these elements can be changed and therefore provide the flexibility to redirect your story to any other Datasphere source which is accessible from your SAC tenant.

Prerequisite

To follow long the step you must have a Postman installed in your system. The Postman scripts used in this blog can be downloaded at GitHub.

The new data source must be consumable/accessible with the given user.

Preparation

Story

To avoid any impact to productive applications we are not working on the original story.

  • Create a copy of the story. Note that during this copy process, copies of all SAC models will be created, too. Hence adjusting them will have no effect on the original story.

  • Open the copied story and switch to display mode to remove any potential locks.


 

Postman

Import the postman script and navigate to the variables of the collection tab.


Import postman collection


Fill the variables init_* with your specific values:

  • init_url: Your tenant URL

  • init_cookie: A session cookie - logon to SAC in your browser and copy the session cookie

  • init_story_id: Story Id your like convert

  • init_old_connection: name before

  • init_new_connection: name after

  • init_old_space: space name before replacement

  • init_new_space: space name after replacement

  • init_tenant_id: this is a single digit char - you can find it when you search for a contentlib call - there is a parameter like tenant="id".

  • inti_old_dwc_model: model technical id before replacement

  • init_new_dwc_model: model technical id after replacement


 


Fill the init variable Current Value


Note:

  • The replacement in the story and the model is done using a combination of name-value pair. As an example: "connectionName" is enriched to "SystemName":"connectionName". This helps to ensure that we replace semantically correct. There 3 or 4 name-values pair used.

  • If old and new values are identical the replacement is skipped. For example if you leave both values empty, nothing happens.


Perform the repointing

Start a collection runner, e.g. via the context menu on the collection name, and select all requests. The sequence is not relevant - just the "get-csrf-token" request must be first.

Start the execution and check that all tests are green.

Following action will be performed my collection requests:

  1. Get-CSRF-Token: GET request to fetch the craft-token by using the session id. Both session id and crf-token required by other requests.

  2. GetStory definition from server and replace: POST request to fetch the story details from the server and replace the connection, space, and model only at story level. Identity all the associated models and save changes locally.

  3. UpdateStory on the server: POST request to update the server with story local changes.

  4. GetModel definition from server: POST request to fetch the model details from the server and replace the connection, space, and model. Save changes locally.

  5. UpdateModel replace and send to server: POST request to update the sever with model local changes. If we have more than 1 model present in the story, then request 4 and 5 will repeat in a loop until all models are updated on server.


Congratulation! That's it

Hint: if you have several stories to migrate you need to change the init_story_id and start the next run.
15 Comments
MKreitlein
Active Contributor
0 Kudos

Hello Harshit,

looks like a very helpful blog! Even though I did not yet test it... one question comes to my mind:

Why is it not possible to enable the SAC System Owner with a separate Wizard Window directly inside SAC where he/she can do the same without the need for a 3rd Party Tool?

I mean, great that this functionality is available, now years after SAC was general available ... but each and every manual script is a source of error.

Why not implement a wizard with all mandatory fields? For me this would make more sense.

BR, Martin

 

PS: For all, who share my opinion, feel free to vote for my influence item

vigneswararao
Explorer
0 Kudos

Hi Harshith,

 

Thank you and its working fine, is the same way can we change import models also?

 

Thanks & Regards

Rao

 

Hjaiswal
Explorer
Hello Martin,

Yes, you are right separate wizard window will better and SAC will implement this as a standard feature in near future.

Till then we can use this workaround and get the repointing done.

Best Regards,

Harshit Jaiswal
Hjaiswal
Explorer
0 Kudos
Hello Vigneswara,

Glad to know that you already used the solution.
For import models we already have replace option as a standard feature.

Best Regards,
Harshit Jaiswal
karthiksraj
Discoverer
0 Kudos
Hi Harshit,

Appreciate the post!

We are trying to repoint our stories to another DWC Analytical model from same connection. I keep getting the following message in postman while running the collection.

As shown below the Body shows in HTML format and not in JSON, even i choose JSON. Not sure if this is the issue.


Error 1



 

Thanks,

Karthik
Hjaiswal
Explorer
0 Kudos
Hello Karthik,

As you can see in the first request all test cases were not passed.
You might did some mistake while filling the variables.

Could you please cross check it or share details.

BR,
Harshit Jaiswal
JulianJuraske
Participant
0 Kudos
Hello,

I'm currious how I could Identify the Model ID of a Datasphere (DWC) Source ?


Thanks
Julian
0 Kudos

Hi Harshit,

I am also facing same issue. The First step it self failing.

I have given below parameters:

Init_url = SAC URL (Home page)

init_cookie = Cookies ID of SAC URL Page

init_story_id = Story Name of SAC Report

init_tenant_id = tenent ID for SAC Page

init_old_dwc_model =  Technical name of original Analytical Model

init_new_dwc_model = Technical name of Target Analytical Model

 

Please provide your input, What is a miss here.

y_mahendra
Discoverer
0 Kudos
Hi Harshit,

We are trying to repoint our stories to another DWC Analytical model from the same connection. I keep getting the following message in Postman while running the collection.

 


getting this error in the console

JSONError: Unexpected token 'N' at 1:1Not Found^

What might be the issue?
y_mahendra
Discoverer
0 Kudos
Hi Harshit,

We have been trying to change datasource of the SAC reports with another DWC view using the same connection but getting errors in Postman, can you please suggest what might be the issue?


This is the error we are facing in the console

(JSONError: Unexpected token 'N' at 1:1Not Found^)

Thanks,

Mahendra
Hjaiswal
Explorer
0 Kudos
Hello Julian,

Datasphere Source model ID will be it Technical Name. (Technical name of view/model in Datasphere which select as source in SAC)

BR,

Harshit Jaiswal

 
JulianJuraske
Participant
0 Kudos
Hello Harshit,

so it's just the Technical Name within Datasphere?

Models in SAC basing on a e.g. BW Query have a hidden Model-ID (so not the Query Name).
I assumed it would be the same for Datasphere, but you have no Object in SAC for a Model basing on Datasphere AM.

So it kinda makes sense that it is the Technical Name of the Source Object.

Thanks
0 Kudos

Issue got fixed now.

I was giving wrong input for cookie.

Please use the cookie name starting from "JSESSIONID = ---".

Regards, Vikram

0 Kudos

Please try to use the cookie name starting from "JSESSIONID = ---"

In case you are using cookie name something different.

sshankar_narayan
Discoverer
0 Kudos

Hi Harshit,

We were able to run the API successfully. But post API execution we don't see data in the SAC report although we have data in the underlying Datasphere analytical model. If we add a new widget to the report then data appears but the existing visuals do not show any data.

Can you pls advise?

Thanks,

Shankar

Labels in this area