If you need to change a Model based on a live connection in your story, at the moment that I’m publishing this content, there’s no a linear way to change it and you know the effort that is required (Create a new connection, recreate widgets calculations, dimensions, filters, input controls, …).
I found a way that I want to share with you to minimize the effort (10 minutes) to replace a Model based on a live connection.
In our example, lets use a simple story that actually is pointing to a Model that uses a HANA Live connection:
SAC Story Based on a Model with Live Connection
As you can see, you cannot change / replace the actual Model by the new model.
Before to start we need to know the actual and the new model IDs. You can do that just with the option sharing and coping the ID of each one:
SAC Model ID
The workaround is going to Deployment -> Export -> New Export -> Export just the Story and not the dependencies:
SAC Export Story
Upload the file to Linux in a clean folder, decompress the tgz file and after remove the tgz:
tar xvzf <name of the tgz file>
rm <name of the tgz file>
Here is the content of the TGZ file for our example:
SAC TGZ Extracted
After we need to execute from the path where we extracted the TGZ file, next command to replace the actual ID of the MODEL with the new ID:
find <path to the folder TGZ extracted> -type f -exec \
sed -i 's/<Original Model ID>/<Final Model ID>/g' {} +
After replacement of content of Model ID we need to compress the content again:
tar cvzf <name of the TGZ file> *
In SAC, we need to Import the TGZ file: Deployment -> Import -> Upload File overwriting the objects:
SAC TGZ Uploaded
SAC Content Overwrite
We can check in the story that is working and with the new model with live connection mapped:
SAC Model Changed
Note: It can be done also with external tools / plugins or developed in SAP Cloud SDK but with extra costs by the moment.
Model ID with different length:
- It’s also important to have in consideration, if the new model ID length size is different (greater or smallest) than the old one, we need also to change the value of the file size in files where Model ID appears. For example:
Model ID original: C9xht1myjk1olookllp4bla6f4 (length: 26) Model ID final: C3QINITSUXFV5W3VLELZBI1OG (length: 25)
- We need to count how many times appears the string of Model ID:
grep -o <Model ID Original> <File_Name in folders json/export> | wc -l
- Each file where it appears, contains the file size and we need to adjust it to avoid import error:
- In our example if the count was return (n), we need to add (if new Model ID is greater than the old one) or subtract (if new Model ID is shorted than the old one) the number of the file size.
In our example:# n=2 (times that appears). # <size of Model ID original>=26 # <size of Model ID new>=25 # difference -> 26-25=1 # n * difference = 2 * 1 = 2 # Value to replace in file: <file size> - <result> = 5181-2 = 5179
As alternative, request to create an enhancement in SAC to change Models based on Live Connections in a Story: https://apps.support.sap.com/sap/support/knowledge/en/2424376
Amazing idea but what a sad state that it has to be done like this at the moment.
Very useful tip. Thanks for sharing!
Amazing tip! Thank You!
I can't wait to explain it to end users.
Seriously, thanks for sharing!
There is an existing influence request, you can vote for it:
https://influence.sap.com/sap/ino/#idea/229434
2975957 - How to replace a model in a story in SAP Analytics Cloud or SAP Digital Boardroom - for import modes
It does not work for our BW live stories. We see modell name instead of model id in the tar file. When we import the file (with replaced model name) we get error message.
Hi Sabine,
Did you check the length of the Model ID?
BR,
Jorge
Hi Jorge,
as I wrote we see the model name and not id in the tar file.
"modelId":"BVDR_VIRE001_S_INVOICES_Q01AR"
Length of the names and the IDs differ. Maybe this is the reason of the problem and I have to change file size.
To be honest: I only wanted to try it. I do not want to explain it to our key users.
Regards
Sabine
Totally Agree. It's just for non end-users. I hope shortly we'll have another option. But for me solved many hours of work 🙂
In the mean time, till we have a direct option in SAC, I'll create an script to automatize it or something similar.
BR
Jorge
Hi team,
Once the story is exported without dependencies, where do you find the export file to upload to Linux in a clean folder ?
Brgds,
Olivier
Hi Olivier!
It's download to your computer. Check in Downloads folder. This file has the extension TGZ.
BR,
Jorge
Hi Jorge,
No nothing 🙁
And I double-checked, "Downloads" is my default download folder defined in Edge.
No error, no warning, ... when creating the export. Weird...
Brgds,
Olivier
Hi Olivier,
Did you click in the icon:
If yes, check the history of downloads of your browser.
BR,
Jorge
Hi Jorge,
Yes we did. Then some processing happens:
and this progress bar becomes green, then disappear, then ... nothing... 🙁
Brgds,
Olivier
Hi Olivier,
Are you getting any message error?
Is the option "Enable Job for Export and Import" enabled (System -> Administrator -> System configuration)?
In the monitor menu option, did you get any status error? (Can you check it also?)
Did you checked in the browser the downloads menu option?
BR,
Jorge
Hi Jorge,
No error msg at all on the GUI.
Djeeeez, we didn't know about his setting, sorry 🙁 So, yes, we have now enabled it.
We also enabled the "Allow model export to File Server".
I just tried again but got nothing downloaded locally. 🙁
I also went into the trace and saw this:
Brgds,
Olivier
Hi Olivier,
Let's try later, but anyway, the error is not related to this problem.
Also if you have 15 minutes we can be in touch and check in screen sharing to try to see why you cannot do the download. If you are agree, for sure. My email is accessible from the profile, just drop me an email and we can try.
I'm not promising anything, but we can check together.
BR,
Jorge
Hi Jorge,
Thx for your support!
I sent you a Teams meeting request this morning. Feel free to reschedule.
Brgds,
Olivier