Are you tired of creating large numbers of data types in your client-system when you call a remote enabled function module (RFM) by RFC and the data types of its parameters do not exist on the client? Let transaction ACO_PROXY do it for you. In a fraction of the time you need to create all these data types yourself, this tool, also called ABAP connector (ACo) and available as of ABAP 7.40, generates:
| Note: You can also generate one ACo proxy class for RFC calls of several RFMs, if calling each of them with a different method of the same proxy class makes sense from a design perspective. Since, in principle, it is irrelevant to the explanations in this weblog whether a proxy class covers calls to one or many RFMs and in order to keep things simple, I explain the concepts and features of transaction ACO_PROXY using the case of generating a proxy that calls one RFM. |
Reading this weblog,
| Note: Transaction ACO_PROXY performs a recursive analysis of all complex data types used in the relevant RFM’s interface down to the elementary ones and recreates all of them in the client system. Since this tool creates global data types, you can use them not only in your caller program, but in any program in your client system. |
Note: Two other use cases of transaction ACO_PROXY are just mentioned in this introduction, because the first one needs little explanation, and the second one is treated in great detail in a weblog of an SAP colleague:
|
Let us now consider a real-world example of using transaction ACO_PROXY:
Imagine yourself writing a client program which calls the BAPI BAPI_BUPA_ADDRESS_CHANGE by RFC to change the address of a business partner. Its interface has 8 importing and 38 table parameters, which all have complex data types, and neither the BAPI nor any of its data types exist in your client system.
| Note: “BAPI” is an Acronym for “Business Application Programming Interface”. From a technical perspective a BAPI is an RFM for which SAP guarantees a stable interface. From a business perspective BAPIs are interfaces to business objects, which are implemented as function modules. |
If we break all these complex data types down into their components, we get almost 800 elementary data types, which you all have to recreate in the client system – and on top of them also the 46 complex data types. Assuming that you are a fast developer, let us estimate that, on average, in ABAP Dictionary (transaction SE11), it takes you one minute to define an elementary data type and another 20 seconds per component to define a complex data type. Based on this very optimistic estimate, you need about 17 hours for this job.
When you are facing such a repetitive task, transaction ACO_PROXY is a game changer: Just enter the name of the relevant RFM and of a suitable destination as well as some other values in the tool. This is all it takes to make this transaction generate all the almost 800 elementary and 46 complex data types used in this BAPI’s parameters and a proxy class for an RFC call to the BAPI BAPI_BUPA_ADDRESS_CHANGE.
With transaction “ACO_PROXY”, it takes a few minutes to generate the many hundred data types in our example, compared to about 17 hours you need for this task without tool support. In fact, 17 hours is an optimistic estimate for such a job, actually creating all data types used in the parameters of BAPI BAPI_BUPA_ADDRESS_CHANGE might take far longer.
Let us now dive into the details of how to use this transaction. Below, there is a screenshot of ACO_PROXY’s UI with a few numbered labels, which refer to relevant input fields to be explained in this section. You will get to know also some more details of the transaction’s UI in the section to follow.
Picture 1: Transaction ACO_PROXY and its input fields
Note: The option to get the metadata by RFC – whether you retrieve them directly from the remote system or upload them from a file that in turn has got them from the remote system - is needed if, for example, you want to generate an ACo Proxy call to an RFM that, in your landscape, is not available on any system whose release supports transaction “ACO_PROXY”. |
You can also choose:
Normally, you are almost done now. Just press “Execute” or F8 to generate:
In an SM59 destination that is used in an RFC call via an ACo proxy you should always select these options in the tab “Special Options”:
With any other serialization or interface check, you might run the risk of data corruption due to incorrect data offset, which might happen to a parameter with a structured data type if this data type differs between client and server system. Though the probability that this might occur is small, once it happens, it might corrupt a large part of the data in the relevant table or structure and thereby cause big harm. Therefore, it is important to always choose fast serialization for new scenarios in destinations used by an ACo proxy.
Now, let us call an ACo proxy in a program. Suppose you have created a proxy class zcl_rfc_system_info, which calls RFM RFC_SYSTEM_INFO via RFC, which needs the destination name in the constructor, and which you want to call in the same system.
This is how you instantiate this class and pass destination SELF to the constructor:
And this is the code to call this RFM using the proxy class instance:
Obviously, this code is self-explaining and does not offer any surprise for you ABAP developers.
| Note: The name of the public instance method to call an RFM always is the name of the respective RFM. But there is no need to choose a proxy class name that contains the respective RFM’s name – as we do it in the example above. |
There is also the option to create a dynamic ACo proxy class, and certainly you want to know, if there are use cases, in which a dynamic proxy might be advantageous over the static proxy generated by transaction “ACO_PROXY”. So, let’s start with a short description how dynamic ACo proxy works:
| Note: For a code example of how to create and use a dynamic ACo proxy, look at the program SAP_ACO_EXAMPLE_DYNAMIC_PROXY – also delivered with ABAP 7.40. Developers familiar with using SAP JAVA and SAP .NET Connector will see that, in many respects, creating and using a dynamic ACo proxy class is similar to how you things work with these other two connectors. |
Each time a program runs that uses a dynamic ACo proxy to call an RFM, this proxy is created via API based on the respective RFMs metadata. The dynamic proxy class is not persisted. For this reason, the parameters of the proxy class are always up-to-date, even after an upgrade of the server side involving changes to the respective RFM’s interface, which would require recreation of a static proxy. This, at first sight, appears to be a big advantage of the dynamic proxy over the static one. But in this case, appearances are deceiving:
If, for example, after an upgrade, the relevant RFM has additional input or output parameters, a developer has to adapt the client program’s code – be it to process additional output values or to pass values to the additional input parameters. But if developer action is required in any case – to extend the client program accordingly -, then it makes little difference whether or not the ACo proxy class also needs to be re-created as in the case of a static proxy: Compared to the effort required to adapt the client program, the additional effort needed to recreate the proxy class is negligible. Therefore, as to the case of changes to the RFM’s interface, what, at first sight, may appear to be a big advantage of the dynamic over the static proxy, in fact, carries no weight.
In contrast, the advantages of the static proxy are weighty:
Therefore, we arrive at the conclusion that, in most cases, you are better off using the static proxy. But – and this is the relevant exception -, you should choose the dynamic ACo proxy, if it is used in a completely dynamic framework. In all other cases, you should prefer the static proxy over the dynamic one.
| Note: As with all RFC calls and no matter which kind of ACo proxy you use, after an upgrade of the respective the server system, you should have a look into possible changes of the respective RFM’s interface and also test the relevant connections. If needed, just recreate your static ACo proxy and – as required or useful for your client-program - adapt or extend the program’s code no matter which flavor of ACo you use. |
After all, transaction ACO_PROXY
Normally, you are better off with a static than with a dynamic proxy class to be created by an ACo API. Only if the ACo proxy should be part of a fully dynamic framework, you should use dynamic ACo. In all other cases the static proxy is not only fully sufficient but even the better choice.
Just try it out and you will see: Transaction ACO_PROXY really is a big time saver.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 57 | |
| 16 | |
| 10 | |
| 10 | |
| 10 | |
| 9 | |
| 9 | |
| 9 | |
| 9 | |
| 8 |