2024 Oct 18 7:47 AM - edited 2024 Oct 18 9:09 AM
"sample scenario
WITH +raw_data AS (
SELECT sold_to_id, bill_to_id
FROM Z_table
)
SELECT *
FROM +raw_data as A
WHERE A~sold_to_id <> A~bill_to_id
INTO TABLE (LT_KUNNR).
hi guys, does anyone knows why the statement above will give me sy-subrc = 4 but it returns me result if I use conventional SELECT?
Request clarification before answering.
I have found the answer with chatgpt..it was due to my columns contain NULL values
If either column1 or column2 contains NULL values, the comparison will not return TRUE because any comparison with NULL returns NULL. To handle NULL values, use IS NULL or COALESCE:
WITH cte_name AS ( SELECT column1, column2 FROM table_name) SELECT * FROM cte_nameWHERE COALESCE(column1, '') = COALESCE(column2, '');
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 28 | |
| 14 | |
| 13 | |
| 6 | |
| 5 | |
| 5 | |
| 4 | |
| 4 | |
| 4 | |
| 4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.