Data extracting can be necessary in many business cases, but mostly for transferring data from one system to another. It could also be for other reasons, but let’s stick with the idea that we have sold a branch of our company and we need to transfer our data to the purchasing company.
Apidays New York 2024 - The value of a flexible API Management solution for O...
LeverX SAP Essential Tutorial - Simple Data Extraction
1. Essential
SAP Tutorial
Simple SAP Data Extraction
By Jason Thom
SAP Technical Consultant
1 Copyrighted 2012 by LeverX, Inc.
2. Tutorial Goal
Data extracting can be necessary in many business cases, but mostly for
transferring data from one system to another. It could also be for other
reasons, but let’s stick with the idea that we have sold a branch of our
company and we need to transfer our data to the purchasing company.
First, we will need to collect the requirements for the customer. This
involves finding all the needs of the new system and what data is essential.
Then go into your own SAP environment and find all the table-field
locations of your data.
2 Copyrighted 2012 by LeverX, Inc.
3. Tutorial Goal
Next, you should map the links between tables. This also includes finding if
the fields are 1:n or 1:1. This will make it easier to do your SELECT
statements including INNER JOIN and/or OUTER JOIN statements.
Now your ready to get started!
3 Copyrighted 2012 by LeverX, Inc.
4. Create New Program Via SE38
Program overview:
1. Declare your data statements and constants
2. Use SELECT statements and collect data into a
single internal table
3. Use CALL FUNCTION 'GUI_DOWNLOAD'
4. Write a simple IF statement to display whether or
not the new file was created
4 Copyrighted 2012 by LeverX, Inc.
5. Declare DATA, CONSTANTS, and Create SELECT Statements
• Every report has a report statement. This will be done automatically for you.
• Table MARA is declared for use
• lt_output is an internal table like MARA and will be used as the final table to be extracted
• wa_output is a work area, or line, of table MARA
• lv_outputfile will be the name and location of our newly extracted file
• Finally, use as many select statements as needed to get all your data into a single internal table
5 Copyrighted 2012 by LeverX, Inc.
6. Conclusion
• Filename (lv_outputfile) is being used to declare the name and location of the new file
• Filetype ASC is declaring that data should be transferred as ASCII text. Data is converted as
necessary
• Under tables, data_tab (lt_outputdata) is the internal table that is being used for extraction
• You can use as many exceptions as you need. In this case we are only using one for when sy-subrc =
‘1’.
• This IF statement is telling the user if the file could be created or not
6 Copyrighted 2012 by LeverX, Inc.
8. Contact Information
Please contact us for more information about our services or solutions available.
LeverX, Inc.
800 West El Camino Real, Suite 180
Mountain View, CA 94040 USA
Tel: (650) 625 – 8347
Web Site: www.LeverX.com
8 Copyrighted 2012 by LeverX, Inc.