cancel
Showing results for 
Search instead for 
Did you mean: 

ABAP LIKE Operator in JOIN

former_member460045
Participant
0 Kudos

Hi,

I want to do a JOIN with a Like Operator.

SELECT s~*,t~BUKRS, t~BUTXT FROM smmain as s inner join t001 as t ons~VARIANTE LIKE t~BUKRS into CORRESPONDING FIELDS OF TABLE @et_entitysetwhere UNAME = '755285'.

Unfortunately the Workbench tells me, that only Data type C is allowed for this. Even though, the fields are already data type C.

How can I do this LIKE Operation with table fields?

Best regards
Jo

Accepted Solutions (0)

Answers (2)

Answers (2)

chaouki_akir
Contributor
0 Kudos

I tried in my system and my conclusion is that it is not possible with OPEN SQL. This SQL statement can be executed with Native SQL (cl_sql_statment). But I am not sure about the result you intended to have because I suppose there is no '%' in t001.bukrs. What data is there in your tables smmain and t001 (smmain.variante and t001.bukrs) ? Can you show example of entries that you want to join ?

former_member460045
Participant
0 Kudos

Yes, I understand your point. Of course you are right.

Cant I do something like a CONCAT.

SELECT s~*,t~BUKRS, t~BUTXT FROM smmain as s inner join t001 as t ons~VARIANTE LIKE CONCATENATE( '%' t~BUKRS '%') into CORRESPONDING FIELDS OF TABLE @et_entitysetwhere UNAME = '755285'.

I'm not very familiar with ABAP, so I'm not quite sure about that.

Best regards

Johannes

DoanManhQuynh
Active Contributor
0 Kudos

you cant put a field after LIKE, it have to a variable or a value.