‎2008 Aug 27 1:39 PM
here is my code, its taking more time during execution....how can i improve the performance ...plz help me out..
thanks in advance
SELECT agent vkont
FROM zu1cd_fkkvkp INTO CORRESPONDING FIELDS OF TABLE it_agent
FOR ALL ENTRIES IN it_dimaiobpar
WHERE vkont = it_dimaiobpar-partneracc AND
gpart = it_dimaiobpar-partner.
SORT it_agent ASCENDING BY vkont.
*To get the Amount Values.
LOOP AT it_dimaiobpar INTO wa_dimaiobpar.
CALL FUNCTION 'FKK_ACCOUNT_BALANCE_COMPUTE'
EXPORTING
i_vkont = wa_dimaiobpar-partneracc
i_gpart = wa_dimaiobpar-partner
i_vtref = wa_dimaiobpar-insobject
i_start_date = '00000000'
i_start_time = '000000'
i_end_date = sy-datum
i_end_time = '000000'
I_XALLF = ' '
IMPORTING
E_BALANCE =
E_SUM_OPENITEMS =
E_SUM_CLEARINGS =
E_SUM_INSTITEMS =
E_SUM_INTERESTITEMS =
E_SUM_CHARGEITEMS =
TABLES
t_postab = it_postab2.
T_AUGTAB =
T_INSTTAB =
T_INTERESTTAB =
T_CHARGETAB =
CLEAR wa_postab2. .
LOOP AT it_postab2 INTO wa_postab2 WHERE augst = ' ' .
MOVE-CORRESPONDING wa_postab2 TO wa_postab1.
APPEND wa_postab1 TO it_postab1.
ENDLOOP.
ENDLOOP.
‎2008 Aug 27 3:31 PM
I get really tired by these ignorant recommendations which appear here in every posting. One should read a posting before one answers a question. Answering questions is related zto understanding not to a search of keywords!!!
The 'move-corresponding' and 'into corresponding' will not make a performance problem!
People who don't understand that should not answer questions!
-
Here as always you must run a trace to figure out where your time is spent.
First guess would be the SELECT
Second guess the Function
Third guess the table it_postab2 is noot refreshed inside the function but new lines are just appended.
Run the SE30 as explained here:
SE30
=> What is the total time and what are the top 10 net time consumers?
Run the SQL trace:
if the SELECT is among the top 10 in SE30
Siegfried
‎2008 Aug 27 1:45 PM
Hi Vipin,
Do not use INTO CORRESPONDING FIELDS OF TABLE.
Instead declare the internal table with the fields you are selecting and go for INTO TABLE.
Do not use LOOP-ENDLOOP inside another LOOP-ENDLOOP.
Regards,
Chandra Sekhar
‎2008 Aug 27 1:48 PM
Hi,
Don't use INTO CORRESPONDING FIELDS , it makes performance down insted use into table.
Thanks,
‎2008 Aug 27 1:50 PM
Hi,
First you can optimize the select query by removing 'INTO CORRESPONDING FIELDS OF TABLE' if your it_agent has the same sequence in the structure.
SELECT agent vkont
FROM zu1cd_fkkvkp INTO CORRESPONDING FIELDS OF TABLE it_agent
FOR ALL ENTRIES IN it_dimaiobpar
WHERE vkont = it_dimaiobpar-partneracc AND
gpart = it_dimaiobpar-partner.
Secondly, In the Loop at the Last :
LOOP AT it_postab2 INTO wa_postab2 WHERE augst = ' ' .
MOVE-CORRESPONDING wa_postab2 TO wa_postab1.
APPEND wa_postab1 TO it_postab1.
ENDLOOP.
You can write in such a manner :
LOOP AT it_postab2 INTO wa_postab2.
check augst = ' '
MOVE-CORRESPONDING wa_postab2 TO wa_postab1.
APPEND wa_postab1 TO it_postab1.
ENDLOOP.
Only this is way you can improve the performance in your code otherwise you need to put a trace on code to check which query or statement is taking time.
<removed_by_moderator>
Bye.
Edited by: Julius Bussche on Aug 27, 2008 3:51 PM
‎2008 Aug 27 3:31 PM
I get really tired by these ignorant recommendations which appear here in every posting. One should read a posting before one answers a question. Answering questions is related zto understanding not to a search of keywords!!!
The 'move-corresponding' and 'into corresponding' will not make a performance problem!
People who don't understand that should not answer questions!
-
Here as always you must run a trace to figure out where your time is spent.
First guess would be the SELECT
Second guess the Function
Third guess the table it_postab2 is noot refreshed inside the function but new lines are just appended.
Run the SE30 as explained here:
SE30
=> What is the total time and what are the top 10 net time consumers?
Run the SQL trace:
if the SELECT is among the top 10 in SE30
Siegfried
‎2008 Aug 27 10:32 PM
Hallo Siegfried,
Du solltest Deine Bedenken - die auch die Meinen sind - doch vorzugsweise an das SDN Team adressieren. Dort koennen diesbezueglich vielleicht einige neue "rules" diskutiert werden. Du fragst Dich wahrscheinlich, warum ich in Deutsch schreibe! Und ich frage mich wieso die Forum Kategorien Japanisch - Chinesisch und Korean eingefuert wurden!
Cheers,
Heinz
‎2008 Aug 27 3:47 PM
Hello.
To help you, we must know 3 things:
1 - What is the structure of the key of table zu1cd_fkkvkp? Are you using it's key in your SELECT?
2 - And how much records has it_dimaiobpar? If it has too many, you shoukd avoid for all entries. Explain the goal, and perhaps someone gives you a better solution of data selection.
3 - What's the point of second LOOP? It's looping inside the other loop without refering previous data. It will append same fields to second table, several times!
Yes, corresponding fields and move-corresponing will only tune you program in one or two seconds (if you have thousands or records). If you have less, not even that!
Regards,
Valter Oliveira.