Application Development 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: 

Problems accessing Object members by name in BAPI-VB code

Former Member
0 Kudos

I have been maintaining several applications in VB6 for several years, but have recently run into problems when accessing BAPI objects by name. For instance, part of my code for creating a Sales Order is shown below:


  Set boOrder = oBAPICtrl.GetSAPObject("SalesOrder")
  Set oHeader = oBAPICtrl.DimAs(boOrder, "CreateFromDat2", "OrderHeaderIn")
  With oHeader
'THIS CODE FAILS WITH THIS ERROR "Structure member not found..." ON EACH LINE:
  .Value("DOC_TYPE") = "SO" ' rush order (or TA for non-rush order)
  .Value("SALES_ORG") = "BP01"
  .Value("DISTR_CHAN") = "01"
  .Value("DIVISION") = "01"
  .Value("PRICE_DATE") = "07/01/2015"
  .Value("PURCH_DATE") = "08/01/2015"
  .Value("PURCH_NO_C") = "CA78-0613401c"
  .Value("PURCH_NO_S") = ""
  .Value("INCOTERMS1") = ""PPA"
  .Value("INCOTERMS2") = "UPSN-UPS NDA"
'THE CODE BELOW WORKS! (but I'm guessing about ordinals) 
' .Value(4) = "SO" ' rush order (or TA for non-rush order)
' .Value(6) = "BP01"
' .Value(7) = "01"
' .Value(8) = "01"
' .Value(30) = "07/01/2015"
' .Value(13) = "08/01/2015"
' .Value(40) = "CA78-0613401c"
' .Value(41) = ""
' .Value(23) = "PPA"
' .Value(24) = "UPSN-UPS NDA"
  End With >/font>


Incidentally, this problem has only become evident since I updated to the SAP GUI 7.4 front end!

Can anyone help?

3 REPLIES 3

Former Member
0 Kudos

Boy, a lot of knowledgeable folks out there - not even a hint in nearly 4 months!

0 Kudos

This is an Abap forum, not a VB one (try Scripting Languages or Interoperability .NET), also you posted during summer holidays too

stefan_schnell
Active Contributor
0 Kudos

Hello James,

you can find here the solution of your problem, from the post of the 5th Dec. 2014 from Dinesh Bhandarkar.

Cheers

Stefan