cancel
Showing results for 
Search instead for 
Did you mean: 

Create Process order through BAPI_PROCORD_CREATE with MS Excel

0 Kudos

Hi All,

I'm trying to create a process order via BAPI_PROCORD_CREATE and VBA.

Strange enough SAP doesn't throw an exception or message. The return table stays "nothing" as well as all other return fields (order number & order type). I'm checking the SAP connection, and this is opened, also rights are oke, because when I call the BAPI through SE37, it all works fine. Thanks for your comments in advance.

Regards, Aschwin

Below the code I'm trying to execute.

    Set Func = FunctionsC.Add("BAPI_PROCORD_CREATE")
    'Importing parameters are set
    Func.Exports("ORDERDATA").Value(2) = Material 'Material '18 characters including leading zeros
    Func.Exports("ORDERDATA").Value(3) = "####" 'Plant
    Func.Exports("ORDERDATA").Value(5) = "####" 'Order type
    Func.Exports("ORDERDATA").Value(6) = BasicS 'Basic start. Format YYYYMMDD
    Func.Exports("ORDERDATA").Value(7) = "00:00:00" 'Basic start time
    Func.Exports("ORDERDATA").Value(8) = BasicF 'Basic finished. Format YYYYMMDD
    Func.Exports("ORDERDATA").Value(9) = "00:00:00" 'Basic finish time
    Func.Exports("ORDERDATA").Value(10) = Quantity 'Quantity
    Func.Exports("ORDERDATA").Value(29) = StorageLocation 'Storage location

    'Tables and fields are defined to read get the messages returned
    Set tRETURN = Func.Tables("RETURN") 'table stays empty after call
    OrderNo = Func.Imports("ORDER_NUMBER") 'no number after call
    
    'Executing the FM
    If Func.Call = False Then
        AddLogCreate "SAP Error", Func.Exception, vbRed
        AddLogCreate "RFC", "Function call failed", vbRed
        shScript.Cells(currentline, 9).Value = "-"
    Else 'Below code gets executed, but no order is created
        DumpReturn tRETURN 'Write return records to log
    End If

Accepted Solutions (0)

Answers (0)