Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Rewriting Code from ABAP 7.45 in obsolete ABAP 7.21 Selection Options Left Join Many Tables

Former Member
0 Kudos
1,037

Dear Experts,

we have a small Code which works perfectly fine, however only in the upgraded System with the new SQL/Left Join Features a.s.o. We need to "translate" it into the obsolete Open SQL and joins quiery. Here is the Code:

SELECT mara~matnr,
makt~maktx,
mara~mtart,
mara~matkl,
marc~werks,
mard~lgort,
mard~lgpbe
INTO table @lt_nl_itab
FROM mara left JOIN marc ON ( marc~matnr = mara~matnr )

left JOIN makt ON ( mara~matnr = makt~matnr )

left JOIN mard ON ( mard~matnr = mara~matnr )

WHERE mara~matnr IN @so_matnr and marc~werks IN @so_werksand and mara~mtart IN @so_mtartand and mara~matkl IN @so_matkland and mard~lgort IN @so_lgortand and mard~lgpbe IN @so_lgpbe.

Thank you so much.

5 REPLIES 5
Read only

matt
Active Contributor
0 Kudos
798

Why not do it using cl_sql_statement, or even EXEC SQL?

Read only

UweFetzer_se38
Active Contributor
798

Just delete the @s in front of the variables and the "," (comma) in the selection list. Should work in older systems.

Read only

798

Also add WHERE makt~spras... otherwise be prepared for a BIG surprise when another language gets installed in the system. mard~werks condition wouldn't hurt either.

Read only

0 Kudos
798

@Uwe: it will only solve the Syntax issue. Left outer join still won't allow using Parameters from the right table in Where condition.

Read only

Sandra_Rossi
Active Contributor
0 Kudos
798

7.45 and 7.21 !? kernel versions? But you only have ABAP 7.5x, 7.40, 7.02, 7.31 (possibly 7.03, 7.1 or 7.2, etc.), cf ABAP News for Release 7.40