Monday, February 4, 2008

Counterintuitive Coding

BAPI_ALM_ORDEROPER_GET_LIST is provided by SAP to find a list of operations for a service order. It is the equivalent of transaction IW33 where you can see the list of the order operations.

The question is, how do you specify the service order that the operations are attached to?

There is a helpful IT_RANGES structure which you can populate with field / value pairs to simulate the entry of selection options. So far so good. The problem comes in determining the field names to use.

Unable to find any documentation on the field names, and having failed to get the thing to work with SAP data dictionary field names, or with the non-German BAPI structure field names, I ended up in the debugger tracking down the ME206 error message - selection parameter not defined.

Guess what intuitive field names have been chosen for the ranges table?

OPTIONS_FOR_WORK_CNTR

OPTIONS_FOR_PLANT

OPTIONS_FOR_ORDERID

OPTIONS_FOR_DOC_TYPE

OPTIONS_FOR_ACTIVITY

OPTIONS_FOR_REFDATE

OPTIONS_FOR_DESCRIPTION

OPTIONS_FOR_FUNCLOC

OPTIONS_FOR_EQUIPMENT

OPTIONS_FOR_MATERIAL

OPTIONS_FOR_SERIALNO

OPTIONS_FOR_SORTFIELD


So if you are using this function, and you think you should put ORDERID in the fieldname, try OPTIONS_FOR_ORDERID instead....

No comments: