Pdf in mail

I converted a sapscript to pdf. If I download this file and check its contents, all is fine and the logo in the sapscript appears fine as well. Now I have to send the pdf as an attachment through e-m to the user. I open the pdf attachment in my e-m but it's not opened properly. If I remove logo everything is fine and the contents of pdf is fine in attachment.
What have to be done to get logo and contents perfect as an attachment?

hi naty,
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/d4fe7fca-0b01-0010-569a-9a9c1ddf4132
SAP Send mail via ABAP functions SO_NEW_DOCUMENT_SEND_API1
This abap mail sending program demonstrate how you can send a mail to the user SAP Office mailbox.
REPORT ZSEND .
TABLES: KNA1.
data for send function
DATA DOC_DATA  LIKE SODOCCHGI1.
DATA OBJECT_ID LIKE SOODK.
DATA OBJCONT   LIKE SOLI OCCURS 10 WITH HEADER LINE.
DATA RECEIVER  LIKE SOMLRECI1 OCCURS 1 WITH HEADER LINE.
SELECT * FROM KNA1 WHERE ANRED LIKE 'C%'.
  WRITE:/ KNA1-KUNNR, KNA1-ANRED.
send data internal table
  CONCATENATE KNA1-KUNNR KNA1-ANRED
                         INTO OBJCONT-LINE SEPARATED BY SPACE.
  APPEND OBJCONT.
ENDSELECT.
insert receiver (sap name)
  REFRESH RECEIVER.
  CLEAR RECEIVER.
  MOVE: SY-UNAME TO RECEIVER-RECEIVER,
        'X'      TO RECEIVER-EXPRESS,
        'B'      TO RECEIVER-REC_TYPE.
  APPEND RECEIVER.
insert mail description
  WRITE 'Sending a mail through abap'
                 TO DOC_DATA-OBJ_DESCR.
CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
     EXPORTING
          DOCUMENT_DATA              = DOC_DATA
     IMPORTING
          NEW_OBJECT_ID              = OBJECT_ID
     TABLES
          OBJECT_CONTENT             = OBJCONT
          RECEIVERS                  = RECEIVER
     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.
smartform to mail
Data declaration .....
  CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
   EXPORTING
     formname           = 'Z_REPORT'
   IMPORTING
     fm_name            = v_form_name
   EXCEPTIONS
     no_form            = 1
     no_function_module = 2
     OTHERS             = 3.
   IF sy-subrc <> 0.
   MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
   WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
   w_ctrlop-getotf    = 'X'.
w_ctrlop-no_dialog = 'X'.
w_compop-tdnoprev  = 'X'.
w_compop-tddest    = 'Locl'.
   w_ctrlop-no_dialog = 'X'.
w_ctrlop-device = 'PRINTER'.
   CALL FUNCTION v_form_name
   EXPORTING
     control_parameters = w_ctrlop
     output_options     = w_compop
     user_settings      = ' '
     l_load             = p_load
   IMPORTING
     job_output_info    = w_return
   TABLES
     i_output           = i_output
   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 = text-002.
APPEND i_objtxt.
CLEAR i_objtxt.
APPEND i_objtxt.
i_objtxt = 'Kind regards,'.
APPEND i_objtxt.
i_objtxt = 'Client facing team'.
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 = 'Shipment Summary Report'.
w_doc_chng-sensitivty = 'O'. "Standard
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 'Hazard report-' p_load '.pdf' INTO i_objpack-obj_descr.
i_objpack-doc_size = v_lines_bin * 255.
APPEND i_objpack.
IF sy-subrc = 0.
   LOOP AT i_misc INTO w_misc.
     i_reclist-receiver = w_misc-z_value_1.
     i_reclist-express = 'X'.
     i_reclist-rec_type = 'U'. "Internet address
     APPEND i_reclist.
   ENDLOOP.
Sending mail.
   CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
     EXPORTING
       document_data              = w_doc_chng
       put_in_outbox              = 'X'
       commit_work                = 'X'
     TABLES
       packing_list               = i_objpack
       object_header              = w_objhead
       contents_bin               = 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.
   ELSE.
     CALL FUNCTION 'POPUP_TO_INFORM'
       EXPORTING
         titel = 'Mail sent'(003)
         txt1  = 'The report is sent via e-mail.'(004)
         txt2  = '  '.
     LEAVE PROGRAM.
   ENDIF.
ELSE.
   CALL FUNCTION 'POPUP_TO_INFORM'
     EXPORTING
       titel = 'No e-mail specified'(005)
       txt1  = 'You need to maintain the e-mail adress in table'(006)
       txt2  = text-007.
   LEAVE PROGRAM.
ENDIF.
thanks
karthik

Similar Messages

  • Problems sending a PDF via mail

    Hi !! I have a report, runs in background, which obtains some information from sap tables and then generates an ALV. As it is executed in background, the ALV creates an spool order. After this, I convert this spool into a PDF object . And then I need to send a mail to an specific user with some text in its body and this PDF as attach. If I don't attach the PDF, the mail is sent ok. The problem is when I try to attach the PDF.. Here is my code so anybody can help me please... REPORT zautorizaciones_spool . TABLES : usr02, agr_texts, agr_users, adr6, usr21, adrp, itcpo, tsp01. TYPE-POOLS : slis. DATA: BEGIN OF i_tabla OCCURS 0, agr_name LIKE agr_texts-agr_name, text LIKE agr_texts-text, uname LIKE agr_users-uname, name_text LIKE adrp-name_text, END OF i_tabla. * Spool IDs TYPES: BEGIN OF t_tbtcp. INCLUDE STRUCTURE tbtcp. TYPES: END OF t_tbtcp. DATA: fieldcat TYPE slis_t_fieldcat_alv, fieldcat_ln LIKE LINE OF fieldcat, sortcat TYPE slis_t_sortinfo_alv. DATA: col_pos TYPE i, spos TYPE i. DATA: v_buffer TYPE string. DATA: BEGIN OF it_email OCCURS 0, smtp_addr LIKE adr6-smtp_addr. DATA: END OF it_email. DATA: mi_rqident LIKE tsp01-rqident, mi_bytecount TYPE i, mtab_pdf LIKE tline OCCURS 0 WITH HEADER LINE. DATA: it_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE, objpack LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE, objhead LIKE solisti1 OCCURS 0 WITH HEADER LINE, objbin LIKE solisti1 OCCURS 0 WITH HEADER LINE, objtxt LIKE solisti1 OCCURS 0 WITH HEADER LINE, doc_chng LIKE sodocchgi1, tab_lines LIKE sy-tabix, reclist LIKE somlreci1 OCCURS 0 WITH HEADER LINE, it_mess_att LIKE solisti1 OCCURS 0 WITH HEADER LINE. DATA: gd_eventid LIKE tbtcm-eventid, gd_eventparm LIKE tbtcm-eventparm, gd_external_program_active LIKE tbtcm-xpgactive, gd_jobcount LIKE tbtcm-jobcount, gd_jobname LIKE tbtcm-jobname, gd_stepcount LIKE tbtcm-stepcount, it_tbtcp TYPE STANDARD TABLE OF t_tbtcp INITIAL SIZE 0, wa_tbtcp TYPE t_tbtcp. CONSTANTS: c_dev LIKE sy-sysid VALUE 'DEV'. *----
    Pantalla de selección *----------------------------------------------------------------------
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001. SELECT-OPTIONS: s_ustyp FOR usr02-ustyp, s_nomrol FOR agr_texts-agr_name, s_uflag FOR usr02-uflag, s_class FOR usr02-class, s_line FOR agr_texts-line, s_todat FOR agr_users-to_dat, s_spras FOR agr_texts-spras, s_gltgb FOR usr02-gltgb, s_correo FOR adr6-smtp_addr. SELECTION-SCREEN END OF BLOCK b1. *----
    INITIALIZATION *----------------------------------------------------------------------
    INITIALIZATION. CLEAR i_tabla. REFRESH i_tabla. *----
    START-OF-SELECTION *----------------------------------------------------------------------
    START-OF-SELECTION. PERFORM obtener_datos. IF NOT i_tabla[] IS INITIAL. IF sy-batch IS INITIAL. PERFORM listado. SKIP. WRITE:/ 'Para que la orden spool pueda ser creada, el programa', 'se debe de ejecutar en fondo.'. ELSE. MESSAGE s000(z2) WITH 'batch'. PERFORM listado. PERFORM get_job_details. PERFORM get_spool_number USING SY-REPID sy-uname CHANGING mi_rqident. PERFORM conver_spool_pdf. PERFORM enviar_mail. PERFORM delete_spool. IF sy-sysid = c_dev. WAIT UP TO 5 SECONDS. SUBMIT rsconn01 WITH mode = 'INT' WITH output = 'X' AND RETURN. ENDIF. ENDIF. ENDIF. *----
    END-OF-SELECTION *---------------------------------------------------------------------
    END-OF-SELECTION. *&----
    *& Form obtener_datos *&--------------------------------------------------------------------
    FORM obtener_datos. SELECT agr_textsagr_name agr_textstext agr_usersuname adrpname_text APPENDING CORRESPONDING FIELDS OF TABLE i_tabla FROM ( agr_users INNER JOIN usr02 ON usr02bname = agr_usersuname INNER JOIN agr_texts ON agr_textsagr_name = agr_usersagr_name INNER JOIN usr21 ON usr21bname = usr02bname INNER JOIN adrp ON adrppersnumber = usr21persnumber ) WHERE agr_usersagr_name IN s_nomrol AND agr_usersto_dat IN s_todat AND usr02class IN s_class AND usr02gltgb IN s_gltgb AND usr02uflag IN s_uflag AND usr02ustyp IN s_ustyp AND agr_textsline IN s_line AND agr_textsspras IN s_spras. ENDFORM *&--------------------------------------------------------------------
    *& Form listado *&--------------------------------------------------------------------
    FORM listado. PERFORM crear_catalogo. PERFORM imprimir. ENDFORM. *&--------------------------------------------------------------------
    *& Form crear_catalogo *&--------------------------------------------------------------------
    FORM crear_catalogo. PERFORM build_fieldcat USING : 'AGR_TEXTS' 'AGR_NAME' '' '' '' '30' '' 'L' 'Papel', 'AGR_TEXTS' 'TEXT' '' '' '' '80' '' 'L' 'Denominación papel', 'AGR_USERS' 'UNAME' '' '' '' '12' '' 'L' 'Usuario', 'NAME_TEXT' 'NAME_TEXT' '' '' '' '80' '' 'L' 'Nombre completo'. ENDFORM. *&--------------------------------------------------------------------
    *& Form build_fieldcat *&--------------------------------------------------------------------
    FORM build_fieldcat USING tabname fieldname key no_out hotspot outputlen do_sum ddictxt seltext_l. ADD 1 TO col_pos. fieldcat_ln-ref_tabname = tabname. fieldcat_ln-fieldname = fieldname. fieldcat_ln-key = key. fieldcat_ln-col_pos = col_pos. fieldcat_ln-no_out = no_out. fieldcat_ln-hotspot = hotspot. fieldcat_ln-do_sum = do_sum. fieldcat_ln-ddictxt = ddictxt. fieldcat_ln-seltext_l = seltext_l. fieldcat_ln-seltext_m = seltext_l. fieldcat_ln-seltext_s = seltext_l. IF NOT outputlen IS INITIAL. fieldcat_ln-outputlen = outputlen. ENDIF. APPEND fieldcat_ln TO fieldcat. CLEAR fieldcat_ln. ENDFORM. *&--------------------------------------------------------------------
    *& Form imprimir *&--------------------------------------------------------------------
    FORM imprimir. DATA : prg LIKE sy-repid. prg = sy-repid. DATA : salida TYPE slis_exit_by_user. CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' EXPORTING i_callback_program = prg i_callback_user_command = 'ALV_USER_COMMAND' it_fieldcat = fieldcat it_sort = sortcat i_save = 'A' IMPORTING es_exit_caused_by_user = salida TABLES t_outtab = i_tabla EXCEPTIONS program_error = 1 OTHERS = 2. ENDFORM. *&--------------------------------------------------------------------
    *& Form informar_cuerpo *&--------------------------------------------------------------------
    FORM informar_cuerpo. objtxt-line = 'Estimado propietario de datos.'. APPEND objtxt. CLEAR objtxt. APPEND objtxt. CLEAR objtxt. CONCATENATE 'En el marco de la auditoría SOX, y para asegurar el cumplimiento' 'de uno de sus controles, le adjuntamos un/os informes para...' INTO objtxt-line SEPARATED BY space. APPEND objtxt. CLEAR objtxt. ENDFORM. " informar_cuerpo *&--------------------------------------------------------------------
    *& Form enviar_mail *&--------------------------------------------------------------------
    FORM enviar_mail. DATA: w_cnt TYPE i, t_attachment LIKE solisti1 OCCURS 0 WITH HEADER LINE, cont type i. doc_chng-obj_name = 'Probando envio mail'. doc_chng-obj_descr = 'Probando asunto mail'. PERFORM informar_cuerpo. READ TABLE it_mess_att INDEX w_cnt. MESSAGE s000(z2) WITH 'w_cnt' w_cnt. MESSAGE s000(z2) WITH 'sy-subrc' sy-subrc. DESCRIBE TABLE objtxt LINES tab_lines. doc_chng-doc_size = ( w_cnt - 1 ) * 255 + STRLEN( it_mess_att ). CLEAR t_attachment. REFRESH t_attachment. t_attachment[] = it_mess_att[]. CLEAR objpack-transf_bin. objpack-head_start = 1. objpack-head_num = 0. objpack-body_start = 1. objpack-body_num = tab_lines. objpack-doc_type = 'RAW'. objpack-obj_descr = doc_chng-obj_descr. DESCRIBE TABLE t_attachment LINES objpack-body_num. objpack-doc_type = 'PDF'. objpack-obj_descr = 'OBJ_Descr'. objpack-obj_name = 'obj_name'. objpack-doc_size = objpack-body_num * 255. APPEND objpack. objhead = 'Envio mail'. READ TABLE objtxt INDEX tab_lines. IF sy-subrc = 0. MESSAGE s000(z2) WITH 'objtxt' tab_lines. ENDIF. reclist-receiver = p_mail. reclist-rec_type = 'U'. reclist-express = 'X'. reclist-com_type = 'INT'. APPEND reclist. CLEAR reclist. CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1' EXPORTING document_data = doc_chng TABLES packing_list = objpack object_header = objhead contents_bin = objbin contents_txt = objtxt receivers = 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. MESSAGE s000(z2) WITH 'sy-subrc' sy-subrc. ENDFORM. " enviar_mail *&--------------------------------------------------------------------
    *& Form get_spool_number *&--------------------------------------------------------------------
    FORM get_spool_number USING f_repid f_uname CHANGING f_rqident. DATA: lc_rq2name LIKE tsp01-rq2name. CHECK NOT ( gd_jobname IS INITIAL ). CHECK NOT ( gd_jobcount IS INITIAL ). SELECT * FROM tbtcp INTO TABLE it_tbtcp WHERE jobname = gd_jobname AND jobcount = gd_jobcount AND stepcount = gd_stepcount AND listident <> '0000000000' ORDER BY jobname jobcount stepcount. CLEAR wa_tbtcp. READ TABLE it_tbtcp INTO wa_tbtcp INDEX 1. IF sy-subrc = 0. f_rqident = wa_tbtcp-listident. MESSAGE s000(z2) WITH 'Se ha creado la orden spool' f_rqident. ELSE. MESSAGE s000(z2) WITH 'No se ha recuperado ninguna orden spool'. ENDIF. ENDFORM. " get_spool_number *&--------------------------------------------------------------------
    *& Form informar_destinatario *&--------------------------------------------------------------------
    FORM informar_destinatario USING p_correo. it_receivers-receiver = p_correo. it_receivers-rec_type = 'U'. it_receivers-express = 'X'. it_receivers-com_type = 'INT'. APPEND it_receivers. CLEAR it_receivers. ENDFORM. " informar_destinatario *&--------------------------------------------------------------------
    *& Form get_job_details *&--------------------------------------------------------------------
    FORM get_job_details. CALL FUNCTION 'GET_JOB_RUNTIME_INFO' IMPORTING eventid = gd_eventid eventparm = gd_eventparm external_program_active = gd_external_program_active jobcount = gd_jobcount jobname = gd_jobname stepcount = gd_stepcount EXCEPTIONS no_runtime_info = 1 OTHERS = 2. MESSAGE s000(z2) WITH 'job: ' gd_jobname. ENDFORM. " get_job_details *&--------------------------------------------------------------------
    *& Form conver_spool_pdf *&--------------------------------------------------------------------
    FORM conver_spool_pdf. CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF' EXPORTING src_spoolid = mi_rqident no_dialog = ' ' dst_device = 'LOCL' IMPORTING pdf_bytecount = mi_bytecount TABLES pdf = mtab_pdf EXCEPTIONS err_no_abap_spooljob = 1 err_no_spooljob = 2 err_no_permission = 3 err_conv_not_possible = 4 err_bad_destdevice = 5 user_cancelled = 6 err_spoolerror = 7 err_temseerror = 8 err_btcjob_open_failed = 9 err_btcjob_submit_failed = 10 err_btcjob_close_failed = 11 OTHERS = 12. CHECK sy-subrc = 0. LOOP AT mtab_pdf. TRANSLATE mtab_pdf USING ' '. CONCATENATE v_buffer mtab_pdf INTO v_buffer. ENDLOOP. TRANSLATE v_buffer USING ' '. DO. it_mess_att = v_buffer. APPEND it_mess_att. SHIFT v_buffer LEFT BY 255 PLACES. IF v_buffer IS INITIAL. EXIT. ENDIF. ENDDO. ENDFORM. " conver_spool_pdf *&--------------------------------------------------------------------
    *& Form delete_spool *&----
    FORM delete_spool. DATA: ld_spool_nr TYPE tsp01_sp0r-rqid_char, ld_status LIKE sy-subrc. CLEAR: ld_spool_nr, ld_status. ld_spool_nr = mi_rqident. CALL FUNCTION 'RSPO_R_RDELETE_SPOOLREQ' EXPORTING spoolid = ld_spool_nr IMPORTING status = ld_status. ENDFORM. " delete_spool I don't know where the error can be and I've been working on it for 2 days... Do I have to download the PDF to a file ??? In that case, how do I attach then the file ?? Thanks a lot in advance, Regards !!

    Sorry, I wrote it as the code appears in SAP and didn't know I can format it..I hope I've done it ok now..
    As I run the report through a job, I do it like this:
    CALL FUNCTION 'GET_JOB_RUNTIME_INFO'
    IMPORTING eventid = gd_eventid
    eventparm = gd_eventparm
    external_program_active = gd_external_program_active
    jobcount = gd_jobcount
    jobname = gd_jobname
    stepcount = gd_stepcount
    EXCEPTIONS no_runtime_info = 1
    OTHERS = 2.
    Then I get the spool:
    DATA: lc_rq2name LIKE tsp01-rq2name.
    SELECT * FROM tbtcp INTO TABLE it_tbtcp
    WHERE jobname = gd_jobname
    AND jobcount = gd_jobcount
    AND stepcount = gd_stepcount
    AND listident '0000000000'
    ORDER BY jobname jobcount stepcount.
    CLEAR wa_tbtcp.
    READ TABLE it_tbtcp INTO wa_tbtcp INDEX 1.
    IF sy-subrc = 0.
    f_rqident = wa_tbtcp-listident.
    After this I create the PDF:
    CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
    EXPORTING
    src_spoolid = mi_rqident
    no_dialog = ' '
    dst_device = 'LOCL'
    IMPORTING
    pdf_bytecount = mi_bytecount
    TABLES
    pdf = mtab_pdf.
    LOOP AT mtab_pdf.
    TRANSLATE mtab_pdf USING ' ~'.
    CONCATENATE
    v_buffer
    mtab_pdf
    INTO v_buffer.
    ENDLOOP.
    TRANSLATE v_buffer USING '~ '.
    DO.
    it_mess_att = v_buffer.
    APPEND it_mess_att.
    SHIFT v_buffer LEFT BY 255 PLACES.
    ENDDO.
    To send the mail..
    DATA: w_cnt TYPE i
    t_attachment LIKE solisti1 OCCURS 0 WITH HEADER LINE,
    cont type i.
    doc_chng-obj_name = 'Probando envio mail'.
    doc_chng-obj_descr = 'Probando asunto mail'.
    READ TABLE it_mess_att INDEX w_cnt.
    DESCRIBE TABLE objtxt LINES tab_lines.
    doc_chng-doc_size = ( w_cnt - 1 ) * 255 + STRLEN( it_mess_att ).
    CLEAR t_attachment.
    REFRESH t_attachment. t_attachment[] = it_mess_att[].
    CLEAR objpack-transf_bin.
    objpack-head_start = 1.
    objpack-head_num = 0.
    objpack-body_start = 1.
    objpack-body_num = tab_lines.
    objpack-doc_type = 'RAW'.
    objpack-obj_descr = doc_chng-obj_descr.
    DESCRIBE TABLE t_attachment LINES objpack-body_num.
    objpack-doc_type = 'PDF'.
    objpack-obj_descr = 'OBJ_Descr'.
    objpack-obj_name = 'obj_name'.
    objpack-doc_size = objpack-body_num * 255.
    APPEND objpack. objhead = 'Envio mail'.
    READ TABLE objtxt INDEX tab_lines.
    reclist-receiver = p_mail.
    reclist-rec_type = 'U'.
    reclist-express = 'X'.
    reclist-com_type = 'INT'.
    APPEND reclist.
    CLEAR reclist.
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
    document_data = doc_chng
    TABLES
    packing_list = objpack
    object_header = objhead
    contents_bin = objbin
    contents_txt = objtxt
    receivers = reclist .
    Edited by: poketina on Nov 19, 2009 4:51 PM
    Sorry, i don't know how to give format....

  • Converting report to PDF and mailing

    Hi every one,
    I've gone through various threads and i'm aware of the Functional module's used to
    convert the report to pdf and mail it back.Like CONVERT_OTFSPOOLJOB_2_PDF, CONVERT_OTF_2_PDF and for mailing we have SEND_NEW_DOCUMENT_ATT_SEND_API1.
    I've worked with this but my problem is i'm not able to convet the report output to pdf.When i'm doing this i'm getting the output of my functional module converted to pdf like the number of header and item records available for the given data in the selection screen.
    Since all the threads i've gone through is converting the single internal table which has the output to pdf.
    But i've got the REUSE_ALV_HIERSQL_LIST_DISPLAY, hierarchial report which as known has got two internal tables.How to the same to this kind of report....More over is it possible to convert report to pdf in online without transfering it to spool and getting the spool id to convert it to pdf.........
    Any help or suggestions will surely be rewarded......
    Thanks in Advance.....

    Here is the complete code for you;
    It Converts spool request into PDF document and emails it.
    <b>http://www.sapdevelopment.co.uk/reporting/rep_spooltopdf.htm</b>
    Regards,
    Vishal

  • Report output to convert to pdf and mail it to recepient

    Hi
    I'm using the below coding for converting the output of the program to pdf and then mail it to the recepient.The coding works for background processsing only can i do the same for online.In the write statement i'm using the sy-repid my program name and when i get the pdf mail i'm getting the name of the program but instead i need to get the output of my program.Can any one help me in correcting the coding to get the output in pdf format.I know where i'm going wrong but this is the first time i'm working with this so new to this....It would be better if i could run the program and get the convertions into pdf through mail instead of background processing.....Please change the coding below to get the same.....
    DATA: gd_recsize TYPE i.
    Spool IDs
    TYPES: BEGIN OF t_tbtcp.
            INCLUDE STRUCTURE tbtcp.
    TYPES: END OF t_tbtcp.
    DATA: it_tbtcp TYPE STANDARD TABLE OF t_tbtcp INITIAL SIZE 0,
          wa_tbtcp TYPE t_tbtcp.
    Job Runtime Parameters
    DATA: gd_eventid LIKE tbtcm-eventid,
          gd_eventparm LIKE tbtcm-eventparm,
          gd_external_program_active LIKE tbtcm-xpgactive,
          gd_jobcount LIKE tbtcm-jobcount,
          gd_jobname LIKE tbtcm-jobname,
          gd_stepcount LIKE tbtcm-stepcount,
          gd_error    TYPE sy-subrc,
          gd_reciever TYPE sy-subrc.
    DATA:  w_recsize TYPE i.
    DATA: gd_subject   LIKE sodocchgi1-obj_descr,
          it_mess_bod LIKE solisti1 OCCURS 0 WITH HEADER LINE,
          it_mess_att LIKE solisti1 OCCURS 0 WITH HEADER LINE,
          gd_sender_type     LIKE soextreci1-adr_typ,
          gd_attachment_desc TYPE so_obj_nam,
          gd_attachment_name TYPE so_obj_des.
    Spool to PDF conversions
    DATA: gd_spool_nr LIKE tsp01-rqident,
          gd_destination LIKE rlgrap-filename,
          gd_bytecount LIKE tst01-dsize,
          gd_buffer TYPE string.
    Binary store for PDF
    DATA: BEGIN OF it_pdf_output OCCURS 0.
            INCLUDE STRUCTURE tline.
    DATA: END OF it_pdf_output.
    CONSTANTS: c_dev LIKE  sy-sysid VALUE 'DEV',
               c_no(1)     TYPE c   VALUE ' ',
               c_device(4) TYPE c   VALUE 'LOCL'.
    *START-OF-SELECTION.
    START-OF-SELECTION.
    Write statement to represent report output. Spool request is created
    if write statement is executed in background. This could also be an
    ALV grid which would be converted to PDF without any extra effort
      WRITE sy-repid.
      new-page.
      commit work.
      new-page print off.
    IF sy-batch EQ 'X'.
        PERFORM get_job_details.
        PERFORM obtain_spool_id.
    Alternative way could be to submit another program and store spool
    id into memory, will be stored in sy-spono.
    *submit ZSPOOLTOPDF2
           to sap-spool
           spool parameters   %_print
           archive parameters %_print
           without spool dynpro
           and return.
    Get spool id from program called above
    IMPORT w_spool_nr FROM MEMORY ID 'SPOOLTOPDF'.
        PERFORM convert_spool_to_pdf.
        PERFORM process_email.
        if p_delspl EQ 'X'.
          PERFORM delete_spool.
        endif.
        IF sy-sysid = c_dev.
          wait up to 5 seconds.
          SUBMIT rsconn01 WITH mode   = 'INT'
                          WITH output = 'X'
                          AND RETURN.
        ENDIF.
    ELSE.
       SKIP.
       WRITE:/ 'Program must be executed in background in-order for spool'
               'request to be created.'.
    ENDIF.
          FORM obtain_spool_id                                          *
    FORM obtain_spool_id.
      CHECK NOT ( gd_jobname IS INITIAL ).
      CHECK NOT ( gd_jobcount IS INITIAL ).
      SELECT * FROM  tbtcp
                     INTO TABLE it_tbtcp
                     WHERE      jobname     = gd_jobname
                     AND        jobcount    = gd_jobcount
                     AND        stepcount   = gd_stepcount
                     AND        listident   <> '0000000000'
                     ORDER BY   jobname
                                jobcount
                                stepcount.
      READ TABLE it_tbtcp INTO wa_tbtcp INDEX 1.
      IF sy-subrc = 0.
        message s004(zdd) with gd_spool_nr.
        gd_spool_nr = wa_tbtcp-listident.
        MESSAGE s004(zdd) WITH gd_spool_nr.
      ELSE.
        MESSAGE s005(zdd).
      ENDIF.
    ENDFORM.
          FORM get_job_details                                          *
    FORM get_job_details.
    Get current job details
      CALL FUNCTION 'GET_JOB_RUNTIME_INFO'
           IMPORTING
                eventid                 = gd_eventid
                eventparm               = gd_eventparm
                external_program_active = gd_external_program_active
                jobcount                = gd_jobcount
                jobname                 = gd_jobname
                stepcount               = gd_stepcount
           EXCEPTIONS
                no_runtime_info         = 1
                OTHERS                  = 2.
    ENDFORM.
          FORM convert_spool_to_pdf                                     *
    FORM convert_spool_to_pdf.
      CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
           EXPORTING
                src_spoolid              = gd_spool_nr
                no_dialog                = c_no
                dst_device               = c_device
           IMPORTING
                pdf_bytecount            = gd_bytecount
           TABLES
                pdf                      = it_pdf_output
           EXCEPTIONS
                err_no_abap_spooljob     = 1
                err_no_spooljob          = 2
                err_no_permission        = 3
                err_conv_not_possible    = 4
                err_bad_destdevice       = 5
                user_cancelled           = 6
                err_spoolerror           = 7
                err_temseerror           = 8
                err_btcjob_open_failed   = 9
                err_btcjob_submit_failed = 10
                err_btcjob_close_failed  = 11
                OTHERS                   = 12.
      CHECK sy-subrc = 0.
    Transfer the 132-long strings to 255-long strings
      LOOP AT it_pdf_output.
        TRANSLATE it_pdf_output USING ' ~'.
        CONCATENATE gd_buffer it_pdf_output INTO gd_buffer.
      ENDLOOP.
      TRANSLATE gd_buffer USING '~ '.
      DO.
        it_mess_att = gd_buffer.
        APPEND it_mess_att.
        SHIFT gd_buffer LEFT BY 255 PLACES.
        IF gd_buffer IS INITIAL.
          EXIT.
        ENDIF.
      ENDDO.
    ENDFORM.
          FORM process_email                                            *
    FORM process_email.
      DESCRIBE TABLE it_mess_att LINES gd_recsize.
      CHECK gd_recsize > 0.
      PERFORM send_email USING p_email1.
    perform send_email using p_email2.
    ENDFORM.
          FORM send_email                                               *
    -->  p_email                                                       *
    FORM send_email USING p_email.
      CHECK NOT ( p_email IS INITIAL ).
      REFRESH it_mess_bod.
    Default subject matter
      gd_subject         = 'Branch Revenue'.
      gd_attachment_desc = 'Branch Revenue'.
    CONCATENATE 'attach_name' ' ' INTO gd_attachment_name.
      it_mess_bod        = 'Branch Revenue,Profit and Commissions'.
      APPEND it_mess_bod.
    it_mess_bod        = 'Message Body text, line 2...'.
    APPEND it_mess_bod.
    If no sender specified - default blank
    IF p_sender EQ space.
       gd_sender_type  = space.
    ELSE.
       gd_sender_type  = 'INT'.
    ENDIF.
    Send file by email as .xls speadsheet
      PERFORM send_file_as_email_attachment
                                   tables it_mess_bod
                                          it_mess_att
                                    using p_email
                                          'Branch Revenue'
                                          'PDF'
                                          gd_attachment_name
                                          gd_attachment_desc
                                         p_sender
                                         gd_sender_type
                                 changing gd_error
                                          gd_reciever.
    ENDFORM.
          FORM delete_spool                                             *
    FORM delete_spool.
      DATA: ld_spool_nr TYPE tsp01_sp0r-rqid_char.
      ld_spool_nr = gd_spool_nr.
      CHECK p_delspl <> c_no.
      CALL FUNCTION 'RSPO_R_RDELETE_SPOOLREQ'
           EXPORTING
                spoolid = ld_spool_nr.
    ENDFORM.
    *&      Form  SEND_FILE_AS_EMAIL_ATTACHMENT
          Send email
    FORM send_file_as_email_attachment tables it_message
                                              it_attach
                                        using p_email
                                              p_mtitle
                                              p_format
                                              p_filename
                                              p_attdescription
                                             p_sender_address
                                             p_sender_addres_type
                                     changing p_error
                                              p_reciever.
      DATA: ld_error    TYPE sy-subrc,
            ld_reciever TYPE sy-subrc,
            ld_mtitle LIKE sodocchgi1-obj_descr,
            ld_email LIKE  somlreci1-receiver,
            ld_format TYPE  so_obj_tp ,
            ld_attdescription TYPE  so_obj_nam ,
            ld_attfilename TYPE  so_obj_des ,
           ld_sender_address LIKE  soextreci1-receiver,
           ld_sender_address_type LIKE  soextreci1-adr_typ,
            ld_receiver LIKE  sy-subrc.
    data:   t_packing_list like sopcklsti1 occurs 0 with header line,
            t_contents like solisti1 occurs 0 with header line,
            t_receivers like somlreci1 occurs 0 with header line,
            t_attachment like solisti1 occurs 0 with header line,
            t_object_header like solisti1 occurs 0 with header line,
            w_cnt type i,
            w_sent_all(1) type c,
            w_doc_data like sodocchgi1.
      ld_email   = p_email.
      ld_mtitle = p_mtitle.
      ld_format              = p_format.
      ld_attdescription      = p_attdescription.
      ld_attfilename         = p_filename.
    ld_sender_address      = p_sender_address.
    ld_sender_address_type = p_sender_addres_type.
    Fill the document data.
      w_doc_data-doc_size = 1.
    Populate the subject/generic message attributes
      w_doc_data-obj_langu = sy-langu.
      w_doc_data-obj_name  = 'SAPRPT'.
      w_doc_data-obj_descr = ld_mtitle .
      w_doc_data-sensitivty = 'F'.
    Fill the document data and get size of attachment
      CLEAR w_doc_data.
      READ TABLE it_attach INDEX w_cnt.
      w_doc_data-doc_size =
         ( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
      w_doc_data-obj_langu  = sy-langu.
      w_doc_data-obj_name   = 'SAPRPT'.
      w_doc_data-obj_descr  = ld_mtitle.
      w_doc_data-sensitivty = 'F'.
      CLEAR t_attachment.
      REFRESH t_attachment.
      t_attachment[] = it_attach[].
    Describe the body of the message
      CLEAR t_packing_list.
      REFRESH t_packing_list.
      t_packing_list-transf_bin = space.
      t_packing_list-head_start = 1.
      t_packing_list-head_num = 0.
      t_packing_list-body_start = 1.
      DESCRIBE TABLE it_message LINES t_packing_list-body_num.
      t_packing_list-doc_type = 'RAW'.
      APPEND t_packing_list.
    Create attachment notification
      t_packing_list-transf_bin = 'X'.
      t_packing_list-head_start = 1.
      t_packing_list-head_num   = 1.
      t_packing_list-body_start = 1.
      DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
      t_packing_list-doc_type   =  ld_format.
      t_packing_list-obj_descr  =  ld_attdescription.
      t_packing_list-obj_name   =  ld_attfilename.
      t_packing_list-doc_size   =  t_packing_list-body_num * 255.
      APPEND t_packing_list.
    Add the recipients email address
      CLEAR t_receivers.
      REFRESH t_receivers.
      t_receivers-receiver = ld_email.
      t_receivers-rec_type = 'U'.
      t_receivers-com_type = 'INT'.
      t_receivers-notif_del = 'X'.
      t_receivers-notif_ndel = 'X'.
      APPEND t_receivers.
      CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
           EXPORTING
                document_data              = w_doc_data
                put_in_outbox              = 'X'
               sender_address             = ld_sender_address
               sender_address_type        = ld_sender_address_type
                commit_work                = 'X'
           IMPORTING
                sent_to_all                = w_sent_all
           TABLES
                packing_list               = t_packing_list
                contents_bin               = t_attachment
                contents_txt               = it_message
                receivers                  = t_receivers
           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.
    Populate zerror return code
      ld_error = sy-subrc.
    Populate zreceiver return code
      LOOP AT t_receivers.
        ld_receiver = t_receivers-retrn_code.
      ENDLOOP.
    ENDFORM.
    Thanks in advance.....

    Hi
      Below is the code I was used to convert the sap script( Sales Order) to convert to PDf and send as an attachment.
    Dev/UDD Id :  EUR-770416                                             *
    Author     :  M.Sreeram Kumar                                        *
    Date       :  08-Apr-07                                              *
    Request    :  DU1K933766
    Description:  Send an order confirmation to the multiple user in a   *
                  PDF format via Email.                                  *
    Change Log                                                           *
    Author      :                                                        *
    Date        :                                                        *
    Description :                                                        *
    Request     :                                                        *
                 Print of an order confirmation by SAPscript
    REPORT zrep_email LINE-COUNT 100 MESSAGE-ID vn.
    TABLES: komk,                          "Communicationarea for conditions
            komp,                          "Communicationarea for conditions
            komvd,                         "Communicationarea for conditions
            vbco3,                         "Communicationarea for view
            vbdka,                         "Headerview
            vbdpa,                         "Itemview
            vbdpau,                        "Subitemnumbers
            conf_out,                      "Configuration data
            sadr,                          "Addresses
            tvag,                          "Reason for rejection
            vedka,                         "Servicecontract head data
            vedpa,                         "Servicecontract position data
            vedkn,                         "Servicecontract head notice data
            vedpn,                         "Servicecontract pos. notice data
            vbpa,                          "Sales Document: Partner
            kna1,                          "General Data in Customer Master
            riserls,                       "Serialnumbers
            komser,                        "Serialnumbers for print
            tvbur,                         "Sales office
            tvko,                          "Sales organisation
            adrs,                          "Communicationarea for Address
            fpltdr.                        "billing schedules
    INCLUDE zrep_rvadtabl.
    *INCLUDE yzrvadtabl.
    *INCLUDE RVADTABL.
    INCLUDE zrep_rvdirekt.
    *INCLUDE yzrvdirekt.
    *INCLUDE RVDIREKT.
    INCLUDE zrep_vedadata.
    *INCLUDE yzvedadata.
    *INCLUDE VEDADATA.
    DATA: retcode   LIKE sy-subrc.         "Returncode
    DATA: repeat(1) TYPE c.
    DATA: xscreen(1) TYPE c.               "Output on printer or screen
    DATA: BEGIN OF steu,                   "Controldata for output
            vdkex(1) TYPE c,
            vdpex(1) TYPE c,
            kbkex(1) TYPE c,
            kbpex(1) TYPE c,
          END OF steu.
    DATA: BEGIN OF tvbdpa OCCURS 0.        "Internal table for items
            INCLUDE STRUCTURE vbdpa.
    DATA: END OF tvbdpa.
    DATA: BEGIN OF tkomv OCCURS 50.
            INCLUDE STRUCTURE komv.
    DATA: END OF tkomv.
    DATA: BEGIN OF tkomvd OCCURS 50.
            INCLUDE STRUCTURE komvd.
    DATA: END OF tkomvd.
    DATA: BEGIN OF tvbdpau OCCURS 5.
            INCLUDE STRUCTURE vbdpau.
    DATA: END   OF tvbdpau.
    DATA: BEGIN OF tkomcon OCCURS 50.
            INCLUDE STRUCTURE conf_out.
    DATA: END   OF tkomcon.
    DATA: BEGIN OF tkomservh OCCURS 1.
            INCLUDE STRUCTURE vedka.
    DATA: END   OF tkomservh.
    DATA: BEGIN OF tkomservp OCCURS 5.
            INCLUDE STRUCTURE vedpa.
    DATA: END   OF tkomservp.
    DATA: BEGIN OF tkomservhn OCCURS 5.
            INCLUDE STRUCTURE vedkn.
    DATA: END   OF tkomservhn.
    DATA: BEGIN OF tkomservpn OCCURS 5.
            INCLUDE STRUCTURE vedpn.
    DATA: END   OF tkomservpn.
    DATA: BEGIN OF tkomser OCCURS 5.
            INCLUDE STRUCTURE riserls.
    DATA: END   OF tkomser.
    DATA: BEGIN OF tkomser_print OCCURS 5.
            INCLUDE STRUCTURE komser.
    DATA: END   OF tkomser_print.
    DATA: BEGIN OF tfpltdr OCCURS 5.
            INCLUDE STRUCTURE fpltdr.
    DATA: END   OF tfpltdr.
    DATA: pr_kappl(01)   TYPE c VALUE 'V'. "Application for pricing
    DATA: BEGIN OF char_val OCCURS 0,
            atnam LIKE cabn-atnam,
            atwrt LIKE ausp-atwrt,
          END OF char_val.
    FORM entry USING return_code us_screen.
      CLEAR retcode.
      xscreen = us_screen.
      PERFORM processing.
      IF retcode NE 0.
        return_code = 1.
      ELSE.
        return_code = 0.
      ENDIF.
    ENDFORM.                    "ENTRY
          FORM PROCESSING                                               *
    FORM processing.
      PERFORM get_data.
      CHECK retcode = 0.
      PERFORM form_open USING xscreen vbdka-land1.
      CHECK retcode = 0.
      PERFORM logo_selection.
    PERFORM form_title_print.
      CHECK retcode = 0.
      PERFORM write_header_info.
      PERFORM validity_print.
      CHECK retcode = 0.
      PERFORM header_data_print.
      CHECK retcode = 0.
      PERFORM header_serv_print.
      CHECK retcode = 0.
      PERFORM header_notice_print.
      CHECK retcode = 0.
      PERFORM header_inter_print.
      CHECK retcode = 0.
      PERFORM header_text_print.
      CHECK retcode = 0.
      PERFORM item_print.
      CHECK retcode = 0.
      PERFORM end_print.
      CHECK retcode = 0.
      PERFORM form_close.
      CHECK retcode = 0.
      PERFORM zemail_process.
    ENDFORM.                    "PROCESSING
          S U B R O U T I N E S                                         *
          FORM ALTERNATIVE_ITEM                                         *
          A text is printed, if the item is an alternative item.        *
    FORM alternative_item.
      CHECK vbdpa-grpos CN '0'.
      CALL FUNCTION 'WRITE_FORM'
        EXPORTING
          element = 'ALTERNATIVE_ITEM'
        EXCEPTIONS
          element = 1
          window  = 2.
      IF sy-subrc NE 0.
        PERFORM protocol_update.
      ENDIF.
    ENDFORM.                    "ALTERNATIVE_ITEM
          FORM CHECK_REPEAT                                             *
          A text is printed, if it is a repeat print for the document.  *
    FORM check_repeat.
      CLEAR repeat.
      SELECT * INTO *nast FROM nast WHERE kappl = nast-kappl
                                    AND   objky = nast-objky
                                    AND   kschl = nast-kschl
                                    AND   spras = nast-spras
                                    AND   parnr = nast-parnr
                                    AND   parvw = nast-parvw
                                    AND   nacha BETWEEN '1' AND '4'.
        CHECK *nast-vstat = '1'.
        repeat = 'X'.
        EXIT.
      ENDSELECT.
    ENDFORM.                    "CHECK_REPEAT
          FORM DELIVERY_DATE                                            *
          If the delivery date in the item is different to the header   *
          date and there are no scheduled quantities, the delivery date *
          is printed in the item block.                                 *
    FORM delivery_date.
      IF vbdka-lfdat =  space AND
         vbdpa-lfdat NE space AND
         vbdpa-etenr_da = space.
        CALL FUNCTION 'WRITE_FORM'
          EXPORTING
            element = 'ITEM_DELIVERY_DATE'
          EXCEPTIONS
            element = 1
            window  = 2.
        IF sy-subrc NE 0.
          PERFORM protocol_update.
        ENDIF.
      ENDIF.
    ENDFORM.                    "DELIVERY_DATE
          FORM DIFFERENT_CONSIGNEE                                      *
          If the consignee in the item is different to the header con-  *
          signee, it is printed by this routine.                        *
    FORM different_consignee.
      CHECK vbdka-name1_we NE vbdpa-name1_we
        OR  vbdka-name2_we NE vbdpa-name2_we
        OR  vbdka-name3_we NE vbdpa-name3_we
        OR  vbdka-name4_we NE vbdpa-name4_we.
      CHECK vbdpa-name1_we NE space
        OR  vbdpa-name2_we NE space
        OR  vbdpa-name3_we NE space
        OR  vbdpa-name4_we NE space.
      CALL FUNCTION 'WRITE_FORM'
        EXPORTING
          element = 'ITEM_CONSIGNEE'
        EXCEPTIONS
          element = 1
          window  = 2.
      IF sy-subrc NE 0.
        PERFORM protocol_update.
      ENDIF.
    ENDFORM.                    "DIFFERENT_CONSIGNEE
          FORM DIFFERENT_REFERENCE_NO                                   *
          If the reference number in the item is different to the header*
          reference number, it is printed by this routine.              *
    FORM different_reference_no.
      CHECK vbdpa-vbeln_vang NE vbdka-vbeln_vang
        OR  vbdpa-vbtyp_vang NE vbdka-vbtyp_vang.
      CALL FUNCTION 'WRITE_FORM'
        EXPORTING
          element = 'ITEM_REFERENCE_NO'
        EXCEPTIONS
          element = 1
          window  = 2.
      IF sy-subrc NE 0.
        PERFORM protocol_update.
      ENDIF.
    ENDFORM.                    "DIFFERENT_REFERENCE_NO
          FORM DIFFERENT_TERMS                                          *
          If the terms in the item are different to the header terms,   *
          they are printed by this routine.                             *
    FORM different_terms.
      DATA: us_vposn   LIKE vedpa-vposn.
      DATA: us_text(1) TYPE c.             "Flag for Noticetext was printed
      IF vbdpa-zterm NE vbdka-zterm AND
         vbdpa-zterm NE space.
        CALL FUNCTION 'WRITE_FORM'
          EXPORTING
            element = 'ITEM_TERMS_OF_PAYMENT'
          EXCEPTIONS
            element = 1
            window  = 2.
        IF sy-subrc NE 0.
          PERFORM protocol_update.
        ENDIF.
      ENDIF.
      IF vbdpa-inco1 NE space.
        IF vbdpa-inco1 NE vbdka-inco1 OR
           vbdpa-inco2 NE vbdka-inco2.
          CALL FUNCTION 'WRITE_FORM'
            EXPORTING
              element = 'ITEM_TERMS_OF_DELIVERY'
            EXCEPTIONS
              element = 1
              window  = 2.
          IF sy-subrc NE 0.
            PERFORM protocol_update.
          ENDIF.
        ENDIF.
      ENDIF.
    Print different validity-data for the position
      READ TABLE tkomservp WITH KEY vbdpa-posnr.
      IF sy-subrc EQ 0.
        vedpa = tkomservp.
        IF vedpa-vbegdat NE space       AND
           vedpa-venddat NE space       AND
           NOT vedpa-vbegdat IS INITIAL AND
           NOT vedpa-venddat IS INITIAL.
          CALL FUNCTION 'WRITE_FORM'
            EXPORTING
              element = 'ITEM_TERMS_OF_SERV1'
            EXCEPTIONS
              element = 1
              window  = 2.
          IF sy-subrc NE 0.
            PERFORM protocol_update.
          ENDIF.
        ELSEIF vedpa-vbegdat NE space AND
               NOT vedpa-vbegdat IS INITIAL.
          CALL FUNCTION 'WRITE_FORM'
            EXPORTING
              element = 'ITEM_TERMS_OF_SERV2'
            EXCEPTIONS
              element = 1
              window  = 2.
          IF sy-subrc NE 0.
            PERFORM protocol_update.
          ENDIF.
        ELSE.
          CALL FUNCTION 'WRITE_FORM'
            EXPORTING
              element = 'ITEM_TERMS_OF_SERV3'
            EXCEPTIONS
              element = 1
              window  = 2.
          IF sy-subrc NE 0.
            PERFORM protocol_update.
          ENDIF.
        ENDIF.
      ENDIF.
    Notice-rules for the positions.
      MOVE vbdpa-posnr TO us_vposn.
      CLEAR us_text.
      LOOP AT tkomservpn WHERE vposn = us_vposn.
        vedpn = tkomservpn.
        IF us_text IS INITIAL.
          CALL FUNCTION 'WRITE_FORM'
            EXPORTING
              element = 'ITEM_TERMS_OF_NOTTXT'
            EXCEPTIONS
              element = 1
              window  = 2.
          IF sy-subrc NE 0.
            PERFORM protocol_update.
          ENDIF.
          us_text = charx.
        ENDIF.
        CALL FUNCTION 'WRITE_FORM'
          EXPORTING
            element = 'ITEM_TERMS_OF_NOTICE'
          EXCEPTIONS
            element = 1
            window  = 2.
        IF sy-subrc NE 0.
          PERFORM protocol_update.
        ENDIF.
      ENDLOOP.
      IF NOT us_text IS INITIAL.
        CALL FUNCTION 'WRITE_FORM'
          EXPORTING
            element = 'EMPTY_LINE'
          EXCEPTIONS
            element = 1
            window  = 2.
        IF sy-subrc NE 0.
          PERFORM protocol_update.
        ENDIF.
      ENDIF.
    ENDFORM.                    "DIFFERENT_TERMS
          FORM END_PRINT                                                *
    FORM end_print.
      PERFORM get_header_prices.
      CALL FUNCTION 'CONTROL_FORM'
        EXPORTING
          command = 'PROTECT'.
      PERFORM header_price_print.
      CALL FUNCTION 'WRITE_FORM'
        EXPORTING
          element = 'END_VALUES'.
      CALL FUNCTION 'CONTROL_FORM'
        EXPORTING
          command = 'ENDPROTECT'.
      CALL FUNCTION 'WRITE_FORM'
        EXPORTING
          element = 'SUPPLEMENT_TEXT'
        EXCEPTIONS
          element = 1
          window  = 2.
      IF sy-subrc NE 0.
        PERFORM protocol_update.
      ENDIF.
    ENDFORM.                    "END_PRINT
          FORM FORM_CLOSE                                               *
          End of printing the form                                      *
    FORM form_close.
    CALL FUNCTION 'CLOSE_FORM'
       EXCEPTIONS
         OTHERS = 1.
      CALL FUNCTION 'CLOSE_FORM'
    IMPORTING
      RESULT                         =
      RDI_RESULT                     =
       TABLES
         otfdata                        = t_otfdata
    EXCEPTIONS
      UNOPENED                       = 1
      BAD_PAGEFORMAT_FOR_PRINT       = 2
      SEND_ERROR                     = 3
      SPOOL_ERROR                    = 4
      CODEPAGE                       = 5
       OTHERS                         = 1.
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      IF sy-subrc NE 0.
        PERFORM protocol_update.
        retcode = 1.
      ENDIF.
      SET COUNTRY space.
    ENDFORM.                    "FORM_CLOSE
          FORM FORM_OPEN                                                *
          Start of printing the form                                    *
    -->  US_SCREEN  Output on screen                                   *
                     ' ' = printer                                      *
                     'X' = screen                                       *
    -->  US_COUNTRY County for telecommunication and SET COUNTRY       *
    FORM form_open USING us_screen us_country.
      INCLUDE zrep_rvadopfo.
    INCLUDE yzrvadopfo.
    INCLUDE RVADOPFO.
    ENDFORM.                    "FORM_OPEN
          FORM FORM_TITLE_PRINT                                         *
          Printing of the form title depending of the field VBTYP       *
    FORM form_title_print.
      CASE vbdka-vbtyp.
        WHEN 'A'.
          CALL FUNCTION 'WRITE_FORM'
            EXPORTING
              element = 'TITLE_A'
              window  = 'TITLE'
            EXCEPTIONS
              element = 1
              window  = 2.
          IF sy-subrc NE 0.
            PERFORM protocol_update.
          ENDIF.
        WHEN 'B'.
          CALL FUNCTION 'WRITE_FORM'
            EXPORTING
              element = 'TITLE_B'
              window  = 'TITLE'
            EXCEPTIONS
              element = 1
              window  = 2.
          IF sy-subrc NE 0.
            PERFORM protocol_update.
          ENDIF.
        WHEN 'C'.
          CALL FUNCTION 'WRITE_FORM'
            EXPORTING
              element = 'TITLE_C'
              window  = 'TITLE'
            EXCEPTIONS
              element = 1
              window  = 2.
          IF sy-subrc NE 0.
            PERFORM protocol_update.
          ENDIF.
        WHEN 'E'.
          CALL FUNCTION 'WRITE_FORM'
            EXPORTING
              element = 'TITLE_E'
              window  = 'TITLE'
            EXCEPTIONS
              element = 1
              window  = 2.
          IF sy-subrc NE 0.
            PERFORM protocol_update.
          ENDIF.
        WHEN 'F'.
          CALL FUNCTION 'WRITE_FORM'
            EXPORTING
              element = 'TITLE_F'
              window  = 'TITLE'
            EXCEPTIONS
              element = 1
              window  = 2.
          IF sy-subrc NE 0.
            PERFORM protocol_update.
          ENDIF.
        WHEN 'G'.
          CALL FUNCTION 'WRITE_FORM'
            EXPORTING
              element = 'TITLE_F'
              window  = 'TITLE'
            EXCEPTIONS
              element = 1
              window  = 2.
          IF sy-subrc NE 0.
            PERFORM protocol_update.
          ENDIF.
        WHEN 'H'.
          CALL FUNCTION 'WRITE_FORM'
            EXPORTING
              element = 'TITLE_H'
              window  = 'TITLE'
            EXCEPTIONS
              element = 1
              window  = 2.
          IF sy-subrc NE 0.
            PERFORM protocol_update.
          ENDIF.
        WHEN 'K'.
          CALL FUNCTION 'WRITE_FORM'
            EXPORTING
              element = 'TITLE_K'
              window  = 'TITLE'
            EXCEPTIONS
              element = 1
              window  = 2.
          IF sy-subrc NE 0.
            PERFORM protocol_update.
          ENDIF.
        WHEN 'L'.
          CALL FUNCTION 'WRITE_FORM'
            EXPORTING
              element = 'TITLE_L'
              window  = 'TITLE'
            EXCEPTIONS
              element = 1
              window  = 2.
          IF sy-subrc NE 0.
            PERFORM protocol_update.
          ENDIF.
        WHEN OTHERS.
          CALL FUNCTION 'WRITE_FORM'
            EXPORTING
              element = 'TITLE_OTHERS'
              window  = 'TITLE'
            EXCEPTIONS
              element = 1
              window  = 2.
          IF sy-subrc NE 0.
            PERFORM protocol_update.
          ENDIF.
      ENDCASE.
      IF repeat NE space.
        CALL FUNCTION 'WRITE_FORM'
          EXPORTING
            element = 'REPEAT'
            window  = 'REPEAT'
          EXCEPTIONS
            element = 1
            window  = 2.
        IF sy-subrc NE 0.
          PERFORM protocol_update.
        ENDIF.
      ENDIF.
    ENDFORM.                    "FORM_TITLE_PRINT
          FORM GET_DATA                                                 *
          General provision of data for the form                        *
    FORM get_data.
      DATA: us_veda_vbeln     LIKE veda-vbeln.
      DATA: us_veda_posnr_low LIKE veda-vposn.
      CALL FUNCTION 'RV_PRICE_PRINT_REFRESH'
        TABLES
          tkomv = tkomv.
      CLEAR komk.
      CLEAR komp.
      vbco3-mandt = sy-mandt.
      vbco3-spras = nast-spras.
      vbco3-vbeln = nast-objky.
      vbco3-kunde = nast-parnr.
      vbco3-parvw = nast-parvw.
      CALL FUNCTION 'RV_DOCUMENT_PRINT_VIEW'
        EXPORTING
          comwa = vbco3
        IMPORTING
          kopf  = vbdka
        TABLES
          pos   = tvbdpa.
    Fetch servicecontract-data and notice-data for head and position.
      us_veda_vbeln     = vbdka-vbeln.
      us_veda_posnr_low = posnr_low.
      CALL FUNCTION 'SD_VEDA_GET_PRINT_DATA'
        EXPORTING
          i_document_number = us_veda_vbeln
          i_language        = sy-langu
          i_posnr_low       = us_veda_posnr_low
        TABLES
          print_data_pos    = tkomservp
          print_data_head   = tkomservh
          print_notice_pos  = tkomservpn
          print_notice_head = tkomservhn.
      PERFORM get_controll_data.
      PERFORM sender.
      PERFORM check_repeat.
      PERFORM tvbdpau_create.
    ENDFORM.                    "GET_DATA
          FORM GET_ITEM_BILLING_SCHEDULES                               *
          In this routine the billing schedules are fetched from the    *
          database.                                                     *
    FORM get_item_billing_schedules.
      REFRESH tfpltdr.
      CHECK NOT vbdpa-fplnr IS INITIAL.
      CALL FUNCTION 'BILLING_SCHED_PRINTVIEW_READ'
        EXPORTING
          i_fplnr    = vbdpa-fplnr
          i_language = nast-spras
        TABLES
          zfpltdr    = tfpltdr.
    ENDFORM.                    "GET_ITEM_BILLING_SCHEDULES
    *&      Form  ITEM_BILLING_SCHEDULES_PRINT
          This routine prints the billing shedules of a salesdocument    *
          position.                                                      *
    FORM  item_billing_schedules_print.
      DATA: first_line(1) TYPE c.
      first_line = charx.
      LOOP AT tfpltdr.
        fpltdr = tfpltdr.
      Output of the following printlines
        IF NOT fpltdr-perio IS INITIAL.
        periodische Fakturen
          CALL FUNCTION 'WRITE_FORM'
            EXPORTING
              element = 'ITEM_BILLING_SCHEDULE_PERIODIC'
            EXCEPTIONS
              element = 1
              window  = 2.
          IF sy-subrc NE 0.
            PERFORM protocol_update.
          ENDIF.
        bei periodischen nur eine Zeile
          EXIT.
        ELSEIF fpltdr-fareg CA '14'.
        prozentuale Teilfakturierung
          IF NOT first_line IS INITIAL.
            CLEAR first_line.
            CALL FUNCTION 'WRITE_FORM'
              EXPORTING
                element = 'ITEM_BILLING_SCHEDULE_PERCENT_HEADER'
              EXCEPTIONS
                element = 1
                window  = 2.
            IF sy-subrc NE 0.
              PERFORM protocol_update.
            ENDIF.
          ELSE.
            CALL FUNCTION 'WRITE_FORM'
              EXPORTING
                element = 'ITEM_BILLING_SCHEDULE_PERCENT'
              EXCEPTIONS
                element = 1
                window  = 2.
            IF sy-subrc NE 0.
              PERFORM protocol_update.
            ENDIF.
          ENDIF.
        ELSEIF fpltdr-fareg CA '235'.
        wertmäßige  Teilfakturierung
          IF NOT first_line IS INITIAL.
            CLEAR first_line.
            CALL FUNCTION 'WRITE_FORM'
              EXPORTING
                element = 'ITEM_BILLING_SCHEDULE_VALUE_HEADER'
              EXCEPTIONS
                element = 1
                window  = 2.
            IF sy-subrc NE 0.
              PERFORM protocol_update.
            ENDIF.
          ELSE.
            CALL FUNCTION 'WRITE_FORM'
              EXPORTING
                element = 'ITEM_BILLING_SCHEDULE_VALUE'
              EXCEPTIONS
                element = 1
                window  = 2.
            IF sy-subrc NE 0.
              PERFORM protocol_update.
            ENDIF.
          ENDIF.
        ELSEIF fpltdr-fareg CA '3'.
        Schlußrechnung
        ENDIF.
      ENDLOOP.
    ENDFORM.                    "ITEM_BILLING_SCHEDULES_PRINT
    *eject
          FORM GET_ITEM_CHARACTERISTICS                                 *
          In this routine the configuration data item is fetched from   *
          the database.                                                 *
    FORM get_item_characteristics.
      REFRESH tkomcon.
      CHECK NOT vbdpa-cuobj IS INITIAL.
      CALL FUNCTION 'CUD0_GET_CONFIGURATION'                    "#EC EXISTS
        EXPORTING
          instance      = vbdpa-cuobj
          language      = nast-spras
        TABLES
          configuration = tkomcon
        EXCEPTIONS
          OTHERS        = 4.
    ENDFORM.                    "GET_ITEM_CHARACTERISTICS
          FORM GET_ITEM_PRICES                                          *
          In this routine the price data for the item is fetched from   *
          the database.                                                 *
    FORM get_item_prices.
      CLEAR: komp,
             tkomv.
      IF komk-knumv NE vbdka-knumv.
        CLEAR komk.
        komk-mandt = sy-mandt.
        komk-kalsm = vbdka-kalsm.
        komk-kappl = pr_kappl.
        komk-waerk = vbdka-waerk.
        komk-knumv = vbdka-knumv.
        komk-vbtyp = vbdka-vbtyp.
      ENDIF.
      komp-kposn = vbdpa-posnr.
      CALL FUNCTION 'RV_PRICE_PRINT_ITEM'
        EXPORTING
          comm_head_i = komk
          comm_item_i = komp
          language    = nast-spras
        IMPORTING
          comm_head_e = komk
          comm_item_e = komp
        TABLES
          tkomv       = tkomv
          tkomvd      = tkomvd.
    ENDFORM.                    "GET_ITEM_PRICES
          FORM GET_HEADER_PRICES                                        *
          In this routine the price data for the header is fetched from *
          the database.                                                 *
    FORM get_header_prices.
      CALL FUNCTION 'RV_PRICE_PRINT_HEAD'
        EXPORTING
          comm_head_i = komk
          language    = nast-spras
        IMPORTING
          comm_head_e = komk
        TABLES
          tkomv       = tkomv
          tkomvd      = tkomvd.
    ENDFORM.                    "GET_HEADER_PRICES
    *&      Form  HEADER_DATA_PRINT
          Printing of header data like terms, weights ....               *
    FORM header_data_print.
      CALL FUNCTION 'WRITE_FORM'
        EXPORTING
          element = 'HEADER_DATA'
        EXCEPTIONS
          element = 1
          window  = 2.
      IF sy-subrc NE 0.
        PERFORM protocol_update.
      ENDIF.
    ENDFORM.                               " HEADER_DATA_PRINT
          FORM HEADER_PRICE_PRINT                                       *
          Printout of the header prices                                 *
    FORM header_price_print.
      LOOP AT tkomvd.
        AT FIRST.
          IF komk-supos NE 0.
            CALL FUNCTION 'WRITE_FORM'
              EXPORTING
                element = 'ITEM_SUM'.
          ELSE.
            CALL FUNCTION 'WRITE_FORM'
              EXPORTING
                element = 'UNDER_LINE'
              EXCEPTIONS
                element = 1
                window  = 2.
            IF sy-subrc NE 0.
              PERFORM protocol_update.
            ENDIF.
          ENDIF.
        ENDAT.
        komvd = tkomvd.
        IF komvd-koaid = 'D'.
          CALL FUNCTION 'WRITE_FORM'
            EXPORTING
              element = 'TAX_LINE'.
        ELSE.
          CALL FUNCTION 'WRITE_FORM'
            EXPORTING
              element = 'SUM_LINE'.
        ENDIF.
      ENDLOOP.
      DESCRIBE TABLE tkomvd LINES sy-tfill.
      IF sy-tfill = 0.
        CALL FUNCTION 'WRITE_FORM'
          EXPORTING
            element = 'UNDER_LINE'
          EXCEPTIONS
            element = 1
            window  = 2.
        IF sy-subrc NE 0.
          PERFORM protocol_update.
        ENDIF.
      ENDIF.
    ENDFORM.                    "HEADER_PRICE_PRINT
          FORM HEADER_TEXT_PRINT                                        *
          Printout of the headertexts                                   *
    FORM header_text_print.
      CALL FUNCTION 'WRITE_FORM'
        EXPORTING
          element = 'HEADER_TEXT'
        EXCEPTIONS
          element = 1
          window  = 2.
      IF sy-subrc NE 0.
        PERFORM protocol_update.
      ENDIF.
    ENDFORM.                    "HEADER_TEXT_PRINT
          FORM ITEM_CHARACERISTICS_PRINT                                *
          Printout of the item characteristics -> configuration         *
    FORM item_characteristics_print.
      LOOP AT tkomcon.
        conf_out = tkomcon.
        IF sy-tabix = 1.
          CALL FUNCTION 'WRITE_FORM'
            EXPORTING
              element = 'ITEM_LINE_CONFIGURATION_HEADER'
            EXCEPTIONS
              OTHERS  = 1.
          IF sy-subrc NE 0.
            PERFORM protocol_update.
          ENDIF.
        ELSE.
          CALL FUNCTION 'WRITE_FORM'
            EXPORTING
              element = 'ITEM_LINE_CONFIGURATION'
            EXCEPTIONS
              OTHERS  = 1.
          IF sy-subrc NE 0.
            PERFORM protocol_update.
          ENDIF.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    "ITEM_CHARACTERISTICS_PRINT
          FORM ITEM_DELIVERY_CONFIRMATION                               *
          If the delivery date is not confirmed, a text is printed      *
    FORM item_delivery_confirmation.
      CHECK vbdpa-lfdat = space.
      CHECK vbdpa-kwmeng NE 0.
      CALL FUNCTION 'WRITE_FORM'
        EXPORTING
          element = 'ITEM_DELIVERY_CONFIRMATION'
        EXCEPTIONS
          element = 1
          window  = 2.
      IF sy-subrc NE 0.
        PERFORM protocol_update.
      ENDIF.
    ENDFORM.                    "ITEM_DELIVERY_CONFIRMATION
          FORM ITEM_PRICE_PRINT                                         *
          Printout of the item prices                                   *
    FORM item_price_print.
      LOOP AT tkomvd.
        komvd = tkomvd.
        IF sy-tabix = 1.
          CALL FUNCTION 'WRITE_FORM'
            EXPORTING
              element = 'ITEM_LINE_PRICE_QUANTITY'.
        ELSE.
          CALL FUNCTION 'WRITE_FORM'
            EXPORTING
              element = 'ITEM_LINE_PRICE_TEXT'.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    "ITEM_PRICE_PRINT
          FORM ITEM_PRINT                                               *
          Printout of the items                                         *
    FORM item_print.
      DATA: da_subrc LIKE sy-subrc,
            da_dragr LIKE tvag-dragr.
      CALL FUNCTION 'WRITE_FORM'           "First header
           EXPORTING  element = 'ITEM_HEADER'
           EXCEPTIONS OTHERS  = 1.
      IF sy-subrc NE 0.
        PERFORM protocol_update.
      ENDIF.
      CALL FUNCTION 'WRITE_FORM'           "Activate header
           EXPORTING  element = 'ITEM_HEADER'
                      type    = 'TOP'
           EXCEPTIONS OTHERS  = 1.
      IF sy-subrc NE 0.
        PERFORM protocol_update.
      ENDIF.
      LOOP AT tvbdpa.
        vbdpa = tvbdpa.
      TVAG lesen um festzustellen ob abgesagte Positionen gedruckt werden
      sollen
        PERFORM tvag_select(sapmv45a) USING vbdpa-abgru
                                            da_dragr
                                            space
                                            da_subrc.
        IF da_dragr EQ space.              "Print rejected item?
          IF vbdpa-posnr_neu NE space.     "Item
            PERFORM get_item_serials.
            PERFORM get_item_characteristics.
            PERFORM get_item_billing_schedules.
            PERFORM get_item_prices.
            CALL FUNCTION 'CONTROL_FORM'
              EXPORTING
                command = 'ENDPROTECT'.
            CALL FUNCTION 'CONTROL_FORM'
              EXPORTING
                command = 'PROTECT'.
            CALL FUNCTION 'WRITE_FORM'
              EXPORTING
                element = 'ITEM_LINE'.
            PERFORM item_rejected.
            PERFORM item_price_print.
            CALL FUNCTION 'CONTROL_FORM'
              EXPORTING
                command = 'ENDPROTECT'.
            PERFORM item_text_print.
            PERFORM item_serials_print.
            PERFORM item_characteristics_print.
            PERFORM alternative_item.
            PERFORM delivery_date.
            PERFORM item_delivery_confirmation.
            PERFORM item_billing_schedules_print.
            PERFORM different_reference_no.
            PERFORM different_terms.
            PERFORM different_consignee.
            PERFORM schedule_header.
            PERFORM main_item.
          ELSE.
            PERFORM schedule_print.
          ENDIF.
        ENDIF.
      ENDLOOP.
      CALL FUNCTION 'WRITE_FORM'           "Deactivate Header
           EXPORTING  element  = 'ITEM_HEADER'
                      function = 'DELETE'
                      type     = 'TOP'
           EXCEPTIONS OTHERS   = 1.
      IF sy-subrc NE 0.
        PERFORM protocol_update.
      ENDIF.
    ENDFORM.                    "ITEM_PRINT
          FORM ITEM_REJECTED                                            *
          A text is printed, if the item is rejected                    *
    FORM item_rejected.
      CHECK NOT vbdpa-abgru IS INITIAL.
      CALL FUNCTION 'WRITE_FORM'
        EXPORTING
          element = 'ITEM_REJECTED'
        EXCEPTIONS
          element = 1
          window  = 2.
      IF sy-subrc NE 0.
        PERFORM protocol_update.
      ENDIF.
    ENDFORM.                    "ITEM_REJECTED
          FORM MAIN_ITEM                                                *
          A text is printed, if the item is a main item                 *

  • Since downloading the iOS on my iPad, I cannot download more than one pdf from mail to iBooks.  I have to shut down y iPad and start again.  Any suggestions?

    Since downloading iOS on my new iPad, I cannot downlaod more than one pdf from mail into iBooks.  I have to shut down my iPad and restart it to save a second pdf. Wasn't a problem with the old operating system.  Any suggestions?

    It seems that I have solved my issue by performing a full factory reset (erasing all content, something which I had hoped to avoid) restoring from an iCloud backup did not alleviate the issue, I had to set up as a new iPad.
    Hopefully anyone else else who has this issue in the future will be able to find this.

  • When I download pdf files in Safari I get a black screen.  However, if I open a pdf in Mail it is viewable in Preview.  How do I fix this?

    When I download pdf files in Safari I get a black screen.  However, if I open a pdf in Mail it is viewable in Preview.  What is wrong?

    Back up all data.
    Triple-click the line of text below to select it, the copy the selected text to the Clipboard (command-C):
    /Library/Internet Plug-ins
    In the Finder, select
    Go ▹ Go to Folder
    from the menu bar, or press the key combination shift-command-G. Paste (command-V) into the text box that opens, then press return.
    From the folder that opens, remove any items that have the letters “PDF” in the name. You may be prompted for your login password. Then quit and relaunch Safari, and test.
    I've seen an unconfirmed report that the "Silverlight" web plugin distributed by Microsoft can also interfere with PDF display in Safari, so you might need to remove it as well, if applicable.
    If you still have the issue, repeat with this line:
    ~/Library/Internet Plug-ins
    If you don’t like the results of this procedure, restore the items from the backup you made before you started. Relaunch Safari again.

  • Convert Spool to PDF and mail for the jobs not run in background.

    Dear All,
    I need to convert the spool job into pdf and mail as attachment for job not run in background.
    I am printing the bills  using the program  SD70AV3A to print the bills in a batch using the SUBMIT.
    But i am not using the spool options since its going to into waiting state in spool...and i need to change the printer properties to G
    to get the printer to print the reports as these jobs run in backgroud....but this solution is not acceptable solution.
    SUBMIT SD70AV3A
             WITH RG_KSCHL-LOW = 'ZRR'
             WITH RG_NACHA-LOW = '1'
             WITH PM_VERMO = '2'
             WITH PM_NSORT = '1'
             WITH RG_VBELN IN range.
    *        TO SAP-SPOOL
    *        SPOOL PARAMETERS print_parameters
    *        WITHOUT SPOOL DYNPRO
    *        VIA JOB name NUMBER number
    *        AND RETURN.
    so how do i get the spool number from the above after the job is submitted....and then convert into pdf and mail
    please suggest some solution. I have searched on net but most the solutions are say to run the job as background job...
    i have also looked into the program RSTXPDFT4 but it asks for the spool id ....how can i get spool id for the job that has been completed.
    please suggest some solution.
    Thanks
    Bhargava.

    Hi,
    Spool to PDF : FM 'CONVERT_ABAPSOOLJOB_2_PDF'
    Table TSP01 to get spool number
    You ,may need to convert OTF to PDF: FM CONVERT_OTF
    and the to binary : FM 'SMCS_XSTRING_TO_BINARY'
    To send mail use class: cl_document _bcs.
    Regards,
    Maria João Rocha

  • Sending a pdf with mail that is directly seen by opening the mail?possible?

    hello,
    I want to send a pdf by Mail but I would like the receiver to click on my email and that he/she will see the complete pdf immediately.
    is that possible?
    thanks
    Hein

    that depends on the mail client of your email recipient. There is nothing you can control on the sender end. For example, Mail will display pdf attachments inline automatically.
    Message was edited by: V.K.

  • How to open a PDF e-mail attachment?

    How do you open a PDF e-mail attachment?

    Inside your email, tap on the pdf attachment. It will first gets downloaded, after that tap on it and it will show Adobe Reader (installed on your device) as an option to open pdf file.
    Thanks,
    Ankit

  • How do I set the quality of a  "save to pdf" or "mail pdf" ?

    I have created a document (say, in Pages, MS Word, or Apple Works/Claris Works [yes, that is still an excellent programme..., even on an intel Mac] and then want to save it as pdf or " mail pdf".
    If the document page has many pictures, the pdf created via the "Print" function in OS X has quite some pixelation and the print-out is sub-optimal (eg for a Christmas/New Year card).
    Is there a way that the quality of the created pdf file can be altered?
    Any advice would be appreciated.

    Audition's native recording and processing format is 32 bit floating. This allows for the most accurate processing of your audio. You cannot set it to record at 24 bit depth. However a 24 bit source is happily stored in the 32 bit format when you record from an external 24 bit audio interface.
    If you need to save 24 bit files for use after you have finished editing them then you choose 24 bit from the Options drop down in the Save As panel when you save the file.
    See further explanation 24-bit hardware with "32-bit float" recording in 3.0

  • PO OUTPUT AS PDF TO MAIL

    hi,
    i want to know how to send po output as pdf to mail...

    Hi,
    I hope the below link can help you.
    E-mail PDF Subcon PO to vendor (ECC5.0)
    Thanks,
    Khushboo.

  • I can see and download pdfs in Mail, but I can't even see editable pdfs in Mail.  can anyone help please?  Thx.

    I can see and download pdfs in Mail, but I can't even see editable pdfs in Mail.  Can anyone help please?  Thx.

    Thx Eric.  You've helped!  When I tried to copy the words written in my e-mail to show you what I meant, I right clicked to copy, and saw an option to open the attachment, which it did!  So I'm sorted thank you.  Editable means a form which you can fill in and send back.  Thanks again.  Stephen

  • Since I updated I can't open anything that comes in a pop upwindow i.e. pdf or mail window. How can I solve or go back to the previous version - it worked just fine.

    Since I updated I can't open anything that comes in a pop upwindow i.e. pdf or mail window. How can I solve or go back to the previous version - it worked just fine.

    I am not sure what your problem is, can you give more details.
    One possibility is you may be in full screen mode, for details on fixing that see the [[menu bar is missing]] article.
    If you are missing various toolbar items, see the [[back and forward or other toolbar items are missing]] article.
    If your problem is something else please give more details.

  • Pdf in mail not showing complete

    when i either drag a pdf from finder to the mail icon in the dock, or use the send pdf with mail shortcut from the print dialog, the pdf only shows it's first page in the mail that's created.
    it seems however, that the attachment itself isn't corrupted, only how it shows up in the mail.
    any ideas? does anyone else experience this?

    thanks for trying to help, but i already know that i can choose to view as icon or as inline pdf. the issue is that when i create the mail, the inline preview is incomplete (one page), but when i send the mail to myself, the attached pdf is displayed completely (all pages). just a little inconcistancy, but it seems like a bug to me, because there is no way of telling whether i actually only send one page, all pages, or if the file has been corrupted.

  • PDF in mail through workflow

    Hi,
         There was a workflow already there for PO approval based on the limits.
    Now i need to ater that PO by including a mail triggering of PO in PDF after the approval has been done.
    I dont know what is the work flow they have already for this Approval process.
    I tried with SWELS t.code,But i cant save the PO with Event trace on,Since the mail will be triggered (Before for approaval they have designed this).
    How to find the workflow and how to give this PDF in mail attachment.
    Can cnyone help me in this regards.

    Hi,
    Check the event-linkage configuration SWE2 for object BUS2012 (PO) you may get a workflow from there.
    Then add another task for attach PDF in workflow. Check how to create a task to attach pdf here.
    http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/60ff6ad3-729b-2b10-6582-fedc82680a29
    If you just want to create an email. create a custom task and use class cl_bcs to send email with attach ADobe, See this article for more details.
    http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/60ff6ad3-729b-2b10-6582-fedc82680a29
    Chaiphon

  • Convert alv to pdf and mail

    hi friends,
    i want convert the alv report to pdf and mail the same pdf.
    have used function REUSE_ALV_LIST_DISPLAY to display alv report.
    i am using CONVERT_ABAPSPOOLJOB_2_PDF to convert the alv report to pdf.
    now i need to mail the pdf implicitly to the email address.
    i have used some function to mail the pdf but it is asking for the path which has to be hard coded.
    the path cannot be hard coded.
    cant use F4_GETFILENAME or gui_upload  to attach the file or to get the path because the pdf has to be sent directly to some email address.
    thanks.
    regards,
    akshay ruia.

    Please refer the link below.............
    Sample Program To Convert Smartform To PDF Document & Mail It To The Concerned As An Attachment.
    [http://www.abapmadeeasy.com/2011/02/sap-abap-sample-program-to-convert.html|http://www.abapmadeeasy.com/2011/02/sap-abap-sample-program-to-convert.html]
    Regards,
    Uttam Agrawal
    http://www.abapmadeeasy.com
    Edited by: uttamagrawal on Feb 22, 2011 9:19 AM

Maybe you are looking for

  • Unable to Xport iMovie Footage to Videocamera

    Hi all. Anyone having trouble exporting iMovie footage to Videocamera? When I create a movie, I often send it back to iDVD tape as a backup. With the new iMovie update I am unable to export footage back to my Canon XL1 Videocamera or my Sony DCR-HC26

  • Commands redrawing (Samsung)

    I'm developing for SGH Samsung S100 and find that if I switch from Form with Command objects on it to Canvas (which has no Command objects), the Command objects from the Form remain at the bottom of the screen and are not cleared. They remain even If

  • Integrated WebLogic Server 10.3.5.0 doubts

    hi jdev experts, am using jdev 11.1.1.5.0 i had projects which is deployed in intergrated wls. and my lot of example also deployed in integrated wls. but while running my bIG project means out of memory error. heap space. bla. bla. i also increased h

  • Synchronizing calendars and contacts using 2 computers and 2 iphones

    my husband and I both have a MacBook Pro; we both have an iPhone. Lucky us! We want to be able to synchronize our calendars and contacts on each other's computers. How can we do this without over-writing each other's calendars and address book? We bo

  • Server Admin error: servermgr_info

    Something (as yet unknown, although I suspect my self-signed SSL certificate may have expired) caused my webserver (at least the secure portion) to be unresponsive. I tried to restart the server, but the finder was being unresponsive as well. So I wa