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: 

Call Table SUB_HEADER from BAPI1077 GetDetail via VBA

Former Member
0 Kudos

Hello,

I have a problem with calling the table SUB_HEADER from the BAPI_BUS1077__GETDETAIL with VBA.

I tried that BAPI with SE37 - everything works well.

However, with VBA I cannot find the table SUB_HEADER (the table REFSUBS can be found).

My VBA-code:

Dim oMat As Object
Set oMat = SAPBAPIControl1.GetSAPObject("BUS1077")
Dim oRangeSubNr As Object
Set oRangeSubNr = SAPBAPIControl1.DimAs(oMat, "GETDETAIL", "SUB_HEADER")


The Error says:

Parameter SUB_HEADER not found

Where is my problem?

I hope, anyone can help me with this problem.

Thanks already in advance!

Carsten

5 REPLIES 5

stefan_schnell
Active Contributor
0 Kudos

Hello Carsten,

I tried the following code, and it works - but it is a little bit different from yours:

Sub Test()

  Dim rfcFunction As SAPFunctionsOCX.SAPFunctions
  Dim rfcConnection As SAPLogonCtrl.Connection
  Dim table As SAPTableFactoryCtrl.table
  Dim func As SAPFunctionsOCX.Function

  Set rfcFunction = CreateObject("SAP.Functions.Unicode")
  If Not IsObject(rfcFunction) Then
    Exit Sub
  End If

  Set rfcConnection = rfcFunction.Connection

  rfcConnection.ApplicationServer = "C0T"
  rfcConnection.System = "C0T"
  rfcConnection.SystemNumber = 65
  rfcConnection.User = "YI00159"
  rfcConnection.Client = "099"
  rfcConnection.Language = "DE"

  If Not rfcConnection.Logon(0, False) Then
    Exit Sub
  End If

  Set func = rfcFunction.Add("BAPI_BUS1077_GETDETAIL")

  Set table = func.Tables("SUB_HEADER")

  Stop

  rfcConnection.Logoff

  Set rfcLogon = Nothing
  Set rfcConnection = Nothing

End Sub

Maybe it is an alternative for you.

Cheers

Stefan

0 Kudos


Hi Stefan,

can you please help me out,how to call SAP web service in VBA.

Thanks In advance.

Regards

RR Pradhan

0 Kudos

Hello RR pradhan,

I am not an expert in using web services via VBA.

Maybe this could help you.

Cheers

Stefan


0 Kudos

Hi Stephan,

Thanks for quick reply.

I have try above link,but I am getting the error.

Can you help me shortout the error.

The error is in below link.

CALL SAP WEB SERVICE FROM MS EXCEL 2010 using VBAunknown

Thanks In advance.

Best Regards

RR Pradhan

Former Member
0 Kudos

Hi Stephan,

Thanks for quick reply.

I have try above link,but I am getting the error.

Can you help me shortout the error.

The error is in below link.

Thanks In advance.

Best Regards

RR Pradhan