SAP RFC 如何更改 PM 订单上的日期 [英] SAP RFC how to change date on a PM order

查看:71
本文介绍了SAP RFC 如何更改 PM 订单上的日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 SAP 函数BAPI_ALM_ORDERHEAD_GET_LIST"来检索订单号 12345.我想通过将日期移至 2015 年 1 月 1 日来更改日期.我找不到有关如何更改我使用 SAP 引入的字段的文档RFC.我可以使用代码从 SAP 获取订单,但我不知道如何更改日期.这是我的代码:

I am using SAP function "BAPI_ALM_ORDERHEAD_GET_LIST" to retrieve order number 12345. I would like to change the date by moving it to January 01 2015. I can't find the documentation on how to change a field I pulled in with SAP RFC. I can get the order from SAP with the code but I dont know how to change the date. Here is my code:

objRfcFunc = doLogin()
With objRfcFunc.Tables("IT_RANGES")
    Dim arrStr(,) As String = {{"OPTIONS_FOR_ORDERID", "12345"}, _
           {"SHOW_OPEN_DOCUMENTS", "X"}, _
           {"SHOW_DOCUMENTS_IN_PROCESS", "X"}, _
           {"SHOW_COMPLETED_DOCUMENTS", "X"}, _
           {"SHOW_HISTORICAL_DOCUMENTS", "X"}, _
           {"SHOW_DOCS_WITH_FROM_DATE", "00010101"}, _
            {"SHOW_DOCS_WITH_TO_DATE", "99991231"}}

        For i = 0 To (arrStr.Length / arrStr.Rank) - 1
            If .RowCount < i + 1 Then .Rows.Add()
            .cell(i + 1, 1) = arrStr(i, 0)
            .cell(i + 1, 2) = "I"
            .cell(i + 1, 3) = "EQ"
            .cell(i + 1, 4) = arrStr(i, 1)
        Next

    End With
    If objRfcFunc.Call = False Then
        MsgBox("Error occured - " & objRfcFunc.Exception)
        Exit Sub
    End If
    'How do I change date here?

推荐答案

如果有人需要,这里有 awnser.

Here is the awnser if anyone needed it.

    objRfcFunc = sapFunc.Add("BAPI_ALM_ORDER_MAINTAIN")

    With objRfcFunc.Tables("IT_METHODS")
        If .RowCount < 1 Then .Rows.Add()
        .cell(1, 1) = 1
        .cell(1, 2) = "HEADER"
        .cell(1, 3) = "CHANGE"
        .cell(1, 4) = oNum
        If .RowCount < 2 Then .Rows.Add()
        .cell(2, 2) = ""
        .cell(2, 3) = "SAVE"
    End With

    With objRfcFunc.Tables("IT_HEADER")
        If .RowCount < 1 Then .Rows.Add()
        .cell(1, "ORDERID") = oNum
        .cell(1, "START_DATE") = "2016-11-03"
        .cell(1, "BASICSTART") = "1:00 AM"
    End With
    With objRfcFunc.Tables("IT_HEADER_UP")
        If .RowCount < 1 Then .Rows.Add()
        .cell(1, "START_DATE") = "X"
        .cell(1, "BASICSTART") = "X"
    End With

    If objRfcFunc.Call = False Then
        MsgBox("Error occured - " & objRfcFunc.Exception)
        Exit Sub
    End If

    Dim cmt = sapFunc.Add("BAPI_TRANSACTION_COMMIT")
    If cmt.Call = False Then
        MsgBox("Error occured Commiting - " & objRfcFunc.Exception)
        Exit Sub
    End If

    cmt.exports("wait").value = "X"

    tab = objRfcFunc.Tables("RETURN")
    For i = 1 To tab.RowCount
        If (tab.Cell(i, "TYPE") = "W" Or tab.Cell(i, "TYPE") = "E") Then
            Console.WriteLine("<<-- <" & tab.Cell(i, "TYPE") & ">" & tab.Cell(i, "MESSAGE"))
        End If
    Next

这篇关于SAP RFC 如何更改 PM 订单上的日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆