Extracting data from the SAP system - Part 3 - Output of reports

Direkt zum Seiteninhalt

Extracting data from the SAP system - Part 3 - Output of reports

Veröffentlicht von Shortcut IT in Sc4SAP · 14 Dezember 2023
Tags: SAP automation;SAP data extract;SAP data download
In practice, it is often necessary to extract data from the SAP system, whether for further processing outside the SAP system, for transfer to other SAP systems, or for other purposes. Part 1 of this blog was about extracting table data into a file, part 2 explained the different formats. This part is about how to extract output from reports.

Given is the following use case: as it is for compliance reason necessary to archive information of the users on the system (for a longer time, even if they were deleted), we recognize a gap in the SAP standard functionality. Lots of attributes of the user master data are captured in the change documents, but we can not find any information for the name and the email address. In transaction SUIM we have a report available (RSUSR002) that offers this information. Therefore we decide to schedule the program RSUSR002 with a suitable ALV layout on a daily basis and extract the output into a directory.

Ok, let's prepare some things in the SAP system:
  1. Add an ALV layout (let's name it "/NAME+EMAIL"), containing the user ID, the full name and the email address.
    Creating the ALV layout for the report
  2. Add a variant for the report (let's name it "4Archiving"), using the ALV layout.
    Report variant
That is all we need to do in the SAP system. Done within a minute.

Now we switch to our application "Shortcut for SAP systems" and create a variant for the function "Execute program" for executing the report RSUSR002 with the variant "4Archiving":
Specifying the variant in Shortcut for SAP systems

After saving the variant ("PX1/100 user master data for archiving") we make a short test whether the result is as expected. Just click on the Execute button and after few seconds the list is available.
Result of executing the report

Looks good. The "Save" button in the viewer enables us to save the list in a file.
Saving the list in a file
But of course we do not want to do this manually each and every day. So let us implement a periodic run via the command line tool.

We use the command line tool using the saved variant ("PX1/100 user master data for archiving") and store the output list in a file which contains - beside the information of the system / client - the date of the list. In the file containing the call of the command line tool we specify the filename using the environment variable %date%, then we call the command line tool with
  • the function as 1st argument,
  • the variant as 2nd argument
  • the target file for the output as 3rd argument.
A command file for calling the command line tool

Let's test it on the Windows command prompt...
Calling the command line tool via console

... and have a look into the written file:
Extracted data from the SAP system in a file

Good, works perfectly! Now we can schedule this in a periodic task, using an automation software (this ranges from simple tools such as the Windows Task Scheduler to complex automation applications such as Automic Automation (formerly UC4), ActiveBatch, etc.). In case you use the Windows Task Scheduler, have a look into this blog article which describes doing this.

Es gibt noch keine Rezension.
Shortcut IT GmbH
Försterstr. 11A
31275 Lehrte

Zurück zum Seiteninhalt