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

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

  • 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

  • Unable read container element in the BO

    Hi
    I have created a new container element in the task and trying to pass the value and read the same value in the bussiness object method
    using the statement   "SWC_GET_ELEMENT CONTAINER 'Classification' l_KLGRU1". I have created the the container element in parameters of the BO method.
    In the task binding I am direclty passing the container value i.e my case
    Classification  = FI
    "SWC_GET_ELEMENT CONTAINER 'Classification' l_KLGRU1".
    But the above statement is not returning the value at all.
    Where am I going wrong....
    Regards,
    Krishna prasad

    This question is going waaaaaayyyy off-topic, sorry about that Krishna. Just a final response from me, pointing people in the right direction if they are not already aware of another great forum.
    There is a debate (see the Coffee Corner forum which I try to read at least a few times a week) going on with respect to technical solutions to reduce the number of repeated questions and questions to which the answer is available on help.sap.com. There are many suggestions already, some of which are:
    forcing a forum search before posting (as when creating customer messages on service.sap.com)
    restricting the number of open questions a user can have
    a solution as in Experts Exchange where asking a question cost you some points, thus encouraging people to find the answers from previous questions and saving their points for a question that they <u>really</u> can't find an answer to
    forcing a period as lurker, i.e. a new member can not post before he has visited the forums X number of days
    Obviously, not all suggestions will be implemented, and not all are desireable. For instance, forcing a period as a lurker can shut out people who have spent 15 days trying to solve a problem on their own before finally deciding to give SDN a try.
    PS: Mike's last name is Pokraka, I had to double-check it quite a few times before I finally could remember it - my variation was Pokarka

  • Use SAP_WAPI_READ_CONTAINER to read all container element

    Hi All,
    I am writing an ABAP to read message texts from a workflow container. The text is stored in a container element called RejectionTexts which is a multiline container element.
    When I call the Function Module SAP_WAPI_READ_CONTAINER it brings be back the "standard" container elelments but doesn't return the element RejectionTexts.
    Am I doing something wrong or is there another FM for getting the other container elements?
    DATA: lt_container LIKE swr_cont OCCURS 0 WITH HEADER LINE.
    DATA: lt_worklist TYPE swr_wihdr OCCURS 0 WITH HEADER LINE. "PH9K008190
    DATA: lt_message_lines  LIKE  swr_messag OCCURS 0 WITH HEADER LINE,
          lt_message_struct LIKE  swr_mstruc OCCURS 0 WITH HEADER LINE,
          lt_subcontainer_bor_objects LIKE  swr_cont OCCURS 0 WITH HEADER
    LINE,
          lt_subcontainer_all_objects LIKE  swr_cont OCCURS 0 WITH HEADER
    LINE.
    lt_worklist-wi_id = '495105'.
    CALL FUNCTION 'SAP_WAPI_READ_CONTAINER'
      EXPORTING
        workitem_id                    = lt_worklist-wi_id
    *   LANGUAGE                       = SY-LANGU
    *   USER                           = SY-UNAME
    * IMPORTING
    *   RETURN_CODE                    =
      TABLES
        simple_container               = lt_container
       message_lines                   = lt_message_lines
       message_struct                  = lt_message_struct
       subcontainer_bor_objects        = lt_subcontainer_bor_objects
       subcontainer_all_objects        = lt_subcontainer_all_objects.

    It looks like that if there is no value on the container for RejectionText the container element doesn't come through as a blank (even though the other container elements come through if they are blank).
    Once I manually popuated an entry and read the container again the value appeared.
    Thanks for the help,
    Colm

  • Read Workflow Container Elements attributes

    Hi,
    I am using a F.M <b>'RH_GET_TASK_ATTRIBUTES'</b> to get the attributes of the <b>Workflow container</b> elements.
    But the above F.M does not show the element attributes that I create inside the Workflow Builer under <b>Workflow Container Block</b> and I dont select either Import or Export Properties.
    Is there any F.M that reads ALL Workflow Container elements.

    If you want to clear a single element, use a container operation and assign it to space. If you need to clear an internal table, create another internal table container element that is always empty. Then, inside the container operation assign the empty table to the table you want to clear.
    Basically, you are doing this:
    container_element = space. OR container_element = ' '.
    container_internal_table[ ] = container_empty_internal_table[ ].

  • Set a container element inside class to exit a loop

    Hi,
    I want to set a container element inside a class to exit a loop.
    The element is marked as import/export parameter and the binding from the task to the container exists as well.
    The loop has a condition  &finish& = X but I cannot exit the loop. Looks like the value gets never updated in the container.
    When i am using a container operation to set the element its working but i want to do this out of my method in the class.
    Is it not possible to change a container element inside a loop without using a container operation?
    Thanks,
    Christoph

    Hi,
    Using the container operation is a good method to solve the problem. But if you intend to do that in the method coding itself then you will have to have it as the export parameter of the method. You can view all the import and export parameters of a method by going to the Business Object Builder (SWO1) and then choose the method and click on the "Parameters" Button. Once you are done with the interface of the method use that method in the workflow builder as a task and in the binding there are two rows. One for the import that occurs just below the container elements and the export parameters appear below the import in a separate window. Make sure you have the binding set there too as this is where you can transfer the container elements back to the workflow container from the task container and it should work. Maybe you are missing that in the binding.
    Hope it helps,
    Sudhi

  • Program exit to change workitem text

    Hi All,
    I have a requirement to change work item text at runtime, i am using program exit to change the task contrainer variable which is being used to display work item text. i have written a code in program exit to update container element, but it's not reflected to change workitem text, when i check in ln workflow log the variable shows with updated value.
    Please help to solve issue.
    Many thanks,

    Hi Gupta,
    I used below code to update container element.
    CASE im_event_name.
         WHEN swfco_event_after_creation.
            CLEAR l_value.
           CALL METHOD l_wi_cont->get
             EXPORTING
               name  = 'LV_WITEXT'
             IMPORTING
               value = l_value.
             REPLACE '$' INTO l_value WITH lv_id.
           CALL METHOD l_wi_cont->set
             EXPORTING
               name  = 'LV_WITEXT'
               value = l_value.
    With above code LV_WITEXT is updated with new value, but same is not displayed as workitem text in inbox.
    After workitem displayed in inbox if i use FM SWL_REFRESH_WORKITEM_TEXT explicitly to refresh, workitem text getting refreshed.
    Many thanks.

  • Current Agent Value in Program Exit Workflow

    Hi Gurus,
    we are using program exit to send mail to outlook on user decsion step and it is working fine for Sequential approval but when we have to send mail for parallel approval(have used block for parallel approval) we are not able to fetch current agent.
    - Have store agent in workflow container 'Agent' and used it in Block in workflow for implementing parallel appoaval.
    - Created class implementing inetrface IF_SWF_IFS_WORKITEM_EXIT and put it under program exit of user decsion in workflow
    - Now in this class I have created method at work item created to trigger email for which i require runtime work item id and agent for it.
    - We are getting workitem id at runtime and based on it picking up approval agent from workflow container and send mail to it.
    - this workfs fine for sequential one as there is only one approver at a time but in parallel where all approver are maintained in one multiline container, it is sending mail to first person maintained in multiline container.
    Please find steps below what i have tried:-
    - i tried with  FM RH_USERS_OF_WI_READ to get current agent for particular work item id  but it is throwing dump no value found at   runtime but stangely gives value if we run standalone for same work item id.
    - Then,  I tried putting wait upto to see if it helps, but then also above fm is unable to fetch agent.
    - Tried by putting select on   SWWUSERWI table but that also is not giving current agent
    Question is:
    Why we are not able to get value of current agent through above FM or select from userwi table? How do we get current agent value at the time of work item creation event is triggered which further hits our custom method.
    Please help...
    Regards
    Ajit C

    Hi Ajit,
    Here you go.
    You must be having a multiline container (probably of type WFSYST-AGENT) in your workflow which holds all the user ids to whom work item must be going parellely. e.g if the multiline container name is AGENT.
    The current agent from that multiline container is referred by &AGENT[_AGENT_line_]&. This you must hast have put in your user decision step/activity as an agent also.
    Now in your user decision step/activity, create one single line container element of type WFSYST-AGENT e.g. current_agent. in workflow to task binding, bind &AGENT[_AGENT_line_]& to CURRENT_AGENT. This way you will have current agent in that task container.
    Finally use function module SAP_WAPI_READ_CONTAINER using WORKITEM id to read the value of CURRENT_AGENT in your program exit.
    Regards,
    Ibrahim

  • Container element for Count in Parallel Approval Workflow

    Hi Gurus,
    We are using ECC 6.0 and I have this below requirement. Please share your thoughts on how we can achieve this.
    We are using a User decision step in parallel workflow to generate and send individual work items to multiple approvers. that is, we generate multiple work items and send to individual approvers for the same step in the workflow and get the combined result (Approve or Reject) to proceed further. I understand that individual result for each work item is stored in container element '_RESULT' (0001 for Approve, 0002 for Reject) and combined result of all the sub-work items is stored in '_WI_RESULT' (0001 for Approve, 0002 for Reject). Also, we can see the index # of work items generated for the same step (node) from container element ''_WF_PARFOREACH_INDEX'.
    My requirement is to set work item to COMPLETED status after we obtain a certain # of APPROVE (_RESULT = 0001) decision. Let's say, after 2 of the approvers say Ápproved', then I'd like to close all the other relevant work items and set the Combined result '_WI_RESULT'to APPROVE and Complete the relevant work item. I was wondering if there is a container element that holds the (count) # of work items generated in individual work item container so that I can keep reading this value to see how many decisions have been made. That is, for example, If there are 3 parallel work items generated and 1st user said Äpproved',  is there a way to know out of a total of 3 approvals (to get the combined result '_WI_RESULT'), one is completed and 2 approval decisions are still pending. I'm trying to use step-level Pgm Exit (After_execution Method) to read this container element for # of approvals done and if the combined result '_WI_RESULT'is '0001'(Approve), i'll try to end other work items. One way of doing is to have a custom table to capture this and keep reading this table after each decision. But, I don't want to have all this customization and I believe there should be a way the SAP is storing somewhere this # of completed or Pending approval work items that got originated from a single step/node. One way of doing could be, after each decision, read the dependent work items (having same node # and Parent Work item etc.,) and get the other relevant work items and read their status etc., But I think this is a lengthy process and may be there is an easier way, perhaps some container element that holds this information.
    Please let me know if you need any clarification on my requirement and share your thoughts on how I can achieve easily.
    Appreciate and thank you in advance for your help.
    Regards,
    Venu

    Hi Karri,
    Thank you for your reply. I was actually doing the same with having an APR_COUNT and passing that for each of individual work items and bind it back to task--> wflow container. And keep checking this counter in wf container.
    Once, we obtain certain # of approvals, then I guess I'll have to complete or cancel the other work items.
    I was thinking may be there is some container element already exists that keep track of this, I guess not .
    Thanks for your input
    Regards,
    Venu

  • How do the Program exits in Workflow  work?

    hi all,
    there is a Program Exit available in Workflow tasks...and it says
    You can execute additional methods that you have programmed when predefined events occur. Add the ABAP classes that contain these methods. The ABAP classes added must support the IF_SWF_IFS_WORKITEM_EXIT interface.
    now i want to use this program exits in my workflow...so that this program exit(which is basically a class) will take input from Workflow container and gives back processed data <b>back to workflow</b>.
    so how to go about with these Program exits.
    thanks,
    subba

    hi
    good
    go throgh this links
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/82d03e23-0a01-0010-b482-dccfe1c877c4
    http://help.sap.com/saphelp_nw04/helpdata/en/1a/6b023c3f6aaf08e10000000a11402f/content.htm
    thanks
    mrutyun^

  • Programming exit tabpage

    Hi all,
    I have a requirement to implement some coding in a 'Program Exit' tab page in a Activity Step, and for some reason, I have to call a RFC function in this  area, like below:
    call function 'XXX' starting new TASK l_task
       exporting
    And I found some note in Library like below:
    ABAP classes that you use as programming exits must not use the following elements:
    ●      COMMIT WORK
    ●      ROLLBACK WORK
    ●      Calling of function module DB_COMMIT
    ●      Any type of RFC calls
    ●      Change a system element in the container
    Then I want to know, why shouldn't I use "Any type of RFC calls" here?
    Thanks a lot.
    Best Regards,
    Ivan

    Hi ivan zhao
      I think you can use RFC but not the ABAP statements like roll back, commit work. Check out this link it would be helpful to you.
    [Program Exits In Workflow |https://wiki.sdn.sap.com/wiki/display/ABAP/Program%20Exits%20In%20Workflow]
    Regards
    vijay

  • UIWebView cause "Program exited with status value:101"

    My application uses both imagepickercontroller and UIWebView as subviews. it crashes frequently, I guessed the reason was related to imagepickercontroller at first, but after doing more testing , I found it is UIWebView cause crash and exit silently problem with message in console "Program exited with status value:101". I tried to write a simple test app which contains only a window and an UIWebView as subview to load pages with javascripts like maps.google.com, it exit silently always after opening such pages after a while. I also tested UICatalog on iPhone, get the same result. any ideas on this issues??

    Error 101 means iPhone runs out of Memory and ends your application.
    Set a breakpoint to the "applicationDidReceiveMemoryWarning" function or however it is called exactly.
    Also if you check object allocations and leaks with instruments you should be able to see a big memory footprint of your application.

  • When I click on the 'help' key in the elements 12 program it wants to open it in Firefox2. Firefox doesn't work on my Macbook Pro Air. I use Safari. How do I get it to open?

    When I click on the 'help' key in the elements 12 program it wants to open it in Firefox2. Firefox doesn't work on my Macbook Pro Air. I use Safari. How do I get it to open?

    Hmm, that is very strange. I agree with MichelB that it's probably best just to get the PDF, but you can try going to your username>library>preferences and deleting:
    com.adobe.PhotoshopElements.plist
    Adobe Photoshop Elements 12 settings
    Adobe Photoshop Elements 12 paths
    To see the library, click the Go menu in the Finder and hold down the option key and it will appear below the little house for your user account. While you're in there it wouldn't be a bad idea to go to the Saved Application States folder and delete anything pertaining to PSE.
    Repair permissions and see if that does it.

  • XML DB: is it possible to get a row for each element in a container element?

    I have an XML document containing a container element (collection). If I query, using an XPath expression, the contained elements I get a row for each container element with the contained element concatenated. Is it possible to get a row for each contained element?
    I run this simple query:
    select extract(xmltype('<colors><color>Red</color><color>Green</color></colors>')
    , '/colors/color/text()').getstringval() from dual
    And get this result:
    EXTRACT(XMLTYPE('<COLORS><COLOR>RED</COLOR><COLOR>GREEN</COLOR></COLORS>'),'/COL
    RedGreen
    1 row selected.
    What I would like to have is:
    Red
    Green
    2 rows selected.
    Wishful thinking or possible? Many thanks!

    Sure. This is where our XMLSequence() function comes in. It allows you to treat the top-level nodes in a nodeset as if they were rows in a table when combined with the TABLE() operator. Here's an example.
    First, to make the SQL look a little cleaner, I like to define a function like this:
    create or replace function testdoc return xmltype as
    begin
      return xmltype('<colors><color>Red</color><color>Green</color></colors>');
    end;.
    To break out the nodeset of <color> elements as a table, we use the following query:
    select value(list_of_color_elements).extract('*/text()').getStringVal() as color
    from TABLE( XMLSequence( extract(testdoc(),'/colors/color'))) list_of_color_elements.
    Or, using the new-in-9.2 extractValue() operator so we don't have to remember the text() part:
    select extractValue( value(list_of_color_elements), '.') as color
    from TABLE( XMLSequence( extract( testdoc() ,'/colors/color'))) list_of_color_elements.
    Here the TABLE(XMLSequence(...)) combo produces a table of XMLType, with one XMLType object in each row of the table.
    In general, if the XMLType instance were coming from an XMLType table xmltab the query would look like this:
    select extractValue( value(colors), '.') as color
    from xmltab x, /* Important that this table comes earlier in the FROM clause! */
         TABLE( XMLSequence( extract( value(x),'/colors/color'))) colors.
    And if the XMLType were instead in a column of XMLType named doc in a table xmltab, then we would have the syntax:
    select extractValue( value(colors), '.') as color
    from xmltab x, /* Important that this table comes earlier in the FROM clause! */
         TABLE( XMLSequence( extract( x.doc ,'/colors/color'))) colorsOnce you get the hang of it, you'll see that the combination of TABLE(XMLSequence()) to "shred" XML nodes into rows, and XMLAgg() to aggregate fragments of XML across multiple rows back into a single document, is quite powerful.

Maybe you are looking for