Smartform in PDF umwandeln und per Email verschicken

Getting started ... Alles für einen gelungenen Start.
4 Beiträge • Seite 1 von 1
4 Beiträge Seite 1 von 1

Smartform in PDF umwandeln und per Email verschicken

Beitrag von Alpha (ForumUser / 25 / 0 / 0 ) »
Hallo Leute

Ich habe folgende Fehler Meldung :
Bei der Funktion "SO_NEW_DOCUMENT_ATT_SEND_API1" ist der STRUCTURE-Parameter
"CONTENTS_HEX" so typisiert,
daß nur Aktualparameter zugelassen sind, die unter Unicode gemäß der
Fragmentsicht kompatibel sind.


,wenn ich dieses Test-Programm ausführe.
Meine Frage, da ich 4.70 und kein Unicode habe, liegt es nur am Unicode oder habe ich was vergessen ?

Das SF sollte eigendlich jeder haben

Code: Alles auswählen.

* Internal Table declarations
 data: i_otf type itcoo occurs 0 with header line,
       i_tline type table of tline with header line,
       i_receivers type table of somlreci1 with header line,
       i_record like solisti1 occurs 0 with header line,
* Objects to send mail.
       i_objpack like sopcklsti1 occurs 0 with header line,
       i_objtxt like solisti1 occurs 0 with header line,
       i_objbin like solisti1 occurs 0 with header line,
       i_reclist like somlreci1 occurs 0 with header line,
* Work Area declarations
       w_objhead type soli_tab,
       w_ctrlop type ssfctrlop,
       w_compop type ssfcompop,
       w_return type ssfcrescl,
       w_doc_chng type sodocchgi1,
       w_data type sodocchgi1,
       w_buffer type string,"To convert from 132 to 255
* Variables declarations
       v_form_name type rs38l_fnam,
       v_len_in like sood-objlen,
       v_len_out like sood-objlen,
       v_len_outn type i,
       v_lines_txt type i,
       v_lines_bin type i.


 data: carr_id type sbook-carrid,
       fm_name type rs38l_fnam.

 data: customer    type scustom,
       bookings    type ty_bookings,
       connections type ty_connections.

 parameter:      p_custid type scustom-id default 21.
 select-options: s_carrid for carr_id     default 'LH' to 'LH'.
 parameter:      p_form   type tdsfname   default 'SF_EXAMPLE_01',
             p_email type somlreci1-receiver  default 'deine_email.com'.


* get data
 select single * from scustom into customer where id = p_custid.
 check sy-subrc = 0.

 select * from sbook into table bookings
 where customid = p_custid
 and   carrid   in s_carrid
 order by primary key.

 select * from spfli into table connections
 for all entries in bookings
 where carrid = bookings-carrid
 and   connid = bookings-connid
 order by primary key.

* print data
 call function 'SSF_FUNCTION_MODULE_NAME'
 exporting  formname           = p_form
*                 variant            = ' '
*                 direct_call        = ' '
 importing  fm_name            = fm_name
 exceptions no_form            = 1
   no_function_module = 2
   others             = 3.

 if sy-subrc <> 0.
*   error handling
   message id sy-msgid type sy-msgty number sy-msgno
   with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
   exit.
 endif.

 w_ctrlop-getotf = 'X'.
 w_ctrlop-no_dialog = 'X'.
 w_compop-tdnoprev = 'X'.

 call function fm_name
   exporting
     control_parameters = w_ctrlop
     output_options     = w_compop
     user_settings      = 'X'
     customer           = customer
     bookings           = bookings
     connections        = connections
   importing
     job_output_info    = w_return
   exceptions
     formatting_error   = 1
     internal_error     = 2
     send_error         = 3
     user_canceled      = 4
     others             = 5.
 if sy-subrc <> 0.
   message id sy-msgid type sy-msgty number sy-msgno
   with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
 endif.

 i_otf[] = w_return-otfdata[].

 call function 'CONVERT_OTF'
   exporting
     format                = 'PDF'
     max_linewidth         = 132
   importing
     bin_filesize          = v_len_in
   tables
     otf                   = i_otf
     lines                 = i_tline
   exceptions
     err_max_linewidth     = 1
     err_format            = 2
     err_conv_not_possible = 3
     others                = 4.

 if sy-subrc <> 0.
   message id sy-msgid type sy-msgty number sy-msgno
   with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
 endif.

* Convert PDF from 132 to 255.
 loop at i_tline.
* Replacing space by ~
   translate i_tline using ' ~'.
   concatenate w_buffer i_tline into w_buffer.
 endloop.


* Replacing ~ by space
 translate w_buffer using '~ '.
 do.
   i_record = w_buffer.
* Appending 255 characters as a record
   append i_record.
   shift w_buffer left by 255 places.
   if w_buffer is initial.
     exit.
   endif.
 enddo.

 refresh: i_reclist,
 i_objtxt,
 i_objbin,
 i_objpack.
 clear w_objhead.

* Object with PDF.
 i_objbin[] = i_record[].

 describe table i_objbin lines v_lines_bin.

* Object with main text of the mail.
 i_objtxt = 'Find attached the output of the smart form.'.
 append i_objtxt.

 i_objtxt = 'Regards,'.
 append i_objtxt.

 i_objtxt = sy-uname.
 append i_objtxt.

 describe table i_objtxt lines v_lines_txt.
* Document information.
 w_doc_chng-obj_name = 'Smartform'.
 w_doc_chng-expiry_dat = sy-datum + 10.
 w_doc_chng-obj_descr = 'Smart form output'.
 w_doc_chng-sensitivty = 'F'. "Functional object
 w_doc_chng-doc_size = v_lines_txt * 255.

* Pack to main body as RAW.
* Obj. to be transported not in binary form
 clear i_objpack-transf_bin.
* Start line of object header in transport packet

 i_objpack-head_start = 1.
* Number of lines of an object header in object packet
 i_objpack-head_num = 0.
* Start line of object contents in an object packet
 i_objpack-body_start = 1.
* Number of lines of the object contents in an object packet
 i_objpack-body_num = v_lines_txt.
* Code for document class
 i_objpack-doc_type = 'RAW'.
 append i_objpack.

* Packing as PDF.
 i_objpack-transf_bin = 'X'.
 i_objpack-head_start = 1.
 i_objpack-head_num = 1.
 i_objpack-body_start = 1.
 i_objpack-body_num = v_lines_bin.
 i_objpack-doc_type = 'PDF'.
 i_objpack-obj_name = 'Smartform'.
 concatenate 'Smartform_output' '.pdf'
 into i_objpack-obj_descr.
 i_objpack-doc_size = v_lines_bin * 255.
 append i_objpack.

* Document information.
 clear i_reclist.
* e-mail receivers.
 i_reclist-receiver = p_email.
 i_reclist-express = 'X'.
 i_reclist-rec_type = 'U'. "Internet address
 append i_reclist.

* Sending mail.
 call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
   exporting
     document_data              = w_doc_chng
     put_in_outbox              = 'X'
   tables
     packing_list               = i_objpack
     object_header              = w_objhead
     contents_hex               = i_objbin
     contents_txt               = i_objtxt
     receivers                  = i_reclist
   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.
   message id sy-msgid type sy-msgty number sy-msgno
   with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
 endif.
Gruss

Alpha

gesponsert
Stellenangebote auf ABAPforum.com schalten
kostenfrei für Ausbildungsberufe und Werksstudenten


Re: Smartform in PDF umwandeln und per Email verschicken

Beitrag von TWP (Specialist / 445 / 0 / 1 ) »
Du schreibst deine Output aus Smartforms nach W_RETURN. Hier ist eine Tabelle OTFDATA enthalten, diese stellst du in einen Tabelle und gibst sie als Angang mit der Endung PDF mit.

Code: Alles auswählen.

data:   data: l_txt(255) type c,
           gt_text             type bcsy_text.
field-symbols: <otf> type itcoo.

*--- OTF Daten in einfache Textstruktur schreiben
  loop at w_return-otfdata assigning <otf>.
    concatenate <otf>-tdprintcom <otf>-tdprintpar into l_txt.
    append l_txt to gt_text.
  endloop.
Was su jetzt bei dem FB zum senden beachten musst, weiß ich nicht so genau da ich meine Mails über BCS versende. Hierzuu gibt es auch ein paar Musterprogramme (BCS*).

MfG

Thomas

Re: Smartform in PDF umwandeln und per Email verschicken

Beitrag von Alpha (ForumUser / 25 / 0 / 0 ) »
Hallo TWP

Danke für die Info ich habe nun alles umgebaut und stehe vor dem letzten Problem :wink:
Ich bekomme das PDF nicht ins Mail rein falls du mir da helfen könntest.

Nachtrag hat sich erledigt :up:
Gruss

Alpha

Re: Smartform in PDF umwandeln und per Email verschicken

Beitrag von commander (ForumUser / 2 / 0 / 0 ) »
Hallo Alpha,

kannst du mir sagen wie du das geschafft hast?.

wollte auch meine smartforms als pdf zu verschicken. leider bekomme ich die pdf nicht geöffnet. es kommt immer eine fehlermeldung. hoffe du kannst mir dabei helfen.

Seite 1 von 1

Vergleichbare Themen

2
Antw.
2781
Views
Smartform als PDF im Email verschicken
von Kleenmex » 08.06.2007 11:55 • Verfasst in ABAP Objects®
5
Antw.
2972
Views
email mit Anhang aus dem WAS verschicken
von Thomas » 17.06.2004 16:23 • Verfasst in Web-Dynpro, BSP + BHTML
1
Antw.
1903
Views
email verschicken mit Bild
von LosPablos » 17.11.2005 13:35 • Verfasst in Web-Dynpro, BSP + BHTML
1
Antw.
1810
Views
Report als PDF erzeugen und per Email verschicken
von godevilgo » 04.04.2006 14:55 • Verfasst in ABAP® Core
3
Antw.
4589
Views
Verkaufsbelege per eMail - PDF-Datei verschicken -SAPScript
von Nicole_80 » 20.01.2005 11:24 • Verfasst in ABAP® Core

Über diesen Beitrag


Unterstütze die Community und teile den Beitrag für mehr Leser und Austausch

Newsletter Anmeldung

Keine Beiträge verpassen! Wöchentlich versenden wir lesenwerte Beiträge aus unserer Community.
Die letzte Ausgabe findest du hier.
Details zum Versandverfahren und zu Ihren Widerrufsmöglichkeiten findest du in unserer Datenschutzerklärung.

Unbeantwortete Forenbeiträge

Zwischensumme Adobe Forms
vor 4 Tagen von Lucyalison 1 / 72
Group Items auf einer Filterbar
vor einer Woche von Bright4.5 1 / 111
tRFC Transaktionen SM58
vor 4 Wochen von A6272 1 / 141