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.

Similar Messages

  • Problem in displaying smartform as pdf in portal

    Hi all,
    We  created a smartform and we are displaying as a pdf in portal.Everything is fine and pdf  is coming.But there is arabic data in the form .
    Some of the arabic data is coming perfectly.
    But some data is coming in Japanese or chinese and some data is coming like
    F,D'! 9(/'D1-EF (F 5'D- 'D3JA 叉â
    Department 'D%/'1) 'D9'E) DDEH'1/ 'D(41J).
    Please let me know what could be the problem.
    Thanks and Regards,
    Rajesh

    hi Rajesh.....
    Could you explain me how 2 display SMARTFORM as PDF in portal..... please.....
    I have the requirement as follows.....
    By pressing a button the smartform must be generated.....
    SO what must be the RFC o/p from ABAP.... I am ABAPER basically
    and what the portal guys must do.....
    pleaseeee

  • In R/3 display smartform as pdf in a custom container

    Hello,
    I want to display smartform as pdf in a custom contianer . I was able to find all the right code from sdn.
    but my problem is that when executed my sap gui is closed without any error.
    I am unable to understand what is going wrong.
      CALL METHOD G_HTML_CONTROL->SHOW_URL( URL = LV_URL
        IN_PLACE = 'X' ).  does not show the pdf.
    Can any one help me to find out if we need to do some setting for MIME type application/pdf. Because I tried to display a bar chart in the custom container of MIME type text/html , and this is working fine.
    Is any setting missing in our R/3 because of which the code is not getting executed.
    below code is the exact copy from a post in sdn:
    report ztest_pdf.
    DATA: LT_PDF TYPE TABLE OF TLINE,
          LS_PDF LIKE LINE OF LT_PDF,
          LV_URL TYPE CHAR255,
          PDF_FSIZE TYPE  I,
          LV_CONTENT  TYPE XSTRING,
          LT_DATA TYPE STANDARD TABLE OF X255.
    DATA : L_JOB_OUTPUT_INFO TYPE SSFCRESCL.
    DATA : LS_CONTROL_PARAM  TYPE SSFCTRLOP.
    DATA : G_HTML_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
           G_HTML_CONTROL   TYPE REF TO CL_GUI_HTML_VIEWER.
    *      pdf_control type ref to cl_gui_pdfviewer.
    DATA : P_VBELN TYPE  VBELN_VL.
    DATA : i_html TYPE w3htmltabtype.
    ",       g_url  TYPE w3url
    FIELD-SYMBOLS <FS_X> TYPE X.
    INITIALIZATION.
    LS_CONTROL_PARAM-GETOTF = 'X'.
    LS_CONTROL_PARAM-NO_DIALOG = 'X'.
    START-OF-SELECTION.
      CALL FUNCTION '/1BCDWB/SF00000298'
    EXPORTING
    *    ARCHIVE_INDEX              =
    *   ARCHIVE_INDEX_TAB          =
    *   ARCHIVE_PARAMETERS         =
         CONTROL_PARAMETERS         = LS_CONTROL_PARAM
    *     P_VBELN                    = P_VBELN
    *   MAIL_APPL_OBJ              =
    *   MAIL_RECIPIENT             =
    *   MAIL_SENDER                =
    *   OUTPUT_OPTIONS             =
    *   USER_SETTINGS              = 'X'
    IMPORTING
    *      DOCUMENT_OUTPUT_INFO  = L_DOCUMENT_OUTPUT_INFO
           JOB_OUTPUT_INFO       = L_JOB_OUTPUT_INFO
    *      JOB_OUTPUT_OPTIONS    = L_JOB_ OUTPUT_OPTIONS
    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.
    data pdfxstring type xstring.
      CALL FUNCTION 'CONVERT_OTF'
        EXPORTING
          FORMAT                = 'PDF'
        IMPORTING
          BIN_FILESIZE          = PDF_FSIZE
          bin_file              = pdfxstring
        TABLES
          OTF                   = L_JOB_OUTPUT_INFO-OTFDATA
          LINES                 = LT_PDF
        EXCEPTIONS
          ERR_MAX_LINEWIDTH     = 1
          ERR_FORMAT            = 2
          ERR_CONV_NOT_POSSIBLE = 3
          OTHERS                = 4.
      CALL SCREEN 100.
    module STATUS_0100 output.
    *  SET PF-STATUS 'xxxxxxxx'.
    *  SET TITLEBAR 'xxx'.
      CREATE OBJECT G_HTML_CONTAINER
        EXPORTING
          CONTAINER_NAME = 'PDF'.
    CREATE OBJECT G_HTML_CONTROL
        EXPORTING
          PARENT = G_HTML_CONTAINER.
    * Convert xstring to binary table to pass to the LOAD_DATA method
      CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
        EXPORTING
          BUFFER     = pdfxstring"LV_CONTENT
        TABLES
          BINARY_TAB = LT_DATA.
    * PERFORM bar_chart .
    * Load the HTML
      CALL METHOD G_HTML_CONTROL->LOAD_DATA(
         EXPORTING
           TYPE         = 'application' "'text' " 'application'
           SUBTYPE      = 'pdf' "'html'  "'pdf'
         IMPORTING
           ASSIGNED_URL         = lv_URL
         CHANGING
           DATA_TABLE           =  LT_DATA "i_html "LT_DATA
         EXCEPTIONS
           DP_INVALID_PARAMETER = 1
           DP_ERROR_GENERAL     = 2
           CNTL_ERROR           = 3
           OTHERS               = 4 ).
    * Show it
      CALL METHOD G_HTML_CONTROL->SHOW_URL( URL = LV_URL
        IN_PLACE = 'X' ).
    Thanks,
    Jaya.
    Edited by: kishan P on Jun 9, 2011 1:40 PM

    Hello Sandra,
    Thanks for your reply, but eventhen it fails to load the pdf. Is ADS required to be installed for this?
    Can I just pass the pdf_fsize imported from  CONVERT_OTF which is of type i.
      CALL FUNCTION 'CONVERT_OTF'
        EXPORTING
          FORMAT                = 'PDF'
        IMPORTING
          BIN_FILESIZE          = PDF_FSIZE    
    bin_file              = pdfxstring
        TABLES
          OTF                   = L_JOB_OUTPUT_INFO-OTFDATA
          LINES                 = LT_PDF
        EXCEPTIONS
          ERR_MAX_LINEWIDTH     = 1
          ERR_FORMAT            = 2
          ERR_CONV_NOT_POSSIBLE = 3
          OTHERS                = 4.
      CALL METHOD G_HTML_CONTROL->LOAD_DATA(
         EXPORTING
           TYPE         = 'application' "'text' " 'application'
           SUBTYPE      = 'pdf' "'html'  "'pdf'
           size           = PDF_FSIZE
         IMPORTING
           ASSIGNED_URL         = lv_URL
         CHANGING
           DATA_TABLE           =  LT_DATA "i_html "LT_DATA
         EXCEPTIONS
           DP_INVALID_PARAMETER = 1
           DP_ERROR_GENERAL     = 2
           CNTL_ERROR           = 3
           OTHERS               = 4 ).
    Thanks,
    Jaya.

  • How to display smartform as PDF in web dynpro java

    Hi,
    Where can I find sample program to display smartform as PDF in web dynpro java.
    Thanks.
    Regards,
    Henry

    1. Create a smart form in the R/3 side
    2. Now create a function module with the corresponding export parameter:
    3. Make sure that the function module is marked remote enabled. 
    4. In NWDS  create an Adaptive RFC model which points to the FM created in R/3 under the webdynpro application
    5. Now create an application and view inside it to display the PDF and Insert a frame inside the view
    6. Create a  value node and an attribute say url of type string inside that node and bind it to the source
    7. In the doInit() method place the following code
    >    ZTest_Pdf_1_Input input = new ZTest_Pdf_Input();
    >    wdContext.nodeZTest_Pdf_Input().bind(input);      
    >    try {                       
    >            wdContext.currentZTest_Pdf_InputElement().modelObject().execute();
    >            }
    >  catch (Exception e) {
    >                        e.printStackTrace();
    >            }          
    >  wdContext.currentInternalElement().setUrl(convert(wdContext.currentOutputElement().getBin_File()));       
    Inside that view create a method to convert the string to url so that it can be passed as a string to the setUrl method of the currentContextElement() , say convet(byte[] doc_content) which return a string.
    Inside that methos write the following code,
    >         String url = "";
    >           WDWebResourceType webResType = WDWebResourceType.PDF;
    >            IWDWebResource webResource = WDWebResource.getWebResource(doc_content, webResType);
    >            try {
    >                        url = webResource.getURL();
    >            }
    >  catch (Exception e) {
    >                        e.printStackTrace();
    >            }          
    >            return url;
    Hope It will be helpful
    Regards,
    Sam Charles J.

  • 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

  • Problems with specifying File Extension of E-Mail attachment

    Hi everybody
    I have a problem that seems to be so simple that it almost drives me crazy that I cannot find a solution for it.
    I need to send the content of an internal table (some lines) as a mail attachment to a specified mail address.
    The format should be normal ASCII, so when I open it with any text editor (e.g. Notepad),  I want to have all my lines there (including CR/LF).
    The problem now is - The extension of this mail attachment must be ".key", so the attached file should have the name "L_12345.key" (for example).
    For E-Mailing I use FM "SO_NEW_DOCUMENT_ATT_SEND_API1".
    This part works fine, also the attachment part works in general.  (I receive the mail and I receive the attachment).
    BUT I get either an attachment with the name "L_12345.txt" or "L_12345.key.txt" and in correct format, or I get an attachment "L_12345.key", where the name is correct but format is wrong (no CR/LF - everything in one line).
    Example:
    =======
    Attachment-Content should be:
    Line 1
    Line 2
    Line 3
    Name of Attachment should be: L_12345.key
    What I tried:
    TEST 1 **
    Declare Attachment in Packing list. ..
      ls_packing_list-transf_bin   = ' '.
      ls_packing_list-head_start   = 1.
      ls_packing_list-head_num     = 0.
      ls_packing_list-body_start   = 7.  "Startline of Attachment
      ls_packing_list-body_num     = 3.  "No of Attachment lines
      ls_packing_list-doc_type     = 'RAW'. 
      ls_packing_list-doc_size     = 3 * 255.
      ls_packing_list-obj_name     = 'ATT01'.
      ls_packing_list-obj_descr    = 'L_12345'   "Attachment name
      APPEND ls_packing_list TO lt_packing_list.
    ==> Result: Attachment Filename = L_12345.txt
    ==> File as I need it (ASCII with CR/LF), but extension wrong
        Line 1
        Line 2
        Line 3
    TEST 2 **
    Same as TEST 1, but with:
      ls_packing_list-obj_descr    = 'L_12345.KEY'   "Attachment name
    ==> Result: Attachment Filename = L_12345.KEY.txt
    ==> File as I need it (ASCII with CR/LF), but extension wrong
        Line 1
        Line 2
        Line 3
    TEST 3 **
    Declare Attachment in Packing list. ..
      ls_packing_list-transf_bin   = ' '.
      ls_packing_list-head_start   = 1.
      ls_packing_list-head_num     = 0.
      ls_packing_list-body_start   = 7.  "Startline of Attachment
      ls_packing_list-body_num     = 3.  "No of Attachment lines
      ls_packing_list-doc_type     = 'KEY'.
      ls_packing_list-doc_size     = 3 * 255.
      ls_packing_list-obj_name     = 'ATT01'.
      ls_packing_list-obj_descr    = 'L_12345'. "Attachment name
      APPEND ls_packing_list TO lt_packing_list.
    ==> Result: Attachment Filename = L_12345.KEY
    ==> File Format is wrong:
        Line 1          Line 2     Line3
    I have tried several other Extensions (DOC_TYPE), it seems, that the File format is only correct with "RAW", but it seems with "RAW" SAP adds ".txt" as extension to the filename.
    Does anyone know how I can achieve having an e-mail attachment with multiple text lines and name "<anyname>.key"
    Any help (if possible with example code ?) would be highly appreciated.
    Many thanks
    Harald

    hi,
    check the following code.
    *&      Form  send_email
    FORM send_email.
    CLASS cl_abap_char_utilities DEFINITION LOAD.
    CONSTANTS: con_cret TYPE c VALUE cl_abap_char_utilities=>cr_lf.
    *Body of mail
      CLEAR objtxt.
      CLEAR objtxt[].
      objtxt = 'Dear abc'.
      APPEND objtxt.
      CLEAR objtxt.
      APPEND objtxt.
      objtxt = 'Attached herewith is the detail list of materials.'.
      APPEND objtxt.
      CLEAR objtxt.
      APPEND objtxt.
      objtxt = 'Regards,'.
      APPEND objtxt.
      objtxt = 'Admin'.
      APPEND objtxt.
      DESCRIBE TABLE objtxt LINES tab_lines.
      READ TABLE objtxt INDEX tab_lines.
    *Mail description
      CLEAR docdata.
      docdata-doc_size  = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ).
      docdata-obj_name  = 'List'.
      docdata-obj_descr = 'List of materials'.
      docdata-obj_langu = sy-langu.
    *Packing list for main document
      CLEAR objpack.
      CLEAR objpack[].
      objpack-head_start = 1.
      objpack-head_num   = 0.
      objpack-body_start = 1.
      objpack-body_num   = tab_lines.
      objpack-doc_type   = 'RAW'.
      APPEND objpack.
    *Attachment data
      CLEAR objbin.
      CLEAR objbin[].
      CONCATENATE
            'field1' 'field2' 'field3' 'field4'
        INTO objbin SEPARATED BY ','.
      CONCATENATE con_cret objbin INTO objbin.
      APPEND objbin.
      LOOP AT it_material_list INTO wa_material_list.
        MOVE-CORRESPONDING wa_material_list TO wa_char_material_list.
        CONCATENATE
              wa_char_material_list-field1
              wa_char_material_list-field2
              wa_char_material_list-field3
              wa_char_material_list-field4
          INTO objbin SEPARATED BY con_tab.
        CONCATENATE con_cret objbin INTO objbin.
        APPEND objbin.
        CLEAR objbin.
        CLEAR wa_char_employee_list.
      ENDLOOP.
      DESCRIBE TABLE objbin LINES tab_lines.
      READ TABLE objbin INDEX tab_lines.
    *Packing list for attachment document
      CLEAR objpack.
      objpack-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objbin ).
      objpack-transf_bin = 'X'.          "check these values
      objpack-head_start = 1.          "check these values
      objpack-head_num   = 1.          "check these values
      objpack-body_start = 1.          "check these values
      objpack-body_num   = tab_lines.
      objpack-doc_type   = 'KEY'.
      objpack-obj_name   = 'Attachment'.
      objpack-obj_descr  = 'Report.KEY'.
      APPEND objpack.
    *Email receiver's list
      CLEAR reclist.
      CLEAR reclist[].
      reclist-receiver = mail_id.
      reclist-rec_type = 'U'.
      APPEND reclist.
    *Function module to send email with an attachment
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          document_data              = docdata
          put_in_outbox              = 'X'
          commit_work                = 'X'
        TABLES
          packing_list               = objpack
          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.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    ENDFORM.                    "send_email
    Edited by: vikram shah on Sep 25, 2008 5:28 PM

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

  • 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

  • Problem in converting smartform to PDF

    Hi Experts,
    I am facing the issue while converting the smartform to pdf form with the help of FM convert_otf_2_pdf .
    Problem is that
    CH3OH4OD7     3 , 4 and 7 are the subscipts in SMARTFORM like in a chemical formula ,but after conveting to PDF # is replacing the subscripts like CH#OH#OD# .
    Kindly help in this issue.
    Thanks
    Sachin
    Edited by: Rob Burbank on Feb 6, 2012 10:13 AM

    Try this example it will be help full
    REPORT  YSAMPLE5.
    DATA:
    w_form_name TYPE tdsfname VALUE 'YSAMPLE2',
    w_fmodule TYPE rs38l_fnam,
    w_cparam TYPE ssfctrlop,
    w_outoptions 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.
    Internal tables declaration
    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.
    This function module call is used to retrieve the name of the Function
    module generated when the SMARTFORM is activated
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
    formname = w_form_name
    VARIANT = ' '
    DIRECT_CALL = ' '
    IMPORTING
    fm_name = w_fmodule
    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.
    Calling the SMARTFORM using the function module retrieved above
    GET_OTF parameter in the CONTROL_PARAMETERS is set to get the OTF
    format of the output
    w_cparam-no_dialog = 'X'.
    w_cparam-preview = space. " Suppressing the dialog box
                                                        " for print preview
    w_cparam-getotf = 'X'.
    Printer name to be used is provided in the export parameter
    OUTPUT_OPTIONS
    w_outoptions-tddest = 'LP01'.
    CALL FUNCTION w_fmodule
    EXPORTING
    ARCHIVE_INDEX =
    ARCHIVE_INDEX_TAB =
    ARCHIVE_PARAMETERS =
    control_parameters = w_cparam
    MAIL_APPL_OBJ =
    MAIL_RECIPIENT =
    MAIL_SENDER =
    output_options = w_outoptions
    USER_SETTINGS = 'X'
    IMPORTING
    DOCUMENT_OUTPUT_INFO =
    job_output_info = t_otf_from_fm
    JOB_OUTPUT_OPTIONS =
    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.
    t_otf[] = t_otf_from_fm-otfdata[].
    Function Module CONVERT_OTF is used to convert the OTF format to PDF
    CALL FUNCTION 'CONVERT_OTF'
    EXPORTING
    FORMAT = 'PDF'
    MAX_LINEWIDTH = 132
    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.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    To display File SAVE dialog window
    CALL METHOD cl_gui_frontend_services=>file_save_dialog
    CHANGING
    filename = w_FILE_NAME
    path = w_FILE_PATH
    fullpath = w_FULL_PATH
    USER_ACTION =
    FILE_ENCODING =
    EXCEPTIONS
    CNTL_ERROR = 1
    ERROR_NO_GUI = 2
    NOT_SUPPORTED_BY_GUI = 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.
    Use the FM GUI_DOWNLOAD to download the generated PDF file onto the
    presentation server
    CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
    BIN_FILESIZE = W_bin_filesize
    filename = w_FULL_PATH
    FILETYPE = 'BIN'
    tables
    data_tab = T_pdf_tab
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.

  • Sending SMARTFORM as PDF in mail

    Hi all
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/smartformtoMailasPDF+attachment
    In this link, i got how to convert the smartform to pdf format. When i tried with this , only the layout is going in mail,No data is in the smartform.....
    I have been struck up with this for a long time.,,
    Hoping for ur Wonderful support
    Regards
    Karthikeyan.P

    Karthikeyan,
    Try this code
    Re: Error opening pdf in email
    When you call the smartform FM, make sure that data is passed to it correctly.
    Regards
    Indu

  • Display Smartform in PDF.

    Hi All,
    I have gone through the forum threads to convert a smartform into a pdf document. All of them say to use function module CONVERT_OTF. This function module converts the output of the smartform which is in OTF into the PDF format and we can download the information which opens up with Adobe Reader.
    The question is whether we can display the output of the smartform in Adobe at runtime within the SAP GUI because if it is in the portal then we can set the attribute in SAP Connect, to display the output of SAP Script and Smartforms in PDF.
    I tried this code
    REPORT  ZACOSTA_FETCH_DATA_COPY.
    DATA : IT_ZACOSTA TYPE  ZACOSTA_TAB_DET.
    DATA : V_FORM_NAME TYPE TDSFNAME VALUE 'ZACOSTA_FORMS_COPY1',
           V_FUNC_NAME TYPE RS38L_FNAM.
    DATA:   LS_CONTROL_PARAMETERS TYPE SSFCTRLOP,
            LS_OUTPUT_OPTIONS     TYPE SSFCOMPOP,
            LS_JOB_OUTPUT_INFO    TYPE SSFCRESCL,
            LT_LINES              TYPE TABLE OF TLINE,
            L_DEVTYPE             TYPE RSPOPTYPE,
            L_SAM_HAWKINS         TYPE INT4,
            L_DOC TYPE DOCS OCCURS 0 WITH HEADER LINE.
    START-OF-SELECTION.
      SELECT VBAKVBELN VBAKVKORG VBAK~VTWEG
             VBAKSPART VBAKKUNNR VBAP~POSNR
             VBAPMATNR VBAPARKTX VBAP~NETWR
             VEDAVBEGDAT VEDAVENDDAT
             INTO CORRESPONDING FIELDS OF TABLE IT_ZACOSTA
             FROM VBAK INNER JOIN VBAP
             ON VBAKVBELN = VBAPVBELN
             INNER JOIN VEDA
             ON VEDAVBELN = VBAPVBELN
             WHERE VBAK~VBELN  = '0040000264'. "Where Clause to be removed
      CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
        EXPORTING
          FORMNAME                 = V_FORM_NAME
           VARIANT                  = ' '
           DIRECT_CALL              = ' '
          IMPORTING
            FM_NAME                  = V_FUNC_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.
    Set language
      LS_CONTROL_PARAMETERS-LANGU  = SY-LANGU.
    Set control parameters to get the output format (OTF) from Smart Forms
      LS_CONTROL_PARAMETERS-NO_DIALOG = 'X'.
      LS_CONTROL_PARAMETERS-GETOTF    = 'X'.
      LS_OUTPUT_OPTIONS-TDNOPREV = 'X'.
      CALL FUNCTION V_FUNC_NAME
        EXPORTING
          OUTPUT_OPTIONS     = LS_OUTPUT_OPTIONS
          CONTROL_PARAMETERS = LS_CONTROL_PARAMETERS
          USER_SETTINGS      = SPACE
          IT_ZACOSTA         = IT_ZACOSTA
        IMPORTING
          JOB_OUTPUT_INFO    = LS_JOB_OUTPUT_INFO.
      CALL FUNCTION 'CONVERT_OTF'
           EXPORTING
             FORMAT                      = 'PDF'
            MAX_LINEWIDTH               = 132
           ARCHIVE_INDEX               = ' '
           COPYNUMBER                  = 0
           IMPORTING
             BIN_FILESIZE                = L_SAM_HAWKINS
            bin_file                    = p_data       " binary file
           TABLES
             OTF                  = LS_JOB_OUTPUT_INFO-OTFDATA
             LINES                       = LT_LINES
           EXCEPTIONS
             ERR_MAX_LINEWIDTH           = 1
             ERR_FORMAT                  = 2
             ERR_CONV_NOT_POSSIBLE       = 3
             ERR_BAD_OTF                 = 4
             OTHERS                      = 5
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
      BIN_FILESIZE                    =
        FILENAME                        = 'C:\Test.pdf'
       FILETYPE                        = 'BIN'
      APPEND                          = ' '
      WRITE_FIELD_SEPARATOR           = ' '
      HEADER                          = '00'
      TRUNC_TRAILING_BLANKS           = ' '
      WRITE_LF                        = 'X'
      COL_SELECT                      = ' '
      COL_SELECT_MASK                 = ' '
      DAT_MODE                        = ' '
      CONFIRM_OVERWRITE               = ' '
      NO_AUTH_CHECK                   = ' '
      CODEPAGE                        = ' '
      IGNORE_CERR                     = ABAP_TRUE
      REPLACEMENT                     = '#'
      WRITE_BOM                       = ' '
      TRUNC_TRAILING_BLANKS_EOL       = 'X'
    IMPORTING
      FILELENGTH                      =
      TABLES
        DATA_TAB                        = LT_LINES
      FIELDNAMES                      =
    EXCEPTIONS
       FILE_WRITE_ERROR                = 1
       NO_BATCH                        = 2
       GUI_REFUSE_FILETRANSFER         = 3
       INVALID_TYPE                    = 4
       NO_AUTHORITY                    = 5
       UNKNOWN_ERROR                   = 6
       HEADER_NOT_ALLOWED              = 7
       SEPARATOR_NOT_ALLOWED           = 8
       FILESIZE_NOT_ALLOWED            = 9
       HEADER_TOO_LONG                 = 10
       DP_ERROR_CREATE                 = 11
       DP_ERROR_SEND                   = 12
       DP_ERROR_WRITE                  = 13
       UNKNOWN_DP_ERROR                = 14
       ACCESS_DENIED                   = 15
       DP_OUT_OF_MEMORY                = 16
       DISK_FULL                       = 17
       DP_TIMEOUT                      = 18
       FILE_NOT_FOUND                  = 19
       DATAPROVIDER_EXCEPTION          = 20
       CONTROL_FLUSH_ERROR             = 21
       OTHERS                          = 22
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    The reson why I had to download is because this does not show the PDF at runtime. Am I missing some parameter here or is there some kind of configuration required to display the smartform in PDF at runtime within the SAP GUI.
    Any hints on this would be greatly appreciated.
    Best Regards,
    Sudhi

    Hi,
    Here is the sample code.This code will download the smartforms as PDF.Kindly reward points by clicking the star on the left of reply,if it helps.
    REPORT zswar.
    SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME.
    PARAMETER: p_date LIKE sy-datum.
    PARAMETER: p_rea TYPE char255.
    SELECTION-SCREEN: END OF BLOCK b1.
    DATA: ws_ucomm LIKE sy-ucomm.
    INITIALIZATION.
    SET PF-STATUS 'STANDARD' OF PROGRAM 'ZSWAR'.
    AT SELECTION-SCREEN.
    ws_ucomm = sy-ucomm.
    CASE ws_ucomm.
    WHEN '&PDF'.
    PERFORM f1000_download_form.
    EXIT.
    WHEN '&BACK'.
    SET SCREEN 0.
    EXIT.
    WHEN '&EXIT'.
    SET SCREEN 0.
    EXIT.
    WHEN '&canc'.
    SET SCREEN 0.
    LEAVE TO SCREEN 0.
    ENDCASE.
    *& Form F1000_DOWNLOAD_FORM
    text
    --> p1 text
    <-- p2 text
    FORM f1000_download_form.
    DATA: form_name TYPE rs38l_fnam.
    DATA: wa_ctrlop TYPE ssfctrlop,
    wa_outopt TYPE ssfcompop.
    DATA: t_otfdata TYPE ssfcrescl,
    t_pdf_tab LIKE tline OCCURS 0 WITH HEADER LINE.
    Tutorial on SMART FORMS
    © 2005 SAP AG 7
    DATA: t_otf TYPE itcoo OCCURS 0 WITH HEADER LINE.
    DATA: w_filesize TYPE i.
    DATA: w_bin_filesize TYPE i.
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
    formname = 'ZSMARTFORM_SWAR'
    VARIANT = ' '
    DIRECT_CALL = ' '
    IMPORTING
    fm_name = 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.
    wa_ctrlop-getotf = 'X'.
    wa_ctrlop-no_dialog = 'X'.
    wa_outopt-tdnoprev = 'X'.
    CALL FUNCTION form_name
    EXPORTING
    ARCHIVE_INDEX =
    ARCHIVE_INDEX_TAB =
    ARCHIVE_PARAMETERS =
    control_parameters = wa_ctrlop
    MAIL_APPL_OBJ =
    MAIL_RECIPIENT =
    MAIL_SENDER =
    output_options = wa_outopt
    user_settings = 'X'
    mydate = p_date
    reason = p_rea
    IMPORTING
    DOCUMENT_OUTPUT_INFO =
    job_output_info = t_otfdata
    JOB_OUTPUT_OPTIONS =
    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.
    t_otf[] = t_otfdata-otfdata[].
    CALL FUNCTION 'CONVERT_OTF'
    EXPORTING
    format = 'PDF'
    Tutorial on SMART FORMS
    © 2005 SAP AG 8
    max_linewidth = 132
    ARCHIVE_INDEX = ' '
    IMPORTING
    bin_filesize = w_bin_filesize
    TABLES
    otf = t_otf
    lines = t_pdf_tab
    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.
    CALL FUNCTION 'WS_DOWNLOAD'
    EXPORTING
    bin_filesize = w_bin_filesize
    CODEPAGE = ' '
    filename = 'd:     est.PDF'
    filetype = 'BIN'
    MODE = ' '
    WK1_N_FORMAT = ' '
    WK1_N_SIZE = ' '
    WK1_T_FORMAT = ' '
    WK1_T_SIZE = ' '
    COL_SELECT = ' '
    COL_SELECTMASK = ' '
    NO_AUTH_CHECK = ' '
    IMPORTING
    filelength = w_filesize
    TABLES
    data_tab = t_pdf_tab
    FIELDNAMES =
    EXCEPTIONS
    file_open_error = 1
    file_write_error = 2
    invalid_filesize = 3
    invalid_type = 4
    no_batch = 5
    unknown_error = 6
    invalid_table_width = 7
    gui_refuse_filetransfer = 8
    customer_error = 9
    OTHERS = 10
    IF sy-subrc <> 0.
    MESSAGE i003(z00) WITH 'File not downloaded succesfully'.
    ELSE.
    MESSAGE i003(z00) WITH 'File Test.pdf downloaded succesfully '
    'under D drive'.
    ENDIF.
    ENDFORM. " F1000_DOWNLOAD_FORM

  • Problem In Displaying Smartform Text Field In Qual & Prd Server

    Hi All,
    I am working on a smartform in which i am checking the field which is displaying fine in quality server but when it is transported to PRD server it is displaying text field  in the smartform having ms word document which is giving me problem in displaying in the PRD Server.
    Please provide me guideline for it..

    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

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

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

Maybe you are looking for

  • How to find total size of selected items in library

    My library contains much more than my 2GB Nano can hold. I frequently change the content of the Nano with songs and books. How can I keep track of the total size of items I'm selecting for the next Nano update to speed my update? Presently I can only

  • How is this build looking?

    Planned system, so far: http://pcpartpicker.com/user/crhawkeye/saved/1AkA System concerns: - Any dumb bottlenecks? Anything standout? What should I spend less on, what should I spend more on? Never built before. Still in research mode. - Motherboard

  • How to set % based charges ?

    We are going to have some charges that are related to the quantity shipped and some that aren't.   Also we have some that have a minimum/maximum charge. Typically, if the charge is a % based charge, then it should be based on the quantity shipped.  

  • Help- Number of Pictures on a Page Option has been reduced.  What can I do?

    My first photo book allowed my to put up to 16 pictures on a page. Now when I go to the layout icon, I am limited to a maximum of 4 pictures on a page. Any idea what happened or how I can get back to the full spectrum of pictures per page?

  • I have reset my apple ID password a few times now and my iPod 4th gen still say apple ID disabled

    I have reset my apple ID password a few times now and my iPod  still says "your apple ID disabled" when I want to download apps....!!!!