我有一个问题需要澄清。我用的是Excel 2003。该表包含12列。我需要从Excel导出数据到SAP软件。在导出之前,我需要检查记录是否存在,如果存在,则删除和插入。
我有两个BAPI,这一个是导入表,里面需要填入参数,填入这个表后BAPI搜索相关记录。
列表将显示在表格中。我需要从Excel中搜索该表的值,然后导入一个字段值到Excel。
我写了这段代码,但它不工作的BAPI给Error 0
。
提前感谢任何帮助。..
Public Function Import_Order() As Boolean
Dim oBAPIGetOrder As Object
Dim oBAPIVariant1 As Object
Dim oBAPIVariant2 As Object
Dim oBAPIVariant3 As Object
Dim oBAPIImpOrder As Variant
Dim oBAPIRet As Boolean
Dim oDoNothing As Variant
gBAPIPlanOrder = 0
Set oBAPIGetPlOrder = sBAPIControl.Add("PLANED_GET_DET_LIST") 'BAPI
Set oBAPIVariant1 = oBAPIGetPlOrder.exports.Item("SELECTIONCRITERIA") 'Internal table
Set oBAPIVariant2 = oBAPIGetPlOrder.Tables.Item("DETAILEDLIST") 'Table
oBAPIVariant1.Value("MATERIAL") = eMaterial
oBAPIVariant1.Value("PLANT") = ePlnPlant
lBAPIRet = oBAPIGetPlOrder.call
If lBAPIRet Then
'oBAPIImpOrder = oBAPIGetPlOrder.imports.Item("PLANNEDORDER_NUM")
a = oBAPIVariant2.Rows.Count
oBAPIImpOrder = oBAPIVariant2.Value("PLANNEDORDER_NUM")
Import_PlannedOrder = True
Else
oBAPIImpOrder = 0
Import_PlannedOrder = False
End If
End Function
1条答案
按热度按时间vmdwslir1#
请将调用函数语句lBAPIRet = www.example.com 在exports语句之后,在tables和importstatements之前