Skip to Content
0
Former Member
May 31, 2011 at 06:39 AM

Value is not passed to Workflow container from Program Exit

857 Views

Hi Experts,

I have added one class in the program exit where I am setting some value for a workflow element. The value is setting over their but it is not reflecting/ it is not passed to the workflow container. I am giving the code below.

DATA: ls_wihead   TYPE swr_wihdr.
  DATA: ls_msg      TYPE swr_mstruc.
  DATA: lt_agents   TYPE tswhactor.

  DATA: container   TYPE REF TO if_swf_cnt_container,
        container1  TYPE REF TO if_swf_cnt_container,
        name        TYPE swfdname,
        lh_wihandle TYPE REF TO if_swf_run_wim_internal,
        l_exception TYPE REF TO cx_swf_cnt_container,
        l_wiid      TYPE sww_wiid,
         l_wfcont1    TYPE REF TO if_swf_ifs_parameter_container,
       l_wfcont    TYPE REF TO if_swf_ifs_parameter_container.

  DATA: ls_agents          TYPE REF TO data,
        value_ref          TYPE REF TO data,
        value_ref1         TYPE REF TO data,
        unit_ref           TYPE REF TO data,
        swotobjid          TYPE swotobjid,
        l_item_guid        TYPE crmt_object_guid,
        exception_return   TYPE REF TO cx_swf_cnt_container,
        exception_return1  TYPE REF TO cx_swf_cnt_container.

  FIELD-SYMBOLS: <value_ref1>      TYPE ANY,
                 <fs1>             TYPE ANY,
                 <fs2>             TYPE ANY,
                 <l_item_guid1>    TYPE ANY.

  l_wfcont = me->m_ctx->get_wf_container( ).

  IF l_wfcont IS NOT INITIAL.

    l_wiid = me->m_ctx->get_workitem_id( ).

    TRY.
        lh_wihandle = cl_swf_run_wim_factory=>find_by_wiid( l_wiid ).

*- get element from work item container

        container = lh_wihandle->get_wi_container( ).

      CATCH cx_swf_run_wim.

    ENDTRY.
    TRY.
        lh_wihandle = cl_swf_run_wim_factory=>find_by_wiid( l_wiid ).
*- get element from work item container
        container1 = lh_wihandle->get_wf_container( ).
      CATCH cx_swf_run_wim.
    ENDTRY.

    TRY.

        CALL METHOD container->if_swf_cnt_element_access_1~element_get_value_ref
          EXPORTING
            name             = 'BUSINESSOBJECT'
          IMPORTING
            value_ref        = value_ref
            unit_ref         = unit_ref
            exception_return = exception_return.

        ASSIGN: value_ref->*       TO <value_ref1>.

        ASSIGN COMPONENT 'OBJKEY' OF STRUCTURE <value_ref1> TO <l_item_guid1>.
        swotobjid = <value_ref1>.

        l_item_guid = swotobjid-objkey.

        CALL FUNCTION 'YGET_AGENTS_QT_O_FOLLOWUP'
          EXPORTING
            iv_item_guid = l_item_guid
          TABLES
            actor_tab    = lt_agents.

        IF lt_agents[] IS NOT INITIAL.

          agent_table = lt_agents.

          CREATE DATA : ls_agents       TYPE tswhactor.
          ASSIGN : ls_agents->* TO <fs1>.
          <fs1> = lt_agents[].

          CALL METHOD container->if_swf_cnt_element_access_1~element_set_value
            EXPORTING
              name             = 'AGENT_TABLE'
              value            = lt_agents
            IMPORTING
              exception_return = exception_return1.

  COMMIT WORK.

          CALL METHOD container1->if_swf_cnt_element_access_1~element_set_value
            EXPORTING
              name             = 'AGENT_TABLE'
              value            = lt_agents
            IMPORTING
              exception_return = exception_return1.

  COMMIT WORK.


        ENDIF.


      CATCH cx_swf_tst_introspection_error.
      CATCH cx_swf_cnt_container.

    ENDTRY.

  COMMIT WORK.

  ENDIF.

I have even tried to get the data directly from class by declaring a element in the workflow container and assigning a class to it with interface if_workflow. But I am unable to send the Key value to it. Please help me in get the value.