cancel
Showing results for 
Search instead for 
Did you mean: 

send value to BAPI and and get value from BAPI on VB 6.0

Former Member
0 Kudos

Hi All,

I want to connect SAP and send some values and get some results from BAPI with Visual Basic 6.0

I connected SAP successfull But I didn't send value to BAPI.

I want to connect SAP with BAPI_MATERIAL_GET_ALL BAPI and I want to send u2018000000000000980010u2019 parameter. So I want get the result from BAPI.

Could anyone help me about send and get value BAPI with VB 6.0?

Thanks in advanced

captivator

Edited by: captivator on Dec 10, 2010 4:24 PM

Accepted Solutions (0)

Answers (1)

Answers (1)

0 Kudos

Hi,

Please find the below code:

Set bapi = CreateObject("SAP.BAPI.1")

Set conn = bapi.Connection

If conn.logon(0, false) <> True Then

MsgBox "Cannot logon!."

Else

MsgBox "logon succeed!."

End If

Set obj = bapi.GetSAPObject("BAPI_MATERIAL_GET_ALL BAPI")

Set return = bapi.DimAs(obj, "ZTest", "RETURN")

Regards,

Dinesh

Former Member
0 Kudos

Hi Dinesh,

Thanks for your reply.

I'll try your suggestion and let you know.

Thanks

0 Kudos

Hi

I am not sure the data type and the name of the parameter which you want to pass to BAPI with value as 000000000000980010. Please share whether this is export or import parameter in BAPI. Also the data type for this parameter.

Regards,

Dinesh

Former Member
0 Kudos

Hi Dinesh,

My full code is below.

I'm getting error when "Set obj = ctlLogon.GetSAPObject("BAPI_MATERIAL_GET_ALL")" code line is working.

Error : Script error in module line 30:(10091) ActiveX Automation:no such property or method

Have you got any idea?

Thanks in advanced.

Esat

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

Set sapConnection = ctlLogon.NewConnection

sapConnection.User = "user"

sapConnection.Client = "120"

sapConnection.Password = "1q2w3e4r"

sapConnection.ApplicationServer = "xxxxxx"

sapConnection.Language = "EN"

sapConnection.SystemNumber = "00"

booReturn = sapConnection.Logon(0, True)

If booReturn <> True Then

gSAPConnect = False

Else

gSAPConnect = True

End If

If booReturn Then

'MsgBox "Logged On successfullyu2026"

Debug.Print"Logged On successfullyu2026"

End If

Dim obj As Object

Dim return As Object

Set obj = ctlLogon.GetSAPObject("BAPI_MATERIAL_GET_ALL")

Set return = ctlLogon.DimAs(obj, "000000000000980010", "RETURN")

Former Member
0 Kudos

Hi Dinesh,

I want to export "000000000000980010" value to BAPI and import return value from BAPI to my vb code.

Thanks

Esat

0 Kudos

Hi,

Please check the following link:

<< http://help.sap.com/saphelp_bw/helpdata/en/59/ae455e488f11d189490000e829fbbd/content.htm >>

Hope this helps.

Regards,

Dinesh