pythonabapbapipyrfc

How to fetch work order data using Pyrfc?


I'm using pyrfc to connect to SAP. I need to download work order data and sales order data. I've been using the 'RFC_READ_TABLE' function, but I don't seem to be able to get what I need. Can someone point me to a resource that would guide me in this process?

I had the idea to use BAPI functions, however I am unable to find the right functions for the data that I need.

Thanks!


Solution

  • I believe that BAPI_ALM_ORDER_GET_DETAIL is exactly what you need:

    from pyrfc import Connection
    params = dict(ashost='1.1.1.1', sysnr='1', client='100',
                  user='username', passwd='password')
    num = '100000'
    with Connection(**params) as conn:
        # Method 1
        result = conn.call('BAPI_ALM_ORDER_GET_DETAIL', NUMBER=num)
        header = result['ES_HEADER']
        operations  = result['ET_OPERATIONS']
    

    You can inspect its interface and choose the parameters to fetch from order.