vbscript SAP B1期刊录入

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了vbscript SAP B1期刊录入相关的知识,希望对你有一定的参考价值。

The following sample code shows how to add a JournalEntries object into the database.
Private Sub cmdTest_Click()
   On Error GoTo ErrorHandler
   Dim vCompany As SAPbobsCOM.Company

   'create company object
   Set vCompany = New SAPbobsCOM.Company

   'set paras for connection
   vCompany.CompanyDB = "SBODemo_US"
   vCompany.Password = "manager"
   vCompany.UserName = "manager"
   vCompany.Server = "(local)"

   'connect to database server
   If (0 <> vCompany.Connect()) Then
      MsgBox "Failed to connect"
      Exit Sub
   End If

   Dim nErr As Long
   Dim errMsg As String

   'add an Journal entry
   Dim vJE As SAPbobsCOM.JournalEntries
   Set vJE = vCompany.GetBusinessObject(oJournalEntries)
   vJE.TaxDate = Now
   vJE.Lines.AccountCode = "110000"
   vJE.Lines.ContraAccount = "10110"
   vJE.Lines.Credit = 0
   vJE.Lines.Debit = 150
   vJE.Lines.DueDate = CDate("11/13/ 2002")
   vJE.Lines.ReferenceDate1 = Now
   vJE.Lines.ShortName = "110000"
   vJE.Lines.TaxDate = Now
   Call vJE.Lines.Add
   Call vJE.Lines.SetCurrentLine(1)
   vJE.Lines.AccountCode = "10110"
   vJE.Lines.ContraAccount = "110000"
   vJE.Lines.Credit = 150
   vJE.Lines.Debit = 0
   vJE.Lines.DueDate = CDate("11/13/ 2002")
   vJE.Lines.Line_ID = 1
   vJE.Lines.ReferenceDate1 = Now
   vJE.Lines.ShortName = "10110"
   vJE.Lines.TaxDate = Now
   If (0 <> vJE.Add()) Then
       MsgBox ("failed to add a journal entry")
   Else
       MsgBox ("Succeeded in adding a journal entry")
       vJE.SaveXml ("c:\temp\JournalEntries" + Str(vJE.JdtNum) + ".xml")
   End If

   'Check Error
   Call vCompany.GetLastError(nErr, errMsg)
   If (0 <> nErr) Then
       MsgBox ("Found error:" + Str(nErr) + "," + errMsg)
   End If

   'disconnect the company object, and release resource
   Call vCompany.Disconnect
   Set vCompany = Nothing
   Exit Sub
ErrorHandler:
   MsgBox ("Exception:" + Err.Description)
End Sub 

以上是关于vbscript SAP B1期刊录入的主要内容,如果未能解决你的问题,请参考以下文章

vbscript 检测文件名的期刊是否和文件里页眉页脚的期刊一致,提示询问期刊标识是否正确

vbscript 新期刊发表

sap 凭证录入时分配字段自动带出记账日期怎么取消

vbscript Manejo de grid SAP

小企业用sap b1的产品好吗?效果怎么样?

SAP MM 可以不用创建盘点凭证直接录入盘点结果?