Select-options to RFC_READ_TABLE options

This is not going to be rocket-science, but after searching SCN for some time not finding the answer/code I needed, but realizing that many people have the same/similar requirement to mine, I decided to share this code via this blog.

Summary:

* you have a report with select-options

* you need to collect data from remote systems and despite all the warnings that the RFC_READ_TABLE function module should not be used (although it is used in zillions of SAP standard programs as well as customer programs so it is zero chance SAP would ever change or remove this function module, I would say), you decided to go for RFC_READ_TABLE.

* you need to transfer the complex selection provided by the user to the remote system because downloading all the data to the local system and deleting the data based on the selection locally is just so inefficient and slow (try transferring huge tables via RFC once and you will understand why this blog…)

* …which means you need to transfer the select-options to the remote system, because the selection is much smaller and faster to transfer than all the data in the table you need to download

Here is the code you need…

* first comes the part of the WHERE clause that you can easily specify manually/hardcode in the source code, because it never changes

* then comes the conversion of one select-option (so for more select-options you need to do this several times)