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: 

Question about performance in a code.

Former Member
0 Kudos
88

Hi experts...

I need to make a program to make a backp of one table and the a restore.

The performance of this code is fine?? The tables contain a lot of records!



PARAMETERS:

          p_backup    TYPE c AS CHECKBOX,
          p_rest      TYPE c AS CHECKBOX,
          p_del       TYPE c AS CHECKBOX.

SELECTION-SCREEN END OF BLOCK bl2.

IF p_backup IS NOT INITIAL.  "Cuando se seleccione para hacer backup.

*Data Selection:
  SELECT mandt bukrs day_a racct prctr per_day average agregate agregate_m accumulate average_m day_exe
    FROM zavg_bal_table INTO TABLE t_avg.

  INSERT zavg_backuptable FROM TABLE t_avg.

ELSEIF p_rest IS NOT INITIAL.  "Cuando se seleccione para hacer restore.

  SELECT mandt bukrs day_a racct prctr per_day average agregate agregate_m accumulate average_m day_exe
    FROM zavg_backuptable INTO TABLE t_avg.

  INSERT zavg_bal_table FROM TABLE t_avg.'

ENDIF.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
69

Hi Carlos,

Use where clause atleast by passing empty values to the key fields, otherwise more the records goes up performance will go down.

Reward Points if it helps,

Satish

4 REPLIES 4

Former Member
0 Kudos
69

Without a where clause this could take for ever (if it contains a lot of data). You are better of doing this at the DB level.

Albert

Former Member
0 Kudos
70

Hi Carlos,

Use where clause atleast by passing empty values to the key fields, otherwise more the records goes up performance will go down.

Reward Points if it helps,

Satish

rxsalomone
Explorer
0 Kudos
69

Hi,

you are taking a lots of records at one time, just split your results by adding "where" clause, here are a few examples of split:

- by mandt (very few splits, lot of records)

- by day

- by initial name (lot of splits, few records)

procedure:

read all mandt's into itab, loop itab doing select and insert

NOTES:

- of course splits and quntity of records depend of each table.

- I suppose that lot of splits with few records are the best choice.

best regards.

Former Member
0 Kudos
69

Use PACKAGE SIZE option to prevent the program from running out of memory and resulting in a short dump.

Your insert statement may suffer from short dump if there are records already in the target table. Use ACCEPTING DUPLICATE KEYS option. Or, delete the target table contents before inserting new records. (Try to avoid MODIFY statement.)

On a different topic, you should really be using radio buttons instead of checkboxes.