Skip to Content

One of the quite popular requirements mentioned on the Process Integration forum on SDN
is retriving an XML file from the web page. It may sound strange but SAP PI/XI
does not support such a functionality out of the box (as there is not adapter that
could do it). So what kind of options do we have? Do we need to build our own
adapter or at least java proxy for that purpose? It turns out there might be a few
workarounds and one of them is to use…. file adapter ๐Ÿ™‚
One of file adapter features let’s you use something that is called Operation system command
which allows you to start a script on the OS level. But how can this help me, you may ask?
If you’ve ever heard about a tool like wget then this should definately ring a bell ๐Ÿ™‚
It turns out that we can quite easily use a tool like wget (or any other command line
application that downloads files from the internet to fill our requirement.

Let’s take a look at a sample scenario:

We need to retrive daily exchange rates from the web page and upload them into
SAP ECC (as exchange_rate01 IDOC for example which does that in standard)

How do we do that:

1. we can create a small report in SAP ECC that will send (via RFC or ABAP Proxy)
an indicator to get the file from the web page – later on we can schedule it
to run daily in order to download the exchange rates file only once a day

2. once the message will reach SAP PI/XI it will get transformed into a file
and placed into a folder – we don’t care about this file as it has only the inidicator
for the download in the payload

3. the file adapter will execute an OS command (command after processing option)
which will be a script (.bat file in case of windows) that will retrive the XML file from the web

4. in order to prepare the script we need to download wget (for windows in my example):
(you can use any other wget version)

and then this is our script’s code:

Point to notice
(we can also specify the directory to which the XML file should be downloaded)

5. then we only need to create a new scenario – file -> IDOC where the source will
be the XML file downloaded from the web page

Picture below shows you how this can work:

More advanced options:

Some of you might say: “But my file does not have the same name each time
it changes as it has the date inside”. This is also not an issue,
try the code below to get the date:

@For /F “tokens=1,2,3 delims=. ” %%A in (‘Date /t’) do @(
Set Date=%%A

@echo Date = %Date%  

and later you can use this date variable to specify the name of the file

Hope this approach may some some of you some time with doing advanced (adapter, proxy)
development on SAP PI/XI 

To report this post you need to login first.


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

  1. Former Member
    Hi Michal,
    Thanks a lot for the wonderful blog, currently we are facing a requirement where we need to take exchange rate from site of Bank of Canada and update R3 system.
    Our blog will help us do this in a simplified manner.

    Gautam Purohit

    1. Michal Krawczyk
      Post author
      hi Gautam,

      hope it will be useful for your exchange rates too as you can even do a simple parsing of a page with this tool (to get the name) 

      Michal Krawczyk

        1. Former Member
          Depends on your Unix platform – wget is open source and should compile on whatever platform you’re using. Binaries are available from wherever you usually obtain third-party software (eg, your distribution in the case of Linux, Blastwave for Solaris, AIX toolbox for AIX, etc).

          See for source code.

  2. Former Member
    Hi Michal,

    Thanks for an another excellent blog for sharing alternative way to advance development with java proxies/adapter development on such req with webpage.

    But,could you please also comment upon from maintenance/monitoring perspective on usage of script at OS level or Java proxy and with future PI upgrade versions 7.3 for recommonded option here?

    Anoop Garg

  3. Former Member

    Hi Experts,

    I have gone through the blog and i have the same scenario and anyone tell me the steps for the below case .

    I have a dynamic URL(website) where the currency rates are updated on a daily basis .***/2017/11/06.tsv

    1 70$

    where *** – is the dynamic value which will be passed from SAP ECC

    then follows the /2017/11/06 – Current date

    – I dont want to use HTTP_GET to get the dollar value and update it in SAP table .

    – I want to use PI where i will be passing this linkย***/2017/11/06.tsvย in a dynamic way and fetch values from website and update in SAP tables .

    Can anyone suggest an idea how to achieve it via PI ?


    Karthik S


Leave a Reply