Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

How to connect to RfcDestinationManager from inside function

Hello,

Nowadays I have this:

   [WebMethod]

    public string ZPKG_IMPRIMEETIQUETA001(string P_PESO, string P_WERKS, string P_ROLLO, string P_PAPEL)

    {

        RfcDestination prd;

        string P_RESULT;

        ECCDestinationConfig onk1 = new ECCDestinationConfig();

        onk1.compruebaconection();

        prd = RfcDestinationManager.GetDestination("QAS");

        try

        {

            RfcDestinationManager.RegisterDestinationConfiguration(new ECCDestinationConfig());

        }

        catch

        {

        }

        try

        {

            RfcRepository repo = prd.Repository;

            IRfcFunction companyBapi = repo.CreateFunction("ZPKG_IMPRIMEETIQUETA001");

            companyBapi.SetValue("P_PESO", P_PESO);

            companyBapi.SetValue("P_WERKS", P_WERKS);

            companyBapi.SetValue("P_ROLLO", P_ROLLO);

            companyBapi.SetValue("P_PAPEL", P_PAPEL);

            companyBapi.Invoke(prd);

            P_RESULT = companyBapi.GetValue("P_RESULT").ToString();

            return P_RESULT.ToString();

        }

        catch (Exception exa)

        {

            P_RESULT = "Error en el Web Services";

            return P_RESULT;

           // return null;

        }

    }

In the line 12 I set the parameters for connection like this:   prd = RfcDestinationManager.GetDestination("QAS"); But I want to set the parameters without a function from a class, I want Set parameters directly.

Do you know How Can I do this?

Thanks and Regards.

Former Member
Not what you were looking for? View more on this topic or Ask a question