Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Calling ABAP BAPI InspLotOperation.RecordResults via ActiveX control in VB6

Former Member
0 Likes
638

We are migrating an existing applicatioon that used the DCom Connector to call QM BAPIs to the ActiveX Control (SAPBAPIControl) that is included with the SAP GUI.

We have had no problem reading data from SAP. When writing data using RecordResults and passing it the object SingleResults all seems to work well.

When trying to write data using RecordResults and passing it the object CharResults nothing is written to SAP and both the objects Return and ReturnTable come back empty (Return = Error 0).

Sample Code:

Dim objInspLot As Object

Dim objReturn As Object

Dim objCharResults As Object

Dim objReturnTable As Object

Set objInspLot = SAPBAPIControl1.GetSAPObject("InspLotOperation", Me.txtInspLot.Text, "0010")

Set objReturn = SAPBAPIControl1.DimAs(objInspLot, "RecordResults", "Return")

Set objReturnTable = SAPBAPIControl1.DimAs(objInspLot, "RecordResults", "ReturnTable")

Set objCharResults = SAPBAPIControl1.DimAs(objInspLot, "RecordResults", "CharResults")

With objCharResults

.rows.Add

.Value(1, "INSPLOT") = CVar(Me.txtInspLot.Text)

.Value(1, "INSPOPER") = "0010"

.Value(1, "INSPCHAR") = 10

.Value(1, "CLOSED") = ""

.Value(1, "EVALUATED") = "X"

.Value(1, "EVALUATION") = "A"

End With

objInspLot.RecordResults Return:=objReturn, CharResults:=objCharResults, ReturnTable:=objReturnTable

This is a sample of the SAP_Errorlog.txt

Tue Feb 15 15:43:45 2011

4392: <<BAPI Call() OK

4392: <<Pop parameter (RETURN/RETURN)

4392: <<Pop table (CHARRESULTS/CHAR_RESULTS)

4392: <<Pop table (RETURNTABLE/RETURNTABLE)

4392: >>swo_free(116754400, QAI.777, 5)

4392: *** ERROR => swo_free(116754400, QAI.777, 5)<< [P.BAPI 2242]

4392: *** ERROR => RETURN: Code 8008 [P.BAPI 2286]

4392: *** ERROR => Errortype 2 [P.BAPI 2288]

4392: *** ERROR => Workarea OL [P.BAPI 2289]

4392: *** ERROR => Message 808 [P.BAPI 2290]

4392: *** ERROR => Text Object with runtime number '&' not defined [P.BAPI 2291]

4392: *** ERROR => Variable1 5 [P.BAPI 2292]

4392: *** ERROR => [8198] A runtime object of type 5 with the persistent key 0300000648040010 could not be released in the Business Object Repository.

Message-Nr: 808

Workarea: OL

R/3 error message: Object with runtime number '&' not defined [P.BAPI 3804]

Any help would be appreciated.

We are migrating an existing applicatioon that used the DCom Connector to call QM BAPIs to the ActiveX Control (SAPBAPIControl) that is included with the SAP GUI.

We have had no problem reading data from SAP. When writing data using RecordResults and passing it the object SingleResults all seems to work well.

When trying to write data using RecordResults and passing it the object CharResults nothing is written to SAP and both the objects Return and ReturnTable come back empty (Return = Error 0).

Sample Code:

Dim objInspLot As Object

Dim objReturn As Object

Dim objCharResults As Object

Dim objReturnTable As Object

Set objInspLot = SAPBAPIControl1.GetSAPObject("InspLotOperation", Me.txtInspLot.Text, "0010")

Set objReturn = SAPBAPIControl1.DimAs(objInspLot, "RecordResults", "Return")

Set objReturnTable = SAPBAPIControl1.DimAs(objInspLot, "RecordResults", "ReturnTable")

Set objCharResults = SAPBAPIControl1.DimAs(objInspLot, "RecordResults", "CharResults")

With objCharResults

.rows.Add

.Value(1, "INSPLOT") = CVar(Me.txtInspLot.Text)

.Value(1, "INSPOPER") = "0010"

.Value(1, "INSPCHAR") = 10

.Value(1, "CLOSED") = ""

.Value(1, "EVALUATED") = "X"

.Value(1, "EVALUATION") = "A"

End With

objInspLot.RecordResults Return:=objReturn, CharResults:=objCharResults, ReturnTable:=objReturnTable

This is a sample of the SAP_Errorlog.txt

Tue Feb 15 15:43:45 2011

4392: <<BAPI Call() OK

4392: <<Pop parameter (RETURN/RETURN)

4392: <<Pop table (CHARRESULTS/CHAR_RESULTS)

4392: <<Pop table (RETURNTABLE/RETURNTABLE)

4392: >>swo_free(116754400, QAI.777, 5)

4392: *** ERROR => swo_free(116754400, QAI.777, 5)<< [P.BAPI 2242]

4392: *** ERROR => RETURN: Code 8008 [P.BAPI 2286]

4392: *** ERROR => Errortype 2 [P.BAPI 2288]

4392: *** ERROR => Workarea OL [P.BAPI 2289]

4392: *** ERROR => Message 808 [P.BAPI 2290]

4392: *** ERROR => Text Object with runtime number '&' not defined [P.BAPI 2291]

4392: *** ERROR => Variable1 5 [P.BAPI 2292]

4392: *** ERROR => [8198] A runtime object of type 5 with the persistent key 0300000648040010 could not be released in the Business Object Repository.

Message-Nr: 808

Workarea: OL

R/3 error message: Object with runtime number '&' not defined [P.BAPI 3804]

Any help would be appreciated.

2 REPLIES 2
Read only

madhu_vadlamani
Active Contributor
0 Likes
557

Hi Paul,

Which bapi you are using. What are table parameters your are passing .Check all the declaration types .It seems to be coding error.

Regards,

Madhu.

Read only

Former Member
0 Likes
557

Hi Madhu,

I'm calling the BAPI BAPI_INSPOPER_RECORDRESULTS in the Quality Management Hierarchy.

Quality Inspection -->

InspLotOperation (Object) -->

Recordresults (Method)

The parameters I've set are in the code snippet above.

We have checked for data type converstion errors, the one that comes to mind as a potential problem would be the INSPLOT as it is defined as numeric in the SAP data structure, but I can't dimension an integer data type large enough to accomodate it, so I used a variant. It works in previous calls to other methods, so maybe that shouldn't be the problem.

My big concern is that if I have an error in my code, and the SAP_Errorglog file is showing errors, how come the Return and ReturnTable objects don't return errors?

Thanks again for you help.

Edited by: Paul Murray on Feb 16, 2011 8:33 PM