Fetch Workitems Attachments

Steffen Schloenvoigt steffen.schloenvoigt at googlemail.com
Wed Aug 31 09:52:13 EDT 2011


Hi Swathi,

you could try it with something like that:

DATA: lt_attach_objects  TYPE swrtobject.
DATA: lr_s_attach_object    TYPE REF TO swr_object.
  DATA: ls_attach_key      TYPE swotobjid.

* get the attachments from the Workflow
  CALL FUNCTION 'SAP_WAPI_GET_ATTACHMENTS'
    EXPORTING
      workitem_id = iv_source_workitem_id
*     USER        = SY-UNAME
      language    = iv_language
    IMPORTING
      return_code = lv_retrn_code
    TABLES
      attachments = lt_attach_objects.

 * Now for each attachment in the list
  LOOP AT lt_attach_objects REFERENCE INTO lr_s_attach_object.
* Convert to the correct keys
       MOVE lr_s_attach_object->object_id TO ls_attach_key.

 *   Add the attachment in the workflow container
    CALL FUNCTION 'SWW_WI_OBJECTHANDLE_ADD'
      EXPORTING
        wi_id         = lv_target_wf_instance_id
        object_id     = ls_attach_key
        do_commit     = 'X'
      EXCEPTIONS
        update_failed = 1
        OTHERS        = 2.

  ENDLOOP.

This way you only copy over the Key/Handle and don't create new Attachments
in the filesystem.

Best regards
Steffen

2011/8/29 Swathi_Devireddy <Swathi_Devireddy at mahindrasatyam.com>

>  Hi,****
>
> I need to fetch the attachments from a workitem id and pass the attachments
> to a new workflow which is initiated.****
>
> I tried to retrieve the attachment list from SAP_WAPI_GET_ATTACHMENTS but I
> am not able to pass it to the new workflow _*ATTACH*_OBJECTS.****
>
> Please let me know how to go about it.****
>
> ** **
>
> Thanks & Regards, ****
>
> *Swathi Devireddy* | ArcelorMittal Corporate SAP ****
>
> Technical Consultant****
>
> *T** **+91 40 306 72068 ** **M** **+91 9948587999***
>
> *[image: cid:image001.png at 01CA052D.2CB53220]*****
>
> ** **
>
> ------------------------------
> DISCLAIMER:
> This email (including any attachments) is intended for the sole use of the
> intended recipient/s and may contain material that is CONFIDENTIAL AND
> PRIVATE COMPANY INFORMATION. Any review or reliance by others or copying or
> distribution or forwarding of any or all of the contents in this message is
> STRICTLY PROHIBITED. If you are not the intended recipient, please contact
> the sender by email and delete all copies; your cooperation in this regard
> is appreciated.
>
> _______________________________________________
> SAP-WUG mailing list
> SAP-WUG at mit.edu
> http://mailman.mit.edu/mailman/listinfo/sap-wug
>
>


-- 
Steffen Schlönvoigt

Am Sportplatz 9/2
88677 Markdorf

Internet: http://www.schloenvoigt.de
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.mit.edu/pipermail/sap-wug/attachments/20110831/a68ed577/attachment.htm
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/png
Size: 5623 bytes
Desc: not available
Url : http://mailman.mit.edu/pipermail/sap-wug/attachments/20110831/a68ed577/attachment.png


More information about the SAP-WUG mailing list