【问题标题】:PM Order change status to TECO - BAPI - VB ABAPPM 订单更改状态为 TECO - BAPI - VB ABAP
【发布时间】:2019-10-16 07:12:22
【问题描述】:

我的代码以MsgBox "TECO FuBa Call false!" 结尾。

LogOnLogout 函数工作正常,当我通过 SAP GUI 事务代码 SE37 测试函数模块 BAPI_ALM_ORDER_MAINTAIN 时,一切正常。

我已经检查过: PM Order change status to TECO

Public Sub teco()
Dim auftr As String
Dim teco_date As Date
teco_date = Format(Now, "dd/MM/yyyy")
auftr = "000123456789"    

Dim oFuBa As Object
Set oFuBa = Nothing
Set oFuBa = objBAPIControl.Add("BAPI_ALM_ORDER_MAINTAIN")

' EXPORTING
Dim e_import As Variant
Set e_import = oFuBa.Exports("IV_MMSRV_EXTERNAL_MAINTENACE")
e_import.Value = ""

' TABLES
Dim t_methods_data As Variant
Set t_methods_data = oFuBa.Tables("IT_METHODS")

Dim Row As Object
Set Row = t_methods_data.Rows.Add
Row("REFNUMBER") = "0001"
Row("OBJECTTYPE") = "HEADER"
Row("METHOD") = "TECHNICALCOMPLETE"
Row("OBJECTKEY") = auftr

Set Row = t_methods_data.Rows.Add
Row("REFNUMBER") = "0001"
Row("OBJECTTYPE") = ""
Row("METHOD") = "SAVE"
Row("OBJECTKEY") = auftr

MsgBox CStr(t_methods_data.RowCount)

Dim t_header_data As Variant
Set t_header_data = oFuBa.Tables("IT_HEADER")

Set Row = t_header_data.Rows.Add
Row("ORDERID") = auftr
Row("TECO_REF_DATE") = CStr(teco_date)
Row("TECO_REF_TIME") = "00:00:00"

MsgBox CStr(t_header_data.RowCount)

Dim t_return As Variant
Set t_return = oFuBa.Tables("RETURN")

If oFuBa.Call = True Then
    If t_return.RowCount > 0 Then
            If t_return.Cell(1, 1) = "E" Then
                Dim oFuBa2 As Object
                Set oFuBa2 = objBAPIControl.Add("BAPI_TRANSACTION_ROLLBACK")
                If oFuBa2.Call = True Then
                    t_methods_data.Rows.Remove
                    t_methods_data.Rows.Remove
                    t_header_data.Rows.Remove
                End If
            Else
                Dim oFuBa3 As Object
                Set oFuBa3 = objBAPIControl.Add("BAPI_TRANSACTION_COMMIT")
                If oFuBa3.Call = True Then
                    MsgBox "TECO commit true!"
                Else
                    MsgBox "TECO commit false!"
                End If
            End If
            MsgBox "Ende Teco!"
    Else
            MsgBox "Ende TECO return False!"
    End If
Else
       If oFuBa.Exception <> "" Then
            MsgBox "Exception: " & oFuBa.Exception
        End If
            MsgBox "TECO FuBa Call false!"
End If
End Sub

我做错了什么?

【问题讨论】:

  • oFuBa.Exception 包含什么?
  • 这是 VBA 还是 VB6? vb.net 中没有 Variant 数据类型。
  • 它在 VB6 中,我将检查异常。 sap中的bapi在异常下没有条目时可以添加吗?
  • 我已经为异常添加了块,但没有抛出异常! If oFuBa.Exception &lt;&gt; "" Then MsgBox "Exception: " &amp; oFuBa.Exception End If

标签: vb6 abap saprfc bapi


【解决方案1】:

看起来不错,所以也许这些点会有所帮助。

  • 创建时无法订购东元订单。你只能东元和退出订单。仅更改。
  • 如果您有标头通知 (AFIH-QMNUM ),请尝试使用 method = 'TECO_WITH_NOTIF' 而不是 'TECHNICALCOMPLETE'

【讨论】:

    猜你喜欢
    • 2017-05-24
    • 2018-08-30
    • 2021-11-26
    • 1970-01-01
    • 2022-10-05
    • 2018-01-01
    • 2019-02-01
    • 1970-01-01
    • 2022-09-30
    相关资源
    最近更新 更多