cancel
Showing results for 
Search instead for 
Did you mean: 

CONCAT SQL Operation with more than 2 Parameters as INNER JOIN Condition in AMDP issue.

Sijin_Chandran
Active Contributor
0 Kudos

Hello ABAP Gurus,

I have an SQL query where I need to use 'NOT LIKE' operation along with CONCAT operation in INNER JOIN, but CONCAT is not accepting more than 2 Parameters.

Below is the Code snippet,

Error message says " SQLSCRIPT message:wrong number of arguments in function invocation.

Actually I want to use NOT LIKE for below purpose:

I just followed the below thread for writing this query.

https://stackoverflow.com/questions/23276344/like-operator-in-inner-join-in-sql

Please guide, how to proceed or where I am wrong.

Thanks,

Sijin

Accepted Solutions (1)

Accepted Solutions (1)

matt
Active Contributor

Use two CONCATs

CONCAT( ( '%' , zsd_catalog_price.zz_catalog ), '%' )

Two things:

1. Use the CODE button in the editor for posting code. Right click "paste as plain text".

2. Why have a fieldname in a Z table that begins ZZ - why not a meaningful name, like "catalog"?).

Sijin_Chandran
Active Contributor
0 Kudos

First very thanks Matthew for your time and suggestion,

I will check your suggestion for sure,

But in the below Stackoverflow link they are doing it in one single Concatenate ( 3 parameters ),

https://stackoverflow.com/questions/23276344/like-operator-in-inner-join-in-sql

SQL should be SQL everywhere right ? ( Correct me if I am wrong )

And for your below concern,

2. Why have a fieldname in a Z table that begins ZZ - why not a meaningful name, like "catalog"?).

I cent percent agree with you, actually this field was added by another developer and he moved out of our project ( of course not for this reason 😉 ). Since the solution was already in use by the time I pitched in , so thought of not touching it.

Thanks,

Sijin

matt
Active Contributor

SQL should be SQL everywhere right ?

Wrong. For a start, while SQLs across different databases are very similar and largely standardised, they can have different functions. CONCAT for HANA SQL only allows two parameters.

However, the main point you really need to understand is that this isn't SQL! It's openSQL which is part of the ABAP programming language. If you read the documentation for CONCAT in the ABAP help, you'll see it only accepts 2 parameters.

If in doubt, read the documentation. I've been programming ABAP since 1997 and I still refer to the ABAP help on an almost daily basis.

Sijin_Chandran
Active Contributor
0 Kudos
AND cdpos.value_new NOT LIKE CONCAT( CONCAT('%', t_customers.zz_catalog),'%')

Above worked like charm 🙂

Thank you very much.

Sandra_Rossi
Active Contributor

Things are not simple, even openSQL is now named ABAP SQL (>= 7.53) 😉

Answers (0)