Using Google Chrome?

Download my
free Chrome Extension, Power Notes Searcher, to make searching for and evaluating SAP notes, much easier.

Thursday, December 21, 2017

Downloading SAP Download Basket Contents in the Cloud on Linux

Print Friendly and PDF
Scenario: You've made the move to the cloud.  You are about to install some SAP software on a new Linux server hosted in the cloud and you just need to get the installation media uploaded.
Except, you don't want to have to start X-Windows or setup a specific Windows server just to do this.

You have two options to achieve this, you can either:
Upload the files from your local network using SFTP or SCP (maybe you have ExpressRoute or DirectConnect) and have a fast connection.

or

Why not just download them straight from your SAP download basket into the target server.
What's the difference between the two?  Well, it depends on whether you've already got access to the installation media locally, or if you are intending to first download it locally from SAP, then upload it to your cloud hosted server.
This doesn't make sense to download then re-upload to the cloud.
Therefore, here's how you can download straight from your SAP download basket.

What you will need:
- A web browser on your local PC.
- A valid SAP S-user account.
- Disk space on a cloud hosted Linux server (I'm going to show you the Linux way).
- The cloud hosted server will need internet access.

Setup Download Basket:
Before we start downloading, you need to cleanup your download basket.
Go to https://launchpad.support.sap.com/#/downloadbasket
Remove everything already in there that is not the items you want to download to the cloud hosted server.
The reason we must do this is because it's difficult to know which items relate to which files in the download basket (you'll see in a moment).
Now you can add the specific items you wish to download, into your download basket.
I've got two items:


Export Download Basket:
In the download basket click the "Export Links to Text File" button:


This will generate a text document which you can open on your PC called myDownloadBasketFiles.txt.

Open the text file using notepad:



I have 2 lines for the two items in my download basket.  I don't know which is which.  I can suppose they are in order, but I don't really know for sure.
Take the first line and log onto your cloud hosted Linux server as your preferred user.
Ping the softwaredownload.sap.com server using the Linux utility wget to make sure you can see the server.
> wget https://softwaredownloads.sap.com

A successful ping will show a HTTP error 401 and "Authorization failed":



We have confirmed that our cloud hosted Linux server can see the SAP download server.
Switch to your target download directory (somewhere with disk space):
> cd mydownloadsdirectory
We now call wget again and pass the first item to download:
> wget --http-user="[your s-user]" --http-password="[your password]" [the first url] --output-document=1file.SAR
Adjust the command line above to put in your S-user account name and password.
You should also change the last parameter to give your file a name.

We have to guess that it is a SAR file.  Once it's downloaded you can always re-name and test the extraction using "SAPCAR -tvf thefile.SAR".

The wget utility will save the file in the current directory.
Repeat the same command line, changing the URL and the output document file, for each of the remaining items in the notepad text file of your download basket.

As you can see, using wget will allow you to script the download process so that you could schedule an overnight download of software.

4 comments:

Vijay Chandra said...

if you click on "related info/Content Info" for a particular download package - and get the new page - that page URL will identify the Custom Application ID number for the package.

for eg - LIBDBSL package content info opens up at https://websmp110.sap-ag.de/~form/handler?_APP=00200682500000001043&_EVENT=INFO&INFONR=002007974700001766882017. This is the same APP ID that the Text Download URL will use.

this is one way to identify which SAR/ZIP/EXE file is being downloaded and script the download to happen to the correct file name.

regards,
VJC

Darryl said...

Hi Vijay,

Excellent find! Thanks.
So what you're saying is that the "_APP=00200682500000001043" portion of the URL for the "Related Info/Content Info" button for each item you add to the download basket, will match the ID you see in the URL inside the text file that is generated when you export the download basket.

Doesn't this mean that you will need to make a note of these ID numbers at the point of adding them to the download basket?

Thanks.

Darryl

Vijay Chandra said...

Hi Darryl,
If you plan to use the CLI mode downloader - using Wget - then yes. it's possible to only do this for the EXE/ZIP files since SAPCAR won't always work with them. The remaining SAR files can be downloaded as 1.SAR, 2.SAR, etc since after it's all over, we just go ahead and SAPCAR -xvf them anyway into seperate folders which will have the material number in them.

regards,
Vijay

Darryl said...

You can just use the "file" command to show the files which are executable binaries.
Obviously if you've got a Windows executable, then you won't be executing that on your Linux servers in the cloud (which could mean a download, then execution, then upload to the cloud, unless you've got a Windows VM in the cloud).

Best,

Darryl