cancel
Showing results for 
Search instead for 
Did you mean: 

How to connect to RfcDestinationManager from inside function

Former Member
0 Kudos

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.

Accepted Solutions (0)

Answers (1)

Answers (1)

hynek_petrak
Active Participant
0 Kudos

What do you mean by setting parameters directly?

Btw. you shall move line 12.

prd = RfcDestinationManager.GetDestination("QAS"); 

to line 28.