1

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!

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
Shend
  • 95
  • 1
  • 9
  • 1
    If you're looking for a list of BAPIs, you can search in [SAP Community forum](https://answers.sap.com). `RFC_READ_TABLE` is a function module to execute generic SQL queries, so you should be able to query anything. Maybe the issue is about to access specific data in work and sales orders. Which data? – Sandra Rossi Feb 13 '20 at 10:59

1 Answers1

2

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.

Suncatcher
  • 10,355
  • 10
  • 52
  • 90