Regarding PDF and mail attachement at SMARTFORMS

hey jeyanthi,
I tried the program from the link you gave to convert otf to pdf and sending pdf file as attachement.
Everything works fine till PDF creation.
but i did not get mail sending function works.
while debugging i come to know that FM
is goint to execption error
'OTHERS 8'.
why is it...its not working..could you pls guide me here..
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.
ambichan.

hey jayanthi,
Thanks for your reply.
I am sorry, I debugged the code from starting again.
I can see all the table fields except w_objhead gets populating values and passing to FM.
everything is fine, even sy-subrc is 0 in this case now.
and execution Ends normally without displaying any dialog or popup.
but i could not see the Mail received to the mail id. could the FM be problem? I am working in 4.6C.
could u pls look at my code.
REPORT ZZZ_TEST2_PRG .
DATA :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,
*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.
parameter:      p_form   type tdsfname   default 'ZZZ_TEST2'.
DATA:i_otf TYPE itcoo occurs 0 with HEADER LINE.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
  EXPORTING
    FORMNAME                 = p_form
  VARIANT                  = ' '
  DIRECT_CALL              = ' '
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_ctrlop-preview = 'X'.
w_compop-tdnoprev = 'X'.
CALL FUNCTION v_form_name
EXPORTING
control_parameters = w_ctrlop
output_options = w_compop
user_settings = 'X'
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
  ARCHIVE_INDEX               = ' '
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 = 'chandra'.
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 = '[email protected]'.
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.
ambichan.
Message was edited by: ambi chan

Similar Messages

  • 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

  • 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

  • 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

  • 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

  • Using event.target.submitForm to submit a PDF and XML attachment in a single email.

    I have a button on a PDF form which emails a PDF and XML attachment of the current form in two seperate emails. The code is as follows:
    event.target.submitForm({cURL:"mailto:" +  "[email protected]" +"?subject="+"Request for action " + "&body=Please find attached..." ,cSubmitAs:"XML",cCharset:"utf-8"});
    event.target.submitForm({cURL:"mailto:" +  "[email protected]" +"?subject="+"Request for action " + "&body=Please find attached..." ,cSubmitAs:"PDF",cCharset:"utf-8"});
    This results in 2 seperate emails, when all I need is a single email with two attachments. Is there a way to do this?

    As far as I know you can only attach one attachment at once.

  • PDF e-mail attachment won't close

    I opened a .PDF e-mail attachment.  Now it won't close even when I hit "Done".  I can't get back to my mailboxes.

    Did you try what I suggested on your thread : https://discussions.apple.com/message/15804386#15804386 ?

  • Problem in displaying smartform as pdf in mail attachment

    Hi Gurus,
    I have generated a Smartform, converted to PDF and sent as attachment to email, upto this everything working fine.
    Now the email is generated with the PDF attachment but Adobe Reader encounters an error when opening.
    Error display as below mentioned
    Adobe Reader could not open 'abc_X.PDF' because it is either not a supported file type or because the file has been damaged(for  example, it was sent as an email attachment and wasn't correctly decoded).
    The program cods as below mentioned
    TYPES:BEGIN OF ty_viqmel,
          qmnum TYPE viqmel-qmnum,
          qmart TYPE viqmel-qmart,
          objnr TYPE viqmel-objnr,
          qmtxt TYPE viqmel-qmtxt,
          erdat TYPE viqmel-erdat,
          erzeit TYPE viqmel-erzeit,
          aenam TYPE viqmel-aenam,
          aufnr TYPE viqmel-aufnr,
          qmdab TYPE viqmel-qmdab,
          swerk TYPE viqmel-swerk,
          END OF ty_viqmel.
    TYPES: BEGIN OF ty_t001w,
           werks TYPE werks,
           name1 TYPE name1,
           END OF ty_t001w.
    DATA:IT_VIQMEL TYPE TABLE OF TY_VIQMEL,
         WA_VIQMEL TYPE TY_VIQMEL,
         IT_T001W TYPE TABLE OF TY_T001W,
         WA_T001W TYPE TY_T001W,
         IT_FINAL TYPE TABLE OF ZPM_T_MAINTENACE,
         WA_FINAL TYPE ZPM_T_MAINTENACE.
    data: it_diff like it_viqmel,
            wa_diff like line of it_diff.
    Smartforms data declarations
    DATA: lv_fmname   TYPE rs38l_fnam, "value 'ZPM_F_MAINTENANCE_REQUEST'.
         w_cparam     TYPE ssfctrlop ," To display smart form in arabic.
          w_compop type ssfcompop,
          W_bin_filesize TYPE i, " Binary File Size
    w_FILE_NAME type string,
    w_File_path type string,
    w_FULL_PATH type string,
    WA_BUFFER TYPE STRING. "To convert from 132 to 255
    Internal table to hold the OTF data
    DATA:
    t_otf TYPE itcoo OCCURS 0 WITH HEADER LINE,
    Internal table to hold OTF data recd from the SMARTFORM
    t_otf_from_fm TYPE ssfcrescl,
    Internal table to hold the data from the FM CONVERT_OTF
    T_pdf_tab LIKE tline OCCURS 0 WITH HEADER LINE.
    Objects to send mail.
    data: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,
    I_RECORD LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
    WA_OBJHEAD TYPE SOLI_TAB,
         WA_DOC_CHNG TYPE SODOCCHGI1.
    DATA: V_LEN_IN LIKE SOOD-OBJLEN,
    I_TLINE TYPE TABLE OF TLINE WITH HEADER LINE,
    V_LEN_OUT LIKE SOOD-OBJLEN,
    V_LEN_OUTN TYPE I,
    V_LINES_TXT TYPE I,
    V_LINES_BIN TYPE I.
    START-OF-SELECTION.
    SELECT QMNUM
           QMART
           QMTXT
           ERDAT
           ERZEIT
           AENAM
           AUFNR
           QMDAB
           SWERK
           OBJNR
      FROM VIQMEL
      INTO CORRESPONDING FIELDS OF TABLE IT_VIQMEL
                   WHERE aufnr = SPACE
                   and qmdab = '00000000'
                   AND ( QMART EQ 'M1' OR QMART EQ 'M2' OR QMART EQ 'M3' ).
      IF SY-SUBRC = 0.
        sort it_viqmel by qmnum.
        ENDIF.
        loop at it_viqmel into wa_viqmel.
          perform 72hours.
    endloop.
    SELECT WERKS
           NAME1 FROM T001W INTO TABLE IT_T001W
                 FOR ALL ENTRIES IN IT_diff
                 WHERE WERKS = IT_diff-SWERK.
      IF SY-SUBRC = 0.
        LOOP AT IT_diff INTO WA_diff.
       READ TABLE IT_T001W INTO WA_T001W WITH KEY WERKS = WA_diff-SWERK.
       IF SY-SUBRC = 0.
         WA_FINAL-QMNUM = WA_diff-QMNUM.
          WA_FINAL-QMTXT = WA_diff-QMTXT.
          WA_FINAL-ERDAT = WA_diff-ERDAT.
            WA_FINAL-ERZEIT = WA_diff-ERZEIT.
             WA_FINAL-SWERK = WA_diff-SWERK.
              WA_FINAL-NAME1 = WA_T001W-NAME1.
               WA_FINAL-AENAM = WA_diff-AENAM.
               APPEND WA_FINAL TO IT_FINAL.
               CLEAR WA_FINAL.
               ENDIF.
               ENDLOOP.
               ENDIF.
    clear:w_cparam,w_compop.
    w_cparam-langu = 'AR'.
    w_cparam-getotf = 'X'.
    w_cparam-no_dialog = 'X'. " Suppressing the dialog box
    W_COMPOP-TDNOPREV = 'X'.
    w_compop-tddest = 'LP01'.
    W_COMPOP-TDPRINTER = 'PRINTER'.
                CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
                 EXPORTING
                   formname                 = 'ZPM_F_MAINTENANCE_REQUEST'
                 VARIANT                  = ' '
                 DIRECT_CALL              = ' '
                IMPORTING
                  FM_NAME                  = lv_fMNAME
                EXCEPTIONS
                  NO_FORM                  = 1
                  NO_FUNCTION_MODULE       = 2
                  OTHERS                   = 3
               IF sy-subrc <> 0.
    Implement suitable error handling here
               ENDIF.
    CALL FUNCTION lv_fmname
    EXPORTING
      ARCHIVE_INDEX              =
      ARCHIVE_INDEX_TAB          =
      ARCHIVE_PARAMETERS         =
       CONTROL_PARAMETERS         = w_cparam
      MAIL_APPL_OBJ              =
      MAIL_RECIPIENT             =
      MAIL_SENDER                =
       OUTPUT_OPTIONS             =  w_compop
      USER_SETTINGS              = 'X'
    IMPORTING
      DOCUMENT_OUTPUT_INFO       =
       JOB_OUTPUT_INFO            = t_otf_from_fm
      JOB_OUTPUT_OPTIONS         =
      TABLES
        it_final                   = it_final
    EXCEPTIONS
       FORMATTING_ERROR           = 1
       INTERNAL_ERROR             = 2
       SEND_ERROR                 = 3
       USER_CANCELED              = 4
       OTHERS                     = 5
    IF sy-subrc <> 0.
    Implement suitable error handling here
    ENDIF.
    t_otf[] = t_otf_from_fm-otfdata[].
    CALL FUNCTION 'CONVERT_OTF'
    EXPORTING
       FORMAT                      = 'PDF'
       MAX_LINEWIDTH               = 132
      ARCHIVE_INDEX               = ' '
      COPYNUMBER                  = 0
      ASCII_BIDI_VIS2LOG          = ' '
      PDF_DELETE_OTFTAB           = ' '
      PDF_USERNAME                = ' '
    IMPORTING
       BIN_FILESIZE                = w_bin_FILESIZE
      BIN_FILE                    =
      TABLES
        otf                         = T_OTF
        lines                       = T_PDF_TAB
    EXCEPTIONS
       ERR_MAX_LINEWIDTH           = 1
       ERR_FORMAT                  = 2
       ERR_CONV_NOT_POSSIBLE       = 3
       ERR_BAD_OTF                 = 4
       OTHERS                      = 5
    IF sy-subrc <> 0.
    Implement suitable error handling here
    ENDIF.
    LOOP AT T_PDF_TAB.
    TRANSLATE T_PDF_TAB USING '~'.
    CONCATENATE WA_BUFFER T_PDF_TAB INTO WA_BUFFER.
    ENDLOOP.
    TRANSLATE WA_BUFFER USING '~'.
    DO.
    I_RECORD = WA_BUFFER.
    APPEND I_RECORD.
    SHIFT WA_BUFFER LEFT BY 255 PLACES.
    IF WA_BUFFER IS INITIAL.
    EXIT.
    ENDIF.
    ENDDO.
    Attachment
    REFRESH: I_RECLIST,
    I_OBJTXT,
    I_OBJBIN,
    I_OBJPACK.
    CLEAR WA_OBJHEAD.
    I_OBJBIN[] = I_RECORD[].
    Create Message Body Title and Description
    I_OBJTXT = 'Maintenance Request'.
    APPEND I_OBJTXT.
    DESCRIBE TABLE I_OBJTXT LINES V_LINES_TXT.
    READ TABLE I_OBJTXT INDEX V_LINES_TXT.
    WA_DOC_CHNG-OBJ_NAME = 'ZPM_F_MAINTENANCE_REQUEST'.
    *WA_DOC_CHNG-EXPIRY_DAT = SY-DATUM + 10.
    WA_DOC_CHNG-OBJ_DESCR = 'Maintenance Request'.
    WA_DOC_CHNG-SENSITIVTY = 'F'.
    WA_DOC_CHNG-DOC_SIZE = V_LINES_TXT * 255.
    Main Text
    CLEAR I_OBJPACK-TRANSF_BIN.
    I_OBJPACK-HEAD_START = 1.
    I_OBJPACK-HEAD_NUM = 0.
    I_OBJPACK-BODY_START = 1.
    I_OBJPACK-BODY_NUM = V_LINES_TXT.
    I_OBJPACK-DOC_TYPE = 'RAW'.
    APPEND I_OBJPACK.
    Attachment (pdf-Attachment)
    I_OBJPACK-TRANSF_BIN = 'X'.
    I_OBJPACK-HEAD_START = 1.
    I_OBJPACK-HEAD_NUM = 0.
    I_OBJPACK-BODY_START = 1.
    DESCRIBE TABLE I_OBJBIN LINES V_LINES_BIN.
    READ TABLE I_OBJBIN INDEX V_LINES_BIN.
    I_OBJPACK-DOC_SIZE = V_LINES_BIN * 255 .
    I_OBJPACK-BODY_NUM = V_LINES_BIN.
    I_OBJPACK-DOC_TYPE = 'PDF'.
    I_OBJPACK-OBJ_NAME = 'ZPM_F_MAINTENANCE_REQUEST'.
    I_OBJPACK-OBJ_DESCR = 'Maintenance Request'.
    APPEND I_OBJPACK.
    CLEAR I_RECLIST.
    I_RECLIST-RECEIVER = '[email protected]'.
    I_RECLIST-REC_TYPE = 'U'.
    APPEND I_RECLIST.
    ENDLOOP.
    CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
      EXPORTING
        document_data                    = WA_DOC_CHNG
       PUT_IN_OUTBOX                    = 'X'
      SENDER_ADDRESS                   = SY-UNAME
      SENDER_ADDRESS_TYPE              = 'B'
       COMMIT_WORK                      = 'X'
    IMPORTING
      SENT_TO_ALL                      = w_sent_all
      NEW_OBJECT_ID                    =
      SENDER_ID                        =
      tables
        packing_list                     = I_OBJPACK
       OBJECT_HEADER                    = WA_OBJHEAD
       CONTENTS_BIN                     = I_OBJBIN
       CONTENTS_TXT                     = I_OBJTXT
      CONTENTS_HEX                     =
      OBJECT_PARA                      =
      OBJECT_PARB                      =
        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.
    WRITE:/ 'Error When Sending the File', SY-SUBRC.
    ELSE.
    WRITE:/ 'Mail sent'.
    ENDIF.
    ENDIF.
    ENDIF.
    Please let me know what could be the problem.
    Thanks in advance.
    vs.sarvan.

    Hi Sarvan,
    Post the code in code format.Check on the right side for example.
    Sy-subrc  = 0
    Regards,
    Madhu.

  • Error while opening PDF in mail attachment

    Hi All,
    In smartform i am sending a mail with attachemnt as PDF file,there is one more option like preview of smartform .
    issue is like i am able to see the preview of the same record but when it is sent in mail attachement,and while opening PDF its showing error that file can not be open it is corrupted.
    Please help.
    Mona Singh.

    Dear Sandra
    That was my problem: binary data was incorrectly converted (often because of Unicode systems).
    I returned
            bin_filesize          = v_len_in
            bin_file              = l_binfile
    from the function module CONVERT_OTF, then converted the xstring data (l_binfile) into an internal table (t_objbin) to send to the mail send function with the following function module:
        CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
          EXPORTING
            buffer        = l_binfile
          IMPORTING
            output_length = v_lines_bin
          TABLES
            binary_tab    = t_objbin.
    Many thanks for your help.
    Best regards
    Patricia

  • R3 to Mail-PDF and Mail-PDF to R3

    Hi sdners!
    I have a doubt. well.. 2 really
    1- I have to send some data from R/3 to a supplier by mail, with a pdf document attached to it. Is it possible to convert IDoc data to pdf format, and send it throw mail (attached to it) to a recipient determined by the IDoc data?
    I think a solution would be to create a XSL Mapping to create PDF and send it throw mail (like Prakash's blog /people/community.user/blog/2006/09/07/email-reporting ), but I never did this.
    2- And I have to do the response too, asynchronous. I have to receive the mail, with a pdf attached to it, and use the pdf data to send an IDoc to R/3.
    Is it possible to use PayloadSwapBean module to use pdf attached file (like Michal's blog /people/michal.krawczyk2/blog/2005/12/18/xi-sender-mail-adapter--payloadswapbean--step-by-step) , and then use a module to parse the PDF file and frame a XML document  (like blog /people/sap.user72/blog/2005/07/31/xi-read-data-from-pdf-file-in-sender-adapter) ??
    Are these interfaces possible?
    I will reaaally apreciate your help
    Regards,
    Fede

    You can't do that. Couldn't you just export the data from the PDF after it's received?
    In order to attach the complete PDF with Reader, the document has to be Reader-enabled.

  • 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                 *

  • How to run 2 reports to send 1 PDF e-mail attachment instead of 2 e-mails.

    I used 9i Reports to create 2 reports in a PDF format. I run these reports from a 9i form using the web.show_document command. XML is used to send the 2 e-mails with the reports.
    Is there a way I can combine the running of the reports to make one PDF to created 1 e-mail attachment or run the reports at the same time and attach 2 PDF files to 1 e-mail.
    I have no problems running 1 report and sending 1 e-mail attacment!
    This is example of the XML used in creating the e-mail:
    - <destinations>
    - <foreach>
    - <file id="Test" name="REPORT_1.pdf" format="pdf" instance="XXXX">
    <include src="report" />
    </file>
    </foreach>
    - <!-- Send a mail with an attachment
    -->
    - <mail id="ex1" to="&DESNAME" from="&DESNAME" subject="&DESNAME;*;&p_postal_number: was submitted for
    approval on &p_postal_date">
    <body srcType="text">This is to notify you of a new submission that requires an approval before being
    sent to out. Please use the URL link below to review the information as soon as possible.
    https://xxxx.aaaa.sss.com:234/web_html/static.html AAAA Administrator</body>
    - <attach format="pdf" name="Report_1&.pdf" srcType="report">
    <include src="mainSection" />
    </attach>
    </mail>
    </destinations>

    You can use iText to combine two PDF files into one.

  • PDF e-mail attachment will not open after FF update

    FF 31 and/or 32
    Outlook or GroupWise fat client
    PDF attachments
    After FF updated PDF's were re-associated with FF not the installed PDF program. Used Windows to re associate PDF's to PDF program. No problem, all PDF's open in PDF program UNLESS the PDF is an attachment in an e-mail.
    Open e-mail fat client (doesn't matter the client) try and open the PDF and user gets message stating there is no program associated with attachment. Yet, all PDF's still open with correct PDF program as long as they are not in the e-mail. Now here's the really weird part.....
    If there are two or more PDF's attachments in the same e-mail the first one will not open but the second, thirds, etc attached PDF's will open with the correct PDF program.
    The only temporary solution I have found is to uninstall FF, re-install it and for a 1/2 day the issue goes away. I have not figured out the trigger that resets the issue.
    FF is my go-to browser, but since v 31 this has been happening and if it keeps up, I'm switching to Chrome.
    Come on Tech Support, help us out with this issue.

    Sorry you're having this problem. I think it was previously reported only by Windows XP users.
    When you reinstall, were you making Firefox your default browser? Some users have reported that ''not'' making Firefox the default browser was an effective workaround.
    However, you may have success with this approach, suggested by a user in another thread, which appears to more thoroughly update the Windows registry:
    # Open Adobe Reader / Acrobat
    # Edit->Preferences
    # In the Categories column click 'General'
    # Near the bottom of the page click the button marked 'Select Default PDF Handler'
    # In the dialog, select 'Adobe Reader XI' (or Adobe Acrobat, as the case may be) and click 'Apply'
    # A Windows Configuration screen will appear. Allow it to do its stuff (takes a few minutes), then restart your computer when prompted.
    Does that resolve the issue for you?

  • Using the Mail content and Mail Attachment in the mapping

    Hi,
    I have a requirement in which I need to read a file from the mail server and I am using the sender mail adapter for this. I have to convert the attachment of the mail in to the payload. To do this I am using the payload swap bean and mail transform bean. Now the issue is I have to get the information from both attachment and the mail content and need to map it to the target message. Please let me know how to do this.
    Thanks!
    ~Vaas

    Not sure if there is a staright forward way to achieve this.
    But I can think of a work around for your scenario.
    >>To do this I am using the payload swap bean and mail transform bean.
    Instead of doing it this way, try
    1. Message Transform bean that will transform the payload(content of the mail) to XML.
    2. PayloadSwapBean to switch Payload and Attachment.
    3. Message Transform bean to transform the attachment to XML.
    4. Custom adapter module to read the attachment, contnet and create your own desired XML.
    Alternatively, step 4 could be replaced by a Java mapping doing the same operation.
    Regards
    Jai

  • Can you create a pdf e-mail attachment with working hyperlinks?

    I'm trying to figure out how to generate an e-mail with working hyperlinks where the recipient doesn't have to open the pdf for the links to work...in other words, when they open the e-mail and view the pdf as it is displayed, the links are visible and the viewer can click on them and go to a URL. I see this all the time, and can't figure out how to do it with a pdf (I've added the links with the link took in pdf and they display within the application window, but disappear when the file is an e-mail attachment) or with html. I've attached the pdf that I'm trying to make interactive within an e-mail message. Any help that can be provided is much appreciated!

    Michael your answer is colored by the fact you use an ASCII (Text only) News Reader.
    The answer is more along these lines:
    PDF's can be created with working hyperlinks.
    They can be automatically be brought over from programs such as MS Word, Open Office, and such  provided your on a PC Platform
    they can actually be viewed and clickable from Acrobat or Reader PC Versions, if created from a PC Version.
    they are not viewable or clickable if created from Mac version of Office.
    They are viewable and clickable from a PC if created from Mac version of Office (Word/Excel)
    The Mac can can not do so automatically you must do them Manually with in Acrobat.
    in Past it has been a Pain to do so though may be different in version 9
    If you use a browser Plugin such as Schubert's PDF Browser Plugin that works on Safari, fireFox, Camino, SeaMonkey Opera, OmniPage, iCab. Links you create in Mac version of Acrobat are viewable and clickable.
    Finally MS and Adobe have been having this on going problem since the day's PDF's first hit the market. (Version 1.) and MS  decided to support them. The hooks are there for both PC and Mac versions of Word. and either are capable of being created and acted upon on whether created by the Mac version of Office, or the PC version of Office, but only on a windows PC. Its clearly a problem of Acrobat/Reader on the Mac. Its either a problem Adobe won't own up to, or they can't solve or, this is one item they can't be bothered with to put in the Mac Versions.
    Some of this information is based on my participation in the msnews. nntp newsgroups for Office Mac. The experts there for the most part (MVP's) use both Mac and PC's and have investogated the problem themselves and been give information from the MacBU (Mac Business Unit) at MicroSoft. The basic internal code of Office 2003/2004 is the same. The UI is different and key cobinations are different. And same for 2007/2008 except office 2008 don't support VBA and Macros, and neither 2004 nor 2008 have MasterPages, And thankfully according the the MVP's Thankfully the Robbonis not supported on 2008.

Maybe you are looking for

  • Just got an 8 gig Zen MicroPhoto and love it! Just some suggestions tho

    Hi everyone, my friend was considering a Zen Vision M and an Ipod video. I kinda suggested the Zen so he got it and absolutely loves it. After seeing how nice the Zen Vision M is, I jumped on this MicroPhoto when I saw a sale and it is awesome! The Z

  • How do I get Linux on Slot Loading iMac G3 350 running with Tiger OSX?

    Hi, How do I get Linux (Ubuntu) running alongside Tiger 10.4 on an iMac G3? I have a 350MHz Slot Loading iMac G3 Indigo currently running OSX 10.4. I would like to have Ubuntu and OSX on the same computer, so when I boot, I can choose which OS to boo

  • Doubt about uses of OBIEE

    I have some doubts about the possible uses of OBIEE. It happens that using OBIEE sometimes users demand report of an "analytical" type, that is aggregated analysis through OBIEE's Answers, selecting data from dimension tables and measures from fact t

  • Remove path white lines after Live Trace

    Hello, Very new to Adobe products(CS5)..... I have created a glass orb image (no mean feat for me!!) in PS from which I would like to make a .swf file from. The plan is to convert it to an ai in Illustrator and then export to .swf. I have opened the

  • Can't connet to airport Extreme

    Hello, I bought a new airport extreme(2009) in order to partialy replace my sagen f@sr modem and router. I intend to turn off the wireless feature from the sagem router and use it only as modem. My problem is that I can see the airport extreme throug