Application Development 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: 

Open SQL and UNION ALL

Former Member
0 Kudos

Hi,

I want to do a union all for two open SQL statements at the database level, e.g:

SQL statement 1

UNION ALL

SQL statement 2.

Is this possible with ABAP open sql? I know its possible via native sql or using manipulations via ABAP internal tables (FOR ALL ENTRIES, joins, etc) but I don't want to take these routes and want to do it with just a SQL instead...So is this possible?

6 REPLIES 6

Former Member
0 Kudos

A subquery?

Rob

Former Member
0 Kudos

Already covered the sub query option but its not applicable to what I need since I am interested in a union of datasets rather than the results of dataset derived from another dataset.

ferry_lianto
Active Contributor
0 Kudos

Hi Thang,

Check this link perhaps it may help.

http://help.sap.com/saphelp_nw2004s/helpdata/en/05/5b0e24d68849d4abcf034885ca82a0/content.htm

Regards,

Ferry Lianto

sridhar_k1
Active Contributor
0 Kudos

Try with two open sql select statements works similar to UNION ALL:

select f1 f2 from tab1 into corresponding fields of table itab.

select f1 f2 from tab2 appending corresponding fields of table itab

Regards

Sridhar

Former Member
0 Kudos

thanks for the info everyone. figured in the end that ABAP OPEN SQL couldn't handle UNIONs very well as per native SQL. Had wanted to transfer the processing logic to the DB but in the end of the day, I gave up and just did the union using internal tables.

0 Kudos

This message was moderated.