Application Development 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: 

Help with AMDP procedure - For all Entries

Former Member
0 Kudos

Hi Experts,

I want to write a AMDP procedure by passing an internal table as where condition.

What would be the best approach? Our system is NW 7.4. I have used APPLY FILTER function but it didn't work.

My input internal table looks like this:

ConsumerDate LowDate High
100101.01.201531.12.2016
100201.01.201430.06.2014

Table in HANA DB

ConsumerDateSales
100101.01.201410
100101.01.201510
100118.08.201610
100201.01.201410
100202.02.201410
100230.06.201410
100201.01.201610

Output internal Table

ConsumerSum of Sales
100120
100230

Looping my internal table and getting the sum for each record will work but as you know it is performance killer.

I would be calling this procedure in a BW transformation where data come in package of 50000 records(so my input internal table can contain 50,000 records at a time) .

1 REPLY 1

pfefferf
Active Contributor
0 Kudos

Hello Sumukan,

you can solve this with a join between the input parameter table and the database table. E.g.


lt_res = select t2.consumer, sum(t2.sales)

            from :it_input as t1 inner join "<schema>"."<table>" as t2

               on t1.consumer = t2.consumer

               and t1.datelow <= t2.date

               and t1.datehigh >= t2.date

            group by t2.consumer;

Consider that you have to replace the input parameter, schema/table name and column names with your values (cause I don't know it).

Best Regards,

Florian