Skip to Content

How to Concatenate in SELECT query using FOR ALL ENTRIES?

Dear Techies,

i have came across a situation, like writing a select query using new enhanced OpenSQL, here i am concatenating two sting fields into single field with for all entries as of requirement.

Example ABAP Query

SELECT kunnr, ( inco1 && inco2 ) as inco, FROM knvv INTO TABLE @<target table> FOR ALL ENTRIES IN @<base table> WHERE <condition follows>.

But I am getting error "<b> The addition or variable with ID "INCO1" is not allowed in conjunction with FOR ALL ENTRIES. </b>"

I understood that concatenation not allowed while FOR ALL ENTRIES.

My questions here are,

1. Is any alternate to concate in the query itself?

2. Want to know the reason that why not allowed concatenate using FOR ALL ENTRIES?

googled for information on above questions, unfortunately did not find satisfied solutions.

Please share information.

Thanks for Advance,.

Vijay

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Posted on Nov 06, 2019 at 09:40 AM

    Minimal code to reproduce the problem:

    DATA carrids TYPE TABLE OF scarr-carrid.
    SELECT carrid, ( carrname && currcode ) as inco FROM scarr INTO TABLE @DATA(scarr_s) 
    FOR ALL ENTRIES IN @carrids WHERE carrid = @carrids-table_line.

    Error message:

    The addition CARRNAME is not allowed in combination with FOR ALL ENTRIES. Use JOINs or global temporary tables instead of FOR ALL ENTRIES.
    

    Solution: do as suggested

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Nov 06, 2019 at 05:19 AM

    Hello Vijay Simha,

    Recommend you to go through the below link for the DOs and DONTs with respect to FOR ALL ENTRIES.

    FOR ALL ENTRIES

    Alternate solution would be using joins of the respective tables.

    Regards!

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.