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

BAPI function BAPI_PO_GETITEMS from Visual Basic

Former Member
0 Likes
546

Dear All,

Please help to understand what is wrong.

I try to select PO itesm using BAPI function BAPI_PO_GETITEMS.

u2026.

Define variable

Fill connection data

u2026.

oBAPICtrl = CreateObject("SAP.BAPI.1")

LogonControl = CreateObject("SAP.LogonControl.1")

oBAPICtrl.Connection = LogonControl.NewConnection

oBAPICtrl.Connection.System = ""

oBAPICtrl.Connection.GroupName = ""

oBAPICtrl.Connection.Client = ""

oBAPICtrl.Connection.User = ""

oBAPICtrl.Connection.Password = ""

oBAPICtrl.Connection.Language = ""

If oBAPICtrl.Connection.Logon = False Then

MsgBox("Error occured - " & RFC_READ_TABLE.Exception)

Else

MsgBox("connectd")

End If

boOrder = oBAPICtrl.GetSAPObject("BUS2012", "5810000018") '5810000018 = PO number

oPurchaseOrders = oBAPICtrl.DimAs(boOrder, "GetItems", "PurchaseOrder")

After executon thi row I receive error messag:

"Additional information: Parameter PurchaseOrder of method GetItems is not a structure!

You should use plain data types"

What correct function call?

Regards,

Svetlana

1 REPLY 1
Read only

Former Member
0 Likes
422

Started working after I have done like this:

PoNumber = "5810000018"

boOrder = oBAPICtrl.GetSAPObject("BUS2012", PoNumber)

boOrder.GetItems(PurchaseOrder:=PoNumber, PoItems:=oPurchaseOrders)

Regards,

Svetlana