Generating Smartform in PDF Format through SRM portal link

Hi All,
Please can one tell me generating Smartform in PDF format while we click on Output-format while displaying Purchase order.
Is there any configuration needed or is there any process to generate smartform in SRM portal link.
Thanks,
Sri Lakshmi

Hi Pradeep,
Thanks for your reply.
I dont want any BADI or Method.
I want to know, when we display or create  Purchase Order through SRM link- there is an option Output format where the details of PO will be generated through Smartform in PDF format.
I want to know the procedure how that PDF format is generating.
Regards,
Sri Lakshmi

Similar Messages

  • How to generate report in pdf format through a JSP page

    I require to generate my report from my JSP page into a PDF format . How can i do it?

    Use a Java API which can create PDF files based on some collection of plain vanilla Java objects (List, String, Number, etc).
    Google can find them all. Just feed it with something like "Java PDF API" or so. A commonly used one is iText.
    That said, when talking about this in JSP context, ensure that you do NOT write raw Java code in JSP files using scriptlets. Raw Java code belongs in Java classes. In such case you need a Servlet. In JSP just use taglibs and EL to interact with backend Java code and data. Scriptlets are discouraged since over a decade.

  • A big problem of Generate report with PDF format....Urgent

    I want to generate a report with pdf format through one java file, it have two page 1)gen_report.jsp 2) report_gen.java , the compliation was failed. However, i don't what the problem is .... i hope anyone can help me as it is very argent for me ....Thanks a lot
    1)gen_report.jsp
    <table  id="AutoNumber1">
       <tr>
         <td background="images/top5movie.png">
         <p align="center"> </p>
        </td>
       </tr>
       <tr>
       <td >
          <div align="center">
            <table id="AutoNumber2" >
                  <form method="GET" action="../report_gen" name="report_gen" target="_blank" onSubmit="javascript:return checkr1(this)">
                    <tr>
                      <td ><b>Report Description:</b></td>
                      <td >This report is to show the top five popular movies in cinemix for a period </td>
                    </tr>
                    <tr>
                      <td><b>Data scope:</b></td>
                      <td >Start from
                      <input type="text" name="start" value="2003-1-1" >to
                      <input type="text" name="end" value="2006-1-1" ></td>
                     </tr>
                     <tr>
                      <td><b>Data processing:</b></td>
                      <td >Show
                        <select name="order_by">
                          <option value="desc" selected>top</option>
                          <option value="asc">bottom</option>
                        </select>
                      5 films</td>
                    </tr>
                    <tr>
                      <td> <p align="center">
                          <input type="submit" value="View_Report" name="subm">
                        </p></td>
                    </tr>
                    <input type="hidden" name="report" value="r1">
                  </form>
                  <form method="GET" action="../report_gen" name="report_gen" target="_blank" onSubmit="javascript:return checkr2(this)">
                    <input type="hidden" name="report" value="r2">
                  </form>
                </table>
         </div>
          </td>
        </tr>
      </table>Then my java code is here
    report_gen.java
    import java.io.*;
    import java.net.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.util.*;
    import java.sql.*;
    // chart and pdf out
    import java.awt.Graphics2D;
    import java.awt.geom.Rectangle2D;
    import java.io.FileNotFoundException;
    import java.io.FileOutputStream;
    import org.jfree.chart.ChartFactory;
    import org.jfree.chart.JFreeChart;
    import org.jfree.chart.plot.PlotOrientation;
    import org.jfree.data.category.DefaultCategoryDataset;
    import org.jfree.data.xy.*;
    import org.jfree.data.xy.XYBarDataset;
    import org.jfree.data.general.DefaultPieDataset;
    import org.jfree.data.statistics.SimpleHistogramDataset;
    import org.jfree.data.xy.XYSeries;
    import org.jfree.data.xy.XYSeriesCollection;
    import com.lowagie.text.Document;
    import com.lowagie.text.DocumentException;
    import com.lowagie.text.Rectangle;
    import com.lowagie.text.pdf.DefaultFontMapper;
    import com.lowagie.text.pdf.PdfContentByte;
    import com.lowagie.text.pdf.PdfTemplate;
    import com.lowagie.text.pdf.PdfWriter;
    import com.lowagie.text.*;
    import com.lowagie.text.pdf.*;
    import com.lowagie.text.pdf.PdfPCell;
    public class report_gen extends HttpServlet
       private final String titles[] = {"Top Five popular movies ",
                        "Financial cirumstance of cinemas",
                        "Distribution of time segment",
                        "Distribution of favourite movie type"
       private final String descs[] = {"This report is to show the top five  popular movies in cinemix for a period ",
                   "This report is to show the financial circumstance of each cinema site ",
                   "This report is to analysis the customer when is the most visit time ",
                   "This report is to analysis the customer which type of movie do they watch the most"
        private final String bigTitle = "Cinemix";
        private final String driver = "org.gjt.mm.mysql.Driver";
        private final String url= "jdbc:mysql://localhost:3306/cinemix";
        private final String userID = "abc";
        private final String passwd = "abc";     
        public void init(ServletConfig config) throws ServletException
          super.init(config);
       protected void doGet(HttpServletRequest request, HttpServletResponse response)
       throws ServletException, IOException
          final int width = 550;
         final int height = 200;
    / title font (centre and report title)
         final Font fTitle0 = FontFactory.getFont("Helvetica", 42, Font.BOLD);
         final Font fTitle1 = FontFactory.getFont("Helvetica", 30, Font.BOLD);
              // centre name:
        final String title0 = bigTitle;
       // Default category for DefaultCategoryDataset
       final String cat = "data";
       Connection conn;
      JFreeChart chart;
       String title1     = "xyz Report";
       String chartDesc = "description";
       String notes[] = new String[4];
       String chartTitle = "so bad this is title";
       String chartXTitle = "this is x";
       String chartYTitle = "this is y.";
       String report = request.getParameter("report");     
       int max=-10000;
       int min=10000;
       int j=0;          
      // do some basic checking
       if (report == null || report.equals(""))
         report = "-1";  // this course unknow report error message
         String start   = request.getParameter("start");
         String end  = request.getParameter("end");
         String order_by  = request.getParameter("order_by");  // ToDo: check invalid string
           int topN  = 5;
        String order = (order_by.equals("desc")) ? "Top" : "Last";
       String inv[] = {"08:30", "09:30", "10:30", "11:30", "12:30", "11:30", "12:30", "13:30", "14:30", "15:30", "16:30", "17:30","18:30","19:30","20:30","21:30","22:30","23:30"};
         int inv_val[] = new int[inv.length - 1];
         try
            Class.forName(driver).newInstance();
             catch(Exception e)
            printE("Cannot load mysql database driver!", response);
              e.printStackTrace();
               return;
           try
                 conn = DriverManager.getConnection(url, userID, passwd);
                  if (report.equals("r1")) {  // report 1
               DefaultCategoryDataset dataset = new DefaultCategoryDataset();
              Statement stmt = conn.createStatement();
              String sql = "select *,count(f.Name),f.Name from film f, filmDetail fd, ticket t where f.startDate > '" + start + "' and f.endDate <  '" + end + "'and fd.filmID = f.filmID and fd.filmDetailID = t.filmDetailID group by f.name order by fd.filmDetailID asc limit '" +topN+"'";
              ResultSet rs = stmt.executeQuery(sql);
            while (rs.next())
           if (rs.getInt("fd.filmDetailID") > max) max = rs.getInt("fd.filmDetailID");
         if (rs.getInt("fd.filmDetailID") < min) min = rs.getInt("fd.filmDetailID");
          j++;
           ataset.setValue(rs.getInt("fd.filmDetailID"), cat,rs.getString("f.Name"));
           title1     = titles[0];
         chartDesc  = descs[0];
         chartTitle = order + " " + topN + " popular movie";
          chartYTitle = "Box Office record";
          chartXTitle = "Film Name";
          gender = " ";
          chart = ChartFactory.createBarChart(chartTitle, chartXTitle,   chartYTitle, dataset,PlotOrientation.VERTICAL, false, true, false);
        else
              print("Error: I don't inderstand your request!", response);
         return;
           catch (SQLException e)
         printE("Cannot open database connection? <br>", response);
         // printE(e.toString);
      e.printStackTrace();
      return;
         response.setContentType("application/pdf");
         Document document = new Document(PageSize.A4, 5, 5, 5, 5);
        try
             PdfWriter writer;
         writer = PdfWriter.getInstance(document, response.getOutputStream());
        HeaderFooter footer = new HeaderFooter(new Phrase("Page: "), true);
         footer.setBorder(Rectangle.NO_BORDER);
    document.setFooter(footer);
                   footer.setAlignment(Element.ALIGN_CENTER);
                   // step 3
                   document.open();
                   document.add(getHeader(title0, title1, start, end, gender, order, topN, chartDesc));
                   document.add(printChart(chart, writer));
                   document.add(getFooter(notes));
              catch(DocumentException de)
                   de.printStackTrace();
              // step 5
              document.close();
              return;
         }// end doGet()
         /** Handles the HTTP <code>POST</code> method.
          * @param request servlet request
          * @param response servlet response
         protected void doPost(HttpServletRequest request, HttpServletResponse response)
              throws ServletException, IOException
              // processRequest(request, response);
         /** Returns a short description of the servlet.
         public String getServletInfo()
              return "Generate reports for " + bigTitle;
         /* To print en error and exit(?) */
         private void printE(Object obj, HttpServletResponse response) throws IOException
              response.setContentType("text/html");
              PrintWriter out;
              out = response.getWriter();
              out.print(obj.toString());
              out.close();
              // To-Do: how to force exiting?
         // create data chart
         private PdfPTable getHeader(String title0, String title1, String start, String end, String sex, String order, int topN, String desc)
              Font fTitle0 = FontFactory.getFont("Helvetica", 42, Font.BOLD);
              Font fTitle1 = FontFactory.getFont("Helvetica", 24, Font.BOLD);
              Font fTitle3 = FontFactory.getFont("Helvetica", 12, Font.BOLD);
              Font fValue = FontFactory.getFont("Helvetica", 12, Font.UNDERLINE);
              Paragraph parStartEnd = new Paragraph();
              parStartEnd.add(new Phrase("Data start from:                  ", fTitle3));
              parStartEnd.add(new Phrase(start, fValue));
              parStartEnd.add(new Phrase("     to     ", fTitle3));
              parStartEnd.add(new Phrase(end, fValue));
              Paragraph parGenerateDate = new Paragraph();
              parGenerateDate.add(new Phrase("Report generated at:         ", fTitle3));
              parGenerateDate.add(new Phrase(new java.util.Date().toString(), fValue));
              Paragraph parGender = new Paragraph();
              parGender.add(new Phrase("Current show gender:       ", fTitle3));
              parGender.add(new Phrase(sex, fValue));
              Paragraph parTopN = new Paragraph();
              parTopN.add(new Phrase("Now is showing                 ", fTitle3));
              parTopN.add(new Phrase(order, fValue));
              parTopN.add(new Phrase("  ", fValue));
              parTopN.add(new Phrase(new Integer(topN).toString(), fValue));
              parTopN.add(new Phrase("   record(s)", fTitle3));
              // Start main table
              PdfPTable tblMain = new PdfPTable(1);
              tblMain.getDefaultCell().setBorder(0);
              // Print title
              tblMain.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
              tblMain.addCell(new Paragraph(title0, fTitle0));
              tblMain.addCell(new Paragraph(title1, fTitle1));
              tblMain.addCell("");
              tblMain.addCell("");
              tblMain.addCell("");
              // Print headers data
              //tblMain.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT);
              //tblMain.addCell(parInvoiceNum);
              //tblMain.addCell("");
              tblMain.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT);
              tblMain.addCell(parStartEnd);
              tblMain.addCell("");
              tblMain.addCell(parGenerateDate);
              tblMain.addCell("");
              if (sex != " ")
                   tblMain.addCell(parGender);
              else if(order != null && topN > 0)
                   tblMain.addCell(parTopN);
              else
                   tblMain.addCell(" \n");
              tblMain.addCell("");
              tblMain.setWidthPercentage(96);
              tblMain.addCell(new Paragraph("Description of this report:", fTitle3));
              tblMain.addCell(desc);
              tblMain.addCell("\n");
              // Finish main table
              return tblMain;
         // print a chart _directly_ to pdf and return a empty Pdftable...
         public PdfPTable printChart(JFreeChart chart, PdfWriter writer)
              PdfContentByte cb = writer.getDirectContent();
              int width = 550;
              int height = 450;
              PdfTemplate tp = cb.createTemplate(width, height);
              Graphics2D g2d = tp.createGraphics(width, height, new DefaultFontMapper());
              Rectangle2D r2d = new Rectangle2D.Double(0, 0, width, height); //->,
              chart.draw(g2d, r2d);
              g2d.dispose();
              cb.addTemplate(tp, 20, 170);
              // quick method to push down the footer text
              // the only things this method return
              PdfPTable tblDownDown = new PdfPTable(1);
              tblDownDown.getDefaultCell().setBorder(0);
              tblDownDown.addCell(" \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n");
              tblDownDown.addCell(" \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n");
              tblDownDown.addCell(" \n \n \n \n \n \n");
              return tblDownDown;
         public PdfPTable getFooter(String notes[])
              Font fNote = FontFactory.getFont("Helvetica", 14, Font.UNDERLINE);
              Font fComment = FontFactory.getFont("Helvetica", 12, Font.ITALIC);
              Font fTitle1 = FontFactory.getFont("Helvetica", 30, Font.ITALIC);
              // Start footer table
              PdfPTable tblFooter = new PdfPTable(1);
              tblFooter.getDefaultCell().setBorder(0);
              if (notes != null)
                   tblFooter.addCell(new Paragraph("Notes:", fNote));
                   tblFooter.addCell("");
                   tblFooter.addCell("");
                   tblFooter.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT);
                   for (int i=0;i<notes.length;i++)
                        if (notes[i] != null)
                             tblFooter.addCell(new Paragraph("" + (i+1) + ". " + notes[i] + "", fComment));
                             tblFooter.addCell("");
                             tblFooter.addCell("");
                        tblFooter.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
                        tblFooter.addCell(new Paragraph("- End of report -", fComment));
                        return tblFooter;
    }

    Go to the cache directory and see if you can open the report directly from here (not in IE).
    I have seen posts on problems with Acrobat Reader Plugin for IE (I believe it was version 6 of Reader).

  • Hi, I have converted different smartforms to pdf format.How to combine pdf?

    Hi All,
    I have converted different smartforms to pdf format. How to combine all the pdf's into single pdf.
    I need all the smartforms to be in single pdf.
    Please help me in this regard.
    Thanks in advance.

    Hi Keshu,
    Individual pdf should be sent to individual user.
    And at last all the pdfs of the smartform should be combined into one.
    And admin have the provision to download it .
    I mean the requirement is
    For example.
    For the month of september i will generate Pay Slip to each employee. And each pdf will be send to corresponding employee.
    And finally all the pay slips of all the employees will be combined into single PDF and admin will download it and keep it for reference.
    So as of now. I have generated individual pdfs and mailed it accordingly.
    But how to combine it into one PDF is my question.
    Please help me in this regard.
    Thanks in advance.

  • Convert Smartform in PDF format and send to SAP Workplace

    Hi to all.
    I need help of somebody expert in SMARTFORM's.
    I need to convert a smartform into PDF format and to send as attachement for SAP workplace
    of the user.
    I developed the next code.
    IT is to function and to send the mail for SAP workplace, but it happens that smartform
    contains images (logos) and tables, when the user tries to open the file pdf in inbox gives
    to error - "An unrecognized token ' q0 ' was found".
    I tried to call a smartform only with text and functioned well.
    Somebody can help me?
    My code:
    Begin ***********************************************
    REPORT zteste_nsa_send_pdf_sap_office.
    DATA: t_print LIKE zeps_fm04 OCCURS 0 WITH HEADER LINE,
          v_size TYPE i.
    DATA: ls_bil_invoice TYPE lbbil_invoice.
    TABLES: nast.
    DATA: i_otf TYPE itcoo OCCURS 0 WITH HEADER LINE,
    i_tline TYPE TABLE OF tline WITH HEADER LINE,
    i_receivers TYPE TABLE OF somlreci1 WITH HEADER LINE,
    i_record LIKE solisti1 OCCURS 0 WITH HEADER LINE,
    Objects to send mail.
    i_objpack LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
    i_objtxt LIKE solisti1 OCCURS 0 WITH HEADER LINE,
    i_objbin LIKE solisti1 OCCURS 0 WITH HEADER LINE,
    i_reclist LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
    Work Area declarations
    wa_objhead TYPE soli_tab,
    w_ctrlop TYPE ssfctrlop,
    w_compop TYPE ssfcompop,
    w_return TYPE ssfcrescl,
    wa_doc_chng TYPE sodocchgi1,
    w_data TYPE sodocchgi1,
    wa_buffer TYPE string,"To convert from 132 to 255
    Variables declarations
    v_form_name TYPE rs38l_fnam,
    v_len_in LIKE sood-objlen,
    v_len_out LIKE sood-objlen,
    v_len_outn TYPE i,
    v_lines_txt TYPE i,
    v_lines_bin TYPE i.
    START-OF-SELECTION.
      CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
        EXPORTING
          formname           = 'ZFPS_FICHA_VALORIZACAO'
        IMPORTING
          fm_name            = v_form_name
        EXCEPTIONS
          no_form            = 1
          no_function_module = 2
          OTHERS             = 3.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
        WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
      w_ctrlop-getotf    = 'X'.
      w_ctrlop-no_dialog = 'X'.
      w_compop-tdnoprev  = 'X'.
      CALL FUNCTION v_form_name
        EXPORTING
          control_parameters = w_ctrlop
          output_options     = w_compop
          user_settings      = 'X'
          is_bil_invoice     = ls_bil_invoice
          is_nast            = nast
          is_repeat          = 'X'
        IMPORTING
          job_output_info    = w_return
        TABLES
          t_list             = t_print
        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
          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 EQ 0.
      ENDIF.
    Convert PDF from 132 to 255.
      LOOP AT i_tline.
        TRANSLATE i_tline USING '~'.
        CONCATENATE wa_buffer i_tline 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.
    SEND MAIL
      REFRESH:  i_reclist,
                i_objtxt,
                i_objbin,
                i_objpack.
      CLEAR wa_objhead.
    Object with PDF.
      i_objbin[] = i_record[].
    Object with main text of the mail.
      i_objtxt = 'Fichas de Valorização e Esquemas Tipo'.
      APPEND i_objtxt.
    Document information.
      wa_doc_chng-obj_name   = 'SMART'.
      wa_doc_chng-expiry_dat = sy-datum + 10.
      wa_doc_chng-obj_descr  = 'Ficha de Valorização'.
      wa_doc_chng-sensitivty = 'F'. "Functional object
      wa_doc_chng-doc_size = ( v_lines_txt - 1 ) * 255 + STRLEN( i_objtxt ).
    Pack to main body as RAW.
    Obj. to be transported not in binary form
      DESCRIBE TABLE i_objtxt LINES v_lines_txt.
      READ TABLE i_objtxt INDEX v_lines_txt.
      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.
    Packing as PDF.
    Obj. to be transported in binary form
      DESCRIBE TABLE i_objbin LINES v_lines_bin.
      READ TABLE i_objbin INDEX v_lines_bin.
      i_objpack-transf_bin = 'X'.
      i_objpack-head_start = 1.
      i_objpack-head_num   = 0.
      i_objpack-body_start = 1.
      i_objpack-body_num   = v_lines_bin.
      i_objpack-doc_type   = 'PDF'.
      i_objpack-obj_name   = 'SMART'.
      CONCATENATE 'Ficha_Valorizacao' '.pdf' INTO i_objpack-obj_descr.
      i_objpack-doc_size = ( v_lines_bin - 1 ) * 255 + STRLEN( i_objbin ).
      APPEND i_objpack.
    e-mail receivers.
      CLEAR i_reclist.
      i_reclist-receiver = sy-uname.
      i_reclist-rec_type = 'B'.
      i_reclist-express  = 'X'.
      APPEND i_reclist.
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          document_data              = wa_doc_chng
          put_in_outbox              = 'X'
          commit_work                = ' '
        TABLES
          packing_list               = i_objpack
          object_header              = wa_objhead
          contents_bin               = i_objbin
          contents_txt               = i_objtxt
          receivers                  = i_reclist
        EXCEPTIONS
          too_many_receivers         = 1
          document_not_sent          = 2
          document_type_not_exist    = 3
          operation_no_authorization = 4
          parameter_error            = 5
          x_error                    = 6
          enqueue_error              = 7
          OTHERS                     = 8.
      IF sy-subrc EQ 0.
      ENDIF.
    End  *************************************************
    Thanks very much to all and Happy New year...
    Nelson

    Please check this link...
    [http://help.sap.com/saphelp_nw04/helpdata/en/27/67443cc0063415e10000000a11405a/content.htm|http://help.sap.com/saphelp_nw04/helpdata/en/27/67443cc0063415e10000000a11405a/content.htm]
    -Muktar

  • How to send output of smartform in pdf format as an attachment to email

    how to send output of smartform in pdf format as an attachment to email
    search before posting further and follow Forum rules
    Edited by: Vijay Babu Dudla on Jan 15, 2009 4:50 AM

    Did u check on sdn?
    i dont think so or else there are many posts on this topic and good wikis too.
    look at one of these code tutorial wiki
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/mail%2bsend%2bthrough%2boutput%2bcontrols
    So next time do use the search functionality.
    кu03B1ятu03B9к
    Edited by: kartik tarla on Jan 15, 2009 12:33 PM

  • Smartform In PDF Format

    Hi All,
    Can anyone send me the sample code for attaching a SmartForm in PDF Format.
    Thanks in advance.
    Ulhas

    hi,
    check this
    http://www.****************/Tutorials/Smartforms/OTF2PDF.htm

  • How can I generate javadoc in PDF format?

    Hi,
    How can I generate javadoc in PDF format?
    Thanks,
    Fayezin

    HTML to PDF with Java, using OpenOffice.org - example here: [http://www.dancrintea.ro/html-to-pdf/|http://www.dancrintea.ro/html-to-pdf/]
    You can use OpenOffice.org, running as a server and command it remotely for document convertion.
    Besides HTML to PDF, there are also possible other convertions:
    doc --> pdf, html, txt, rtf
    xls --> pdf, html, csv
    ppt --> pdf, swf
    Code example:
    import officetools.OfficeFile; // this is my tools package
    FileInputStream fis = new FileInputStream(new File("c:/test.html"));
    FileOutputStream fos = new FileOutputStream(new File("c:/test.pdf"));
    // suppose OpenOffice.org runs on localhost, port 8100
    OfficeFile f = new OfficeFile(fis,"localhost","8100", true);
    f.convert(fos,"pdf");
    -----------------------------------------------------------------------------------------------------------------------------------------

  • VF01- invoice smartform in PDF format to be sent thro' mail

    Hello Gurus,
    We have a requirement from our client that we need to trigger a mail of invoice smartform in PDF format on saving in VF01.
    Can any body suggest the steps in NACE and also output..
    Regards

    As per your post, I understood that,
    After saving Invoice , automatically Invoice has to send in PDF format to the respective email id maintained in CMR-Payer master
    if yes, this involves ABAP & BASIS ,
    ABAP- Program & FOrm routine has to created & assigned in respective output type & type-PDF (Check in NACE- Output type)
    for this, you need to maintain the Condition record- VV31 - with medium as "Mail" -
    or else,
    you can do this manually also, in VF31- you can give a print  & save in PDF format- you can send it - but its complete manual process.

  • Sending smartform as PDF attachment through email

    Hi,
    I have used the FM SO_NEW_DOCUMENT_ATT_SEND_API1 to send the smartform as PDF attachment through email.In SOST transaction I can see that the mail has been sent to the reciepient,but the mail is not going to the mail box.What would be the reason for this?
    Regards,
    Hema

    That should be the basis issue. They needs to do some settings. Please ask them to do so.
    Pranav

  • Smartforms as PDF format

    HI Experts,
                    How do I dispaly my smartforms in PDF format. How do I get Spool ID. where all the changes I have to made. plz describe properly.
    Thanks. Alot.
    Khan

    Hi
    You will get the Spool ID in the Fun module itself (in SE38 program)
    in the output paramters <b> DOCUMENT_OUTPUT_INFO =</b>  or
    <b>JOB_OUTPUT_INFO =</b>  take that
    call function 'SSF_FUNCTION_MODULE_NAME'
    exporting
    formname = 'ZSMARTFORM'
    VARIANT = ' '
    DIRECT_CALL = ' '
    IMPORTING
    FM_NAME = FM_NAME
    EXCEPTIONS
    NO_FORM = 1
    NO_FUNCTION_MODULE = 2
    OTHERS = 3.
    if sy-subrc <> 0.
    WRITE: / 'ERROR 1'.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    call function FM_NAME
    EXPORTING
    ARCHIVE_INDEX =
    ARCHIVE_INDEX_TAB =
    ARCHIVE_PARAMETERS =
    CONTROL_PARAMETERS =
    MAIL_APPL_OBJ =
    MAIL_RECIPIENT =
    MAIL_SENDER =
    OUTPUT_OPTIONS =
    USER_SETTINGS = 'X'
    IMPORTING
    <b>* DOCUMENT_OUTPUT_INFO =</b>
    <b>JOB_OUTPUT_INFO =</b>
    JOB_OUTPUT_OPTIONS =
    TABLES
    GS_MKPF = INT_MKPF
    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.
    and pass that spool ID to the fun module
    call function 'CONVERT_ABAPSPOOLJOB_2_PDF'
           exporting
                src_spoolid   = spoolid
                no_dialog     = 'X'
           importing
                pdf_bytecount = pdf_fsize
           tables
                pdf           = pdf_table
           exceptions
                others        = 0.
    Now PDF data is in PDF_TABLE
    so download it using GUI_DOWNLOAD and send it to your mail ID
    <b>Reward points for useful Answers</b>
    Regards
    Anji

  • Identifying Technical name of a query through a portal link

    Hi,
    If from a portal link I see a BW report, how can I know its technical name so that I can access it in BEx to see the query definition. The title on the portal appears not to be helping.
    Thanks

    In the future, please do not post the same question more than once:
    Identifying Technical name of a query through a portal link
    Thanks!

  • Conversion of sapscripts/smartforms to PDf format

    i want to use the standard program RSTXPDFT4 for converting into pdf format. but i want a way in which the spool number is automatically generated for the current script or smartform opened instead of the manual entry of the spool number by the user.

    hi bhaskar,
    this sample code may help u to convert smartforms to pdf.
    report ztest_smartforms_to_pdf
    DATA : FM_NAME TYPE  RS38L_FNAM,
           IT_VENDOR LIKE TABLE OF ZVENDOR,
           IT_MATERIAL LIKE TABLE OF ZMATERIAL,
           IT_PO LIKE TABLE OF ZPURCHASEORDER.
    DATA: CTRLPARAMS TYPE SSFCTRLOP,
          JOBOUTPUT TYPE SSFCRESCL,
          TLINES LIKE TABLE OF TLINE,
          IT_FILETABLE LIKE TABLE OF FILE_TABLE WITH HEADER LINE,
          FNAME TYPE STRING,
          RC TYPE I,
          BIN_SIZE TYPE I.
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
      EXPORTING
        FORMNAME                 = 'ZSSF_PURCHASEORDER'
      VARIANT                  = ' '
      DIRECT_CALL              = ' '
    IMPORTING
       FM_NAME                  = FM_NAME.
    CTRLPARAMS-GETOTF = 'X'.
    CALL FUNCTION FM_NAME
      EXPORTING
      ARCHIVE_INDEX              =
      ARCHIVE_INDEX_TAB          =
      ARCHIVE_PARAMETERS         =
        CONTROL_PARAMETERS         = CTRLPARAMS
      MAIL_APPL_OBJ              =
      MAIL_RECIPIENT             =
      MAIL_SENDER                =
      OUTPUT_OPTIONS             =
      USER_SETTINGS              = 'X'
      IMPORTING
      DOCUMENT_OUTPUT_INFO       =
        JOB_OUTPUT_INFO            = JOBOUTPUT
      JOB_OUTPUT_OPTIONS         =
      TABLES
        IT_VENDOR                  = IT_VENDOR
        IT_PO                      = IT_PO
        IT_MATERIAL                = IT_MATERIAL.
    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.
    CALL FUNCTION 'CONVERT_OTF'
      EXPORTING
        FORMAT                      = 'PDF'
      MAX_LINEWIDTH               = 132
      ARCHIVE_INDEX               = ' '
      COPYNUMBER                  = 0
      IMPORTING
        BIN_FILESIZE                = BIN_SIZE
      TABLES
        OTF                         = JOBOUTPUT-OTFDATA
        LINES                       = TLINES
    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.
    CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
      EXPORTING
        WINDOW_TITLE            = 'ENTER A FILENAME'
        DEFAULT_FILENAME        = 'REPORT.PDF'
        FILE_FILTER             = '*.PDF'
        INITIAL_DIRECTORY       = 'C:\'
      CHANGING
        FILE_TABLE              = IT_FILETABLE[]
        RC                      = RC.
      LOOP AT IT_FILETABLE.
        FNAME = IT_FILETABLE-FILENAME.
      ENDLOOP.
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          BIN_FILESIZE                  = BIN_SIZE
          FILENAME                      = FNAME
          FILETYPE                      = 'BIN'
        TABLES
          DATA_TAB                      = tlines.

  • Smartforms to pdf format  while emailing

    Hi All,
           My requirement is (Smartforms):
    I want to send the smartform print values to some email id in pdf format .
    How to do that .....
    Ashok..

    Below code will help you to get the smartfrom output in pDF format and Send it across email.
    Create a samrtfrom according to your requirement and follow the below code to generate PDF and send it across the Email
    *& Report  YSMARTFORM_EMAIL
    REPORT  YSMARTFORM_EMAIL.
    TABLES: VBAK.
    Constants                                                            *
    CONSTANTS:
      C_X        TYPE C VALUE 'X',         " Value X
      C_0        TYPE C VALUE '0',                              " Value 0
      C_1        TYPE C VALUE '1'.                              " Value 1
    Work Variables declaration                                           *
    DATA:
       W_UCOMM  LIKE SY-UCOMM,             " Function code
       W_TABLN  TYPE I,                    " Lines
       W_LINE   TYPE SO_TEXT255,           " Line of text
       W_EADDR(60) TYPE C.                 " FieldLength for Email
    DATA: VBAP_TAB LIKE VBAP OCCURS 0 WITH HEADER LINE.
    DATA: W_FUNMOD TYPE RS38L_FNAM.
    Structure to hold the Attributes of new Document
    DATA: FS_DOCDATA TYPE SODOCCHGI1.
    Internal table for storing OTF data form Smart-Form
    DATA: BEGIN OF FS_OTF_DATA.
            INCLUDE STRUCTURE ITCOO.
    DATA: END OF FS_OTF_DATA,
          T_OTF_DATA LIKE STANDARD TABLE OF FS_OTF_DATA.
    Internal table for storing PDF data form Smart-Form
    DATA: BEGIN OF FS_PDF_DATA.
            INCLUDE STRUCTURE TLINE.
    DATA: END OF FS_PDF_DATA,
          T_PDF_DATA LIKE STANDARD TABLE OF FS_PDF_DATA.
    Internal table to hold the attachment data text of the email
    DATA: BEGIN OF FS_ATTACH_DATA.
            INCLUDE STRUCTURE SOLISTI1.
    DATA: END OF FS_ATTACH_DATA,
          T_ATTACH_DATA LIKE STANDARD TABLE OF FS_ATTACH_DATA.
    Internal table to hold Message body of the email
    DATA: BEGIN OF FS_MESSBODY.
            INCLUDE STRUCTURE SOLISTI1.
    DATA: END OF FS_MESSBODY,
          T_MESSBODY LIKE STANDARD TABLE OF FS_MESSBODY.
    Internal table for packing list for main document
    DATA: BEGIN OF FS_OBJPACK.
            INCLUDE STRUCTURE SOPCKLSTI1.
    DATA: END OF FS_OBJPACK,
          T_OBJPACK LIKE STANDARD TABLE OF FS_OBJPACK.
    Internal table for header text of the attachment
    DATA: BEGIN OF FS_OBJHEAD.
            INCLUDE STRUCTURE SOLISTI1.
    DATA: END OF FS_OBJHEAD,
          T_OBJHEAD LIKE STANDARD TABLE OF FS_OBJHEAD.
    Internal table receiver information
    DATA: BEGIN OF FS_RECEIVER.
            INCLUDE STRUCTURE SOMLRECI1.
    DATA: END OF FS_RECEIVER,
          T_RECEIVER LIKE STANDARD TABLE OF FS_RECEIVER.
    *Internal table to store data upto 255 lines
    DATA: BEGIN OF FS_OBJCONT.
            INCLUDE STRUCTURE SOLI.
    DATA: END OF FS_OBJCONT,
          T_OBJCONT LIKE STANDARD TABLE OF FS_OBJCONT.
    *DATA : P_VBELN LIKE VBAK-VBELN.
    DATA: P_EADDR(60) TYPE C
         VALUE '[email protected]'.
    PARAMETERS : P_VBELN LIKE VBAK-VBELN.
    *PARAMETERS:
    P_EADDR(60) TYPE C.     " Email address
    SELECT SINGLE *
      FROM VBAK
    WHERE VBELN EQ P_VBELN.
    SELECT *
      FROM VBAP
      INTO TABLE VBAP_TAB
    WHERE VBELN EQ P_VBELN.
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
      EXPORTING
        FORMNAME                 = 'YSMARTFORM_EMAIL'
       VARIANT                  = ' '
       DIRECT_CALL              = ' '
    IMPORTING
       FM_NAME                  = W_FUNMOD
    EXCEPTIONS
       NO_FORM                  = 1
       NO_FUNCTION_MODULE       = 2
       OTHERS                   = 3      .
    IF SY-SUBRC <> 0.
    Do nothing
    ENDIF.
    DATA: FS_CONT_PARM TYPE SSFCTRLOP,
          T_JOB_INFO    TYPE SSFCRESCL.
    CLEAR FS_CONT_PARM.
    FS_CONT_PARM-GETOTF    = 'X'.
    FS_CONT_PARM-NO_DIALOG = 'X'.
    FS_CONT_PARM-PREVIEW   = ''.
    CALL FUNCTION W_FUNMOD
      EXPORTING
       ARCHIVE_INDEX              =
       ARCHIVE_INDEX_TAB          =
       ARCHIVE_PARAMETERS         =
         CONTROL_PARAMETERS         = FS_CONT_PARM
       MAIL_APPL_OBJ              =
       MAIL_RECIPIENT             =
       MAIL_SENDER                =
       OUTPUT_OPTIONS             =
       USER_SETTINGS              = 'X'
        VBAK                       = VBAK
      IMPORTING
       DOCUMENT_OUTPUT_INFO       =
        JOB_OUTPUT_INFO            = T_JOB_INFO
       JOB_OUTPUT_OPTIONS         =
      TABLES
        VBAP                       = VBAP_TAB
    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.
    PERFORM CONVERT_OTF_TO_PDF.
    *&      Form  convert_otf_to_pdf
          text
    -->  p1        text
    <--  p2        text
    FORM CONVERT_OTF_TO_PDF .
      DATA: LV_BYTES TYPE P.
      IF FS_CONT_PARM-GETOTF EQ 'X'.
        REFRESH T_OTF_DATA.
        CLEAR FS_OTF_DATA.
        LOOP AT T_JOB_INFO-OTFDATA INTO FS_OTF_DATA.
          APPEND FS_OTF_DATA TO T_OTF_DATA.
          CLEAR FS_OTF_DATA.
        ENDLOOP.                           " LOOP AT t_outtab-otfdata
        CALL FUNCTION 'CONVERT_OTF'
          EXPORTING
            FORMAT                = 'PDF'
            MAX_LINEWIDTH         = 255
          IMPORTING
            BIN_FILESIZE          = LV_BYTES
          TABLES
            OTF                   = T_OTF_DATA
            LINES                 = T_PDF_DATA
          EXCEPTIONS
            ERR_MAX_LINEWIDTH     = 1
            ERR_FORMAT            = 2
            ERR_CONV_NOT_POSSIBLE = 3
            OTHERS                = 4.
        IF SY-SUBRC EQ 0 AND LV_BYTES IS NOT INITIAL.
          PERFORM TABLE_SHIFT.
    To send the output by email
          PERFORM SET_UP_EMAIL.
          PERFORM SEND_MAIL.
        ENDIF.                             " IF sy-subrc EQ space.
      ENDIF.                               " IF gs_control_pars-getotf
    ENDFORM.                               " convert_otf_to_pdf
    Form  set_up_email                                                   *
    This subroutine is used to set mail attributes                       *
    There are no interface parameters to be passed to this subroutine.   *
    FORM SET_UP_EMAIL .
    To setup attributes of the document
      PERFORM SET_EMAIL_HEADER.
    To set body of email
      PERFORM SET_EMAILBODY.
    To convert output table data with tab delimiter
      PERFORM PREPARE_OUTPUT_DATA_FOR_ATTACH.
    To set the Receipents
      PERFORM SET_RECEIPENTS.
    ENDFORM.                               " Set_up_email
    Form  set_email_header                                               *
    This subroutine is used to Setup the attributes of the Document      *
    There are no interface parameters to be passed to this subroutine.   *
    FORM SET_EMAIL_HEADER.
      CONSTANTS :
        LC_P TYPE C   VALUE 'P',             " Production system name
        LC_F TYPE C   VALUE 'F',             " Sensitivity
        LC_OBJNAME(6) TYPE C                 " Object name
                      VALUE 'SAPRPT'.
      CLEAR FS_DOCDATA.
    Populate the subject/generic message attributes
      FS_DOCDATA-DOC_SIZE   = 1.
      FS_DOCDATA-OBJ_LANGU  = SY-LANGU.
      FS_DOCDATA-OBJ_NAME   = LC_OBJNAME.
      FS_DOCDATA-SENSITIVTY = LC_F.
      IF SY-SYSID+0(1) NE LC_P.
        CONCATENATE 'Test mail'(003)
                    'Sales Order Details'(002)
               INTO FS_DOCDATA-OBJ_DESCR
          SEPARATED BY SPACE.
      ELSE.
        MOVE TEXT-002 TO FS_DOCDATA-OBJ_DESCR.
      ENDIF.                               " IF sy-sysid+0(1)...
    ENDFORM.                               " Set_email_header
    Form  set_emailbody                                                  *
    This subroutine is used to set body of an email                      *
    There are no interface parameters to be passed to this subroutine.   *
    FORM SET_EMAILBODY.
      CONSTANTS:
        LC_DOC_TYPE(3) TYPE C VALUE 'RAW'. " Document type
      REFRESH : T_OBJPACK,
                T_MESSBODY.
      CLEAR : FS_OBJPACK,
              FS_MESSBODY.
      MOVE:
        'Hi,'(004) TO FS_MESSBODY-LINE.
      APPEND FS_MESSBODY TO T_MESSBODY.
      CLEAR FS_MESSBODY.
      MOVE:
      'The attachment contains sales order details.'(005)
       'www.google.com'
        TO FS_MESSBODY-LINE.
      APPEND FS_MESSBODY TO T_MESSBODY.
      CLEAR W_TABLN.
      DESCRIBE TABLE T_MESSBODY LINES W_TABLN.
      CLEAR FS_MESSBODY.
      READ TABLE T_MESSBODY INTO FS_MESSBODY INDEX W_TABLN.
      FS_DOCDATA-DOC_SIZE = ( W_TABLN - 1 ) * 255 + STRLEN( W_LINE ).
      MOVE:
        SPACE    TO FS_OBJPACK-TRANSF_BIN,
        C_1      TO FS_OBJPACK-HEAD_START,
        C_0      TO FS_OBJPACK-HEAD_NUM,
        C_1      TO FS_OBJPACK-BODY_START,
        W_TABLN  TO FS_OBJPACK-BODY_NUM,
        LC_DOC_TYPE TO FS_OBJPACK-DOC_TYPE.
      APPEND FS_OBJPACK TO T_OBJPACK.
    ENDFORM.                               " Set_emailbody
    Form  prepare_output_data_for_attach                                 *
    To convert the output table data with comma delimiter                *
    There are no interface parameters to be passed to this subroutine.   *
    FORM PREPARE_OUTPUT_DATA_FOR_ATTACH.
      CONSTANTS:
        LC_DOC_TYPE(3) TYPE C VALUE 'PDF', " Document type
        LC_OBJNAME(6)  TYPE C VALUE 'SAPRPT'. " Object name
      REFRESH T_OBJHEAD.
      REFRESH T_ATTACH_DATA[].
      CLEAR   FS_ATTACH_DATA.
      T_ATTACH_DATA[] = T_OBJCONT[].
      DESCRIBE TABLE T_ATTACH_DATA LINES W_TABLN.
      FS_DOCDATA-DOC_SIZE   = ( W_TABLN - 1 ) * 255 + STRLEN( W_LINE ).
      FS_OBJPACK-BODY_NUM   = W_TABLN.
      FS_OBJPACK-DOC_SIZE   = W_TABLN * 255.
      FS_OBJPACK-TRANSF_BIN = C_X.
      FS_OBJPACK-HEAD_START = C_1.
      FS_OBJPACK-HEAD_NUM   = C_1.
      FS_OBJPACK-BODY_START = C_1.
      FS_OBJPACK-DOC_TYPE   = LC_DOC_TYPE.
      FS_OBJPACK-OBJ_NAME   = 'Attachment'.
      FS_OBJPACK-OBJ_DESCR  = 'Sales Order Details.PDF'(007).
      APPEND FS_OBJPACK TO T_OBJPACK.
    ENDFORM.                               " Prepare_output_data_for_attach
    Form  set_receipents                                                 *
    This subroutine is used to set the Receipents                        *
    There are no interface parameters to be passed to this subroutine.   *
    FORM SET_RECEIPENTS .
      CONSTANTS
       LC_REC_TYPE TYPE C VALUE 'U'.      " Receipent type
      REFRESH T_RECEIVER.
      IF P_EADDR IS NOT INITIAL.
        MOVE:
          P_EADDR TO FS_RECEIVER-RECEIVER,
          LC_REC_TYPE TO FS_RECEIVER-REC_TYPE.
        APPEND FS_RECEIVER TO T_RECEIVER.
      ENDIF.                               " IF P_EMAIL IS NOT.....
    ENDFORM.                               " Set_receipents
    Form  send_mail                                                      *
    This subroutine is used to send output by email                      *
    There are no interface parameters to be passed to this subroutine.   *
    FORM SEND_MAIL.
      CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
        EXPORTING
          DOCUMENT_DATA                   = FS_DOCDATA
          PUT_IN_OUTBOX                   = C_X
        SENDER_ADDRESS                   = SY-UNAME
        SENDER_ADDRESS_TYPE              = 'B'
          COMMIT_WORK                     = C_X
        TABLES
          PACKING_LIST                    = T_OBJPACK
          OBJECT_HEADER                   = T_OBJHEAD
          CONTENTS_BIN                    = T_ATTACH_DATA
          CONTENTS_TXT                    = T_MESSBODY
          RECEIVERS                       = T_RECEIVER
       EXCEPTIONS
         TOO_MANY_RECEIVERS               = 1
         DOCUMENT_NOT_SENT                = 2
         DOCUMENT_TYPE_NOT_EXIST          = 3
         OPERATION_NO_AUTHORIZATION       = 4
         PARAMETER_ERROR                  = 5
         X_ERROR                          = 6
         ENQUEUE_ERROR                    = 7
         OTHERS                           = 8.
      IF SY-SUBRC NE 0.
        MESSAGE I007(CLAIM).
      ELSE.
        MESSAGE S592(EI).
      ENDIF.                               " IF sy-subrc NE 0.
    ENDFORM.                               " Send_mail
    *&      Form  table_shift
    The PDF file that is generated out of the above function module
    cannot be transported as it needs to be of 255 chars.Hence
    converting the file to get a 255 char single line,internal table.
    *There are no interface parameters to be passed to this subroutine
    FORM TABLE_SHIFT .
      CONSTANTS:
        CNV_HEXCONST_ZERO TYPE X VALUE '00'.
      DATA:
        LV_BIG_LINES(268) TYPE C
                          OCCURS 0 WITH HEADER LINE.
      DATA:
        LFL_FLAG          TYPE C,
        LV_LEFT_T(268)    TYPE C,
        LV_LEFT_I         TYPE I,
        TV_LEFT_I         TYPE I,
        LV_CURR_I         TYPE I.
      FIELD-SYMBOLS: <F>.
    Get the lines into a table of 268 char as the first step to put it in
    the pdf file of 255 chars
      CLEAR LFL_FLAG.
      LOOP AT T_PDF_DATA INTO FS_PDF_DATA.
        IF LFL_FLAG EQ ' '.
          CLEAR LV_BIG_LINES WITH CNV_HEXCONST_ZERO.
          ASSIGN LV_BIG_LINES(134) TO <F>.
          <F> = FS_PDF_DATA.
          LFL_FLAG = 'X'.
        ELSE.
          LV_BIG_LINES+134 = FS_PDF_DATA.
          APPEND LV_BIG_LINES.
          CLEAR: LFL_FLAG.
        ENDIF.                             " If lfl_flag = ''..
      ENDLOOP.                             " Loop at t_pdf
      IF LFL_FLAG EQ 'X'.
        APPEND LV_BIG_LINES.
      ENDIF.                               " If lflf_flag eq 'X'..
    Next fill it into a 255 char table
      CLEAR: LV_LEFT_T, LV_LEFT_I, TV_LEFT_I.
      LV_CURR_I = 255.
      LOOP AT LV_BIG_LINES.
        IF LV_LEFT_I NE 0.
          IF LV_CURR_I NE 0.
            FS_OBJCONT(LV_LEFT_I)           = LV_LEFT_T(LV_LEFT_I).
            FS_OBJCONT+LV_LEFT_I(LV_CURR_I) = LV_BIG_LINES(LV_CURR_I).
          ELSE.
            FS_OBJCONT = LV_LEFT_T(LV_LEFT_I).
          ENDIF.                           " IF lv_curr_i NE 0
        ELSE.
          FS_OBJCONT = LV_BIG_LINES(LV_CURR_I).
        ENDIF.                             " IF lv_left_i NE 0
        APPEND FS_OBJCONT TO T_OBJCONT.
        TV_LEFT_I = 268 - LV_CURR_I.
        IF TV_LEFT_I > 255.
          FS_OBJCONT = LV_BIG_LINES+LV_CURR_I(255).
          APPEND FS_OBJCONT TO T_OBJCONT.
          LV_LEFT_I = TV_LEFT_I - 255.
          TV_LEFT_I = 255 + LV_CURR_I.
          LV_CURR_I = 255 - LV_LEFT_I.
          LV_LEFT_T = LV_BIG_LINES+TV_LEFT_I.
        ELSE.
          LV_LEFT_T = LV_BIG_LINES+LV_CURR_I.
          LV_LEFT_I = 268 - LV_CURR_I.
          LV_CURR_I = 255 - LV_LEFT_I.
        ENDIF.                             " IF tv_left_i > 255
      ENDLOOP.                             " LOOP AT lv_big_lines.
      CLEAR FS_OBJCONT WITH CNV_HEXCONST_ZERO.
      ASSIGN FS_OBJCONT(LV_LEFT_I) TO <F>.
      <F> = LV_LEFT_T(LV_LEFT_I).
      APPEND FS_OBJCONT TO T_OBJCONT.
    ENDFORM.                               " Table_shift

  • SMARTFORM TO PDF FORMAT

    Hi All,
    I have a requirement to get a print preview of the smartform in the pdf format and have the option to either print it or save it.
    meaning - the adobe application must automatically open and in it, there must be a window to display the smartform in the PDF format.
    the code i have so far is as below
      CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
           EXPORTING
                FORMNAME           = W_FORM_NAME
           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
    gst_output_options-tddest = 'FRNT_End_Print'. "Frontend printer
    gst_output_options-tdnewid = sy-prnew.
    gst_output_options-tdimmed = 'X'.
    gst_output_options-tddelete = sy-prrel.
    clear gst_control_parameters.
    gst_control_parameters-no_dialog = 'X'.
    gst_control_parameters-getotf = 'X'.
    gst_control_parameters-preview = 'X'. "Deactivate preview!
    *Call the original function module.
    call function w_fmodule
    exporting
    control_parameters = gst_control_parameters
    output_options = gst_output_options
    importing
    job_output_info = gt_job_output_info
    job_output_options = gt_output_options
    tables
    tbl_amt = final_tab
    exceptions
    formatting_error = 1
    internal_error = 2
    send_error = 3
    user_canceled = 4.
    if sy-subrc ne 0.
    message id sy-msgid type sy-msgty number sy-msgno
    with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    endif.
      T_OTF[] = gt_job_output_info-OTFDATA[].
    call function 'SSFCOMP_PDF_PREVIEW'
    exporting
    i_otf = t_otf
    exceptions
    convert_otf_to_pdf_error = 1
    cntl_error = 2
    others = 3.
    if sy-subrc ne 0.
    message id sy-msgid type sy-msgty number sy-msgno
    with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    endif.
    The adobe application is launched but the window inside does not hold anything.
    i get a pop-up inside the adobe window with the message " FILE DOES NOT BEGIN WITH '%PDF-' ".
    Any suggestions are greatly appreciated.
    hoping to hear from you all.
    thank you.
    Sandeep

    Hi Sandeep,
              Plz try with this code this code is working properly.
    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.
    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 = 'ZSM_PDF_1'
    * 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 = F_DATE
    IMPORTING
    * DOCUMENT_OUTPUT_INFO =
    job_output_info = t_otfdata
    * JOB_OUTPUT_OPTIONS =
    TABLES
         ITAB = ITAB
    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'
    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 = 'C:\Users\KO58\Desktop\test1.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.
    If usefull plz give rewards.
    Cheers
    Anirudh

Maybe you are looking for

  • Unable to capture Input field value on BSP page

    Hi I have copied ROS (SRM) standard application ROS_PRESCREEN3 into custom and added one input field . Now when user enters some value in it , i am not able to get that value in my back-hand code. I have treid the availble code on Fourm , its not wor

  • "Could not complete your request because of a program error" when applying text layer style

    This just started happening recently after opening up an Illustrator file in Photoshop. Any clue?

  • "Closed Clam" question

    I use the MacBook Pro attached to a HDTV. My question is.. If I have it in Closed Clam mode for a extended period of time will this hurt and damage the MacBook Pro ?

  • Calling VB Executable using HOST to Slow....

    Hello Friends, I have one form containg one program unit, Program unit has one cursor,which contains Employee Id and Email Id, Based on Employee ID Report is generated in HTML Format.Next I am Calling VB Executable using HOST which Sends generated re

  • Voip dtmf

    Hello, I'm trying to understand how dtmf is different from analog world to the VOIP world.  In the analog world from my understanding dtmf are tones frequency so when caller dials numbers then does numbers have different tones frequency and it send t