Skip to Content
0
Former Member
Jul 21, 2005 at 12:23 PM

Visual Basic - BAPI_DOCUMENT_GETDETAIL2

39 Views

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

Set objSAPConnection = objSAPLogonControl.NewConnection

objSAPConnection.ApplicationServer = ApplicationServer

objSAPConnection.System = System

objSAPConnection.client = client

objSAPConnection.password = password

objSAPConnection.user = user

retcd = objSAPConnection.Logon(0, True)

If retcd <> True Then

LogonSap = 0

Else

LogonSap = 1

End If

Set objFuncSAPControl = CreateObject("SAP.Functions")

objFuncSAPControl.Connection = objSAPConnection

Set objBAPI_DOCUMENT_GETDETAIL2 = objFuncSAPControl.Add("BAPI_DOCUMENT_GETDETAIL2")

Set objTDOCUMENTTYPE = objBAPI_DOCUMENT_GETDETAIL2.Exports("DOCUMENTTYPE")

Set objTDOCUMENTNUMBER = objBAPI_DOCUMENT_GETDETAIL2.Exports("DOCUMENTNUMBER")

Set objTDOCUMENTPART = objBAPI_DOCUMENT_GETDETAIL2.Exports("DOCUMENTPART")

Set objTDOCUMENTVERSION = objBAPI_DOCUMENT_GETDETAIL2.Exports("DOCUMENTVERSION")

Set objTGETACTIVEFILES = objBAPI_DOCUMENT_GETDETAIL2.Exports("GETACTIVEFILES")

Set objTGETDOCDESCRIPTIONS = objBAPI_DOCUMENT_GETDETAIL2.Exports("GETDOCDESCRIPTIONS")

Set objTGETDOCFILES = objBAPI_DOCUMENT_GETDETAIL2.Exports("GETDOCFILES")

objTDOCUMENTTYPE.Value = TipoDoc

objTDOCUMENTNUMBER.Value = DocNumber

objTDOCUMENTPART.Value = DocPart

objTDOCUMENTVERSION.Value = DocVersion

objTGETACTIVEFILES.Value = ActiveFiles

'objTGETDOCDESCRIPTIONS.Value = DocDescriptions

'objTGETDOCFILES.Value = DocFiles

If objBAPI_DOCUMENT_GETDETAIL2.Call = False Then

ReadDataSAP = -1

Exit Function

End If

Set objTDOCUMENTFILES = objBAPI_DOCUMENT_GETDETAIL2.Tables("DOCUMENTFILES")

Set objTDOCUMENTDESCRIPTIONS = objBAPI_DOCUMENT_GETDETAIL2.Tables("DOCUMENTDESCRIPTIONS")

Set objTDOCUMENTDATA = objBAPI_DOCUMENT_GETDETAIL2.Imports("DOCUMENTDATA")

The tables return correctly from SAP.

Into SAP I see the value DOCUMENTDATA, but with Visual Basic the method Imports return always "NOTHING"

objBAPI_DOCUMENT_GETDETAIL2.Imports("DOCUMENTDATA")

Flavio

Message was edited by: flavio petrino

Message was edited by: flavio petrino