Excel VBA Connect SAPRFC
Excel VBA Connect SAPRFC
Easy way to learn excel macros and follow step by step instruction.
This is simple and you don't have to install those development tools to
run the code. Is just required Microsoft excel you can connect into your
SAP R/3. No other tools required, no need the extra software installed
and mainly is using Excel VBA run the code and you able to
retrieve/import data on your SAP R/3 data.
Required item:
1. Microsoft excel.
2. SAP Login id and password.
3. SAP program with remote function call. I will show your my
customized RFC coding in my SAP ABAP. The RFC program name
is "ZMM_PRPORS"
4. SAP Gui installed
One more setting you have to do before start the coding. You have to
add SAP reference below:
Este sitio utiliza cookies de Google para prestar sus servicios y para
analizar su tráfico. Tu dirección IP y user-agent se comparten con
Google, junto con las métricas de rendimiento y de seguridad, para
garantizar la calidad del servicio, generar estadísticas de uso y
detectar y solucionar abusos. 2. Go to Tools ->
References
MÁS INFORMACIÓN ACEPTAR
https://macrostutorials.blogspot.com/2017/08/excel-vba-connect-saprfc.html 1/14
3/15/2021 Excel VBA connect SAPRFC
Please ll in your SAP ip address, client, system id, system number, SAP
user id and password. Make sure you have the correct info in SAP
Esteconnection.
sitio utiliza cookies de Google para prestar sus servicios y para
analizar su tráfico. Tu dirección IP y user-agent se comparten con
Google, junto con las métricas de rendimiento y de seguridad, para
___________________________________________________
garantizar la calidad del servicio, generar estadísticas de uso y
detectar y solucionar abusos.
Option Explicit
MÁS INFORMACIÓN ACEPTAR
Di bjBAPIC t l bjG td t A Obj t
https://macrostutorials.blogspot.com/2017/08/excel-vba-connect-saprfc.html 2/14
3/15/2021 Excel VBA connect SAPRFC
Dim objBAPIControl, objGetdata As Object
'Local variables
'Set Connection
https://macrostutorials.blogspot.com/2017/08/excel-vba-connect-saprfc.html 3/14
3/15/2021 Excel VBA connect SAPRFC
R3Connection.ApplicationServer = "xxxxxx"
R3Connection.Language = "EN"
R3Connection.User = "<userid>"
R3Connection.Password = "<password>"
R3Connection.System = "DEV"
R3Connection.SystemNumber = "00"
R3Connection.UseSAPLogonIni = False
SilentLogon = False
objBAPIControl.Connection = R3Connection
objinput.Rows.Add
vcount_add = objausp.Rows.Count
Next index_add
vcount_add = objt16fs.Rows.Count
Este sitio utiliza cookies de Google para prestar sus servicios y para
Do su
analizar While Right(ActiveSheet.Cells(1,
tráfico. Tu dirección vCols),
IP 2)y <>
user-agent se comparten con
objt16fs.Value(index_add,
Google, "FRGSX")
junto con las métricas de rendimiento y de seguridad, para
garantizar la= vCols
vCols calidad
+ 1 del servicio, generar estadísticas de uso y
detectar
Loop y solucionar abusos.
If Right(ActiveSheet.Cells(1, vCols), 2) = objt16fs.Value(index_add,
MÁS INFORMACIÓN ACEPTAR
"FRGSX") Then
https://macrostutorials.blogspot.com/2017/08/excel-vba-connect-saprfc.html 7/14
3/15/2021 Excel VBA connect SAPRFC
FRGSX ) Then
ActiveSheet.Cells(2, vCols) = objt16fs.Value(index_add, "FRGXT")
'Value
ActiveSheet.Cells(3, vCols) = objt16fs.Value(index_add, "FRGSX")
'Value
ActiveSheet.Cells(5, vCols) = objt16fs.Value(index_add, "FRGC1")
'Value
ActiveSheet.Cells(6, vCols) = objt16fs.Value(index_add, "FRGC2")
'Value
ActiveSheet.Cells(7, vCols) = objt16fs.Value(index_add, "FRGC3")
'Value
ActiveSheet.Cells(8, vCols) = objt16fs.Value(index_add, "FRGC4")
'Value
ActiveSheet.Cells(9, vCols) = objt16fs.Value(index_add, "FRGC5")
'Value
End If
Next index_add
Else
End If
R3Connection.Logoff
Este sitio utiliza cookies de Google para prestar sus servicios y para
analizar
End Subsu tráfico. Tu dirección IP y user-agent se comparten con
Google, junto con las métricas de rendimiento y de seguridad, para
garantizar la calidad del servicio, generar estadísticas de uso y
detectar y solucionar abusos.
Private Sub ResetOutput_Click()
MÁS INFORMACIÓN ACEPTAR
R ("B1 XFD159") S l t
https://macrostutorials.blogspot.com/2017/08/excel-vba-connect-saprfc.html 8/14
3/15/2021 Excel VBA connect SAPRFC
Range("B1:XFD159").Select
Selection.ClearContents
Range("L162:L164").Select
Selection.ClearContents
End Sub
EsteET_AUSP_LIST - This is
sitio utiliza SAP AUSPde
cookies table. Use t-code
Google paraSE11 to create sus servicios y para
prestar
analizar su tráfico. Tu dirección IP y user-agent se comparten con
structure.
Google, junto con las métricas de rendimiento y de seguridad, para
garantizar la calidad del servicio, generar estadísticas de uso y
detectar y solucionar abusos.
MÁS INFORMACIÓN ACEPTAR
https://macrostutorials.blogspot.com/2017/08/excel-vba-connect-saprfc.html 9/14
3/15/2021 Excel VBA connect SAPRFC
EsteRFC Coding:
sitio utiliza cookies de Google para prestar sus servicios y para
analizar su tráfico. Tu dirección IP y user-agent se comparten con
_______________________________________________________________________
Google, junto
_______ con las métricas de rendimiento y de seguridad, para
garantizar la calidad del servicio, generar estadísticas de uso y
detectar y solucionar abusos.
FUNCTION ZMM_PRPORS.
MÁS INFORMACIÓN ACEPTAR
*"----------------------------------------------------------
https://macrostutorials.blogspot.com/2017/08/excel-vba-connect-saprfc.html 10/14
3/15/2021 Excel VBA connect SAPRFC
------------
*"*"Local Interface:
*" TABLES
*" ET_AUSP_LIST STRUCTURE ZMM_AUSP_LIST
*" ET_T16FS STRUCTURE ZMM_T16FS_LIST
*" ET_OBJEK STRUCTURE ZAUS_OBJNUM
*"----------------------------------------------------------
------------
DATA: DESC LIKE T16FT-FRGXT.
IF NOT ET_OBJEK[] IS INITIAL.
SELECT OBJEK
ATINN
ATZHL
MAFID
KLART
ADZHL
ATWRT
ATFLV
ATAWE
ATFLB
ATAW1
ATCOD
INTO TABLE ET_AUSP_LIST
FROM AUSP
WHERE OBJEK IN ET_OBJEK.
IF sy-subrc <> 0.
Clear: et_AUSP_list.
ELSE.
Sort et_ausp_list by OBJEK ATINN ATWRT.
ENDIF.
Este
sitioSELECT * INTO CORRESPONDING
utiliza FIELDS OF
cookies de Google TABLE
para ET_T16FS
prestar sus servicios y para
analizar su tráfico.
FROM T16FS Tu dirección IP y user-agent se comparten con
Google,
junto con las métricas de rendimiento y de seguridad, para
FOR ALL ENTRIES IN et_AUSP_List
garantizar la calidad del servicio, generar estadísticas de uso y
WHERE FRGGR EQ et_AUSP_List-objek(2)
detectar y solucionar abusos.
AND FRGSX EQ et_AUSP_List-objek+2(2).
MÁS INFORMACIÓN ACEPTAR
https://macrostutorials.blogspot.com/2017/08/excel-vba-connect-saprfc.html 11/14
3/15/2021 Excel VBA connect SAPRFC
IF SY-SUBRC EQ 0.
LOOP AT ET_T16FS.
SELECT SINGLE FRGXT INTO DESC
FROM T16FT
WHERE FRGGR EQ ET_T16FS-FRGGR
AND FRGSX EQ ET_T16FS-FRGSX.
ENDIF.
ENDIF.
ENDFUNCTION.
REPLY
REPLY
REPLY
READ MORE
https://macrostutorials.blogspot.com/2017/08/excel-vba-connect-saprfc.html 13/14
3/15/2021 Excel VBA connect SAPRFC
READ MORE
Powered by Blogger
Cookie Consent
Macros Tutorial
How to protect Macros code
Video Tutorial
Other Macros Tutorial
1. Variable
2. Other Variable Types
3. Condition
4. Looping Statement
5. Procedure
Report abuse
Followers
Seguidores (0)
Seguir
Este sitio utiliza cookies de Google para prestar sus servicios y para
analizar su tráfico. Tu dirección IP y user-agent se comparten con
Google, junto con las métricas de rendimiento y de seguridad, para
garantizar la calidad del servicio, generar estadísticas de uso y
detectar y solucionar abusos.
MÁS INFORMACIÓN ACEPTAR
https://macrostutorials.blogspot.com/2017/08/excel-vba-connect-saprfc.html 14/14