Retrieve workflow container data in programming exit

I am trying to use a programming exit in Workflow in order to amend the task container for the receipients field of a "Send Email" step. The reason why we are not determining the receipients in the usual way is because we hold the receipients (amongst other data) in a separate Z* table - this needs to stay this way.
I created a class and copied method CHANGE_CONT_ELEMENT to base my altered code on. The method is triggered fine when testing the workflow. Here is what it now looks like:
method CHANGE_CONT_ELEMENT .
  DATA: container TYPE REF TO if_swf_cnt_container,
        if_swf_cnt_container,
        cont TYPE REF TO IF_SWF_IFS_PARAMETER_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,
        w_container type ref to IF_SWF_IFS_PARAMETER_CONTAINER,
        w_names type SWFDNAMTAB,
        wa_names type line of SWFDNAMTAB,
        w_value(30).
  w_container = me->m_ctx->GET_WI_CONTAINER( ).
  w_names = w_container->LIST_NAMES( ).
data: w_name type SWFDNAME.
w_name = 'TEST-NUMBER'.
TRY.
  loop at w_names into wa_names.
    CALL METHOD w_container->get
     EXPORTING
      name       = wa_names.
  endloop.
CATCH CX_SWF_CNT_ELEM_NOT_FOUND .
CATCH CX_SWF_CNT_ELEM_TYPE_CONFLICT .
CATCH CX_SWF_CNT_UNIT_TYPE_CONFLICT .
CATCH CX_SWF_CNT_CONTAINER .
ENDTRY.
ENDMETHOD.
Now w_names retrieves the names of the fields fine (including my "TEST" entry which I declared in the Workflow Builder), but the GET method causes a "CX_SWF_CNT_ELEM_NOT_FOUND" exception.
Is this the correct way to retrieve data out of a Workflow container within a WF programming exit? What am I doing wrong?
Kind regards,
Michael Koch

Hi Michael, Paolo & Other experts,
I am trying to understand when, why and how to use a 'programming exit' in a SAP workflow.
(1) Did you figure out the solution to your problem?
(2) Is there any material / tutorial on use of a  'programming exit' in a workflow?
Thanks
Abaper

Similar Messages

  • Import workflow container element to program exits

    Hi Friends
    Can you please let me know if we can import container elements from workflow to program exits in step?
    Regards
    Rajeev

    Hi Rajeev,
    Yes you can import container elements from the workitem (not the workflow) to the program exit. You need an element which references the container (if_swf_ifs_parameter_container). You probably have an attribute in you class which is a reference to IF_WAPI_WORKITEM_CONTEXT called M_CTX. This has a method called get_wi_container which will give you the workitem container. Now you not only have the option to read elements with method get in your container class, but there is also a method set which will allow you to fill or change values in the container.
    Regards,
    Martin

  • Funtion module to catch the workflow container data

    Hi All
    I need a FM to catch the WF container data. but the input to the FM should be WF templete No. and the status of WF like "STARED/ COMPLETED"
    Thanks,
    Kakoli.

    Hi Kakoli,
    If you know the object type and key you are working with then you could use SAP_WAPI_WORKITEMS_TO_OBJECT to retrieve the relevant workflows based upon the workflow template(s) you specify in the TASK_FILTER table. You could then filter the workflows retrieved by status.
    FM SAP_WAPI_READ_CONTAINER could then be used to retrieve the container data.
    Best Regards,
    Trevor

  • Error in reading workflow container data and populate it in web dynpro pdf

    Hi,
    Please advise on the following issue.
    I have an adobe interactive form built inside a webdynpro java application, on a RFC call this form is sent as an xstring and the BAPI triggers a workflow in the backend. At any point of time, on passing a workitem id, a custom function module returns the form data that exists in the workflow as an xstring back to webdynpro java, intenally this custom FM iterates through the internal table binary contents for IT_SOLIX_TAB and produces an xstring format out of this binary content. This xstring is passed back to the webdynpro java application so that the contents can be displayed in a pdf.
    I assume that since the data source context structure which has to be populated with this wf container form data is exactly the same as the one which generated this pdf in webdynpro java before the workflow trigger, the WDINTERACTIVEFORMHELPER.transer.... method should be sufficient to re-populate the wd java based pdf with wf container data.
    But I am unable to do this as I am getting "PDFDocument processor failed to process input pdf request" at this step. Though I can see that the RFC is returning the binary data
    Versions : ALD 8.1, CE 7.1 SP5 NWDS, Adobe reader 9
    Awaiting your inputs.
    Thanks
    Lisha

    Hi Hari,
    Why do you use a FM to read the container? You couldn't use bindings? Or are you reading the container of the workflow in a separate program?
    Are you sure the container element is filled when the workflow is started? If so how is it filled, in the event binding?
    Regards,
    Martin

  • Error in reading workflow container data and populate it in web dynpro pd

    Hi,
    Please advise on the following issue.
    I have an adobe interactive form built inside a webdynpro java application, on a RFC call this form is sent as an xstring and the BAPI triggers a workflow in the backend. At any point of time, on passing a workitem id, a custom function module returns the form data that exists in the workflow as an xstring back to webdynpro java. This xstring is passed back to the webdynpro java application so that the contents can be displayed in a pdf.
    I assume that since the data source context structure which has to be populated with this wf container form data is exactly the same as the one which generated this pdf in webdynpro java before the workflow trigger, the WDINTERACTIVEFORMHELPER.transer.... method should be sufficient to re-populate the wd java based pdf with wf container data.
    But I am unable to do this as I am getting "PDFDocument processor failed to process input pdf request" at this step. Though I can see that the RFC is returning the binary data
    Versions : ALD 8.1, CE 7.1 SP5 NWDS, Adobe reader 9
    Awaiting your inputs.
    Thanks
    Lisha

    Hi Hari,
    Why do you use a FM to read the container? You couldn't use bindings? Or are you reading the container of the workflow in a separate program?
    Are you sure the container element is filled when the workflow is started? If so how is it filled, in the event binding?
    Regards,
    Martin

  • Read container element in program exits

    Hi all,
    again me
    Today the question is that i want to read and change the element 'ObjectType' of an BOR element's container before execute method of the task. I use the program exits with CL_SWF_TST_PE_BEFOREEXEC class, it's work fine.
    But this element is a BOR of a BOR, so i know how to read an element with CALL METHOD container->element_get_value but in this case how can i do ?
    Thanks
    Edited by: CECG on Jan 24, 2008 2:46 PM

    I think you can use following macros
    swc_get_object_type
    swc_get_object_key
    Checki in Include <CNTN01> for syntax
    Thanks
    Arghadip

  • Can I access WorkFlow Container Data After Archiving?

    Hello .....
    I am tasked to Archive thousands of old WorkFlows that are cluttering up our system and are beginning to cause performance issues.
    I have managed to Archive some WorkFlows in our DEV system with Tcode SARA.
    My question is .... Can I still access container data for Archived WF's?  I can see logs that indicate successful Archive but our Managers still want to be able to see the container data.  is it possible or is it gone?  tahnk you in advance.
    Dan Avis

    Hello,
    Your archiving isn't successful until you've tested it out - and answered your own question.
    But as far as I can recall (I'll check) - yes, the container values are present. So far I haven't been able to find anything that was missing.
    regards
    Rick Bakker
    hanabi technology

  • Send workflow container data to workflow within BSP

    Hi Experts,
    Good day. I think this must be the right place for asking BSP related questions.
    My question is: I'm triggerring a workflow from BSP and container data for the workflow shall also be transferred.  But when my workflow is triggerred, related container data is not transferred to it. I think there might be something special to care about when calling workflow from BSP, but no exact information is found.
    Following is my code in onInputProcessing event handler.
      CALL FUNCTION 'SWE_EVENT_CREATE'
        EXPORTING
          objtype           = lv_objtype
          objkey            = lv_objkey
          event             = lv_event
        IMPORTING
          event_id          = lv_eventid
        TABLES
          event_container   = lt_container
        EXCEPTIONS
          objtype_not_found = 1
          OTHERS            = 2.
      IF sy-subrc = 0.
        COMMIT WORK.
      ENDIF.
    This code is triggering the workflow but the containers in workflow remain initial. Please kindly help me with this issue, any information is highly appriciated.
    Thanks in advance
    Regards
    Luis

    Hi Shailaja,
    The problems are solved, the related thread is in Business Process Management forum and you can search with 'Trigger workflow from BSP and transfer container data' under my name.(sorry I dont have the url to that, the address in my Firefox is always sdn.sap.com/irj/sdn/collaboration).
    Poinst have been distributed and thanks for your time and kindness.
    Best regards
    Luis

  • Play with workflow container data

    Hi, Experts
      I want to read workitem container data using the FM 'SAP_WAPI_READ_CONTAINER', but
      the element in workitem container is a structure type or table type, and length is more than
      255 character.
      How to do it? Thanks you very much!
    Ken.li

    Hi Pavan,
    The 10 open question rule applies to all questions opened since July 2008.
    Already existing open questions prior to July 2008 were not "retro-fitted" with the rule.
    Note: The "Comment" field is not mandatory when closing old threads
    Cheers,
    Julius

  • Return order BUS2102 Workflow container data not populated

    Hi All,
    Please requesting you to provide your advise on the below issue.
    I have created a custom workflow with business object BUS2102
    In the Workflowtemplate (E.g. WS90000XXX)
    i have included the triggering event for BUS2102 with EVENT "CREATED" and
    added a container element SDReturnCN of type BUS2102
    Once the Return Order is created the Workflow is getting triggered successfully
    but data is not populated into the container SDReturnCN.
    Do i need to write and EXIT to populate container UNLIKE as in Credit memo bussiness object :BUS2094
    if yes please let me know which part i am missing.
    Thanks & Regards,
    Veeru.

    Hello,
    "but data is not populated into the container SDReturnCN."
    Check the bindings. Where is the value coming from?
    regards
    Rick Bakker
    hanabi technology

  • How to retrieve data from workflow container ?

    Hi ,
    I  have to retrieve workflow container ID (not sure , may be it is workitem ID). Using that ID I have to fetch data from workflow container . If anyone is aware of it , help me out . It would be better if u can provide some code snippets.
    Thanks in Advance.
    Regards,
    Vishesh

    Thanks Vishal!!!
    I  am  not  aware about workflow. I don't know anything about it so I had posted it in this forum.
    Regards,
    Vishesh

  • How to access Workfow Container data in a program.

    Hello I need to a access Workflow COntainer data for a particular workitem in a program. How to access these using Tables or standard function modules.
    Thanks in advance.

    swc_container it_event_container.                       
    swc_create_container it_event_container.                 
    CALL FUNCTION 'SWW_WI_CONTAINER_READ'
                EXPORTING
                  wi_id                    = wd_id
                TABLES
                  wi_container             = it_event_container
                EXCEPTIONS
                  container_does_not_exist = 1
                  read_failed              = 2
                  OTHERS                   = 3.
    if sy-subrc = 0.
    READ TABLE it_event_container WITH KEY element = 'name of your workflow container element'.
                IF sy-subrc = 0.
                  w_variable= it_event_container-value.
                ENDIF.
    endif.
    Regards
    Kedar

  • FM to catch the WF container data?

    Hi All
    I need a FM to catch the WF container data. but the input to the FM should be WF templete No. and the status of WF like "STARED/ COMPLETED"
    Thanks,
    Kakoli.

    Hi Kakoli,
    If you know the object type and key you are working with then you could use SAP_WAPI_WORKITEMS_TO_OBJECT to retrieve the relevant workflows based upon the workflow template(s) you specify in the TASK_FILTER table. You could then filter the workflows retrieved by status.
    FM SAP_WAPI_READ_CONTAINER could then be used to retrieve the container data.
    Best Regards,
    Trevor

  • PASS DATA FROM ABAP PROGRAM TO WORKFLOW CONTAINER

    Hello Everybody,
    I am a workflow beginner and I want to pass a data from my ABAP code to a workflow container. This workflow container is used in the Send Mail step.
    The ABAP  Program is:
    REPORT  zdb_work_flow.
    tables : vbak.
    DATA : k TYPE sweinstcou-objkey,
                e TYPE swetypecou-event.
    DATA : st TYPE swcont,
                itab TYPE STANDARD TABLE OF swcont.
    PARAMETERS : vbeln TYPE vbak-vbeln.
    start-of-selection.
      st-element = 'VBELN'.   "This is my WORKFLOW CONTAINER
      st-tab_index = 1.
      st-elemlength = 10.
      st-type = 'C'.
      st-value = vbeln.
      append st to itab.
      k = vbeln.
      e = 'TRIGGER'               "This is an event in my BUS OBJ ZDB_WFLOW
      CALL FUNCTION 'SWE_EVENT_CREATE'
        EXPORTING
          objtype                               = 'ZDB_WFLOW'   "My BUS OBJ
          objkey                                 = k
          event                                  = e    "Event TRIGGER in ZDB_WFLOW
        tables
          event_container               = itab
        exceptions
          objtype_not_found             = 1
          OTHERS                        = 2
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.         .
      COMMIT WORK.
    Now I have created a workflow in SWDD as ZDB_WF_SW.
    In this WF I have created a container as VBELN.
    In the SEND MAIL I have given a header as "Worflow Triggered for &VBELN&"
    PROBLEM.
    The Workflow is getting triggered. I am also getting a mail "Workflow Triggered for" in my mailbox but the &VBELN& is missing from the header.
    I have set the IMPORT EXPORT flag of the WF CONTAINER "VBELN"
    Please Help.
    Edited by: Deepankar.B on Feb 22, 2011 4:08 PM
    Edited by: Deepankar.B on Feb 22, 2011 4:10 PM

    You wouldn't use a SMA as an assistance class - but refer to one within it.
    I would use Shared Memory Area classes - but I'd also build a SMA that could talk across multiple application servers.
    Thomas Jung proposed this in a forum reply some time ago.
    It shouldn't be too difficult to use RFC's to access the content of SMA's in multiple app servers - ensuring synchronisation across multi app servers. I've not yet had the need, so haven't attempted.
    The long polling in 7.02 apparently uses this approach, so in a 7.02 system there may even be standard components/ SMAs that you could use.
    I do not think global areas in FM's are available across sessions - I don't think you could use that as a data transport.

  • Doubt in Workflows using Programming Exits on OO ABAP

    I have a doubt on workflows:-
    Let me brief you about my requirement:
    I am trying to update some Master data using ABAP Methods through Programming Exits in a Workflow.
    I managed to find an OO method that can fetch the workflow container values directly into the structure.
    While testing the workflow:-
    The OO ABAP method executes and successfully updates the master tables.
    However, a calling method (that triggers this method indirectly), raises an exception called SWF_RUN_WIM_EXEC_INTERRUPTED.  
    The exception is caught within the caller method and the workflow errors saying that “the method ABC… cannot be executed.”
    The caller method is:-
    CL_SWF_RUN_WORKFLOW_START
    The exception is raised on execution of the following statement:-
    CALL METHOD me->start_workitem( lh_wi_handle ).
    One reason for this is that the workflow is still not completed and still in “READY” state.
    Alternative method
    Once the Master data is updated successfully,
    I tried to use the FM SAP_WAPI_WORKITEM_COMPLETE to end the work item or tried another FM to suspend the workflow.
    Now it gives an error saying that these FMs are restricted from use during run-time execution.
    Query
    Do you have an idea why the exception is raised and how to track/prevent the same?
    Can you suggest any other alternative?  Your valuable advice is urgently needed.
    Thanks a million in advance,
    Best Regards,
    Vinod

    Check the code
          CLASS zcl_event_handler IMPLEMENTATION
    CLASS zcl_event_handler IMPLEMENTATION.
    Top-of-page event
      METHOD top_of_page.
        PERFORM event_top_of_page
                USING z_dyndoc_id.
      ENDMETHOD.   "METHOD top_of_page
    Change Status Button
      METHOD handle_toolbar.
        IF NOT pa_prodr IS INITIAL.
          DATA: lz_toolbar  TYPE stb_button.
          CLEAR lz_toolbar.
          MOVE    'CHANGE_STATUS'  TO lz_toolbar-function.
          MOVE    text-001         TO lz_toolbar-text.
          APPEND  lz_toolbar       TO e_object->mt_toolbar.
        ENDIF.          "IF NOT pa_prodr IS INITIAL
      ENDMETHOD.   "METHOD handle_toolbar
    Handle User Command
      METHOD handle_user_command.
        CASE e_ucomm.
          WHEN 'CHANGE_STATUS'.
            LOOP AT    it_output
                 INTO  wa_output.
              IF wa_output-chk_box EQ kc_x.
                z_flag = 1.
                EXIT.
              ENDIF.          "IF wa_output-chk_box EQ kc_x
            ENDLOOP.      "LOOP AT it_output INTO  wa_output
            IF z_flag EQ 1.
              PERFORM display_selected_data.
            ELSE.
              MESSAGE i001(zzrefn01)
                      WITH text-023.
            ENDIF.       "IF z_flag EQ 1
        ENDCASE.      "CASE e_ucomm
      ENDMETHOD.   "METHOD handle_user_command
    ENDCLASS.   "zcl_event_handler IMPLEMENTATION

Maybe you are looking for

  • System Overload & How to get the best G4 Performance

    Okay all you Logic and OSX Gurus. I need your help. I've finally made the LOGIC leap from OS9 and have hit the SYSTEM OVERLOAD wall like many of you before me. I've been pouring over this, and many other Forums and Blogs, for about two weeks now, and

  • SCEP on ISE 1.2 and Windows 2003 Server

    Hi there has anyone ever be able to get SCEP on ISE 1.2 working with Windows 2003 Server? I know Cisco recommends Windows 2008 Server onwards, but sometimes the server infrastructure is not yet there. Thanks in advance and best regards Dominic

  • Linkage Error while setting up webApp

              Hi,           In my webApp I bumped into following Exception while running JSPs which queries           database.           Platform : Windows NT 4, webLogic 5.1 with SP 8.           Action : WLSServer crashes with Dr. Watson application er

  • How to run ejb application OC4J J2EE Container

    Hi all, I unable run ejb applications in OC4J J2EE Container. I have configure following files. in config directory Server.xml I have .ear file if configured in server.xml. this .ear copied into home/application directory I have create following depl

  • Why doesn't Artwork tab always appear?

    The 6th tab "ARTWORK" doesn't appear for obscure albums. This is frustrating, since I enjoy finding images to put there. A large part of my enjoyment with itunes is watching the artwork in Cover Flow View. I hate to look at the blank black covers whe