03-31-2017 4:06 PM
Is it possible to use UNION with FOR ALL ENTRIES ?
for e.g.
SELECT FROM table1 AS _table1
LEFT JOIN table2 AS _table2 ON _table1~source_doc = _table2~execution_document
LEFT JOIN table3 AS _table3 ON _table2~instrument = _table3~instrument
FIELDS
*-- table1 part
_table1~pricing_key ,
_table1~kposn ,
_table1~kschl ,
_table1~kschl_subkey ,
*-- table2 Part
_table2~valid_to_tst ,
_table2~kbetr ,
_table2~document ,
_table2~execution_document ,
*-- table3 Part
_table3~instrument ,
_table3~pricedate_to ,
_table3~price
FOR ALL ENTRIES IN @lt_sel_table1
WHERE _table1~source_doc = @lt_sel_table1-source_doc AND
_table2~cgroup_cat = @gc_condition AND
_table3~pricetype = _table2~pricetype AND
_table3~pricedate_to = @gc_max
UNION
SELECT FROM table1 AS _table1
LEFT JOIN table2 AS _table2 ON _table1~pricing_key = _table2~pricing_key
LEFT JOIN table3 AS _table3 ON _table2~instrument = _table3~instrument
FIELDS
*-- table1 part
_table1~pricing_key ,
_table1~kposn ,
_table1~kschl ,
_table1~kschl_subkey ,
*-- table2 Part
_table2~valid_to_tst ,
_table2~kbetr ,
_table2~document ,
_table2~execution_document ,
*-- table3 Part
_table3~instrument ,
_table3~pricedate_from ,
_table3~price
FOR ALL ENTRIES IN @lt_sel_table1
WHERE _table1~source_doc_type = 'BUS2028' AND
_table2~cgroup_cat = @gc_contract_condition AND
_table3~pricedate_to = @gc_max
into table @data(lt_anchored_data).
This code gives me syntax error “UNION can not be used here . is expected”. I am not sure that it is because of FOR ALL ENTRIES or some other error.
Please suggest if the issue is known to anyone.
04-01-2017 8:38 AM
Indeed, I'm getting a little bit tired of answering please read this documentation or that documentation.
04-01-2017 7:03 AM
04-01-2017 8:38 AM
Indeed, I'm getting a little bit tired of answering please read this documentation or that documentation.
04-01-2017 5:18 PM