[53124] in SAPr3-news

home help back first fref pref prev next nref lref last post

Re: Frage zum Fuba SO_NEW_DOCUMENT_SEND_API1

daemon@ATHENA.MIT.EDU (Wolfgang Braig)
Tue Jan 25 08:09:59 2005

To: sapr3-news@mit.edu
Date: Tue, 25 Jan 2005 14:09:55 +0100
From: Wolfgang Braig <w.braig@gmx.de>
Message-ID: <35mup3F4n8q3aU1@individual.net>

Peter Kloster schrieb:
> Wolfgang Braig <w.braig@gmx.de> schrieb:
> 
> 
>>Hallo zusammen,
>>
>>ich versuche über ein modifiziertes Druckprogramm ausgehende
>>Auftragsbestätigungen per Mail ein bisschen ansprechender zu
>>machen, als wie das die SAP vorsieht. So will ich zum Anhang auch
>>noch einen Bodytext und einen ansprechenden Betreff definieren.
>>Aus anderen Beiträgen habe ich gelernt, dass man das mit den FuBA
>>"SO_NEW_DOCUMENT_SEND_API1" machen kann, allerdings verschließt
>>sich mir noch wie?
> 
> 
> 
> Wenn du die Lücken füllst, wird die SAPscript-Ausgabe als PDF-Datei
> mit eigendefiniertem Dateinamen, Body und Subject an die angegebene
> Mailadresse versendet (TA SCOT).
> 
> 
> *********************************************************************
> 
> *...
> tables:  itcpo.
> *...
> *--- Ausgabe als OTF
> data:    i_otfout like soli occurs 0 with header line.
> *--- Ausgabe als PDF
> data:    len_out   like sood-objlen,
>          i_pdfout  like solisti1   occurs 0 with header line.
> 
> *--- fuer Mailversand
> data:    i_reci    like somlreci1  occurs 0 with header line,
>          i_cotxt   like solisti1   occurs 0 with header line,
>          i_plist   like sopcklsti1 occurs 0 with header line,
>          i_ohead   like solisti1   occurs 0 with header line,
>          doc_data  like sodocchgi1,
>          outbox    like sonv-flag value '',
>          anz1      like sy-tabix,
>          anz2      like sy-tabix,
>          object    like  solisti1.
> 
> *...
> *... das uebliche Geraffel
> *...
> 
>   perform open_form.
> 
> *...
> *... Verarbeitung und Fuellen des Fomrulars
> *...
> 
>   perform close_form.
>   perform convert_otf2pdf.
> 
> 
> *-------------------------------------------------------------------*
> *       Formular oeffnen
> *-------------------------------------------------------------------*
> form open_form.
> 
>   clear itcpo.
> 
> * fuellen der Spoolparameter
>   itcpo-tdautority = ...
>   itcpo-tdreceiver = sy-uname.
> * ...
> * ...
> * ...
>   itcpo-tddest     = ....          " Drucker wegen Aufbereitung!
>   itcpo-tdgetotf   = 'X'.          " Ausgabe als Tabelle vorbereiten
> 
>   call function 'OPEN_FORM'
>        exporting  device   = 'PRINTER'
>                   dialog   = ' '
>                   form     = pform     " Formularname
>                   language = sy-langu
>                   options  = itcpo
>        exceptions others   = 7.
> 
>   if sy-subrc <> 0.
> *   ...
>   endif.
> 
> endform.
> *
> *-------------------------------------------------------------------*
> *       Formular schliessen
> *-------------------------------------------------------------------*
> form close_form.
> 
>   call function 'CLOSE_FORM'
>        tables
>          otfdata = i_otfout
>        exceptions others = 1.
> 
>   if sy-subrc <> 0.
> *   ...
>   endif.
> 
> endform.
> *
> *-------------------------------------------------------------------*
> *       OTF nach PDF konvertieren
> *-------------------------------------------------------------------*
> form convert_otf2pdf.
> 
>   clear:   ...
>   refresh: ...
> 
>   call function 'SX_OBJECT_CONVERT_OTF_PDF'
>        exporting
>             format_src      = 'OTF'
>             format_dst      = 'TIF'   " !!!
>             devtype         = ''
>             len_in          = ''
>         importing
>             len_out         = len_out
>         tables
>             content_in      = i_otfout    "OTF-Daten
>             content_out     = i_pdfout    "PDF-Daten
>         exceptions
>             err_conv_failed = 1
>             others          = 2.
> 
>   if sy-subrc <> 0.
> *   ...
>   endif.
> 
> * Empfänger bestimmen
>   i_reci-receiver = 'email-Adresse@des.empfaengers'.
>   i_reci-rec_type = 'U'.
>   append i_reci.
> * weitere Mailempfänger
>   i_reci-receiver = 'chef@des.empfaengers'.
>   i_reci-rec_type = 'U'.
>   append i_reci.
> 
> * Mailbody aufbauen
>   i_cotxt = 'Blubber 1'. append i_cotxt.
>   i_cotxt = 'Blubber 2'. append i_cotxt.
>   i_cotxt = 'Blubber 3'. append i_cotxt.
>   i_cotxt = 'Blubber 4'. append i_cotxt.
>   i_cotxt = 'Blubber 5'. append i_cotxt.
> 
>   describe table i_cotxt lines anz1.
>   clear i_plist.
>   i_plist-head_start = 1.
>   i_plist-head_num   = 0.
>   i_plist-body_start = 1.
>   i_plist-body_num   = anz1.
>   i_plist-doc_type   = 'RAW'.
>   append i_plist.
> 
> * Mail-Anhang aufbauen
>   describe table i_pdfout lines anz2.
>   concatenate object '.pdf' into i_ohead.
>   translate i_ohead to lower case.
>   append i_ohead.
>   clear i_plist.
>   i_plist-transf_bin = 'X'.
>   i_plist-head_start = 1.
>   i_plist-head_num   = 1.
>   i_plist-body_start = 1.
>   i_plist-body_num   = anz2.
>   i_plist-doc_type   = 'PDF'.
>   i_plist-obj_name   = object.
>   i_plist-doc_size   = len_out.
>   append i_plist.
> 
> * Dokumentdaten bestimmen
>   doc_data-obj_name   = 'URGENT'.
>   doc_data-obj_descr  = 'TITEL'.
>   doc_data-sensitivty = 'P'.
>   doc_data-doc_size   = ( anz1 - 1 ) * 255 + strlen( i_cotxt ).
> 
> * Mail mit Anhang (PDF-Datei) senden
>   call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
>        exporting
>             document_data              = doc_data
>             put_in_outbox              = outbox
>        tables
>             packing_list               = i_plist
>             object_header              = i_ohead
>             contents_bin               = i_pdfout
>             contents_txt               = i_cotxt
>             receivers                  = i_reci
>        exceptions
>             too_many_receivers         = 1
>             document_not_sent          = 2
>             document_type_not_exist    = 3
>             operation_no_authorization = 4
>             parameter_error            = 5
>             x_error                    = 6
>             enqueue_error              = 7
>             others                     = 8.
>   if sy-subrc <> 0.
> *   ...
>   endif.
> 
> endform.
> *
> *********************************************************************
> 
> 
> HTH,
> ..pk

Super, klappt einwandfrei :-)

Aber mit dem ursprünglichen FUBA geht's nicht (reine Neugier)?

Gruß Wolfgang

home help back first fref pref prev next nref lref last post