Click here to Skip to main content
15,890,438 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

I need to export some data using SAP RFC on VB .NET

I managed to logon to sap server but when i pass the parameters I get return code 4 that means i have some kind of error. So i would need to read the BAPIRET2 table to figure out where I´m failing.
My problem is that i dont have a clue how to read that data.
Anyone?
Thanks in advance
Posted

How are you connecting to SAP?
ERPConnect? SAP.NET.Connector?
 
Share this answer
 
Hi Scubapro,

thats a good question... honestly i create an object that goes like:

RFC = CreateObject("SAP.Functions")
after that:

RFC.Connection.[parameter]=[value]...and so on.

But well, my problem is another at this point. I managed to import the table using

RFC_Return = RFC.Tables("RETURN")
But if I read RFC_Return.Value(1,4) in VB .Net i dont get the message but its address and the parameters [E:ZSMN:63 0.000 1.000]. On the other way if i run this in Excel I get the message just like i wanted it.

The only difference i had to make was adding some 'set' while coding in excel:

Set RFC_Return = RFC.Tables("RETURN")


Any idea?

Regards
 
Share this answer
 
Hello,

I'm struggling with the same problem as you right now. However, your attempt seems very strange to me. I have just started getting familiar with SAP and RFCs/BAPIs. What does "RFC_Return = RFC.Tables("RETURN")" refer to? It basically says Sap.Functions.Tables("RETURN"). I don't see which RFC call the Return refers to. Keep in mind that I am an amateur myself and might be completely wrong with this, but this is what I have so far (R3 is the equivalent to your RFC):

CO13 = R3.add("BAPI_PRODORDCONF_CANCEL")
CO13.exports("CONFIRMATION") = confirmationnr
CO13.exports("CONFIRMATIONCOUNTER") = cnfrmcnt
Bapi_return = CO13.imports("RETURN")

Now I've got the BAPIRET table in Bapi_return, but I don't know how do access the data within Bapi_return.

Your solution gets me "an external component has caused an exception" at the "RFC_Return = RFC.Tables("RETURN")" line
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900