cancel
Showing results for 
Search instead for 
Did you mean: 

Not able to fetch the data using RFC

Former Member
0 Kudos

Hi,

I am able to connect to SAP system using RFC but i am not sure whether i am correct or wrong but i am not able to fetch the data based on the search criteria and without search too.

I am calling a RFC in which i have to pass around 20 parameters and based on that it should fetch the data but i am not getting any result.

Can anybody suggest me the way to go about this.

Regards,

+Naren

Message was edited by:

Narendra Thakur

Accepted Solutions (0)

Answers (6)

Answers (6)

Former Member
0 Kudos

Hi Narendra, I don't know anything about ABAP but there is an easy way to test ABAP functions I encourage you to do prior to your .NET tests.

1º) Install SAP GUI. You can download it from SAP network for free.

2º) Open SAP Logon and connect to your SAP system.

3º) Type SE37 transaction to open functions builder module.

4º) Type the name of an ABAP function on "Funcion Module" entry field. You can press "Display" button to view its properties or "Test/Execute (F8)" icon.

5º) When you are testing, you are prompted to enter input values. Then press "Execute (F8)" icon and see the results. Compare these results with the results you get using .NET Connector.

Regards

Former Member
0 Kudos

Hi Nerandra, any ABAP function can be used throw RFC setting its property "Remote-Enabled Module" to true.

You can find this property on SAP GUI, type "SE37" transaction (Function Builder), create or edit any ABAP function, see its Attributes and then its Processing Type.

Hope this helps.

Regards.

Former Member
0 Kudos

Hi Daniel,

i dont know anything about the SAP, SAP team has just given me the RFC and login credentials that too only to connect to SAP server using SAP.Net connector.

My only concern is the RFC name, that has given to me is the functions or u can say customized RFC written by someone in SAP so is there any other way to call such RFCs coz i am able to call the normal RFCs but not this one.

I am not getting any error in connection but its not returning me any data while i am calling this RFC using the SAP.Net connector.

Regards,

+Naren

Former Member
0 Kudos

Hi All,

Thanks a lot for the information. Please clarify me some doubts regarding this.

I am desingin a windows application in C3, using C# SAP.Connector i am trying to connect the SAP server. Steps i took to do the same:

1. I have add a application server in server control and provided the SAP login Id/Password.

2. I Addedd the function filter in which i have passed the RFC name and i am able to fetch the table details.

3. I have designed a windows form where i have added a SAPProxy and LogonDestination and provided the login details.

4. i have written the code in windows form to connect to RFC and there i am getting the error.

5. Code that i have written in windows form:

sapLogonInfo = new SAP.Connector.SAPLogonDestination();

string cs ="ASHOST=ia2-ms.boi.hp.com; SYSNR=2; CLIENT=445; USER=****; PASSWD=*****";

SAPProxy1 proxy = new SAPProxy1(cs);

LFA1Table tblCust = new LFA1Table();

VS_SAPConnector.BAPIRET1 obj = new BAPIRET1();

proxy.Z9srs_Mypim_1("X","X","X","X","X","X","X","X",txtPONumber.Text,"X","X","X","X","X","X","X","X","X","X","X","X","X",out obj,ref lfa1,ref lfb1,ref lfm1);

6. Here when i run the code, it redirect it to SAPProxy1.cs and giving me the error - An unhandled exception of type 'SAP.Connector.RfcCommunicationException' occurred in sap.connector.dll

Additional information: Connect to SAP gateway failed

Connect_PM GWHOST=ia2-ms.boi.hp.com, GWSERV=sapgw02, ASHOST=ia2-ms.boi.hp.com, SYSNR=02

LOCATION CPIC (TCP/IP) on local host

ERROR partner not reached (host 15.78.80.31, service 3302)

TIME Wed Feb 07 12:58:58 2007

RELEASE 640

COMPONENT NI (network interface)

VERSION 37

RC -10

MODULE nixxi_r.cpp

LINE 8716

DETAIL NiPConnect2

SYSTEM CALL SiPeekPendConn

ERRNO 10061

ERRNO TEXT WSAECONNREFUSED: Connection refused

COUNTER

7. I am not sure abt this RFC because same RFC is getting used in another application and working fine so it should be work fine here too.

8. Pls let me know what and all other details shd i check and whether the process i am taking to connect is correct or not.

Regards,

Naren

Message was edited by:

Narendra Thakur

Message was edited by:

Narendra Thakur

Former Member
0 Kudos

Hi Narendra,

I can suggest to use more structural way while connecting SAP. Can you try this;


SAPProxy1 proxy = new SAPProxy1();
SAP.Connector.Destination destination = new SAP.Connector.Destination();
destination.AppServerHost = "your host";
destination.Client = 445;
destination.Password = "your password";
destination.SystemNumber = 2;
destination.Username = "your username";		
destination.Language = "E";

SAP.Connector.SAPConnection connection = new SAP.Connector.SAPConnection();
connection.destination = destination;
proxy.Connection = connection;

LFA1Table tblCust = new LFA1Table();
VS_SAPConnector.BAPIRET1 obj = new BAPIRET1();
proxy.Z9srs_Mypim_1("X","X","X","X","X","X","X","X",txtPONumber.Text,"X","X","X","X","X","X","X","X","X","X","X","X","X",out obj,ref lfa1,ref lfb1,ref lfm1); 
proxy.Connection.Close();
proxy.Connection = null;
connection = null;

And an important point,

destination.AppServerHost = "your host";

try to assign host as ip not name.

Best Regards.

Huseyin Akturk

-


www.huseyinakturk.net

Former Member
0 Kudos

Hi Huseyin,

Thanks a lot for the usefull information. I have some doubt here in my code. when i am calling the RFC i have to pass some orgument where i have passed "X" and in one parameter i am passing "txtPONumber.Text" on which i want to search the data. is it the correct way or shd i pass pass the null ("") in other parameters when i have to search only on "txtPONumber.Text" parameter.

1. this RFC is customized one so is this the correct way to call this or is there any other way to call such RFCs?

2. I have to call 2 RFC after getting the result from this RFC i have to call the other RFC on basis of selection of a record from this RFC. How to go abt this.

I know i am asking too many question but this is first time i am working on SAP.net connector.

Thanks in advance.

Regards,

+Naren

Former Member
0 Kudos

Hi Naren,

in my opinion if you are passing as X for the search parameter other parameters can be "". This is your selection.

1. I am calling rfc like this. you should call rfc using proxy.

2. you can call other rfcs as;


proxy.Z9srs_Mypim_1(...)
//.. your operation
proxy.znextrfc(..)..
//your operation
proxy.znext2rfc(..)
proxy.Connection.Close();
proxy.Connection = null;
connection = null;

Best Regards.

Huseyin Akturk

-


www.huseyinakturk.net

Former Member
0 Kudos

Hi Huseyin,

Thanks a lot for the information. I will try this and let u know the result. Today our SAP server is down for some maintenance work so could not try this.

Huseyin, Do u have any document to study abt the SAP.Connector or any example which u can share. i have to design this tool in such a way where this tool can handle the load of 200-300 concurrent users.

I have the another way to design this tool, to update the same data from SAP to my application database then design the tool so which one u suggest to go abt this. will RFC call will be able to handle this much of load.

NOTE: <b>I have the SAP system in which data is updating continuesly and that refreshed data i cant get in my application database regularly so we thought of directly getting the data from SAP.</b>

Former Member
0 Kudos

Narendra,

you can find a good technical information from search view(right side of .net) as searching SAP, Connector, etc if you are using connector 2.0

Also, you can find samples under \Program Files\SAP\SAP .NET Connector for VisualStudio 2003\Samples directory.

Best Regards.

Huseyin Akturk

-


www.huseyinakturk.net

Former Member
0 Kudos

Hi Huseyin,

i am doing everything in the same way but i am not getting the data from the search its returning me the table with 0 rows.

proxy.Z9srs_Mypim_1("",""," ","","","","","","","","","","","","","","","","","","","",out obj ,ref lfA1Table1,ref lfB1Table1,ref lfM1Table1);

this line shd return me the result of all records in lfA1Table1 but i am getting the zero rows in lfA1Table1. i using the "" to return all the records.

Regards,

+Naren

Former Member
0 Kudos

Hi Huseyin,

Is there any other way of calling the customized SAP RFC. What i am calling is not a built in RFC its a customized funtion RFC of SAP.

I tried to call the other RFCs on the sap server with the same code and i will able to connect to them but not with this one.

Regards,

+Naren

0 Kudos

Hello Narenda,

> i am doing everything in the same

> way but i am not getting the data from the search

> its returning me the table with 0 rows.

have you verified, that the NAME of the export table is the same as in your attributes of the output parameter in your method of the SAP-proxy ? I had the same problem. After the change of the name in the Attribute all was OK ...

Regards

Holger

Former Member
0 Kudos

Hi Narendra,

1. Are you sure that you are passing tru parameters? Please check your parameters.

2.Test you RFC funciton in SAP with the paramters as you passed in .NET

3. Check the parameters that are into proxy. I mean that when you have called an RFc function as;

proxy.ZGet_Value(....)

Check the ZGet_Value method whether it has got true parameters using debugging.

Best Regards.

Huseyin Akturk

-


www.huseyinakturk.net

Former Member
0 Kudos

Hi Naren,

First, be sure that you are able to communicate with the RFC.

For Eg.

If you pass no parameters for sure you will get an error message.

Check whethere you get this error message.

Second, test your test parameters in the R/3 Side and then test in the .NET Environment.

If your R/3 side executes correctly, then you can come to the conclusion that only in the .NET side there is something to be corrected.

Third, if you have error in the .NET Side check the Spelling that you pass to the parameter and if you are passing a number to the RFC, then

For Eg.

If you are going to pass 1 to the RFC as an input and if the input datatype length in 10 then pass the parameter like 0000000001 in the .NET Environment. i.e Be sure that you concatenate 9 zeros before 1 and pass it to the RFC, this is because R/3 converts this automatically to the above mentioned format but it is not in the case in the .NET Environment.

Hope it helps you.

Regards,

Maheswaran.B

Former Member
0 Kudos

Hi,

Are you using Standard RFC or Customized RFC? Have you tested this RFC in SAP itself?

Thanks & Regards,

Govind.

Former Member
0 Kudos

Hi Govind,

Its not Standard RFC its a customized one. This RFC is already using in another one appication for the same functionality so i hope its properly tested and also working properly.

Is there any other way to work with customized RFCs.

Regards,

+Naren