Tema: SAP y .NET
Ver Mensaje Individual
  #2  
Viejo 01/03/07, 20:11:57
manuelachetigue manuelachetigue is offline
Junior Member
 
Fecha de Ingreso: feb 2007
Localización: Mexico
Mensajes: 21
Anteriormente yo hacia las conexiones vía WEB por medio de este tipo de códigos
<% Public Sub ConexionSap() 'Conexion a SAP
Set Session("oLogon") = Server.CreateObject("SAP.Logoncontrol.1")
Set Session("oConnection") = Session("oLogon").NewConnection
Session("oConnection").ApplicationServer = ""
Session("oConnection").System = "00"
Session("oConnection").Client = "010"
Session("oConnection").User = ""
Session("oConnection").Password = ""
Session("oConnection").Language = "ES"

If not Session("oConnection").Logon(0 , true) Then 'Despliega ventana
Response.WRITE "NO HAY COMUNICACION CON SAP, VERIFIQUE ENTRADAS!!!"
SESSION("oConnection").logoff
End If
end sub
%>
siempre los valores deben de ir en comillas dobles..
y para llamar la RFC o BAPI se hace a través de:
<%
CALL CONEXIONSAP()
'************************** Declaracion de variables ******************************'
dim Functions
dim GpoClientes
dim GpoC
dim Func
dim Row
dim i
dim Rows

'********* Llamada al RFC (ZRFC_DEMO) *********'
Set Functions = CreateObject("SAP.Functions")
Set Functions.Connection = Session("oConnection")
Functions.Autologon = true
Functions.LogFileName = "c:\tmp\table+viewlog.txt"
Functions.LogLevel = 8

Set Func = Functions.Add("ZRFC_DEMO")
Func.Exports("KUNNR") = Request.Form ("fldcvecliente")
Func.Exports("NAME1") = Request.form ("fldnombrecliente")

If Func.Call <> True Then
Response.Write "ERROR en llamada para recuperar los datos del cliente. Excepcion " + Func.exception
else
Set GpoClientes = Func.Tables
Set GpoC = GpoClientes("T_CTES")
Set Row = GpoC.Rows()
End If
%>

<%
Dim TotCols
Dim TabType
Dim Bytes
Dim TotRec

TotRec = GpoC.RowCount ' Get the total records from the table object
TotCols = Gpo.ColumnCount

%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
<title>TEST RFC UTILITIES</title>
</head>

<BODY BGCOLOR="WHITE" BOTTOMMARGIN="0" LEFTMARGIN="0" TOPMARGIN="0" MARGINWIDTH="0" MARGINHEIGHT="0">
<P>
<TABLE BORDER="1" WIDTH="90%" CELLSPACING="0" CELLPADDING="0" ALIGN="CENTER">
<TR>
<td>Num. Cliente</TD>
<td>Nombre Cliente</td>
</TABLE>
<table border=1>
<% for i = 1 to TotRec
set Rows = GpoMat.Rows(i) 'Get the material group
%>
<TD><%= Rows("kunnr") %> <%= "name1" %></TD>

<% next %>
</TABLE>
<DIV ALIGN="center"><INPUT TYPE="submit" NAME="cmdSubmit" VALUE="Procesar">
<INPUT TYPE="Reset" VALUE="Cancelar">
</BODY>
</html>

ESPERO y esto te sirva como base... si tienes dudas puedes contactarme por correo a
Responder Con Cita