cancel
Showing results for 
Search instead for 
Did you mean: 

Determining parameter length of methods

Former Member
0 Kudos

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...

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

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?

reiner_hille-doering
Active Contributor
0 Kudos

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.

Former Member
0 Kudos

I'll look into the release property. Thanks!

Former Member
0 Kudos

I can remember years ago with the SAP IBM connector and Visual age for java was possible to explore the BOR and get all the parameters in a nice Html page.

I wonder if the new nCO has a similar function.

reiner_hille-doering
Active Contributor
0 Kudos

It has - in the design time in Visual Studio - but not as HTML page, but as an interactive designer.

Former Member
0 Kudos

what I'm looking for is a chance to get an overview about the parameter type, lenght and if is optional .

How can I do it in the design time in VS?

reiner_hille-doering
Active Contributor
0 Kudos

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.