Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Is there a BAPI for general SQL query

former_member625844
Participant
0 Likes
2,458

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.

5 REPLIES 5
Read only

Dominik_Tylczynski
SAP Champion
SAP Champion
1,633

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

Read only

1,633

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.

Read only

FredericGirod
Active Contributor
1,633

as 3a9e4ce873a94034b33dc62b0ce600ee said, there is RFC_READ_TABLE, but, what will you do with this ? Where will you use it ?

Read only

former_member625844
Participant
0 Likes
1,633

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

Read only

FredericGirod
Active Contributor
1,633

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