cancel
Showing results for 
Search instead for 
Did you mean: 

No DestinationConfiguration registered

Former Member
0 Kudos

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?

Accepted Solutions (1)

Accepted Solutions (1)

former_member197445
Contributor
0 Kudos

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.

Former Member
0 Kudos

Hello,

I have do that and I have the same problem, please see image below

Have you got any example that works well? I know you are very good in this topic.

former_member197445
Contributor
0 Kudos

Now I see the problem:

After declaring "cn" as new MyBackendConfig, you must register the destination:

RfcDestinationManager.RegisterDestinationConfiguration(cn)

Former Member
0 Kudos

OMG!!! thanks for u help, I love u very much (and I'm not gay) I knew you were good at this.

Thanks again, u are very good developer, You have saved my life.

former_member197445
Contributor
0 Kudos

Ha!  Nice to be loved!  You're welcome.

Answers (0)