send mail with attached objects

Dart, Jocelyn jocelyn.dart at sap.com
Wed Feb 27 03:39:28 EST 2002


Hi Daniel,=20
That's correct.  You create the document in the private folder
and then send it on to the inbox (either of the same user or another
user).   It's a two part process.
 
FM SO_OLD_DOCUMENT_SEND_API1 should suit your design.=20
 
Regards,
        Jocelyn Dart=20
Consultant (EBP, BBP, Ecommerce, Internet Transaction Server, Workflow) =
 
SAP Australia
Email jocelyn.dart at sap.com <mailto:jocelyn.dart at sap.com>=20
Tel: +61 412 390 267
Fax: +61 2 9935 4880
 
 
-----Original Message-----
From: Daniel Fern=E1ndez [mailto:wfdfl1975 at yahoo.es]
Sent: Tuesday, 26 February 2002 7:45 PM
To: SAP-WUG at MITVMA.MIT.EDU
Subject: Re: send mail with attached objects
 
 
Hi Govind,Raskin, Hi all,
 
I have investigated the API functions for to send mail
with attached objects (like a invoice or a purchase
order) and I have a problem.
 
I I try to add a sap office mail in the private
folder, all works Ok, but if I try to add it in the
inbox folder an error of authoritation is showed.
 
I4m the SAP_ALL and SAP_NEW in development system
 
The code (it works for de private folder) is:
 
data: S_MESSAGE type SODOCCHGI1,
      S_LIST_OBJ type SOLISTI1 occurs 0,
      S_USER_DATS type SOUDATAI1,
      S_USER type SOUDNAMEI1,
      S_DOCUMENT type SOFOLENTI1,
      S_TASK_DESCR TYPE TLINE OCCURS 0,
      S_TASK_DESCR_C TYPE SOLISTI1 OCCURS 0,
      S_OBJECT type soxobj,
      S_DESCR_ATTACH type SOATTCHGI1 occurs 0 with
header line.
 
 
* SAP folders of user that receive the mail.
 
 
S_USER-SAPNAME =3D 'DFERNANDEZ'. "(User)
 
CALL FUNCTION 'SO_USER_READ_API1'
    EXPORTING
         USER                      =3D S_USER
    IMPORTING
         USER_DATA                 =3D S_USER_DATS
    EXCEPTIONS
         USER_NOT_EXIST            =3D 1
         PARAMETER_ERROR           =3D 2
         X_ERROR                   =3D 3
         OTHERS                    =3D 4.
 
 
* Obtain Task description
 
CALL FUNCTION 'SWU_GET_TASK_TEXTLINES'
    EXPORTING
          TASK              =3D 'TS99900015'  "(Your
task)
*        WI_ID             =3D
*         WIHEADER          =3D
          USAGE             =3D 'W'
          LINEWIDTH         =3D 75
          LANGUAGE          =3D SY-LANGU
    TABLES
          ASCII_TEXT_LINES  =3D S_TASK_DESCR
*         CONTAINER         =3D
*         HTML_TEXT_LINES   =3D
    EXCEPTIONS
         WRONG_USAGE       =3D 1
         TEXT_NOT_FOUND    =3D 2
         TEXT_SYSTEM_ERROR =3D 3
         OTHERS            =3D 4.
 
* obtain the subject message
 
S_MESSAGE-OBJ_DESCR =3D 'message Subject'.
 
* We will create the 'text' message with the task
description and the
* subject
 
* If The field S_USER_DATS-INBOXFOL is changed for
* S_USER_DATS-PRIVATFOL the message is correctly
sended to the user
 
S_TASK_DESCR_C[] =3D S_TASK_DESCR[].
 
CALL FUNCTION 'SO_DOCUMENT_INSERT_API1'
     EXPORTING
          FOLDER_ID                  =3D
S_USER_DATS-INBOXFOL
          DOCUMENT_DATA              =3D S_MESSAGE
          DOCUMENT_TYPE              =3D 'RAW'
    IMPORTING
         DOCUMENT_INFO              =3D S_DOCUMENT
    TABLES
         OBJECT_HEADER              =3D S_TASK_DESCR_C
         OBJECT_CONTENT             =3D S_TASK_DESCR_C
    EXCEPTIONS
         FOLDER_NOT_EXIST           =3D 1
         DOCUMENT_TYPE_NOT_EXIST    =3D 2
         OPERATION_NO_AUTHORIZATION =3D 3
         PARAMETER_ERROR            =3D 4
         X_ERROR                    =3D 5
         ENQUEUE_ERROR              =3D 6
         OTHERS                     =3D 7.
 
 
* object dats
 
S_OBJECT-LOGSYS =3D 'SAPI'. "(your logic system)
S_OBJECT-OBJTYPE =3D 'BKPF'.
S_OBJECT-OBJKEY =3D 'ES0100190000012002'. "(Object key)
S_OBJECT-DESCRIBE =3D 'Description'.
S_OBJECT-METHOD =3D 'DISPLAY'.
 
append S_OBJECT to S_LIST_OBJ.
 
 
* We write de object description
 
S_DESCR_ATTACH-OBJ_DESCR =3D 'Factura'.
 
* Add the object to the mail.
 
CALL FUNCTION 'SO_ATTACHMENT_INSERT_API1'
     EXPORTING
          DOCUMENT_ID                =3D
S_DOCUMENT-DOC_ID
          ATTACHMENT_DATA            =3D S_DESCR_ATTACH
          ATTACHMENT_TYPE            =3D 'OBJ'
*    IMPORTING
*         ATTACHMENT_INFO            =3D
     TABLES
          ATTACHMENT_HEADER          =3D S_LIST_OBJ
          ATTACHMENT_CONTENT         =3D S_LIST_OBJ
*         CONTENTS_HEX               =3D
    EXCEPTIONS
         DOCUMENT_NOT_EXIST         =3D 1
         ATTACHMENT_TYPE_NOT_EXIST  =3D 2
         OPERATION_NO_AUTHORIZATION =3D 3
         PARAMETER_ERROR            =3D 4
         X_ERROR                    =3D 5
         ENQUEUE_ERROR              =3D 6
         OTHERS                     =3D 7.
 
Regards,
 
 
Daniel.
 
 
 --- "Raskin, Alon (Soliance)" <ARaskin at cps-satx.com>
escribis: > Hi Daviel,
>
> Here is an old email that Jocelyn Dart (thanks
> Jocelyn!) sent me a while
> back regarding this issue.
>
> Regards,
>
> Alon Raskin
>
>
> Hi Alon,
> There are a series of API function modules for
> SAPOffice that you can
> use to do this. e.g. SO_DOCUMENT_INSERT_API.
>
> You need as a minimum a folder, the document type
> and the document data.
>
> For an object the document type is OBJ.
>
> Fill the document_data parameter, field description
> with the title of the
> document.
>
> Fill the object_header table, add a row with object
> type and object key
> using structure SOXOBJ.    (You can specify a method
> - if you don't it will
> use the default method, usually "display").
>
> You need to put the document in a folder, if you use
> fm SO_USER_READ_API1
> with user-sapname =3D their R/3 userid, it will return
> the folders (inbox,
> outbox, private) for that user in the correct
> format. I'd suggest putting
> it in their private folder.
>
> To use it in workflow you'll need to include it in a
> method
> - I'd suggest creating a subtype of SOFM and
> delegating it.
>
> Then you can return the resulting document id as a
> SOFM object, and pass it
> to
> your sendtaskdescription step.
>
> Regards,
>         Jocelyn Dart
> Consultant (EBP, BBP, Ecommerce, Internet
> Transaction Server, Workflow)
> SAP Australia
> Email jocelyn.dart at sap.com
> <mailto:jocelyn.dart at sap.com>
> Tel: +61 412 390 267
> Fax: +61 2 9935 4880
>
>
>
>
> -----Original Message-----
>> From: Raskin, Alon (Soliance)
> [mailto:ARaskin at cps-satx.com]
> Sent: Thursday, 20 December 2001 4:45 AM
> To: SAP-WUG at MITVMA.MIT.EDU
> Subject: SELFITEM.SENDTASKDESCRIPTION
>
>
> Hi Everyone,
>
> I am trying to attach a business object to a mail
> which I am generating from
> a workflow. I am binding the object to the
> ADHOC_OBJECTS but when the mail
> is received no attachment is found. I tried binding
> the business object to
> the ATTACHMENTS element but ATTACHMENTS must be of
> type SOFM. I tried
> somehow attaching my buiness object to a SOFM object
> but still no luck
> there.
>
> If I change the method from SENDTASKDESCRIPTION to
> DISPLAYTASKDESCRIPTION
> and bind through my object into the ADHOC_OJBECT
> then this works. However,
> the workflow will not COMPLETE until the user
> executes the task if I use
> DISPLAYTASKDESCRIPTION. I would much prefer to use
> SENDTASKDESCRIPTION.
>
> Your assistance is appreciated.
>
> Regards,
>
> Alon Raskin
> Workflow Advisor - Soliance
> (xtn. 3183)
>
> Alon Raskin
> Workflow Advisor - Soliance
> (xtn. 3183)
>
>  -----Original Message-----
>> From:   Daniel Fernandez [mailto:wfdfl1975 at yahoo.es]
>
> Sent:   February 18 2002 10:30
> To:     SAP-WUG at MITVMA.MIT.EDU
> Subject:        send mail with attached objects
>
> Hello All,
>
> My name is Daniel, and I have a problem with the
> method SendTaskDescription of object SELFITEM.
>
> I can send a mail with this method but I can4t
> attach
> a object in this mail (a invoice or a purchase
> order,
> for example)
>
> How can I attach a object in a simple mail ( no a
> workitem)??????
>
>
> Thaks a lot for yuor help,
>
> Regards,
>
>
> Daniel
>
>
>
>
_______________________________________________________________
> Do You Yahoo!?
> Yahoo! Messenger
> Comunicacisn instantanea gratis con tu gente.
> http://messenger.yahoo.es
 
_______________________________________________________________
Do You Yahoo!?
Yahoo! Messenger
Comunicacisn instantanea gratis con tu gente.
http://messenger.yahoo.es
 


More information about the SAP-WUG mailing list