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

Can we loop an internal table inside AMDP method

Former Member
17,223

Hello Expert,

Please help me for the below points:

1. Can we loop an internal table inside AMDP method.

2. Can we write delete adjacent duplicate.... inside AMDP method.

3. What all operation we can do inside the AMDP method.

If yes please help me with an example.


Thanks & Best Regards,

Kailash

1 ACCEPTED SOLUTION
Read only

thomasgauweiler
Employee
Employee
8,281

1. Can we loop an internal table inside AMDP method.

Better don't do it. Your performance will go down.

2. Can we write delete adjacent duplicate.... inside AMDP method.

itab = select distinct * from :itab;

3. What all operation we can do inside the AMDP method.

Have a look at the SQL Script Reference in http://help.sap.com/hana/SAP_HANA_SQL_Script_Reference_en.pdf

Best Regards, Thomas

8 REPLIES 8
Read only

thomasgauweiler
Employee
Employee
8,282

1. Can we loop an internal table inside AMDP method.

Better don't do it. Your performance will go down.

2. Can we write delete adjacent duplicate.... inside AMDP method.

itab = select distinct * from :itab;

3. What all operation we can do inside the AMDP method.

Have a look at the SQL Script Reference in http://help.sap.com/hana/SAP_HANA_SQL_Script_Reference_en.pdf

Best Regards, Thomas

Read only

0 Likes
8,281

Thank you Thomas.

Read only

0 Likes
8,281

Hello Thomas,

My requirement is first i wiil fetch data from table VBRK and VBRP by doing the join operation, then I will keep that data into another table for further use. From the second internal table I will delete the duplicate entry and I will use that internal table to fetch data from other table.

I want to write this type of logic inside the AMDP method.

Thanks & Best Regards,

Kailash

Read only

0 Likes
8,281

Try it like this:

first_itab = SELECT .. FROM VBRK JOIN VBRP ... ;

second_itab = SELECT DISTINCT ... FROM :first_itab;

third_itab = SELECT ... FROM OTHERTABLE JOIN :second_itab;

Why do you want to write that logic in AMDP ?

Best Regards, Thomas

Read only

0 Likes
8,281

Hello Binod,

If you have concern about performance then you should have to choose AMDP....

But now advanced open SQL also pretty much faster and has compatibility with HDB.

For your case you can go with advanced open SQL over AMDP , since it does not have performance impact is my assumptions...

I guess Thomas has given you best possible answer...

Regards,

-Amol S

Read only

0 Likes
8,281

Thank you Thomas.

Read only

0 Likes
8,281

There is a scenario where as I can't avoid loop. I have 2 ways to achieve it. 1st way is writing loop in AMDP. And 2nd way is writing loop in Report. Please let me know which way is better.

Read only

8,281

selva123

It's probably better to raise your own question rather than hijacking an old one.