Result of a report as an attachment

Van der Burg, Jeroen JA SITI-ITPSEE Jeroen.J.vanderBurg at si.shell.com
Wed Jul 3 08:55:54 EDT 2002


I use the following custom method (probably nicked the basics from some
standard routine somewhere, can't really remember) and then use the folder
object as input for a task based on Report.CreateListObject.
 
Good luck!
 
 
Jeroen
 
 
begin_method findfolder changing container.
DATA: folder_id        LIKE soodk,
    excl_reg         LIKE soxrg.
DATA: selections       LIKE sofds.
DATA: source_folder    LIKE sofdk.
DATA: f_cancelled      LIKE sonv-flag.
DATA: selected_folders LIKE soxli OCCURS 0 WITH HEADER LINE.
DATA: result_object TYPE swc_object.
DATA:
    foldername LIKE sos06-s_folnam,
    folder TYPE swc_object.
DATA:
 BEGIN OF key,
     foldertype LIKE sofm-foltp,
     folderyear LIKE sofm-folyr,
     foldernumber LIKE sofm-folno,
     type LIKE sofm-doctp,
     year LIKE sofm-docyr,
     number LIKE sofm-docno,
     forwardername LIKE soub-usrnam,
 END OF key.
 
 *  SWC_GET_ELEMENT CONTAINER 'FolderName' FOLDERNAME.
 CALL FUNCTION 'SO_FOLDER_ROOT_ID_GET'
      EXPORTING
           region                = 'B'
      IMPORTING
           folder_id             = folder_id
      EXCEPTIONS
           communication_failure = 1
           owner_not_exist       = 2
           system_failure        = 3
           x_error               = 4.
 
 IF sy-subrc EQ 0.
   CLEAR excl_reg.
   MOVE 'X' TO: excl_reg-fpwb, excl_reg-fswb.
 
   MOVE 'WORKFLOW' TO selections-folnam.
   MOVE ' ' TO selections-document.
   MOVE folder_id TO source_folder.
 
   CALL FUNCTION 'SO_WIND_OBJECTS_SEARCH'
      EXPORTING
           exclude_regions            = excl_reg
           source_folder_id           = source_folder
           folder_selections          = selections
           selection                  = ' '
      IMPORTING
           f_cancelled                = f_cancelled
      TABLES
           follist                    = selected_folders
      EXCEPTIONS
           operation_no_authorization = 1
           owner_not_exist            = 2
           parameter_error            = 3.
 
 IF sy-subrc EQ 0.  "workflow folder found! Now create the object
   CLEAR object-key.
   MOVE: selected_folders-partp  TO key-foldertype,
         selected_folders-paryr  TO key-folderyear,
         selected_folders-parno  TO key-foldernumber,
         selected_folders-foltp  TO key-type,
         selected_folders-folyr  TO key-year,
         selected_folders-folno  TO key-number.
 
    swc_create_object result_object 'SOFM' key.
    swc_set_element container 'Folder' result_object.
 
  ENDIF.
ENDIF.  "folder root found
end_method.
 
 
 
-----Original Message-----
From: Boulay, Serge [mailto:serge.boulay at sap.com]
Sent: 03 July 2002 13:15
To: SAP-WUG at MITVMA.MIT.EDU
Subject: Re: Result of a report as an attachment
 
 
Thanks Jeroen,
 
I understand the concept but can you just elaborate on how to put the report
result in a SAPOffice folder ?
 
Serge
 
-----Original Message-----
From: Van der Burg, Jeroen JA SITI-ITPSEE
[mailto:Jeroen.J.vanderBurg at si.shell.com]
Sent: Monday, July 01, 2002 3:37 AM
To: SAP-WUG at MITVMA.MIT.EDU
Subject: Re: Result of a report as an attachment
 
 
Serge,
 
What I do for reports is generate a list (actually from a variable report
and variant, customisable in a custom table) and store the list in in a
SAPoffice folder. From here you can use the report result (I use it for a
validation process through SAPinbox followed by sending the report result as
an attachment to an email out of the system).
 
You do need to instantiate a SAPoffice folder object next to the report
object to be able to retrieve the report output from the office folder. The
positive side of using folders is that it is very secure (I restrict access
to the folders only to WF-BATCH), documents can be automatically removed
after a certain number of days, the report result is not changeable
(important for validation) and the user does not have to wait for the
running of the report as the result is taken from the folder, not created at
runtime.
 
For display of the report through SAP inbox and Workflow ESS miniApp I use
the SOFM.DISPLAY method, for sending the report result as an email
attachment I use a normal SELFITEM.SENDTASKDESCRIPTION; linking the report
result as an adhoc object to the attachments.
 
 
Hope this helps,
 
 
Regards,
 
 
Jeroen
 
-----Original Message-----
From: Boulay, Serge [mailto:serge.boulay at sap.com]
Sent: 28 June 2002 12:23
To: SAP-WUG at MITVMA.MIT.EDU
Subject: Result of a report as an attachment
 
 
Hi everyone,
 
I am on 4.6B and we are doing Travel and Expense approval... The client
whant to see the expense report before approving the expense. I was going to
create redefine the display method of BUS2089 to call the expense report but
now they are looking at ESS inbox. So i am trying to make an attahcment to
my workflow to make it accessable. I am not even sure if the attachment will
be available in my ESS inbox !?!
 
Is there a way of attaching the result of a report (for me it is the expense
report) to the workflow ?
 
 
Regards.
 
Serge Boulay
HR/Payroll consultant &
Workflow consultant
SAP Canada inc.
 


More information about the SAP-WUG mailing list