MUNDOSAP

Regresar   MUNDOSAP > DESARROLLO > Programación ABAP IV
Nombre de Usuario
Contraseña
Home Descargas Registrar FAQ Miembros Calendario Buscar Temas de Hoy Marcar Foros Como Leídos




 
Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Viejo 05/10/06, 13:00:31
sorgin sorgin is offline
Junior Member
 
Fecha de Ingreso: oct 2006
Mensajes: 2
Llamada a función RFC

Alguién me podría mandar un ejemplo de una llamada a una RFC desde un excel, desde Visual Basic...???

Muchas gracias.
Responder Con Cita
  #2  
Viejo 05/10/06, 13:14:03
Aottone Aottone is offline
Junior Member
 
Fecha de Ingreso: may 2006
Mensajes: 7
Ejemplo Funcion RFC desde macro de Excel

Aca tienes un ejemplo de llamada a una función RFC desde una macro de Excel.
Saludos


Public oR3, oConnection, oMyFunc As Object
Public oSTORE, otI_HEADER, otI_ITEMS As Object

Public Result As Boolean

Public mApplicationServer As String 'Application Server of the R/3 System.
Public mSystem As String ' SAP R/3 System name.
Public mSystemNumber As Long ' System number of the R/3 System.
Public mClient As Long ' Client in the R/3 System.
Public mLanguage As String ' Language you use want to use in the R/3 System
Public mSAPRouter As String
Public mUserId As String
Public mPassword As String

Sub Logon()
'*********************************************
'Logon al sistema SAP R/3
'*********************************************

Set oR3 = Nothing
Set oR3 = CreateObject("SAP.Functions")

' Cargar los parametros de conexion
Set oConnection = oR3.Connection

oConnection.ApplicationServer = "xxx.xxx.x.xxx"
oConnection.System = "DEV"
oConnection.SystemNumber = "00"
oConnection.Client = "100"
oConnection.Language = "ES"
'oConnection.SAPRouter = "/H/xxx.xxx.xx.xx/H/"
oConnection.User = "xxxxxxxx"
oConnection.Password = "xxxx"


'Set App = R3.Application
If oConnection.Logon(0, True) <> True Then
oConnection.SAPRouter = "/H/xxx.xxx.xx.xx/H/"
If oConnection.Logon(0, True) <> True Then
MsgBox "No se puedo establecer conexión SAP"
Exit Sub
End If
End If
End Sub


'*********************************************
'Logon al sistema SAP R/3
'*********************************************

'Set App = R3.Application
If oConnection.IsConnected = 0 Then
MsgBox "No existe conexión SAP establecida, se conectara"
Logon
End If

' Establecer contacto con la funcion.
Set oMyFunc = oR3.Add("ZFUNCION_RFC")
Set oSTORE = oMyFunc.Exports("STORE")
Set otI_HEADER = oMyFunc.Exports("I_HEADER")
Set otI_ITEMS = oMyFunc.Tables("I_ITEMS")
oSTORE.Value = "xxxx"
Call GenerarI_HEADER
Call GenerarTablaI_ITEMS

' Llamar a la funcion de SAP.
Result = oMyFunc.Call

' Analizar el resultado de la llamada.
If Result = False Then
MsgBox "Error en el llamado a la funcion RFC: ZFUNCION_RFC"
Else
MsgBox "Funcion RFC ejecutada OK."
End If

'*********************************************
'Clear de Objetos de parametros
'*********************************************
Set oSTORE = Nothing
Set otI_HEADER = Nothing
Set otI_ITEMS = Nothing

End Sub
Responder Con Cita
Respuesta


Herramientas Buscar en Tema
Buscar en Tema:

Búsqueda Avanzada
Desplegado

Reglas de Mensajes
no puedes crear nuevos temas
no puedes responder temas
no puedes adjuntar archivos
no puedes editar tus mensajes

El código vB está On
Las caritas están On
Código [IMG] está On
Código HTML está Off
Saltar a Foro


Husos Horarios son GMT. La hora en este momento es 17:56:59.


www.mundosap.com 2006 - Spain
software crm, crm on demand, software call center, crm act, crm solutions, crm gratis, crm web