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: 

Converting AMDP Code to ABAP

0 Kudos
732

Hi experts,

I need to rewrite the following code in ABAP.

outTab = SELECT 
COALESCE (team_p.role_id, ") as "CPR_ROLE",
record,
SQL_PROCEDURE_SOURCE_RECORD
FROM:inTab AS it
LEFT OUTER JOIN "/BIC/APCPMAA022" AS team_p
ON it.root_key=team_p.root_key and
WHERE team_p.role_id='XX01'

Alternatively, we could correct the code here, because the last WHERE statement causes an error.

I'd be most grateful if you could give me some advice.

Thanks in advance!

Piotr

6 REPLIES 6

Sandra_Rossi
Active Contributor
0 Kudos
573

What ABAP code did you try? What syntax error did you get?

former_member1716
Active Contributor
0 Kudos
573

piotrillo,

Am afraid we wont be able to support you with the available information. For instance the above query is fetching data from local variable :it_root, unless we know the data logic for this we wont be able to support.

Also do let us know the code you have tried so far, which will be helpful for us to correct.

Regards!

0 Kudos
573

The error is just

SQLSCRIPT: sql syntax error: incorrect syntax near "WHERE"

I haven't tried it in ABAP, I'm not so good at abap.

But I think it would be better to rebuild this logic in ABAP.

What do you think? Maybe someone can help me to do it in ABAP.

573
ON it.root_key=team_p.root_key and  
WHERE team_p.role_id='XX01'

In your case "and" and "where" standing this close are causing the error. You need only one of them

0 Kudos
573

What Artem says. Clearly it's not syntactically correct. I wonder why your first attempt at "fixing" this is to try to write it in ABAP?

venkateswaran_k
Active Contributor
573

Hi

Change your query as below

outTab = SELECT 
COALESCE (team_p.role_id, ") as "CPR_ROLE",
record,
SQL_PROCEDURE_SOURCE_RECORD
FROM :inTab AS it
LEFT OUTER JOIN 
    (select * froom "/BIC/APCPMAA022" WHERE team_p.role_id = 'XX01') AS team_p
    ON (it.root_key = team_p.root_key)

<br>