2025 Mar 25 10:04 AM - edited 2025 Mar 25 10:15 AM
Dear SAP-Community
I have an abap-sql, that selects data on two clients (100 and 700). Some data is in client 100 and some other in client 700.
With the old known CLIENT SPECIFIED a SELECT with CLIENT is possible.
The following code functions, but returns a warning saying I should use USING ALL CLIENTS instead of client specified:
lv_mandt_100 = '100'.
lv_mandt_700 = '700'.
SELECT
FROM ekko AS ekko_100
LEFT OUTER JOIN t024 AS t024_100
ON
t024_100~mandt = @LV_mandt_100 AND
t024_100~ekgrp = ekko_100~ekgrp
LEFT OUTER JOIN ekko AS ekko_700
ON
ekko_700~mandt = @LV_mandt_700 AND
ekko_100~mandt = @LV_mandt_100 AND
ekko_100~externalreferenceid = ekko_700~ebeln
LEFT OUTER JOIN ekpo AS ekpo_100
ON
ekko_100~mandt = @LV_mandt_100 AND
ekpo_100~mandt = @LV_mandt_100 AND
ekko_100~ebeln = ekpo_100~ebeln
CLIENT SPECIFIED
FIELDS
ekko_100~ebeln AS ebeln_100,
ekko_100~ekgrp AS ekgrp_100,
t024_100~eknam AS eknam_100,
ekko_700~ebeln AS ebeln_700,
ekpo_100~ebelp AS ebelp_100,
ekpo_100~konnr AS ekpo_100_konnr,
ekpo_100~txz01 AS ekpo_100_txz01
WHERE
ekko_100~mandt = @LV_mandt_100
ORDER BY
ekko_100~ebeln,
ekpo_100~ebelp
INTO TABLE @DATA(mt_output)
BYPASSING BUFFER.
If I replace the CLIENT SPECIFIED with USING ALL CLIENTS I get an error, that I am not allowed to use field "MANDT" in an ON-constraint.
lv_mandt_100 = '100'.
lv_mandt_700 = '700'.
SELECT
FROM ekko AS ekko_100
LEFT OUTER JOIN t024 AS t024_100
ON
t024_100~mandt = @LV_mandt_100 AND
t024_100~ekgrp = ekko_100~ekgrp
LEFT OUTER JOIN ekko AS ekko_700
ON
ekko_700~mandt = @LV_mandt_700 AND
ekko_100~mandt = @LV_mandt_100 AND
ekko_100~externalreferenceid = ekko_700~ebeln
LEFT OUTER JOIN ekpo AS ekpo_100
ON
ekko_100~mandt = @LV_mandt_100 AND
ekpo_100~mandt = @LV_mandt_100 AND
ekko_100~ebeln = ekpo_100~ebeln
USING ALL CLIENTS "<- instead of CLIENT SPECIFIED belongig to the warning
FIELDS
ekko_100~ebeln AS ebeln_100,
ekko_100~ekgrp AS ekgrp_100,
t024_100~eknam AS eknam_100,
ekko_700~ebeln AS ebeln_700,
ekpo_100~ebelp AS ebelp_100,
ekpo_100~konnr AS ekpo_100_konnr,
ekpo_100~txz01 AS ekpo_100_txz01
WHERE
ekko_100~mandt = @LV_mandt_100
ORDER BY
ekko_100~ebeln,
ekpo_100~ebelp
INTO TABLE @DATA(mt_output)
BYPASSING BUFFER.
Documentation for USING ALL CLIENTS is here: https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/abapselect_client.htm
Belongig the documentation it's not possible to use USING ALL CLIENTS for a single join. But in the above code I use it for the whole FROM/JOIN.
So, my question is, how should I change the abap code to use USING ALL CLIENTS instead of CLIENT SPECIFIED?
And my other question is, if I use the CLIENT SPECIFIED, will the code in future not function anymore?
Best regards
Lorenzo
Request clarification before answering.
| User | Count |
|---|---|
| 7 | |
| 7 | |
| 7 | |
| 7 | |
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 3 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.