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: 

Replacing standard function for the sake of performance improvement

Former Member
0 Kudos
90

Hi,

My current task in hand is optimizing a custom report which also fetches workflow information. As you might have guessed the workflow related information is taking too much time.

The report used a FM which calls bunch of standard functions to get the required information. As the standard function modules fetches a lot of data which in not required for the report, I opted for writing my own function module that would get only the required data.

The Problem: I need to figure out what basic relationship exists between different workflow related tables such as SWWWIHEAD, SWPSTEPLOG, SWWWIRET, SWWWIDEAL, SWW_CONTOB and through where i could find the agents assigned to a particular Work item?

the main function which was getting the major information was BBP_PDH_WFL_APPROVAL_SIMULATE and BBP_PDH_WFL_PARAM_APPLET_FILL2. They were being used as following:


  CALL FUNCTION 'BBP_PDH_WFL_APPROVAL_SIMULATE'
    EXPORTING
      iv_object_type      = g_crmd_orderadm_h-object_type
      iv_object_id        = g_crmd_orderadm_h-object_id
      iv_guid             = lv_guid
    IMPORTING
      ev_db_workitem_id   = lv_db_workitem_id
      ev_start_task       = lv_start_task
      ev_start_wi_id      = lv_start_wi_id
    TABLES
      et_adhoc_agents     = lt_adhoc_agents
    EXCEPTIONS
      workflow_not_found  = 1
      workflow_not_actual = 2
      OTHERS              = 3.

  CALL FUNCTION 'BBP_PDH_WFL_PARAM_APPLET_FILL2'
   EXPORTING
          iv_start_task         = lv_start_task
          iv_start_wi_id        = lv_start_wi_id
          iv_db_workitem_id = lv_db_workitem_id
       IV_OBJECT_TYPE   = object_type
    TABLES
      ET_NODES              = gT_nodes
      ET_LINES                = gT_lines
      ET_AGNTS              = gT_agents
      ET_TASKS              = gT_tasks
      ET_WIS                   = gT_WIS
      ET_APPROVAL_NODES             = gT_approval_nodes
      ET_WF_APPROVER                = gT_wf_approver.

I would be grateful if somebody could help me out in determining workflow items, their status, agents assigned to them against confirmations or point out a performance friendly function which could deliver the same.

regards,

Asim

1 REPLY 1

Former Member
0 Kudos
29

Hi,

Well sorry for the late update, but I was able to resolve the issue in hand by writing my own function which actually gets the values from the table list I already specified. The trick was to get the entries from the table swpsteplog for the records not where wf_id matches wi_id of table swwwihead but also the records where the pred_wi_id matches wi_id of the same table. I had to put in a self join to acheive that. here is the code snipet:

  SELECT
    a~wf_id a~pred_wi_id a~node_id a~wi_id a~task_id a~wi_agent
  INTO  TABLE lt_steplog
  FROM swpsteplog AS a
    INNER JOIN swpsteplog AS b ON
    a~wf_id = b~wf_id AND a~pred_wi_id = b~wi_id
    FOR ALL ENTRIES IN lt_swwwihead
    WHERE b~wf_id = lt_swwwihead-wi_id
    AND   b~returncode <> ''.

The user / agent information was also fetched from two different tables, one from swpsteplog it self and secondly from sww_contob.

if anyone require the full code for the function module, you can always drop me a line.

regards,

Asim