Skip to Content
avatar image
Former Member

Scheduled SAP export to MySQL DB

Hi,

I've been doing a lot of researching for a potential job where I will need to periodically (every 15 minutes) export some specific data from SAP and then import that data into a mySQL database on a separate server.

So far I have gathered that this could be the workflow:

1 Create ABAP program on SAP server that selects required data and outputs to file (sql, csv, tab delimited etc) on external server 

2 Once step 1 is complete, call a php file on external server that imports data into mySQL database.

I have a couple of questions:

a) Can the ABAP program be scheduled to run every 15 minutes? From the screenshots I have seen of the scheduling tool, the increment seems to be in hours

b) Is there a notification/event dispatched once the data has been exported and uploaded to an external server? This way I will know when to call the import .php script.

c) I will only be wanting to import new data added to SAP since the last scheduled run of the ABAP program, will this be easy to implement?

Also, if anyone can suggest improvements on my workflow then I would love to hear them!

Thanks so much

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Oct 08, 2013 at 10:03 AM

    Hello Sidney,

    welcome at Scripting Language forum.

    I am no PHP expert, so I can only answer question a) really:

    Yes, via TAC SE38. Create a variant to your report and choose menu Program > Execute > Background. Choose the variant, press button Schedule, name the job and press button Schedule periodically. Define the period interval with 15 Minutes.

    c) It is a question of your data source, e.g. a table. If the table contains a field with a time stamp of the last change or the creation time, I think it should not be a great problem.

    Let us know your results.

    Cheers

    Stefan

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hello Sidney. I'll add an alternative way to solve this, though the way you stated and Stephan gave explanation on is an execellent option.

      a) instead of developing a report outputting a text file, develop a function module with exactly the same logic, but instead of genereting a text file, make it return a table. Now, either

          i. you can make the function module RFC enabled, or

          ii. construct a webservice "over" the function module via TX SE80

      (in either case, if you have a firewall between your ERP and PHP server, you  may have to open certain ports for the connection to work)

      Now, instead of programming the report on ERP to run every 1 minutes, you develop your PHP script to consume the function module or webservice, and program the script to run using cron or scheduled tasks. This way you won't need the dispatch notification you state on question b.

      As far as I recall there's lots of examples on these 2 alternatives in the forums.

      Answer to your question c will depend on how you've developed your mysql database. If you have common data to identify what's already been transferred or not. If all your data in ERP has date and time, you could save latest sync run on mysql and the get data in ERP later than that. This is up to you.

      Cheers,

      Michael