SAP Integration With Excel - Basic Guide
SAP Integration With Excel - Basic Guide
Basic Guide
Summary
This document provides a foundation overview of SAP Integration with Excel. This is a two-part series
document: the basic guide shows how Excel can retrieve data from SAP; the advanced guide shows how
Excel can post data into SAP.
Perquisites:
Basic SAP ABAP knowledge is required. SAP terminologies and jargons are applied for brevity.
Disclaimers:
Although the author and publisher have made every reasonable attempt to achieve complete accuracy of the
content, they assume no responsibility for errors or omissions. You should use this information as you see fit,
and at your own risk.
This publication is not affiliated with, sponsored by, or approved by SAP. Any trademarks, service marks,
product names or named features are assumed to be the property of their respective owners, and are used
only for reference.
1
SAP Excel Integration
Table of Contents
Business Requirements.................................................................................................................................... 3
System Architecture.......................................................................................................................................... 5
Preparatory work in RFC FM............................................................................................................................ 6
Preparatory work in Excel VBA......................................................................................................................... 8
Integration & Testing....................................................................................................................................... 13
Conclusion...................................................................................................................................................... 14
Appendix......................................................................................................................................................... 15
Author Bio....................................................................................................................................................... 18
Reference....................................................................................................................................................... 19
2
SAP Excel Integration
Business Requirements
In an enterprise with SAP, there can be business units where sales order creation is minimal. Hence, there is
a requirement to create a streamlined user entry/retrieval interface.
It will be a dream come true to have sales order data input in Excel and have these data posted into SAP at a
click of a button and review them back again in Excel. In this document, we will go through how to create a
SAP RFC Function Module that can be called by an Excel VBA.
Step 2: This is the Excel Sales Order Retrieval screen, to be populated with Sales Order information.
3
SAP Excel Integration
Step 3: This is the Excel Screen after Sales Order information has retrieved from SAP.
4
SAP Excel Integration
System Architecture
As the Excel Integration process comprises of various components and interactions, a 3-Tier Model-View-
Controller Framework should be applied to manage the complexity.
5
SAP Excel Integration
This can be achieved by creating a wrapper RFC FM as “ZZZ_SO_BAPI”. This RFC FM will perform
appropriate coordination and relay information to/from the standard BAPI
“BAPI_SALESORDER_GETDETAILBOS”. (It is a good practice to create a wrapper RFC FM, instead of having
the invoking interface calling the standard BAPI directly)
6
SAP Excel Integration
7
SAP Excel Integration
Once turned on, user interface controls such as buttons, checkbox, text field can be used.
8
SAP Excel Integration
This is the layout we will be using for Sales Order Retrieval. User will input the Sales Order to be retrieved
and press the “Retrieve SO” button. Information such as customer, customer reference PO# and the line
items will be displayed.
9
SAP Excel Integration
To attach VBA codes to the button, we need to access the “Assign Macro” context menu item.
10
SAP Excel Integration
SAP ActiveX components needs to be referenced by MS VBA, via the Tools menu.
Typically the ActiveX files (.OCX) are found in SAP frontend folder.
11
SAP Excel Integration
The start of the script is to instantiate ActiveX Components “SAP LogonControl.1” and “SAP.Functions”.
12
SAP Excel Integration
13
SAP Excel Integration
Conclusion
The standard way of access SAP is via SAP GUI. However, it is technically possible to access SAP using
ActiveX control delivered by SAP. This greatly enriches the developer toolset to provide user a wide array of
connectivity options (such as Excel VBA, JAVA, C++, ASP/C#, JavaScript). From a business perspective, an
intuitive user interface greatly enhances user experiences and potentially reduces user training cost.
Kindly look out for ‘SAP integration with Excel - Advanced Guide, by Benedict Yong’ for part II (last part) of
this two-part series.
14
SAP Excel Integration
Appendix
Full RFC FM ABAP
FUNCTION zzz_so_bapi.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" VALUE(SALESDOCUMENT) LIKE BAPIVBELN-VBELN
*" EXPORTING
*" VALUE(ORDERHEADER) LIKE BAPISDHD STRUCTURE BAPISDHD
*" TABLES
*" ORDERITEMS STRUCTURE BAPISDITBOS OPTIONAL
*"----------------------------------------------------------------------
ENDFUNCTION.
15
SAP Excel Integration
16
SAP Excel Integration
17
SAP Excel Integration
Author Bio
Benedict Yong is a PMP/ITIL trained Project Consultant with 9+ years Finance domain experience (FICO,
COPA, BPC) and 3+ years of Logistics experiences (SD, MM, PS, CS). He holds four SAP® Functional
Certifications (Financial Accounting, Management Accounting, Sales, Procurement) and three Technical
Certifications (S/4 HANA Implementation Architect, S/4 Cloud Onboarding with SAP Activate, SAP
Business Intelligence 7.0).
For people who are interested to have a holistic understanding of ERP, a PDF document will not be
enough. “ERP Made Simple” at Amazon might prove to be useful.
https://www.amazon.com/dp/B083C3X8YY
18
SAP Excel Integration
Reference
1. SAP Help - BAPI Framework
https://help.sap.com/doc/saphelp_46c/4.6C/en-
US/d8/44ca02ac3c11d189c60000e829fbbd/content.htm
2. SAP OSS – note 2256415 - Adaptation of RFC controls (Logon, Function, Table and BAPI) to use
SAP NetWeaver RFC Library
https://launchpad.support.sap.com/#/notes/2256415
19