cancel
Showing results for 
Search instead for 
Did you mean: 

.NET CONNECTOR 2.0 : VB fix for BAPIRETURN BUG ?

Former Member
0 Kudos

I am not able to read data from a BAPIRETURN type to a datatable.

Precedently, we used to read values from a Recordset to use them in Visual Basic for our application (DCOM CONNECTOR) but, to my knowledge, it is not possible to read values directly from a BAPIRETURN type (NET CONNECTOR 2.0) and BAPIRETURNTable is Missing.

How can I fix that ?

, I read from Moderator Reiner.

May you explain clearly how this can be fixed for VB code, constraint being data from BAPIRETURN is not intended to be a table but a status check, therefore do we really need BAPIRETURNTable, if yes, how?

Cordially,

Manuel.

I have SAP 2.0.1 but I realized the proxy may have been built with an older version.

v2.0.1 fix.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Good afternoon,

<u>every other type work like this for me:</u>

<i> dim rsReturn as New MEMBERS

dim rsReturnTable as New MEMBERSTable

dim dtReturn as Datatable

...

conn = New connector

conn.setconnection()

conn.Z_Rfcp_MEMBERS_CC(...rsReturn)

conn.Dispose()

conn = Nothing

...

rsReturnTable.add(rsReturn)

dtReturn = rsReturn.toADOdatatable

dtReturn.rows(0)(0) ' retrieve data from MEMBERS Type.</i>

<u>Here is the code I try to fix (bapireturn type):</u>

<i>Dim webAccess As Integer

Dim rsreturn As New BAPIRETURN

conn = New connector

conn.setconnection()

conn.Z_Rfcp_Get_Data(BD, CStr(costNum).PadLeft(10, "0"), ED, Nothing, webAccess, _

rsreturn, rsDays_Tab, rsGeneral_Tab)

conn.Dispose()

conn = Nothing

If Not rsreturn Is Nothing Then

'??????????? How to retrieve data from BAPIRETURN ?

'???????????

rsreturn = Nothing

End If</i>

Cordially,

Manuel

Former Member
0 Kudos

Is there a better way to do that ? Can we avoid to use BAPIRERETURNTable ?

BAPIRETURNTable is not available with my proxy.

#Objects

<i>dim rsReturn as New BAPIRERETURN

dim rsReturnTable as NewME MBERSTable

dim dtReturn as Datatable</i>

#Add BAPIRERETURN into table

<i>rsReturnTable.add(rsReturn)

dtReturn = rsReturn.toADOdatatable</i>

    • Read data

<i>dtReturn.rows(0)(0) </i>

Cordially,

Manuel.

Former Member
0 Kudos

Hi Manuel,

thank you for the 'very helpful answer' reward points

with respect,

amit

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Manuel,

thank you for the very helpful reward points

to retrieve data from the structure rsreturn [type : BAPIRETURN]

use the equivalent switch case in VB

-


switch(rsreturn.Type)

{

case "E":

case "A":

case "W":

// do error / warning handling

break;

case "S":

case "":

default:

// process results from RFC, as result was extracted successfully

break;

}.

-


if the RFC returns a structure with BAPIRETURNTable : say brtReturn

then all you need to do is treat it as an array of BAPIRETURN structures

and then do something like :

brtReturn[0].Type to extract the Type result

with respect,

amit

Former Member
0 Kudos

Although I have v2.0.1 I am unable to use any data in a BAPIRETURN type and I can't use toADOdatatable because BAPIRETURNTable is missing.

Can someone help me ?

Former Member
0 Kudos

Hi Manuel,

how are you doing ?

i need to understand a few things abit clearer in your task :

when you mention "i am not able to use any data iin a BAPIRETURN", i do not understand the limitation, please be more specific here ...

for any class that returns an object of type BAPIRETURN

you will need to create an instance of that class :

BAPIRETURN brtReturn = new BAPIRETURN();

then call RFC -


X-----

then when you want to read it, you can do :

if(brtReturn!=null)

{

switch(brtReturn.Type)

{

case "E"

case "A"

case "W"

// do error / warning handling

break;

case "S"

default:

// process results from RFC

break;

}.

}

etc ....

plz refer :

/people/andre.fischer/blog/2007/02/07/exception-handling-for-web-services-based-on-business-apis-bapi-using-visual-studio-2005

with respect,

amit

Former Member
0 Kudos

gonna check my proxy

Former Member
0 Kudos

I used SAP NET CONNECTOR 2.0.1 for the proxy which should have fixed the BAPIRETURNTable issue, see below, but I can't see, use it.

v2.0.1 bug fix:

- Built-in type BAPIRETURNTable required by some BAPIs is added.

I use Visual studio 2003 .NET with vb code and I am migrating from DCOM to .NET CONNECTOR, trying.

Have you any idea about this issue ?