‎2009 Jan 29 5:21 PM
Hi All,
I have following code in one z program for Organization structure. But there is big performance issue, because the function module 'RH_STRUC_GET_MULTIPLE_ROOTS' is fetching approximately 7000 records for each Org unit. Then it loops through the internal table and assigns Sign = I option = EQ. There are total 355 org unit in the selection. Therefore program is looping through 355 * 7000 = records. Two tables lt_obj and lr_hrg have only PERNR field in them.
Please help in optimizing the code. The standard function module is taking lot of time. Is there any other equivalent FM for this.
CALL FUNCTION 'RH_STRUC_GET_MULTIPLE_ROOTS'
EXPORTING
act_wegid = p_wegid
act_begda = p_edate
act_endda = p_edate
TABLES
root_objects = lt_root
result_objec = lt_objec
EXCEPTIONS
no_plvar_found = 1
no_entry_found = 2
path_not_found = 3
root_not_found = 4
OTHERS = 5.
IF sy-subrc IS INITIAL.
DELETE lt_objec WHERE otype NE g_otype.
ENDIF.
LOOP AT lt_objec INTO ls_objec.
rs_obj-sign = 'I'.
rs_obj-option = 'EQ'.
rs_obj-low = ls_objec-objid.
APPEND rs_obj TO pr_obj.
ENDLOOP.
SORT lt_obj BY otype objid.
DELETE ADJACENT DUPLICATES FROM lt_obj COMPARING otype objid.
DELETE lt_obj WHERE objid NOT IN lr_hrg.
DELETE lt_obj WHERE objid NOT IN lr_csg.
DELETE lt_obj WHERE objid NOT IN lr_org.
DELETE lt_obj WHERE objid NOT IN lr_pos.
DELETE lt_obj WHERE objid NOT IN lr_func.
DELETE lt_obj WHERE objid NOT IN lr_orgl.
Thanks.
‎2009 Jan 29 5:45 PM
Hi Sonali,
If structure of IT_OBJEC and IT_OBJ is same you can use APPEND LINES OF IT_OBJEC TO IT_OBJ.
Sort it and delete adjacent duplicates.
Let me know if this does not helps.
Mubeen
‎2009 Feb 06 6:35 PM
‎2009 Feb 06 6:39 PM
copy and create a zfm of this standard fm and add checks inside the fm itself before any selct query it is using.