cancel
Showing results for 
Search instead for 
Did you mean: 

Show content of two database tables in one UI5 Frontend table

hnrkdwl
Explorer
0 Kudos

Hi Experts,

I'm currently working on a UI5-project (oData version 4), where I want to read the content of two different tables from the Backend and display them in one table in the Frontend. Reading the content of one table and displaying it in the Frontend works fine but I can't find a solution on how to read the content of both and merge them into one big table.

E.g. I've got table1 (database table) with veggies and table2 (also database table) with fruits. They've got both the same properties like weight, price, expiration date but also have got some different properties.

In the Frontend I now want to display all the fruits and veggies in a singular table that only has the shared properties as columns (weight, price, expiration date).

Thanks in advance

View Entire Topic
gichuhimd
Explorer

Hi,

You will need to select the two tables with same properties and use APPENDING TABLE to combine the two tables whose properties are same. APPENDING TABLE works the same way as UNION in SQL.

e.g.

statement 1: SELECT * FROM TABLE1 INTO itab_veg_fruit.

statement 2: SELECT * FROM TABLE2 APPENDING TABLE itab_veg_fruit.

Regards,

Dominic.

hnrkdwl
Explorer
0 Kudos

Thank for very much for your response! Although it was not quite the solution I was asking for, you showed me that I might have been thinking about my problem the wrong way around trying to find a solution in the frontend and not in the backend.

Still I wonder if there is no way to actually combine the two tables in the *frontend*...
Cheers