on 01-15-2014 6:00 PM
Hello,
I have a problem when I try to connect with SAP, please see my code below
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SAP.Middleware.Connector;
public partial class _Default : System.Web.UI.Page
{
public class MyBackendConfig : IDestinationConfiguration
{
public RfcConfigParameters GetParameters(String destinationName)
{
if ("SE38".Equals(destinationName))
{
RfcConfigParameters parms = new RfcConfigParameters();
parms.Add(RfcConfigParameters.AppServerHost, "192.168.16.75");
parms.Add(RfcConfigParameters.SystemNumber, "00");
parms.Add(RfcConfigParameters.User, "ssanchez");
parms.Add(RfcConfigParameters.Password, "SAPLSC001");
parms.Add(RfcConfigParameters.Client, "200");
parms.Add(RfcConfigParameters.Language, "ES");
parms.Add(RfcConfigParameters.PoolSize, "5");
parms.Add(RfcConfigParameters.MaxPoolSize, "10");
parms.Add(RfcConfigParameters.IdleTimeout, "600");
return parms;
}
else return null;
}
public bool ChangeEventsSupported()
{
return false;
}
public event RfcDestinationManager.ConfigurationChangeHandler ConfigurationChanged;
}
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
RfcDestination prd = RfcDestinationManager.GetDestination("SE38");
RfcRepository repo = prd.Repository;
IRfcFunction companyBapi1 = repo.CreateFunction("ZREGRESAVAR");
companyBapi1.Invoke(prd);
string Dato = companyBapi1.GetValue("DATO").ToString();
}
}
But when I run my webpage, I get this error:
Anyone knows how can I solve this?
Everything looks right. The only thing that looks peculiar to me is the following statement:
if ("SE38".Equals(destinationName))
Try this instead:
if (destinationName.Equals("SE38"))
I'm not sure why that would matter, but like I said, it's the only thing that jumps out at me looking at your code.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.