Mobile Menu

HTTP/HTTPS Data Sources Processing in ABAP Background (Basic Hints)

Business Case

SAP Travel Expenses functionality allows employees to take business trips to foreign countries and have expenses in different local currencies.

In the process of reimbursement all the expenses should be converted into the currency according to the account’s configuration.

In a standard SAP solution currency exchange rates could be entered manually, or uploaded from the European Central Bank using a solution provided by SAP.

But how to automate the process for non-Euro zone countries? What is the easiest approach to get data from local, and as it often happens, legally required to be used as data sources.

To improve the simplicity and reliability of the process and reduce time spent, automatic updating of currency exchange rates could be implemented.

Business Scenario (as One of the Possible Cases)

According to the Official Response of the Czech National Bank, there is the only data source to update currency exchange rates in Czech Republic – the web site of the Czech National Bank.

Uploading of a daily exchange rate should be processed automatically every day after 14:00 in txt format.

To perform this action the report for exchange rates downloading from web should be implemented and used for:

  • Historical data uploading in a foreground SAP GUI session
  • Daily uploading by a scheduled background job

Implementation of historical data uploading in a foreground SAP GUI session

To upload current exchange rates the HTTP function call below is used:

sap_http_https_data_sources_in_abap_01

Historical data uploading in a foreground SAP GUI session works as expected and the data is uploaded without any errors because the front-end session is running.

SAP generated TCP/IP RFC connection SAPHTTP:

sap_http_https_data_sources_in_abap_02

Problem and solution for daily uploading by a scheduled background job

For scheduled background job system cannot complete execution successfully:

sap_http_https_data_sources_in_abap_03

As we can see in Job Log for a current job, the issue is in opening RFC connection:

sap_http_https_data_sources_in_abap_04

To avoid issues with the connection for a background process SAP generated TCP/IP RFC connection SAPHTTPA has to be used:

sap_http_https_data_sources_in_abap_05

The difference is that in this case an RFC server program starts on an application server and the work process that calls the RFC server program starts the program directly (no frontend session starting is needed).

When TCP/IP RFC connection SAPHTTPA is set, the job can be completed at the scheduled time daily:

sap_http_https_data_sources_in_abap_06

sap_http_https_data_sources_in_abap_07

Post Scriptum (Our Offer)

As you have seen from the article, we’ve implemented the solution successfully for one of our clients that has headquarters in Czech Republic. In case you are interested to get this solution for your business case, please contact us through the web site contact form and it will be our pleasure to assist you.