on 01-19-2016 2:35 PM
Hi Experts,
please guide me whether can we add the HANA code in ABAP BADI's? actually i got one performance issue with nested loops.
Ex: i have two internal tables with 5k records in both and have to consider every record for processing from both internal tables by nested loop( so 5k * 5k = 25000000 times) in Dev system. Somebody told me that by using HANA code we can reduce this issue.
please advise me how to overcome this issue in ABAP.
Thanks
Srinivas
what those loops are doing ? Are you trying to create a combination table ?
if just reading, it is not that much i am doing similar one with 100K-1million row tables.
better post your logic here, i am sure you can optimize it with hash tables , primary-secondary indexes.
If you are going to implement same logic in HANA it may take longer aswell unless you execute in 1 select statement by cross join.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
reading and fetching data from table.
Ex: loop at Tab1_header assiginig <ftab1>.
loop at Tab2_item assigning <fatb2>.
read table tab3_item into wa3 with key key3 = <ftab2>-key2 binarysearch.
if sy-subrc = 0
select *...................etc
endif.
endloop.
endloop.
please help me using Hash Table concept for above scenario.
thanks
Srinivas
first lets remove your select * which is inside the loops and put outside of the loop.
Never read anything inside a loop . probably hundred thousands-millions of select statement is going to db side.
to make a quick test. remove the select statement (i mean comment it ) and run the code, so lets see the minimum possible time that the code can run. later we can optimize.
lets assume without select (just comment the line ) program finish in 2 min, so after moving select to outside of the loop and reading the records with either read table or looping from a hash table, we can let it finish in 2 min 30 sec or 3 min depending on the number of records on the last table.
To generic question to answer, let us know what you are trying to achieve in the loops.
Did you mean you want to use Native SQL ?
Cheers
Anindya
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This is how you can use Native SQL within ABAP. You can search with " Native SQL in ABAP" for more information
Native SQL - ABAP Programming (BC-ABA) - SAP Library
There are lot of new features in ABAP on HANA which might help you . Have a look at this thread ( Thomas's reply ) .
Cheers
Anindya
User | Count |
---|---|
85 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.