cancel
Showing results for 
Search instead for 
Did you mean: 

Connection Sap with .net using biztalk adapter

Former Member
0 Kudos

Hi All,

I am trying to do a connection btw sap ver 6.0 on hp-ux machine.

I did the follow steps like described here http://msdn.microsoft.com/en-us/library/cc185499.aspx

Installing the RFC

Follow these steps to install the custom RFC

To install the RFC

1.

Copy files from the computer running the adapters to the SAP application server.

1. Log in as the SAP R/3 system administrator to the SAP application server of your development system.

2. Copy the transport file with the naming pattern K9*.BI1 from the installation directory on the computer running the adapters to the following directory on the SAP application server:

<drive>:\usr\sap\trans\cofiles

3. Copy the transport file with the naming pattern R9*.BI1 from the installation directory on the computer running the adapters to the following directory on the SAP application server:

<drive>:\usr\sap\trans\data

2.

Load the transport into the transport buffer on the SAP application server

1. At the command prompt, navigate to the transport program directory on the SAP application server:

<drive>:\usr\sap\trans\bin

2. To load the transport into the transport buffer, execute the following command at the \usr\sap\trans\bin directory and replace sysid with the system ID of your development system:

tp addtobuffer <TransportNumber> <sysid> pf=TP_DOMAIN_<sysid>.PFL

where TransportNumber is the actual transport number (for example BI1K900201).

3. After the tp command finishes, you will see a report similar to the following:

This is tp version 320.56.66 (release 620)

Addtobuffer successful for TransportNumber

tp finished with return code: 0

Return code "0" means that everything is OK.

A return code of 0 or 4 is acceptable. Contact Microsoft Customer Service and Support, if you receive a return code of 8 or above.

Note

You can easily derive the actual transport number from the cofile file name. For example, a cofile named K900201.BI1 provides a transport number of BI1K900201.

tp addtobuffer BI1K900503 SVI pf=TP_DOMAIN_SVI.PFL

tp import BI1K900503 SVI client=200 pf=TP_DOMAIN_SVI.PFL

after doing import I get the return code 4

then I try to run the query from the program

select top 1 * from sflight inner join spfli on sflight.connid = spfli.connid where spfli.connid = @connid

I get this error {"No authorization for SFLIGHT."}

Any suggestions ?

thanks

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

What I want do is a program in .net that call an RFC to read the data from SAP

using Microsoft.Data.Sapclient

.net program

static void SelectSample1()

{

try

{

using (SAPConnection conn = new SAPConnection(connstr))

{

conn.Open();

using (SAPCommand cmd = conn.CreateCommand())

{

cmd.CommandText = "select top 1 * from sflight inner join spfli on sflight.connid = spfli.connid where spfli.connid = @connid";

cmd.Parameters.Add(new SAPParameter("@connid", 17));

//cmd.CommandText = " select KUNNR from KNA1 ";

//cmd.ExecuteReader();

using (SAPDataReader dr = cmd.ExecuteReader())

{

do

{

int rows = 0;

while (dr.Read())

{

rows++;

StringBuilder b = new StringBuilder();

for (int i = 0; i < dr.FieldCount; i++)

{

b.Append(dr<i>.ToString() + " ");

}

Console.WriteLine("row : ", rows, b.ToString()); } Console.WriteLine("Number of rows:", rows);

} while (dr.NextResult());

}

}

}

}

catch (Exception e)

{

Console.WriteLine("Select sample failed with exception: {0}", e);

}

}

when I try to do cmd.ExecuteReader()) I get the error acess denied on the table sflight

hope that is clear

JayChan
Active Participant
0 Kudos

Please check your authority on SAP over the table you mentioned

How:

1.Log on SAP

2.Go to Transaction "SU01"

3.Switch to "Role" page

4.Double click your role, then another session will pop out

5.Go to "Authority" page of afterward session

6.At bottom-left there is a "Display your authority data" bottun, click it

7. Use "Find" function to search the Table you mention (but I am not sure that is the object you cannot access, you have to do some further check)