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: 

Urgent Issue regarding Performance

Former Member
0 Kudos

REPORT /dceur/z_ais_api_link

MESSAGE-ID /dceur/z_go_msg

LINE-SIZE 190

LINE-COUNT 65.

----


  • Start of processing

----


PERFORM prepare_and_call_action.

&----


*& Form prepare_and_call_action

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM prepare_and_call_action.

DATA:tb_apivehque TYPE /dceur/apivehque OCCURS 0 WITH HEADER LINE,

tb_vlcdiavehi TYPE vlcdiavehi OCCURS 0 WITH HEADER LINE,

wa_vlcactdata TYPE vlcactdata,

wa_apivehque LIKE LINE OF tb_apivehque.

DATA : BEGIN OF tb_vlcvehicle OCCURS 0,

zz_commnos LIKE vlcvehicle-zz_commnos,

vhcle LIKE tb_apivehque-vhcle,

vguid LIKE vlcvehicle-vguid,"pradhanv tkt 5592442

END OF tb_vlcvehicle. "SRIVASD

CONSTANTS: co_zfot(4) TYPE c VALUE 'ZFOT'.

  • Begin of insertion by PRADHANV tkt-5592442 DC1K947161 on 14.08.2007.

daTA: wf_vguid TYPE vlcvehicle-vguid.

  • End of insertion by PRADHANV tkt-5592442 DC1K947161 on 14.08.2007.

CLEAR: tb_apivehque,

tb_vlcdiavehi,

tb_vlcvehicle, "SRIVASD

wa_vlcactdata.

REFRESH: tb_apivehque,

tb_vlcdiavehi.

SELECT * FROM /dceur/apivehque INTO TABLE tb_apivehque.

  • begin of insertion for DC1K905147 by SRIVASD on 06.12.2005.

  • Fetch the vehicle data on internal no.

SELECT zz_commnos vhcle vguid "pradhanv tkt 5592442

FROM vlcvehicle

INTO TABLE tb_vlcvehicle

FOR ALL ENTRIES IN tb_apivehque

WHERE vhcle = tb_apivehque-vhcle.

LOOP AT tb_apivehque INTO wa_apivehque.

READ TABLE tb_vlcvehicle WITH KEY vhcle = wa_apivehque-vhcle.

IF tb_vlcvehicle-zz_commnos IS INITIAL.

wa_apivehque-z_commnos = ' '.

MODIFY tb_apivehque FROM wa_apivehque TRANSPORTING z_commnos.

ENDIF.

ENDLOOP.

LOOP AT tb_apivehque INTO wa_apivehque.

DELETE FROM /dceur/apivehque WHERE vhcle = wa_apivehque-vhcle.

  • Modifying database table from workarea.

MODIFY /dceur/apivehque FROM wa_apivehque.

IF sy-subrc = 0.

COMMIT WORK.

ENDIF.

ENDLOOP.

  • end of insertion for DC1K905147 by SRIVASD on 06.12.2005.

  • Deleting the entries in Q-table where commision no is blank.

DELETE tb_apivehque WHERE z_commnos EQ space.

SORT tb_apivehque BY z_timestamp DESCENDING.

LOOP AT tb_apivehque. "SRIVASD on 13.12.2005

*fetching vehicle data into tb_vlcdiavehi

  • Begin of Ins: DC1K939919 Rels 2.01 on 26-01-2007 by Tiramarb

  • CALL FUNCTION 'VELO03_GET_SINGLE_VEHICLE'

  • EXPORTING

  • selvhcle_iv = tb_apivehque-vhcle

  • TABLES

  • vlcdiavehi_et = tb_vlcdiavehi

  • EXCEPTIONS

  • vehicle_not_found = 1

  • OTHERS = 2.

  • Begin of insertion by PRADHANV tkt-5592442 DC1K947161 on 14.08.2007.

CLEAR: wf_vguid.

READ TABLE tb_vlcvehicle WITH KEY vhcle = tb_apivehque-vhcle.

wf_vguid = tb_vlcvehicle-vguid.

*--> Locking the vehicle as to not to change the vehicle data during

*--> the preparation of the data for the action.

CALL FUNCTION 'ENQUEUE_E_VLCVEHICLE'

EXPORTING

mode_vlcvehicle = 'E'

mandt = sy-mandt

vguid = wf_vguid

x_vguid = ' '

_scope = '2'

_wait = ' '

_collect = ' '

EXCEPTIONS

foreign_lock = 1

system_failure = 2

OTHERS = 3.

IF sy-subrc <> 0.

*--> Continue for further processing.

CONTINUE.

ENDIF.

  • End of insertion by PRADHANV tkt-5592442 DC1K947161 on 14.08.2007.

CALL FUNCTION '/DCEUR/Z_VDF_ACTION_PREP'

EXPORTING

wf_vhcle = tb_apivehque-vhcle

wf_action = co_zfot

TABLES

tb_list_of_vehicles = tb_vlcdiavehi

CHANGING

wa_vlcactdata = wa_vlcactdata

EXCEPTIONS

no_data_given = 1

no_vehicle_found = 2

action_not_defined = 3

interlinked_action_error = 4

OTHERS = 5.

IF sy-subrc <> 0.

MESSAGE i999 WITH 'Error getting vehicle rec.' sy-subrc.

CONTINUE.

ENDIF.

  • End of Ins: DC1K939919 Rels 2.01 on 26-01-2007 by Tiramarb

  • Begin of insertion by PRADHANV tkt-5592442 DC1K947161 on 14.08.2007.

CALL FUNCTION 'VELO09_VEHICLE_DEQUEUE'

TABLES

vlcdiavehi_it = tb_vlcdiavehi .

  • End of insertion by PRADHANV tkt-5592442 DC1K947161 on 14.08.2007.

CALL FUNCTION 'VELO09_SET_ACTION'

EXPORTING

incoming_action_iv = 'ZFOT'

commit_iv = 'S'

TABLES

vlcdiavehi_ct = tb_vlcdiavehi

CHANGING

vlcactdata_cs = wa_vlcactdata

EXCEPTIONS

action_not_defined = 1

no_authority = 2

interlinked_action_error = 3

crea_prepare_failed = 4

action_not_performed = 5

action_not_compl_performed = 6

OTHERS = 7.

IF sy-subrc <> 0.

MESSAGE i999 WITH 'Error while executing action: ' sy-subrc.

ENDIF.

ENDLOOP.

ENDFORM. " prepare_and_call_action

In the above code ,to execute it its taking a lot of time.I need to reduce its run time.I request you to suggest the changes to make so that it takes less time to execute that.Its very urgent.plzz post your valuable suggestions ASAP.

Thanks and Regards,

Jaya.

3 REPLIES 3

abdulazeez12
Active Contributor
0 Kudos

<b>SELECT * FROM /dceur/apivehque INTO TABLE tb_apivehque.</b>

In the above stmt, you are not using the WHERE clause. Always mention the WHERE clasue fr better performance otherwise it will hamper the performance.

Moreover, mention the fields list instead of * in the above select.

Reward if helpful

Former Member
0 Kudos

Hi Jaya,

Follow these steps in your code.

Always check the driver internal tables is not empty, while using FOR ALL ENTRIES

Avoid for all entries in JOINS

Try to avoid joins and use FOR ALL ENTRIES.

Try to restrict the joins to 1 level only ie only for tables

Avoid using Select *.

Avoid having multiple Selects from the same table in the same object.

Try to minimize the number of variables to save memory.

The sequence of fields in 'where clause' must be as per primary/secondary index

( if any)

Avoid creation of index as far as possible

Avoid operators like <>, > , < & like % in where clause conditions

Avoid select/select single statements in loops.

Try to use 'binary search' in READ internal table.

Ensure table is sorted before using BINARY SEARCH.

Avoid using aggregate functions (SUM, MAX etc) in selects

( GROUP BY , HAVING,)

Avoid using ORDER BY in selects

Avoid Nested Selects

Avoid Nested Loops of Internal Tables

Try to use FIELD SYMBOLS.

Try to avoid into Corresponding Fields of

Avoid using Select Distinct, Use DELETE ADJACENT

Also by going to transaction SE30->tips and tricks you can get the idea

Reward if helpful.

Regards,

Harini.S

Former Member
0 Kudos

You may reduce the execution time by adding the BINARY SEARCH option to your READ statements.

Rob