0

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 don't 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?
Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
cbkrunch
  • 45
  • 8

2 Answers2

0

As far as I can see, you need to use the BAPI BAPI_ALM_ORDER_MAINTAIN for this. Be sure to consult the documentation of that function module.

vwegert
  • 18,371
  • 3
  • 37
  • 55
  • The problem is there is no documentation of how to do this in RFC. All of the examples are SQL statments – cbkrunch Jun 03 '14 at 12:58
  • You won't find an example on how to call every single RFC-enabled function module in every single programming language out there. You will have to do some of the work by yourself :-) – vwegert Jun 04 '14 at 10:26
  • I will take an example in any OOP lang. – cbkrunch Jun 04 '14 at 12:31
0

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
cbkrunch
  • 45
  • 8