Skip to Content
0
Former Member
May 21, 2007 at 12:40 PM

.NET Connector and Bapi_Alm_Order_Get_Detail

223 Views

I am coding in Visual Studio 2005 (VB). I have written a .NET connector (in Visual Studio 2003) and am referencing it in my 2005 project.

I started out trying to call Bapi_Alm_Order_Maintain because I ultimately want to create a PM work order. But, I couldn't get that to work, initially, because I didn't have the proper privileges. Once my privs were granted, I still was not able to successfully call the BAPI. The return codes (in BAPIRET2Table) are

SAP Return Message :IWO_BAPI:121

SAP Return Type E

SAP Return Message :IWO_BAPI:121

SAP Return Type E

SAP Return Message :IWO_BAPI2:113

SAP Return Type E

This is part of my VB code:

With sapMethod

.Refnumber = "000001"

.Objecttype = "HEADER"

.Method = "CREATE"

.Objectkey = "%00000000001"

End With

sapMethodTable.Add(sapMethod)

With sapMethod

.Refnumber = "000001"

.Objecttype = ""

.Method = "SAVE"

.Objectkey = "%00000000001"

End With

sapMethodTable.Add(sapMethod)

With sapHeader

.Orderid = "%00000000001"

.Order_Type = "PM20"

.Funct_Loc = "WAY-BCF-FAC-WTR-FIW"

.Short_Text = "Test Short Text SAA"

.Pmacttype = "202"

End With

sapHeaderTable.Add(sapHeader)

With sapMethod

.Refnumber = "000001"

.Objecttype = "OPERATION"

.Method = "CREATE"

.Objectkey = "%000000000010010"

End With

sapMethodTable.Add(sapMethod)

With sapMethod

.Refnumber = "000001"

.Objecttype = ""

.Method = "SAVE"

.Objectkey = "%00000000001"

End With

sapMethodTable.Add(sapMethod)

With sapOperation

.Activity = "0010"

.Control_Key = "PM01"

.Calc_Key = "1"

.Number_Of_Capacities = 1

.Duration_Normal = "5.0"

.Work_Activity = "5.0"

End With

sapOperationTable.Add(sapOperation)

proxy.Bapi_Alm_Order_Maintain(sapNumbersTable, _

sapParexTable, _

sapOrdComponentTable, _

sapOrdComponentUpTable, _

sapHeaderTable, _

sapOrdSrvdatTable, _

sapOrdSrvdatUpTable, _

sapOrdHeaderUpTable, _

sapMethodTable, _

sapOperationTable, _

sapOrdOperationUpTable, _

sapOrdPartnerMulTable, _

sapOrdPartnerMulUpTable, _

sapOrdRelationTable, _

sapOrdRelationUpTable, _

sapAlmTextTable, _

sapAlmTextLinesTable, _

sapOrdUserStatTable, _

sapReturnTable)

Since I couldn't get the above code to work, I decided to switch gears and try to just retrieve an existing work order. But, I get a similar error when I call Bapi_Alm_Order_Get_Detail. Here's my errors for that one:

SAP Return Message :IWO_BAPI:121 91074418

SAP Return Type E

Here's my code... I am simply providing the order number in the call:

Dim cs As String = "CLIENT=510 USER=XXXXXXX PASSWD=XXXXXXXX LANG=en ASHOST=XXXXXX.xxx.xx.xxxxx.com SYSNR=1"

' Create a new proxy with connection string

Dim proxy As New SAPProxy.SAPConnectorProxy(cs)

Dim sapHeader As New SAPProxy.BAPI_ALM_ORDER_HEADER_E

Dim sapOrdSrvdatTable As New SAPProxy.BAPI_ALM_ORDER_SRVDAT_E

Dim sapOrdComponentTable As New SAPProxy.BAPI_ALM_ORDER_COMPONENT_ETable

Dim sapOrdCostsDetailTable As New SAPProxy.BAPI_ALM_ORDER_COSTS_DETAIL_ETable

Dim sapOrdCostsSumlTable As New SAPProxy.BAPI_ALM_ORDER_COSTS_SUM_ETable

Dim sapOperationTable As New SAPProxy.BAPI_ALM_ORDER_OPERATION_ETable

Dim sapOrdPartnerTable As New SAPProxy.BAPI_ALM_ORDER_PARTNERTable

Dim sapOrdPrtTable As New SAPProxy.BAPI_ALM_ORDER_PRT_ETable

Dim sapOrdRelationTable As New SAPProxy.BAPI_ALM_ORDER_RELATION_EXPORTTable

Dim sapAlmTextLinesTable As New SAPProxy.BAPI_ALM_TEXT_LINESTable

Dim sapAlmTextTable As New SAPProxy.BAPI_ALM_TEXTTable

Dim sapParexTable1 As New SAPProxy.BAPIPAREXTable

Dim sapParexTable2 As New SAPProxy.BAPIPAREXTable

Dim sapReturnTable As New SAPProxy.BAPIRET2Table

Dim strOrderId As String = "91074418"

Try

proxy.Bapi_Alm_Order_Get_Detail(strOrderId, _

sapHeader, _

sapOrdSrvdatTable, _

sapOrdComponentTable, _

sapOrdCostsDetailTable, _

sapOrdCostsSumlTable, _

sapOperationTable, _

sapOrdPartnerTable, _

sapOrdPrtTable, _

sapOrdRelationTable, _

sapAlmTextLinesTable, _

sapAlmTextTable, _

sapParexTable1, _

sapParexTable2, _

sapReturnTable)

Can you help me understand what these errors mean? There's no error text associated with them.

Thank you!