05-18-2009 6:37 AM
SELECT bname FROM usr02 INTO TABLE lt_user where bname between '101930' and '106953'.
SORT lt_user.
DELETE ADJACENT DUPLICATES FROM lt_user.
LOOP AT lt_user INTO ls_user.
CLEAR lt_worklist.
CLEAR lt_messages.
CLEAR lt_mess_struct.
CALL FUNCTION 'SWN_UWL_GET_WORKLIST'
EXPORTING
user = ls_user-bname
LANGUAGE = SY-LANGU
TRANSLATE_WI_TEXT = ' '
IM_TASK_FILTER =
IM_STATUS_FILTER =
IM_ITEM_TYPE_FILTER =
IMPORTING
RETURN_CODE =
worklist = lt_worklist
DEADLINE_ITEMS =
TABLES
message_lines = lt_messages
message_struct = lt_mess_struct.
loop at lt_worklist into wa_lt_worklist.
employee_rec-USER_ID = wa_lt_worklist-USER_ID.
employee_rec-SUBJECT = wa_lt_worklist-SUBJECT.
CREATED_TIME = wa_lt_worklist-CREATED_TIME.
employee_rec-CREATED_TIME = CREATED_TIME+0(14).
employee_rec-FORWARDED_BY = wa_lt_worklist-FORWARDED_BY.
employee_rec-IDENTITY_NUMBER = n.
append employee_rec to employee.
clear employee_rec.
n = n + 1.
endloop.
ENDLOOP.
output-MT_EP001_ACTION_ITEM-SUMMARY_EMAIL_ACTION_ITEM = employee.
TRY.
CREATE OBJECT employee_data.
call method employee_data->UPLOAD_ACTION_ITEM
EXPORTING
OUTPUT = output.
commit work.
CATCH cx_ai_system_fault INTO go_sys_exception.
WA_ZIT_ERROR_TAB-message = go_sys_exception->errortext.
WA_ZIT_ERROR_TAB-code = go_sys_exception->code.
WA_ZIT_ERROR_TAB-errordate = sy-datum.
insert into ZIT_ERROR_TAB values wa_ZIT_ERROR_TAB.
ENDTRY.
WRITE: / 'no of records', n.
Edited by: SAMEER CHOPRA on May 18, 2009 7:37 AM
Edited by: SAMEER CHOPRA on May 18, 2009 7:40 AM
Edited by: SAMEER CHOPRA on May 18, 2009 7:41 AM
Edited by: SAMEER CHOPRA on May 18, 2009 7:52 AM
05-18-2009 8:04 AM
05-18-2009 10:18 AM
go se30 transection where you got lots of sample code to impove perforance.
05-18-2009 3:36 PM
Please do not try to optimize code but execution !
SE30
/people/siegfried.boes/blog/2007/11/13/the-abap-runtime-trace-se30--quick-and-easy
switch on internal tables
Go to hitlist iof trace, sort by net times descending, the first 5 lines, shows you what you should optimize!
Siegfried