2020 Mar 13 6:44 AM
I wonder is there a BAPI which take a SQL as import parameter and return the result in a table?or I have to write BAPI for each query I need? Thx.
2020 Mar 13 6:55 AM
There is a RFC-enabled function RFC_READ_TABLE that you might consider. Just go through SAP support noted on the function so you know its limitations and authorization concept.
Otherwise there is no generic, all purpose, Swiss-army-knife BAPI that would allow to execute an arbitrary SQL query. That would be a gaping hole in the security.
Best regards
Dominik Tylczynski
2020 Mar 13 8:08 AM
Especially note 382318 - RFC_READ_TABLE
It's generic, so it's a security problem that any table with sensitive data can be extracted (private information, address, email, and so on), now and in the future. The list of tables which can be extracted can be limited via S_TABU_* authorization objects.
2020 Mar 13 6:57 AM
as 3a9e4ce873a94034b33dc62b0ce600ee said, there is RFC_READ_TABLE, but, what will you do with this ? Where will you use it ?
2020 Mar 13 7:17 AM
@frdric.girod.I want to use it in Jco to fetch data from SAP and display in a web page. Since there are several list to write I wonder is there a general way.
2020 Mar 13 7:27 AM
If it is Web related, naybe you have to check this blog:
https://blogs.sap.com/2016/04/06/expose-cds-views-as-odata-service/
You will have some job to do, creating the CDS view (if the standard is not enough) and you could create a Odata service for each CDS (Rest).