SlideShare a Scribd company logo
1
SAP integration with Excel -
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 guid e 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 ac curacy 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.
SAP Excel Integration
2
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
SAP Excel Integration
3
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.
Base on the above, we will design a simple proof of concept.
Step 1: This is the Sales Order in SAP screen that will be retrieved into Excel format.
Step 2: This is the Excel Sales Order Retrieval screen, to be populated with Sales Order information.
SAP Excel Integration
4
Step 3: This is the Excel Screen after Sales Order information has retrieved from SAP.
SAP Excel Integration
5
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.
3-Tier Model-View-Controller Framework
In the 3-Tier MVC Framework, there are
 View/ Interface:The role focuseson userinteraction;collectinganddisplayinginformation. Inour
specificcase,thiswill be ourExcel anditsembeddedVBA.
 Controller:The role focusesontransmittingandmanipulationof information. Inourspecificcase,
thiswill be ourSAPRFC FunctionModule.
 Model:The role focusesondata storage and itsrelatedprocesses. Inourspecificcase,thiswillbe
the underlyingDatabase.
This document will now be divided into 2 sections:
 Preparatory work in RFC FM – this explains how the Controller of the architecture is coded.
 Preparatory work in Excel VBA – this explains how the View/Interface of the architecture is
scripted.
SAP Excel Integration
6
Preparatory work in RFC FM
The purpose of RFC FM/BAPI is to read sales header and line items data from SAP backend.
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)
Note: the FM must be “Remote-Enabled”
Note: full code at appendix.
SAP Excel Integration
7
Function Module Unit Testing is as per expectation.
Sales Order 401004151 is retrieved with its header information and 3 line items.
SAP Excel Integration
8
Preparatory work in Excel VBA
To be able to perform scripting in Excel VBA, the Developer Tab needs to be turned on.
Once turned on, user interface controls such as buttons, checkbox, text field can be used.
SAP Excel Integration
9
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.
SAP Excel Integration
10
To attach VBA codes to the button, we need to access the “Assign Macro” context menu item.
Once selected, the VBA editor will be accessible.
SAP Excel Integration
11
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.
SAP Excel Integration
12
The start of the script is to instantiate ActiveX Components “SAP LogonControl.1” and “SAP.Functions”.
The actual function call to “ZZZ_SO_BAPI” is as per below.
Note: full script at appendix.
SAP Excel Integration
13
Integration & Testing
With both the Excel VBA scripting and SAP RFC FM coding completed, we can perform end-to-end testing.
Testing within SAP end Testing at Excel end
SAP Excel Integration
14
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.
SAP Excel Integration
15
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
*"----------------------------------------------------------------------
CALL FUNCTION 'BAPI_SALESORDER_GETDETAILBOS'
EXPORTING
salesdocument = salesdocument
IMPORTING
orderheader = orderheader
TABLES
orderitems = orderitems.
SELECT SINGLE name1 FROM kna1 INTO orderheader-sold_to
WHERE kunnr = orderheader-sold_to.
ENDFUNCTION.
SAP Excel Integration
16
Full Excel VBA Scripting
Sub Button1_Click()
'---------------------------------
' Declaration.
'---------------------------------
Dim LogonControl As SAPLogonCtrl.SAPLogonControl
Dim R3Connection As SAPLogonCtrl.Connection
Dim TableFactory As SAPTableFactory
Dim Functions As SAPFunctionsOCX.SAPFunctions
Dim objBAPIControl As Object
Dim oWB As Workbook
Dim oST As Worksheet
Set oWB = Application.ActiveWorkbook
Set oST = oWB.Worksheets(1)
'---------------------------------
' Initialize SAP ActiveX Control.
'---------------------------------
Set LogonControl = CreateObject("SAP.LogonControl.1")
Set R3Connection = LogonControl.NewConnection
Dim objBAPIControl As Object
Set objBAPIControl = CreateObject("SAP.Functions")
'--------------------
' Logon with prompt.
'--------------------
R3Connection.Client = "100" 'as per SAP Logon Pad
R3Connection.System = "SID" 'as per SAP Logon Pad
R3Connection.SystemNumber = "00" 'as per SAP Logon Pad
R3Connection.ApplicationServer = "XX.XX.XX.XX" 'as per SAP Logon Pad
R3Connection.User = "sapidx" 'as per SAP Logon Pad
R3Connection.Password = "sapid-passwdx" 'as per SAP Logon Pad
Application.StatusBar = "Start of Logging in"
SY_Subrc = R3Connection.Logon(0, SilentLogon)
If SY_Subrc <> True Then MsgBox "Logon failed": Exit Sub
Application.StatusBar = "Login Successful"
Set objBAPIControl.Connection = R3Connection
'---------------------------------
' Retrieve a sales order.
'---------------------------------
SAP Excel Integration
17
Dim vRow, vCol As Integer
Dim vStr As Integer
Dim vMax, vIdx As Integer
Dim oSearch As String
Dim oInfo As Object
Dim oTabl As Object
oSearch = Cells(4, 4).Value
Set oBAPI = objBAPIControl.Add("ZZZ_SO_BAPI")
oBAPI.Exports("SALESDOCUMENT") = oSearch
Set oInfo = oBAPI.Imports("ORDERHEADER")
Set oTabl = oBAPI.Tables("ORDERITEMS")
Application.StatusBar = "Perform SAP Call"
SY_Subrc = oBAPI.Call
If SY_Subrc <> True Then MsgBox "Call failed": Exit Sub
Application.StatusBar = "Perform SAP Call Successful"
oST.Cells(6, 4).Value = oInfo.Value("SOLD_TO")
oST.Cells(7, 4).Value = Trim(oInfo.Value("PURCH_NO"))
vMax = oTabl.Rows.Count
vCol = 3: vStr = 9
For vIdx = 1 To vMax
vRow = vStr + vIdx
oST.Cells(vRow, vCol + 0) = oTabl.Value(vIdx, "ITM_NUMBER")
oST.Cells(vRow, vCol + 1) = oTabl.Value(vIdx, "MATERIAL")
oST.Cells(vRow, vCol + 2) = Trim(oTabl.Value(vIdx, "NET_VALUE"))
oST.Cells(vRow, vCol + 3) = Trim(oTabl.Value(vIdx, "SHORT_TEXT"))
Next vIdx
'-----------------------------------
' Logoff SAP and close the control.
'-----------------------------------
R3Connection.Logoff
Set LogonControl = Nothing
Set objBAPIControl = Nothing
End Sub
SAP Excel Integration
18
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).
He holds a Bachelor of Management and a Diploma in IT. He has worked in Banking,
Retail and Manufacturing industries, playing both in-house and external consultant
role.
He is situated in Singapore and is bilingual in English and Mandarin. He can be
contacted at benytx@gmail.com.
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
SAP Excel Integration
19
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
3. SAP SDN – Common export parameter issues
https://blogs.sap.com/2014/04/27/activex-component-sapfunctions-with-export-parameter-string/
https://answers.sap.com/questions/529288/datatype-problem-with-sap-gui-75-pl5-unicode-activ.html
https://answers.sap.com/questions/10222185/activex-component-sapfunctions-with-export-
paramet.html

More Related Content

What's hot

Chapter 02 sap script forms
Chapter 02 sap script formsChapter 02 sap script forms
Chapter 02 sap script formsKranthi Kumar
 
J58 s4 cld2105_bpd_en_es
J58 s4 cld2105_bpd_en_esJ58 s4 cld2105_bpd_en_es
J58 s4 cld2105_bpd_en_es
Roque Chévez
 
325546_adding fields in CJI3 & CJI5.pdf
325546_adding fields in CJI3 & CJI5.pdf325546_adding fields in CJI3 & CJI5.pdf
325546_adding fields in CJI3 & CJI5.pdf
Vaishali Ketkar
 
Top 10 sap abap faqs-www.bigclasses.com
Top 10 sap abap faqs-www.bigclasses.comTop 10 sap abap faqs-www.bigclasses.com
Top 10 sap abap faqs-www.bigclasses.com
bigclasses.com
 
SAP Logistics - CS - Standard Process & Configuration document
SAP Logistics - CS - Standard Process & Configuration documentSAP Logistics - CS - Standard Process & Configuration document
SAP Logistics - CS - Standard Process & Configuration document
Subhrajyoti (Subhra) Bhattacharjee
 
Guide to Configure Custom SD Output Types in S/4HANA Using BRF+
Guide to Configure Custom SD Output Types in S/4HANA Using BRF+Guide to Configure Custom SD Output Types in S/4HANA Using BRF+
Guide to Configure Custom SD Output Types in S/4HANA Using BRF+
Ashish Saxena
 
Sap abap tutorials
Sap abap tutorialsSap abap tutorials
Sap abap tutorials
Harshul Phadke
 
Enhancement technique how to use validations
Enhancement technique how to use validationsEnhancement technique how to use validations
Enhancement technique how to use validations
Ugeshkumarnetha Dasari
 
Lsmw (Legacy System Migration Workbench)
Lsmw (Legacy System Migration Workbench)Lsmw (Legacy System Migration Workbench)
Lsmw (Legacy System Migration Workbench)
Leila Morteza
 
Abap package concept
Abap package conceptAbap package concept
Abap package concept
Tobias Trapp
 
BPC 10.1 basics
BPC 10.1 basicsBPC 10.1 basics
BPC 10.1 basics
kamal ega
 
Sap FICO complete end user manual
Sap FICO complete end user manual Sap FICO complete end user manual
Sap FICO complete end user manual
learnstraightsap
 
Copa configuration
Copa configurationCopa configuration
Copa configurationMithun Roy
 
Sap abap-data structures and internal tables
Sap abap-data structures and internal tablesSap abap-data structures and internal tables
Sap abap-data structures and internal tables
Mustafa Nadim
 
Parallel accounting in sap erp account approachversus ledger approachin new g...
Parallel accounting in sap erp account approachversus ledger approachin new g...Parallel accounting in sap erp account approachversus ledger approachin new g...
Parallel accounting in sap erp account approachversus ledger approachin new g...Imran M Arab
 
Sap abap real time questions
Sap abap real time questionsSap abap real time questions
Sap abap real time questions
techie_gautam
 
PCA Configuration
PCA ConfigurationPCA Configuration
PCA Configuration
vannakm
 

What's hot (20)

Chapter 02 sap script forms
Chapter 02 sap script formsChapter 02 sap script forms
Chapter 02 sap script forms
 
J58 s4 cld2105_bpd_en_es
J58 s4 cld2105_bpd_en_esJ58 s4 cld2105_bpd_en_es
J58 s4 cld2105_bpd_en_es
 
325546_adding fields in CJI3 & CJI5.pdf
325546_adding fields in CJI3 & CJI5.pdf325546_adding fields in CJI3 & CJI5.pdf
325546_adding fields in CJI3 & CJI5.pdf
 
Abap dictionary 1
Abap dictionary 1Abap dictionary 1
Abap dictionary 1
 
Transacciones sap
Transacciones sapTransacciones sap
Transacciones sap
 
Top 10 sap abap faqs-www.bigclasses.com
Top 10 sap abap faqs-www.bigclasses.comTop 10 sap abap faqs-www.bigclasses.com
Top 10 sap abap faqs-www.bigclasses.com
 
SAP Logistics - CS - Standard Process & Configuration document
SAP Logistics - CS - Standard Process & Configuration documentSAP Logistics - CS - Standard Process & Configuration document
SAP Logistics - CS - Standard Process & Configuration document
 
Guide to Configure Custom SD Output Types in S/4HANA Using BRF+
Guide to Configure Custom SD Output Types in S/4HANA Using BRF+Guide to Configure Custom SD Output Types in S/4HANA Using BRF+
Guide to Configure Custom SD Output Types in S/4HANA Using BRF+
 
Sap abap tutorials
Sap abap tutorialsSap abap tutorials
Sap abap tutorials
 
Abap reports
Abap reportsAbap reports
Abap reports
 
Enhancement technique how to use validations
Enhancement technique how to use validationsEnhancement technique how to use validations
Enhancement technique how to use validations
 
Lsmw (Legacy System Migration Workbench)
Lsmw (Legacy System Migration Workbench)Lsmw (Legacy System Migration Workbench)
Lsmw (Legacy System Migration Workbench)
 
Abap package concept
Abap package conceptAbap package concept
Abap package concept
 
BPC 10.1 basics
BPC 10.1 basicsBPC 10.1 basics
BPC 10.1 basics
 
Sap FICO complete end user manual
Sap FICO complete end user manual Sap FICO complete end user manual
Sap FICO complete end user manual
 
Copa configuration
Copa configurationCopa configuration
Copa configuration
 
Sap abap-data structures and internal tables
Sap abap-data structures and internal tablesSap abap-data structures and internal tables
Sap abap-data structures and internal tables
 
Parallel accounting in sap erp account approachversus ledger approachin new g...
Parallel accounting in sap erp account approachversus ledger approachin new g...Parallel accounting in sap erp account approachversus ledger approachin new g...
Parallel accounting in sap erp account approachversus ledger approachin new g...
 
Sap abap real time questions
Sap abap real time questionsSap abap real time questions
Sap abap real time questions
 
PCA Configuration
PCA ConfigurationPCA Configuration
PCA Configuration
 

Similar to SAP Integration with Excel - Basic Guide

SYSTEM APPLICATION PRODUCTS AND DATA PROCESING
SYSTEM APPLICATION PRODUCTS AND DATA PROCESINGSYSTEM APPLICATION PRODUCTS AND DATA PROCESING
SYSTEM APPLICATION PRODUCTS AND DATA PROCESING
sivacristiano64
 
Integrating SAP and Low-Code Plaforms
Integrating SAP and Low-Code PlaformsIntegrating SAP and Low-Code Plaforms
Integrating SAP and Low-Code Plaforms
Warren Eiserman
 
SAP performance testing & engineering courseware v01
SAP performance testing & engineering courseware v01SAP performance testing & engineering courseware v01
SAP performance testing & engineering courseware v01
Argos
 
How to find user exits
How to find user exitsHow to find user exits
How to find user exits
Mohammed Shoeb
 
Open sap ui51_week_2_unit_3_acdt_exercises
Open sap ui51_week_2_unit_3_acdt_exercisesOpen sap ui51_week_2_unit_3_acdt_exercises
Open sap ui51_week_2_unit_3_acdt_exercises
vikram sukumar
 
What's New in Apache Spark 3.0 !!
What's New in Apache Spark 3.0 !!What's New in Apache Spark 3.0 !!
What's New in Apache Spark 3.0 !!
Aparup Chatterjee
 
User exits
User exitsUser exits
User exits
anilkv29
 
Sap integration by mule esb
Sap integration by mule esbSap integration by mule esb
Sap integration by mule esb
Son Nguyen
 
Thinking Beyond The Possibilities of SAP Event Management with SAP BRF+
Thinking Beyond The Possibilities of SAP Event Management with SAP BRF+Thinking Beyond The Possibilities of SAP Event Management with SAP BRF+
Thinking Beyond The Possibilities of SAP Event Management with SAP BRF+
Gopi Chandrakesan
 
Mule sap connector
Mule sap connectorMule sap connector
Mule sap connector
Son Nguyen
 
Variables in sap bi
Variables in sap biVariables in sap bi
Variables in sap bishabari76
 
SAP BI Generic Extraction Using a Function Module.pdf
SAP BI Generic Extraction Using a Function Module.pdfSAP BI Generic Extraction Using a Function Module.pdf
SAP BI Generic Extraction Using a Function Module.pdf
KoushikGuna
 
Sap Interview Questions - Part 1
Sap Interview Questions - Part 1Sap Interview Questions - Part 1
Sap Interview Questions - Part 1
ReKruiTIn.com
 
Fi enhancement technique how-to-guide on the usage of business transaction ...
Fi enhancement technique   how-to-guide on the usage of business transaction ...Fi enhancement technique   how-to-guide on the usage of business transaction ...
Fi enhancement technique how-to-guide on the usage of business transaction ...Kranthi Kumar
 
Fi enhancement technique how-to-guide on the usage of business transaction ...
Fi enhancement technique   how-to-guide on the usage of business transaction ...Fi enhancement technique   how-to-guide on the usage of business transaction ...
Fi enhancement technique how-to-guide on the usage of business transaction ...
Rajeev Kumar
 
Sap interface overview
Sap interface overviewSap interface overview
Sap interface overviewgnareshmbacwa
 
Performance and Sizing Guide - Analysis, edition for OLAP v0.2
Performance and Sizing Guide - Analysis, edition for OLAP v0.2Performance and Sizing Guide - Analysis, edition for OLAP v0.2
Performance and Sizing Guide - Analysis, edition for OLAP v0.2Mickey Wong
 
Custom Development of Enterprise Services
Custom Development of Enterprise ServicesCustom Development of Enterprise Services
Custom Development of Enterprise Services
Tobias Trapp
 

Similar to SAP Integration with Excel - Basic Guide (20)

SYSTEM APPLICATION PRODUCTS AND DATA PROCESING
SYSTEM APPLICATION PRODUCTS AND DATA PROCESINGSYSTEM APPLICATION PRODUCTS AND DATA PROCESING
SYSTEM APPLICATION PRODUCTS AND DATA PROCESING
 
Integrating SAP and Low-Code Plaforms
Integrating SAP and Low-Code PlaformsIntegrating SAP and Low-Code Plaforms
Integrating SAP and Low-Code Plaforms
 
SAP performance testing & engineering courseware v01
SAP performance testing & engineering courseware v01SAP performance testing & engineering courseware v01
SAP performance testing & engineering courseware v01
 
How to find user exits
How to find user exitsHow to find user exits
How to find user exits
 
Badi
BadiBadi
Badi
 
Open sap ui51_week_2_unit_3_acdt_exercises
Open sap ui51_week_2_unit_3_acdt_exercisesOpen sap ui51_week_2_unit_3_acdt_exercises
Open sap ui51_week_2_unit_3_acdt_exercises
 
What's New in Apache Spark 3.0 !!
What's New in Apache Spark 3.0 !!What's New in Apache Spark 3.0 !!
What's New in Apache Spark 3.0 !!
 
User exits
User exitsUser exits
User exits
 
Sap integration by mule esb
Sap integration by mule esbSap integration by mule esb
Sap integration by mule esb
 
Thinking Beyond The Possibilities of SAP Event Management with SAP BRF+
Thinking Beyond The Possibilities of SAP Event Management with SAP BRF+Thinking Beyond The Possibilities of SAP Event Management with SAP BRF+
Thinking Beyond The Possibilities of SAP Event Management with SAP BRF+
 
Mule sap connector
Mule sap connectorMule sap connector
Mule sap connector
 
Variables in sap bi
Variables in sap biVariables in sap bi
Variables in sap bi
 
SAP BI Generic Extraction Using a Function Module.pdf
SAP BI Generic Extraction Using a Function Module.pdfSAP BI Generic Extraction Using a Function Module.pdf
SAP BI Generic Extraction Using a Function Module.pdf
 
Sap Interview Questions - Part 1
Sap Interview Questions - Part 1Sap Interview Questions - Part 1
Sap Interview Questions - Part 1
 
Fi enhancement technique how-to-guide on the usage of business transaction ...
Fi enhancement technique   how-to-guide on the usage of business transaction ...Fi enhancement technique   how-to-guide on the usage of business transaction ...
Fi enhancement technique how-to-guide on the usage of business transaction ...
 
Fi enhancement technique how-to-guide on the usage of business transaction ...
Fi enhancement technique   how-to-guide on the usage of business transaction ...Fi enhancement technique   how-to-guide on the usage of business transaction ...
Fi enhancement technique how-to-guide on the usage of business transaction ...
 
Sap interface overview
Sap interface overviewSap interface overview
Sap interface overview
 
Performance and Sizing Guide - Analysis, edition for OLAP v0.2
Performance and Sizing Guide - Analysis, edition for OLAP v0.2Performance and Sizing Guide - Analysis, edition for OLAP v0.2
Performance and Sizing Guide - Analysis, edition for OLAP v0.2
 
sap
sap sap
sap
 
Custom Development of Enterprise Services
Custom Development of Enterprise ServicesCustom Development of Enterprise Services
Custom Development of Enterprise Services
 

More from Benedict Yong (杨腾翔)

Phillip Securities - Prime US REIT Corporate Presentation.pdf
Phillip Securities - Prime US REIT Corporate Presentation.pdfPhillip Securities - Prime US REIT Corporate Presentation.pdf
Phillip Securities - Prime US REIT Corporate Presentation.pdf
Benedict Yong (杨腾翔)
 
ERP Made Simple (preview)
ERP Made Simple (preview)ERP Made Simple (preview)
ERP Made Simple (preview)
Benedict Yong (杨腾翔)
 
ABAP/4 Mindmap!! - for busy functional consultants
ABAP/4 Mindmap!! - for busy functional consultantsABAP/4 Mindmap!! - for busy functional consultants
ABAP/4 Mindmap!! - for busy functional consultants
Benedict Yong (杨腾翔)
 
Practitioner perspective-erp-on-hana-and-fi-analytics 2015
Practitioner perspective-erp-on-hana-and-fi-analytics 2015Practitioner perspective-erp-on-hana-and-fi-analytics 2015
Practitioner perspective-erp-on-hana-and-fi-analytics 2015
Benedict Yong (杨腾翔)
 
SAP with Banking
SAP with BankingSAP with Banking
SAP with Banking
Benedict Yong (杨腾翔)
 
SAP PS Certification Overview (mindmap edition)
SAP PS Certification Overview (mindmap edition)SAP PS Certification Overview (mindmap edition)
SAP PS Certification Overview (mindmap edition)
Benedict Yong (杨腾翔)
 
SAP PP Certification Overview (mindmap edition)
SAP PP Certification Overview (mindmap edition)SAP PP Certification Overview (mindmap edition)
SAP PP Certification Overview (mindmap edition)
Benedict Yong (杨腾翔)
 
SAP S4 HANA Innovations
SAP S4 HANA InnovationsSAP S4 HANA Innovations
SAP S4 HANA Innovations
Benedict Yong (杨腾翔)
 
SAP MTS-To-COPA Flow Diagram
SAP MTS-To-COPA Flow DiagramSAP MTS-To-COPA Flow Diagram
SAP MTS-To-COPA Flow Diagram
Benedict Yong (杨腾翔)
 
SAP Account Determination Diagram
SAP Account Determination DiagramSAP Account Determination Diagram
SAP Account Determination Diagram
Benedict Yong (杨腾翔)
 
SAP COPA Integration overview
SAP COPA Integration overviewSAP COPA Integration overview
SAP COPA Integration overview
Benedict Yong (杨腾翔)
 
SAP S/4HANA Cloud
SAP S/4HANA CloudSAP S/4HANA Cloud
SAP S/4HANA Cloud
Benedict Yong (杨腾翔)
 
Highlevel Overview of S4 Improvements
Highlevel Overview of S4 ImprovementsHighlevel Overview of S4 Improvements
Highlevel Overview of S4 Improvements
Benedict Yong (杨腾翔)
 
SAP S4 HANA MM 1709 Overview (mindmap edition) Final
SAP S4 HANA MM 1709 Overview (mindmap edition) FinalSAP S4 HANA MM 1709 Overview (mindmap edition) Final
SAP S4 HANA MM 1709 Overview (mindmap edition) Final
Benedict Yong (杨腾翔)
 
SAP S4 HANA SD 1709 Overview (mindmap edition) Final
SAP S4 HANA SD 1709 Overview (mindmap edition) FinalSAP S4 HANA SD 1709 Overview (mindmap edition) Final
SAP S4 HANA SD 1709 Overview (mindmap edition) Final
Benedict Yong (杨腾翔)
 
SAP S4 HANA CO 1709 Overview (mindmap edition)
SAP S4 HANA CO 1709 Overview (mindmap edition)SAP S4 HANA CO 1709 Overview (mindmap edition)
SAP S4 HANA CO 1709 Overview (mindmap edition)
Benedict Yong (杨腾翔)
 
SAP S4 HANA FI 1610 Overview (mindmap edition)
SAP S4 HANA FI 1610 Overview (mindmap edition)SAP S4 HANA FI 1610 Overview (mindmap edition)
SAP S4 HANA FI 1610 Overview (mindmap edition)
Benedict Yong (杨腾翔)
 

More from Benedict Yong (杨腾翔) (17)

Phillip Securities - Prime US REIT Corporate Presentation.pdf
Phillip Securities - Prime US REIT Corporate Presentation.pdfPhillip Securities - Prime US REIT Corporate Presentation.pdf
Phillip Securities - Prime US REIT Corporate Presentation.pdf
 
ERP Made Simple (preview)
ERP Made Simple (preview)ERP Made Simple (preview)
ERP Made Simple (preview)
 
ABAP/4 Mindmap!! - for busy functional consultants
ABAP/4 Mindmap!! - for busy functional consultantsABAP/4 Mindmap!! - for busy functional consultants
ABAP/4 Mindmap!! - for busy functional consultants
 
Practitioner perspective-erp-on-hana-and-fi-analytics 2015
Practitioner perspective-erp-on-hana-and-fi-analytics 2015Practitioner perspective-erp-on-hana-and-fi-analytics 2015
Practitioner perspective-erp-on-hana-and-fi-analytics 2015
 
SAP with Banking
SAP with BankingSAP with Banking
SAP with Banking
 
SAP PS Certification Overview (mindmap edition)
SAP PS Certification Overview (mindmap edition)SAP PS Certification Overview (mindmap edition)
SAP PS Certification Overview (mindmap edition)
 
SAP PP Certification Overview (mindmap edition)
SAP PP Certification Overview (mindmap edition)SAP PP Certification Overview (mindmap edition)
SAP PP Certification Overview (mindmap edition)
 
SAP S4 HANA Innovations
SAP S4 HANA InnovationsSAP S4 HANA Innovations
SAP S4 HANA Innovations
 
SAP MTS-To-COPA Flow Diagram
SAP MTS-To-COPA Flow DiagramSAP MTS-To-COPA Flow Diagram
SAP MTS-To-COPA Flow Diagram
 
SAP Account Determination Diagram
SAP Account Determination DiagramSAP Account Determination Diagram
SAP Account Determination Diagram
 
SAP COPA Integration overview
SAP COPA Integration overviewSAP COPA Integration overview
SAP COPA Integration overview
 
SAP S/4HANA Cloud
SAP S/4HANA CloudSAP S/4HANA Cloud
SAP S/4HANA Cloud
 
Highlevel Overview of S4 Improvements
Highlevel Overview of S4 ImprovementsHighlevel Overview of S4 Improvements
Highlevel Overview of S4 Improvements
 
SAP S4 HANA MM 1709 Overview (mindmap edition) Final
SAP S4 HANA MM 1709 Overview (mindmap edition) FinalSAP S4 HANA MM 1709 Overview (mindmap edition) Final
SAP S4 HANA MM 1709 Overview (mindmap edition) Final
 
SAP S4 HANA SD 1709 Overview (mindmap edition) Final
SAP S4 HANA SD 1709 Overview (mindmap edition) FinalSAP S4 HANA SD 1709 Overview (mindmap edition) Final
SAP S4 HANA SD 1709 Overview (mindmap edition) Final
 
SAP S4 HANA CO 1709 Overview (mindmap edition)
SAP S4 HANA CO 1709 Overview (mindmap edition)SAP S4 HANA CO 1709 Overview (mindmap edition)
SAP S4 HANA CO 1709 Overview (mindmap edition)
 
SAP S4 HANA FI 1610 Overview (mindmap edition)
SAP S4 HANA FI 1610 Overview (mindmap edition)SAP S4 HANA FI 1610 Overview (mindmap edition)
SAP S4 HANA FI 1610 Overview (mindmap edition)
 

Recently uploaded

Taurus Zodiac Sign_ Personality Traits and Sign Dates.pptx
Taurus Zodiac Sign_ Personality Traits and Sign Dates.pptxTaurus Zodiac Sign_ Personality Traits and Sign Dates.pptx
Taurus Zodiac Sign_ Personality Traits and Sign Dates.pptx
my Pandit
 
Attending a job Interview for B1 and B2 Englsih learners
Attending a job Interview for B1 and B2 Englsih learnersAttending a job Interview for B1 and B2 Englsih learners
Attending a job Interview for B1 and B2 Englsih learners
Erika906060
 
Meas_Dylan_DMBS_PB1_2024-05XX_Revised.pdf
Meas_Dylan_DMBS_PB1_2024-05XX_Revised.pdfMeas_Dylan_DMBS_PB1_2024-05XX_Revised.pdf
Meas_Dylan_DMBS_PB1_2024-05XX_Revised.pdf
dylandmeas
 
Putting the SPARK into Virtual Training.pptx
Putting the SPARK into Virtual Training.pptxPutting the SPARK into Virtual Training.pptx
Putting the SPARK into Virtual Training.pptx
Cynthia Clay
 
3.0 Project 2_ Developing My Brand Identity Kit.pptx
3.0 Project 2_ Developing My Brand Identity Kit.pptx3.0 Project 2_ Developing My Brand Identity Kit.pptx
3.0 Project 2_ Developing My Brand Identity Kit.pptx
tanyjahb
 
Exploring Patterns of Connection with Social Dreaming
Exploring Patterns of Connection with Social DreamingExploring Patterns of Connection with Social Dreaming
Exploring Patterns of Connection with Social Dreaming
Nicola Wreford-Howard
 
Memorandum Of Association Constitution of Company.ppt
Memorandum Of Association Constitution of Company.pptMemorandum Of Association Constitution of Company.ppt
Memorandum Of Association Constitution of Company.ppt
seri bangash
 
Role of Remote Sensing and Monitoring in Mining
Role of Remote Sensing and Monitoring in MiningRole of Remote Sensing and Monitoring in Mining
Role of Remote Sensing and Monitoring in Mining
Naaraayani Minerals Pvt.Ltd
 
Business Valuation Principles for Entrepreneurs
Business Valuation Principles for EntrepreneursBusiness Valuation Principles for Entrepreneurs
Business Valuation Principles for Entrepreneurs
Ben Wann
 
Brand Analysis for an artist named Struan
Brand Analysis for an artist named StruanBrand Analysis for an artist named Struan
Brand Analysis for an artist named Struan
sarahvanessa51503
 
BeMetals Presentation_May_22_2024 .pdf
BeMetals Presentation_May_22_2024   .pdfBeMetals Presentation_May_22_2024   .pdf
BeMetals Presentation_May_22_2024 .pdf
DerekIwanaka1
 
Accpac to QuickBooks Conversion Navigating the Transition with Online Account...
Accpac to QuickBooks Conversion Navigating the Transition with Online Account...Accpac to QuickBooks Conversion Navigating the Transition with Online Account...
Accpac to QuickBooks Conversion Navigating the Transition with Online Account...
PaulBryant58
 
What is the TDS Return Filing Due Date for FY 2024-25.pdf
What is the TDS Return Filing Due Date for FY 2024-25.pdfWhat is the TDS Return Filing Due Date for FY 2024-25.pdf
What is the TDS Return Filing Due Date for FY 2024-25.pdf
seoforlegalpillers
 
Cree_Rey_BrandIdentityKit.PDF_PersonalBd
Cree_Rey_BrandIdentityKit.PDF_PersonalBdCree_Rey_BrandIdentityKit.PDF_PersonalBd
Cree_Rey_BrandIdentityKit.PDF_PersonalBd
creerey
 
April 2024 Nostalgia Products Newsletter
April 2024 Nostalgia Products NewsletterApril 2024 Nostalgia Products Newsletter
April 2024 Nostalgia Products Newsletter
NathanBaughman3
 
falcon-invoice-discounting-a-premier-platform-for-investors-in-india
falcon-invoice-discounting-a-premier-platform-for-investors-in-indiafalcon-invoice-discounting-a-premier-platform-for-investors-in-india
falcon-invoice-discounting-a-premier-platform-for-investors-in-india
Falcon Invoice Discounting
 
chapter 10 - excise tax of transfer and business taxation
chapter 10 - excise tax of transfer and business taxationchapter 10 - excise tax of transfer and business taxation
chapter 10 - excise tax of transfer and business taxation
AUDIJEAngelo
 
Cracking the Workplace Discipline Code Main.pptx
Cracking the Workplace Discipline Code Main.pptxCracking the Workplace Discipline Code Main.pptx
Cracking the Workplace Discipline Code Main.pptx
Workforce Group
 
Improving profitability for small business
Improving profitability for small businessImproving profitability for small business
Improving profitability for small business
Ben Wann
 
Digital Transformation in PLM - WHAT and HOW - for distribution.pdf
Digital Transformation in PLM - WHAT and HOW - for distribution.pdfDigital Transformation in PLM - WHAT and HOW - for distribution.pdf
Digital Transformation in PLM - WHAT and HOW - for distribution.pdf
Jos Voskuil
 

Recently uploaded (20)

Taurus Zodiac Sign_ Personality Traits and Sign Dates.pptx
Taurus Zodiac Sign_ Personality Traits and Sign Dates.pptxTaurus Zodiac Sign_ Personality Traits and Sign Dates.pptx
Taurus Zodiac Sign_ Personality Traits and Sign Dates.pptx
 
Attending a job Interview for B1 and B2 Englsih learners
Attending a job Interview for B1 and B2 Englsih learnersAttending a job Interview for B1 and B2 Englsih learners
Attending a job Interview for B1 and B2 Englsih learners
 
Meas_Dylan_DMBS_PB1_2024-05XX_Revised.pdf
Meas_Dylan_DMBS_PB1_2024-05XX_Revised.pdfMeas_Dylan_DMBS_PB1_2024-05XX_Revised.pdf
Meas_Dylan_DMBS_PB1_2024-05XX_Revised.pdf
 
Putting the SPARK into Virtual Training.pptx
Putting the SPARK into Virtual Training.pptxPutting the SPARK into Virtual Training.pptx
Putting the SPARK into Virtual Training.pptx
 
3.0 Project 2_ Developing My Brand Identity Kit.pptx
3.0 Project 2_ Developing My Brand Identity Kit.pptx3.0 Project 2_ Developing My Brand Identity Kit.pptx
3.0 Project 2_ Developing My Brand Identity Kit.pptx
 
Exploring Patterns of Connection with Social Dreaming
Exploring Patterns of Connection with Social DreamingExploring Patterns of Connection with Social Dreaming
Exploring Patterns of Connection with Social Dreaming
 
Memorandum Of Association Constitution of Company.ppt
Memorandum Of Association Constitution of Company.pptMemorandum Of Association Constitution of Company.ppt
Memorandum Of Association Constitution of Company.ppt
 
Role of Remote Sensing and Monitoring in Mining
Role of Remote Sensing and Monitoring in MiningRole of Remote Sensing and Monitoring in Mining
Role of Remote Sensing and Monitoring in Mining
 
Business Valuation Principles for Entrepreneurs
Business Valuation Principles for EntrepreneursBusiness Valuation Principles for Entrepreneurs
Business Valuation Principles for Entrepreneurs
 
Brand Analysis for an artist named Struan
Brand Analysis for an artist named StruanBrand Analysis for an artist named Struan
Brand Analysis for an artist named Struan
 
BeMetals Presentation_May_22_2024 .pdf
BeMetals Presentation_May_22_2024   .pdfBeMetals Presentation_May_22_2024   .pdf
BeMetals Presentation_May_22_2024 .pdf
 
Accpac to QuickBooks Conversion Navigating the Transition with Online Account...
Accpac to QuickBooks Conversion Navigating the Transition with Online Account...Accpac to QuickBooks Conversion Navigating the Transition with Online Account...
Accpac to QuickBooks Conversion Navigating the Transition with Online Account...
 
What is the TDS Return Filing Due Date for FY 2024-25.pdf
What is the TDS Return Filing Due Date for FY 2024-25.pdfWhat is the TDS Return Filing Due Date for FY 2024-25.pdf
What is the TDS Return Filing Due Date for FY 2024-25.pdf
 
Cree_Rey_BrandIdentityKit.PDF_PersonalBd
Cree_Rey_BrandIdentityKit.PDF_PersonalBdCree_Rey_BrandIdentityKit.PDF_PersonalBd
Cree_Rey_BrandIdentityKit.PDF_PersonalBd
 
April 2024 Nostalgia Products Newsletter
April 2024 Nostalgia Products NewsletterApril 2024 Nostalgia Products Newsletter
April 2024 Nostalgia Products Newsletter
 
falcon-invoice-discounting-a-premier-platform-for-investors-in-india
falcon-invoice-discounting-a-premier-platform-for-investors-in-indiafalcon-invoice-discounting-a-premier-platform-for-investors-in-india
falcon-invoice-discounting-a-premier-platform-for-investors-in-india
 
chapter 10 - excise tax of transfer and business taxation
chapter 10 - excise tax of transfer and business taxationchapter 10 - excise tax of transfer and business taxation
chapter 10 - excise tax of transfer and business taxation
 
Cracking the Workplace Discipline Code Main.pptx
Cracking the Workplace Discipline Code Main.pptxCracking the Workplace Discipline Code Main.pptx
Cracking the Workplace Discipline Code Main.pptx
 
Improving profitability for small business
Improving profitability for small businessImproving profitability for small business
Improving profitability for small business
 
Digital Transformation in PLM - WHAT and HOW - for distribution.pdf
Digital Transformation in PLM - WHAT and HOW - for distribution.pdfDigital Transformation in PLM - WHAT and HOW - for distribution.pdf
Digital Transformation in PLM - WHAT and HOW - for distribution.pdf
 

SAP Integration with Excel - Basic Guide

  • 1. 1 SAP integration with Excel - 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 guid e 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 ac curacy 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.
  • 2. SAP Excel Integration 2 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
  • 3. SAP Excel Integration 3 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. Base on the above, we will design a simple proof of concept. Step 1: This is the Sales Order in SAP screen that will be retrieved into Excel format. Step 2: This is the Excel Sales Order Retrieval screen, to be populated with Sales Order information.
  • 4. SAP Excel Integration 4 Step 3: This is the Excel Screen after Sales Order information has retrieved from SAP.
  • 5. SAP Excel Integration 5 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. 3-Tier Model-View-Controller Framework In the 3-Tier MVC Framework, there are  View/ Interface:The role focuseson userinteraction;collectinganddisplayinginformation. Inour specificcase,thiswill be ourExcel anditsembeddedVBA.  Controller:The role focusesontransmittingandmanipulationof information. Inourspecificcase, thiswill be ourSAPRFC FunctionModule.  Model:The role focusesondata storage and itsrelatedprocesses. Inourspecificcase,thiswillbe the underlyingDatabase. This document will now be divided into 2 sections:  Preparatory work in RFC FM – this explains how the Controller of the architecture is coded.  Preparatory work in Excel VBA – this explains how the View/Interface of the architecture is scripted.
  • 6. SAP Excel Integration 6 Preparatory work in RFC FM The purpose of RFC FM/BAPI is to read sales header and line items data from SAP backend. 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) Note: the FM must be “Remote-Enabled” Note: full code at appendix.
  • 7. SAP Excel Integration 7 Function Module Unit Testing is as per expectation. Sales Order 401004151 is retrieved with its header information and 3 line items.
  • 8. SAP Excel Integration 8 Preparatory work in Excel VBA To be able to perform scripting in Excel VBA, the Developer Tab needs to be turned on. Once turned on, user interface controls such as buttons, checkbox, text field can be used.
  • 9. SAP Excel Integration 9 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.
  • 10. SAP Excel Integration 10 To attach VBA codes to the button, we need to access the “Assign Macro” context menu item. Once selected, the VBA editor will be accessible.
  • 11. SAP Excel Integration 11 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.
  • 12. SAP Excel Integration 12 The start of the script is to instantiate ActiveX Components “SAP LogonControl.1” and “SAP.Functions”. The actual function call to “ZZZ_SO_BAPI” is as per below. Note: full script at appendix.
  • 13. SAP Excel Integration 13 Integration & Testing With both the Excel VBA scripting and SAP RFC FM coding completed, we can perform end-to-end testing. Testing within SAP end Testing at Excel end
  • 14. SAP Excel Integration 14 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.
  • 15. SAP Excel Integration 15 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 *"---------------------------------------------------------------------- CALL FUNCTION 'BAPI_SALESORDER_GETDETAILBOS' EXPORTING salesdocument = salesdocument IMPORTING orderheader = orderheader TABLES orderitems = orderitems. SELECT SINGLE name1 FROM kna1 INTO orderheader-sold_to WHERE kunnr = orderheader-sold_to. ENDFUNCTION.
  • 16. SAP Excel Integration 16 Full Excel VBA Scripting Sub Button1_Click() '--------------------------------- ' Declaration. '--------------------------------- Dim LogonControl As SAPLogonCtrl.SAPLogonControl Dim R3Connection As SAPLogonCtrl.Connection Dim TableFactory As SAPTableFactory Dim Functions As SAPFunctionsOCX.SAPFunctions Dim objBAPIControl As Object Dim oWB As Workbook Dim oST As Worksheet Set oWB = Application.ActiveWorkbook Set oST = oWB.Worksheets(1) '--------------------------------- ' Initialize SAP ActiveX Control. '--------------------------------- Set LogonControl = CreateObject("SAP.LogonControl.1") Set R3Connection = LogonControl.NewConnection Dim objBAPIControl As Object Set objBAPIControl = CreateObject("SAP.Functions") '-------------------- ' Logon with prompt. '-------------------- R3Connection.Client = "100" 'as per SAP Logon Pad R3Connection.System = "SID" 'as per SAP Logon Pad R3Connection.SystemNumber = "00" 'as per SAP Logon Pad R3Connection.ApplicationServer = "XX.XX.XX.XX" 'as per SAP Logon Pad R3Connection.User = "sapidx" 'as per SAP Logon Pad R3Connection.Password = "sapid-passwdx" 'as per SAP Logon Pad Application.StatusBar = "Start of Logging in" SY_Subrc = R3Connection.Logon(0, SilentLogon) If SY_Subrc <> True Then MsgBox "Logon failed": Exit Sub Application.StatusBar = "Login Successful" Set objBAPIControl.Connection = R3Connection '--------------------------------- ' Retrieve a sales order. '---------------------------------
  • 17. SAP Excel Integration 17 Dim vRow, vCol As Integer Dim vStr As Integer Dim vMax, vIdx As Integer Dim oSearch As String Dim oInfo As Object Dim oTabl As Object oSearch = Cells(4, 4).Value Set oBAPI = objBAPIControl.Add("ZZZ_SO_BAPI") oBAPI.Exports("SALESDOCUMENT") = oSearch Set oInfo = oBAPI.Imports("ORDERHEADER") Set oTabl = oBAPI.Tables("ORDERITEMS") Application.StatusBar = "Perform SAP Call" SY_Subrc = oBAPI.Call If SY_Subrc <> True Then MsgBox "Call failed": Exit Sub Application.StatusBar = "Perform SAP Call Successful" oST.Cells(6, 4).Value = oInfo.Value("SOLD_TO") oST.Cells(7, 4).Value = Trim(oInfo.Value("PURCH_NO")) vMax = oTabl.Rows.Count vCol = 3: vStr = 9 For vIdx = 1 To vMax vRow = vStr + vIdx oST.Cells(vRow, vCol + 0) = oTabl.Value(vIdx, "ITM_NUMBER") oST.Cells(vRow, vCol + 1) = oTabl.Value(vIdx, "MATERIAL") oST.Cells(vRow, vCol + 2) = Trim(oTabl.Value(vIdx, "NET_VALUE")) oST.Cells(vRow, vCol + 3) = Trim(oTabl.Value(vIdx, "SHORT_TEXT")) Next vIdx '----------------------------------- ' Logoff SAP and close the control. '----------------------------------- R3Connection.Logoff Set LogonControl = Nothing Set objBAPIControl = Nothing End Sub
  • 18. SAP Excel Integration 18 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). He holds a Bachelor of Management and a Diploma in IT. He has worked in Banking, Retail and Manufacturing industries, playing both in-house and external consultant role. He is situated in Singapore and is bilingual in English and Mandarin. He can be contacted at benytx@gmail.com. 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
  • 19. SAP Excel Integration 19 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 3. SAP SDN – Common export parameter issues https://blogs.sap.com/2014/04/27/activex-component-sapfunctions-with-export-parameter-string/ https://answers.sap.com/questions/529288/datatype-problem-with-sap-gui-75-pl5-unicode-activ.html https://answers.sap.com/questions/10222185/activex-component-sapfunctions-with-export- paramet.html