attachments with email (selfitem- sendtaskdescription)

Sergey Breslavets sergey.breslavets at epstechnology.com
Tue Jan 20 18:15:36 EST 2004


Hi Monika,
 
You don't have to... forget SOFM! Do the following:
 
1. Create custom method "Send_Notification" as a copy of
"Sendtaskdescription"
2. Modify method include code to generate expense report and insert it
into attachment container (example of the code is attached to this
message below).
3. Modify your workflow to use task based on your custom method instead
of "Sendtaskdescription"
4. You done!
 
When your task is executed, it'll automatically generate proper expense
report and send it as a Windows file type (MS Office, text, etc.)
attachment to the notification message.
 
Code example follows:
------------------------------------------------------------------------
--
. . .=20
  DATA:  REC_TAB LIKE SOOS1 OCCURS 0 WITH HEADER LINE.
  DATA:  NOTE_TAB LIKE SOLI OCCURS 0 WITH HEADER LINE.
  DATA:  OBJECTS LIKE SOOD4 OCCURS 0 WITH HEADER LINE.
  DATA:  OBJHEAD LIKE SOLI OCCURS 0 WITH HEADER LINE.
  DATA:  BEGIN OF OBJECT_HD_CHANGE.
          INCLUDE STRUCTURE SOOD1.
  DATA:  END OF OBJECT_HD_CHANGE.
  DATA:  SO_UNAME        LIKE SOUD-USRNAM. " user's SAP office name
  DATA:  SUBRC LIKE SY-SUBRC.
  DATA:  PACKING_LIST TYPE TABLE OF SOXPL WITH HEADER LINE.
  DATA:  ATT_HEAD TYPE TABLE OF SOLI WITH HEADER LINE.
  DATA:  ATT_CONT TYPE TABLE OF SOLI WITH HEADER LINE.
 
**---------------------- Add attachments -----------------------------*
** Compose Packing List
 
  clear packing_list.
  refresh packing_list.
 
** Add Attachments
  refresh att_content.
 
*** Execute your method and get Expense Report lines in XMLTAB[].
 
  IF SY-SUBRC =3D 0.
    REFRESH CONTAB.
    att_content[] =3D XMLTAB[].
    FREE XMLTAB.
 
    clear object_header_att.
    object_header_att =3D 'Invoice Image'. Append object_header_att.
 
    clear lines.
    refresh packing_list.
    clear packing_list.
 
 
    packing_list-transf_bin =3D 'X'.
** If you will send plain text attachment, uncheck this flag
 
    packing_list-objla =3D sy-langu.
    packing_list-head_start =3D 1.
    packing_list-body_start =3D 1.
 
    describe table att_content lines lines.
    packing_list-body_num =3D lines.
    packing_list-objtp =3D 'FAX'.
    MOVE 'Invoice Image' to packing_list-objdes .
    packing_list-objnam =3D 'Invoice'.
    packing_list-objlen =3D lines * 255.
    append packing_list.
 
    append lines of object_header_att to att_head.
  endif.
 
. . .
 
Then you pass the attachment container and packing list as parameters to
"SEND_MAIL***" function module.
 
=20
------------------------------------------------------------------------
 
Regards,
Sergey..
 
 
-----Original Message-----
From: M Doe [mailto:monica_sap at hotmail.com]=20
Sent: Tuesday, January 20, 2004 2:41 PM
To: SAP-WUG at MITVMA.MIT.EDU
Subject: Re: attachments with email (selfitem- sendtaskdescription)
 
Hi,
 
I don't know if you have completely understood my situation.  I have a
method already which displays the expense report .  How do I attach this
to
the sendmail task?  The sendmail task attachment is looking for
something
with the object type SOFM and this expense report is not.  How do I make
this expense report object type SOFM? How do I make this expense report
an
office document?
 
 
You mentioned that I should use  one of the sapoffice sendmail
functions- do
you mean using object type SOFM.
 
Thanks.
Monica.
 
 
 
>From: Alon Raskin <araskin at eOutlook.com>
>Reply-To: SAP Workflow Users' Group <SAP-WUG at MITVMA.MIT.EDU>
>To: SAP-WUG at MITVMA.MIT.EDU
>Subject: Re: attachments with email (selfitem- sendtaskdescription)
>Date: Mon, 19 Jan 2004 04:29:29 -0600
>
>Hi Adnan,
>
>I dont think you can because the method doesnt return anything to
indicate
>that the note was created. You could redefine the method to do this but
I
>think my earlier suggestion is easier for you and if designed well can
be
>reused in other developments.
>
>Alon
>
>________________________________
>
>From: SAP Workflow on behalf of Adnan Alawi
>Sent: Mon 19/01/2004 09:46
>To: SAP-WUG at MITVMA.MIT.EDU
>Subject: Re: attachments with email (selfitem- sendtaskdescription)
>
>
>
>Thanks Alon,
>        I will try the way you said.
>    I thought of using selfitem.Note_Create which I have used before.
>But the only question in mind was , how to make it mandatory to the
>user to send his document ?
>
>Regards
>Adnan
>
>
> >From: Alon Raskin <araskin at eOutlook.com>
> >Reply-To: SAP Workflow Users' Group <SAP-WUG at MITVMA.MIT.EDU>
> >To: SAP-WUG at MITVMA.MIT.EDU
> >Subject: Re: attachments with email (selfitem- sendtaskdescription)
> >Date: Mon, 19 Jan 2004 03:10:08 -0600
> >
> >Hi Adnan,
> >
> >Why not just create a virtual attribute on a delegated sub-type of
> >WORKINGWI called Attachments? You could then use WAPI
> >SAP_WAPI_GET_ATTACHMENTS to retrieve the attachments and check that
the
> >user has attached something. The work item might have a few
attachments
>so
> >it might be easier to write a method that looks for the specific
>attachment
> >that you want to make mandatory. If the method does not find the
>attachment
> >then you re-route the work item back the users inbox.
> >
> >Alon
> >
> >
> >
> >________________________________
> >
> >From: SAP Workflow on behalf of Adnan Alawi
> >Sent: Sat 17/01/2004 09:15
> >To: SAP-WUG at MITVMA.MIT.EDU
> >Subject: Re: attachments with email (selfitem- sendtaskdescription)
> >
> >
> >
> >Hiiiiiii,
> >    I have a question on attachments, how do u make attachments
> >OBLIGATORY ? or check that the user has attached a something ?
> >
> >Regards
> >Adnan
> >
> >
> > >From: Sergey Breslavets <sergey.breslavets at epstechnology.com>
> > >Reply-To: SAP Workflow Users' Group <SAP-WUG at MITVMA.MIT.EDU>
> > >To: SAP-WUG at MITVMA.MIT.EDU
> > >Subject: Re: attachments with email (selfitem- sendtaskdescription)
> > >Date: Fri, 16 Jan 2004 16:20:19 -0600
> > >
> > >Hi Monica,
> > >
> > >Simplest way:  you can substitute sendmail step with you own
background
> > >task, where you would generate plain text report and send it either
as
> > >attachment of as body text using one of the sapoffice sendmail
> > >functions.
> > >
> > >To make it look nicer you can use Sapscript instead (generate
sapscript
> > >report and pass it as binary content).  I used that technique to
> > >generate and send scanned image of a vendor invoice as an email
> > >attachment.
> > >
> > >I'll try to find some code examples and send to you if you want.
> > >
> > >There is also a step type in 4.6 you can use in the workflow -
Generate
> > >Document from a template. You can create doc template (e.g. using
MS
> > >Word) and insert a placeholders in the text which would at
generation
> > >time be substituted with values from corresponding container
elements.
> > >I'm not sure if it'll work in case of tabular data though..
> > >
> > >
> > >Regards,
> > >Sergey..
> > >
> > >
> > >-----Original Message-----
> > >From: M Doe [mailto:monica_sap at hotmail.com]
> > >Sent: Friday, January 16, 2004 3:52 PM
> > >To: SAP-WUG at MITVMA.MIT.EDU
> > >Subject: Re: attachments with email (selfitem- sendtaskdescription)
> > >
> > >Hi Sergery,
> > >
> > >Please explain how.
> > >
> > >Regards,
> > >Monica
> > >
> > >
> > > >From: Sergey Breslavets <sergey.breslavets at epstechnology.com>
> > > >Reply-To: SAP Workflow Users' Group <SAP-WUG at MITVMA.MIT.EDU>
> > > >To: SAP-WUG at MITVMA.MIT.EDU
> > > >Subject: Re: attachments with email (selfitem-
sendtaskdescription)
> > > >Date: Fri, 16 Jan 2004 13:59:25 -0600
> > > >
> > > >Hi Monica,
> > > >
> > > >You can generate a document (expense report) within the workflow
and
> > > >send it as attachment...
> > > >
> > > >Regards,
> > > >Sergey..
> > > >
> > > >
> > > >-----Original Message-----
> > > >From: M Doe [mailto:monica_sap at hotmail.com]
> > > >Sent: Friday, January 16, 2004 1:29 PM
> > > >To: SAP-WUG at MITVMA.MIT.EDU
> > > >Subject: attachments with email (selfitem- sendtaskdescription)
> > > >
> > > >Hello all,
> > > >
> > > >Hope everyone enjoyed their holidays!
> > > >
> > > >I have a question..I have a workflow that is sending an email to
the
> > > >manager
> > > >telling the manager to go log in to R/3 to approve or reject.
The
> > > >client
> > > >now also is
> > > >requesting that with this email I send an attachment of the
expense
> > > >statement of the employee so they can preview the details with
the
> > > >email.
> > > >
> > > >I am able to send this statement into the R/3 inbox since there
is a
> > > >display
> > > >method behind this workitem but how do I attach it to the email.
> > > >
> > > >I am using " selfitem sendtaskdescription" in this workflow to
send
>the
> > > >email and when I try to attach this form to the attachments in
>binding
> > >I
> > > >get
> > > >an error stating "Reference types 'D' and 'O' are not compatible
"
> > > >because
> > > >the expense form is of "object" type which apparently I cannot
>attach.
> > > >
> > > >Please advise on how to handle this.
> > > >
> > > >Thanks.
> > > >
> > > >Regards,
> > > >Monica
> > > >
> > > >_________________________________________________________________
> > > >Get a FREE online virus check for your PC here, from McAfee.
> > > >http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3D3963
> > >
> > >_________________________________________________________________
> > >Rethink your business approach for the new year with the helpful
tips
> > >here.
> > >http://special.msn.com/bcentral/prep04.armx
> >
> >_________________________________________________________________
> >The new MSN 8: advanced junk mail protection and 2 months FREE*
> >http://join.msn.com/?page=3Dfeatures/junkmail
>
>_________________________________________________________________
>The new MSN 8: advanced junk mail protection and 2 months FREE*
>http://join.msn.com/?page=3Dfeatures/junkmail
 
_________________________________________________________________
Get a FREE online virus check for your PC here, from McAfee.
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3D3963
 


More information about the SAP-WUG mailing list