Skip to Content
author's profile photo Former Member
Former Member

My VB code for function BAPI_DOCUMENT_CHECKOUTVIEW2 not working.

Hello,

My VB code below to call the function BAPI_DOCUMENT_CHECKOUTVIEW2 not working properly.

The original file exists in the document DMS-SAP environment .

Problems:

a. The original file of the document is not copied to the folder "c:\ temp\sap\".

b. Not returning values in the table "DOCUMENTFILES" (is empty).

The VB code is correct?

Does anyone has a sample code in VB to get the document from a DMS to a local file?

Thank you for a while.

Public Sub Check_Out_View2_Test()

Dim Exception As Variant

Dim Result As Boolean

Dim ddDocumentNumber As String

Dim ddDocumentPart As String

Dim ddDocumentVersion As String

Dim ddDocumentType As String

Dim ddOriginalpath As String

Dim ddGetComponents As String

Dim ddGetHeader As String

Dim ddGetStructure As String

ddDocumentNumber = "10000017753"

ddDocumentPart = "000"

ddDocumentVersion = "00"

ddDocumentType = "ACD"

ddOriginalpath = "C:\TEMP\SAP\"

ddGetComponents = "X"

ddGetStructure = "1"

ddGetHeader = "X"

' Logon to SAP

Dim oFunction as Object

Dim oConnection as Object

Set oFunction = CreateObject("SAP.Functions")

' Log file. Set log level to 9 to see lots of internal

' information.

oFunction.LogFileName = "wdtflog.txt"

oFunction.LogLevel = 0

Set oConnection = oFunction.Connection

oConnection.ApplicationServer = "brjgs914"

oConnection.Client = "603"

oConnection.Language = "E"

oConnection.TraceLevel = 0

oConnection.System = "ED0"

oConnection.User = "TEST_USER"

oConnection.Password = "test_user"

On Error Resume Next

Dim oFunc As Object

Set oFunc = oFunction.Add("BAPI_DOCUMENT_CHECKOUTVIEW2")

oFunc.Exports("DOCUMENTNUMBER").Value = ddDocumentNumber

oFunc.Exports("DOCUMENTTYPE").Value = ddDocumentType

oFunc.Exports("DOCUMENTVERSION").Value = ddDocumentVersion

oFunc.Exports("DOCUMENTPART").Value = ddDocumentPart

oFunc.Exports("ORIGINALPATH").Value = ddOriginalpath

oFunc.Exports("GETSTRUCTURE").Value = ddGetStructure

oFunc.Exports("GETCOMPONENTS").Value = ddGetComponents

oFunc.Exports("GETHEADER").Value = ddGetHeader

Dim oTable As Object

Set oTable = oFunc.Tables("DOCUMENTFILES")

If oFunc.Call = False Then

MsgBox ("BAPI Call failed")

Else

''''' --->>> The result goes through here.

MsgBox ("BAPI Call successful")

End If

If oTable.RowCount > 0 Then

MsgBox oTable.Value(1, "WA")

else

''''---->>>> The result goes through here.

MsgBox "The table DOCUMENTFILES is empty"

End If

If Err Then

MsgBox Err.Description '' Exception

Err.Clear

End If

End Sub

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Posted on Jan 12, 2009 at 07:58 PM

    This forum is for Business Objects Enterprise SDK help only. You will want to create this forum post in the appropriate SAP forum to get attention from people skilled in those SDKs.

    Jason

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 13, 2009 at 06:29 PM

    Ok, I send it for other forum.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.