on 2005 Apr 20 6:39 PM
I am trying to implement code that can connect to several different SAP systems using the .NET connector.
Unfortunately, for some functions, the SAP systems might have different number of parameters, or possibly different lengths of these parameters (seems like this is possible). I'd like to be able to check this at runtime.
For example:
In one of the systems, BAPI_IPAK_START only takes 3 parameters instead of 4. When it only takes 3, the parameter it does not take is job name. I've noticed if I use the proxy with 4 parameters, job name just gets ignored. However, I need my code to have a different behavior when there are 3 parameters or 4. Furthermore, when there are 4 parameters, I'd like to be able to check the allowable length of "job name". (1 reason of several: I can limit the input text length in our UI appropriately.)
I don't want to generate a whole bunch of proxies for a bunch of different systems, for rather obvious reasons that is really unacceptable...
I guess I didn't really "ask" a question. My questions are really:
1. How can I check for the existence of a parameter on a function?
2. How can I check (for example) the maximum string length of a string parameter?
I thought there might be an RFC like RFC_FUNCTION_SEARCH that might give me back the answers to both these questions, but I can't seem to find one. But I'm probably just blind. Ideas?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Reading metadata about RFCs (like parameters names parameter types, length, offsets and so on) it not a trivial thing to do. This is one of the reasons that SAP .NET Connector is proxy based and gets this information at design time using a small Java program.
The general recommendedation is generally to use BAPIs that are guaranteed to have a stable API over many realeas cycles. Or you define your own ABAP and import it into the system(s).
Another option is a feature in NCo runtime (that is currently not supported by the NCo code generator):
You might have seen that NCo uses custom attributes like RfcMethodAttribute, RfcParameterAttribute and so to store the metadata. Each has a "Release" property. You can have multiple of them, each with a different release setting. You can by this specify release ranges in which some of the metadata is valid. NCo runtime uses this information to select the correct one at runtime.
Walk through the BOR and find all Methods and Keyfields. You find some properties in the property windows.
To see the details, you need to create a Proxy - don't mind, you can delete it later: Add a new SAP Proxy and drag the BOR class to the designer. Than you can see all methods and keyfields on the BOR class. If you select a method, you can see all relevant properties on the property window. The Parameters are available as and extra window - including e.g. if they are optional.
User | Count |
---|---|
71 | |
11 | |
10 | |
10 | |
10 | |
8 | |
7 | |
7 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.