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: 
MichalKrawczyk
Active Contributor


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):
http://users.ugent.be/~bpuype/wget/
(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

13 Comments
Labels in this area