Convert a web report into pdf and print (in BW 3.5)

Hello gurus,
i have few web reports ( created using WAD). i am looking for a possibility to convert a web report (viewed in a browser by a user) into pdf and print them and this should be done by pressing a button.
Is it possible in BW 3.5 version?.
could anyone please help me?
Any how to docs. would be really helpful.
thanks and regards
kumar

Here it is
<HTML>
<!-- BW data source object tags -->
<object>
         <param name="OWNER" value="SAP_BW"/>
         <param name="CMD" value="SET_DATA_PROVIDER"/>
         <param name="NAME" value="DATAPROVIDER_1"/>
         <param name="DATA_PROVIDER_ID" value=""/>
         DATA_PROVIDER:             DATAPROVIDER_1
</object>
<object>
         <param name="OWNER" value="SAP_BW"/>
         <param name="CMD" value="SET_PROPERTIES"/>
         <param name="TEMPLATE_ID" value="ZPD_ADHOC_PAGE"/>
         <param name="MENU_BACK" value=""/>
         <param name="MENU_BACK_TO_START" value=""/>
         <param name="SUPPRESS_WARNINGS" value="X"/>
         <param name="MENU_FILTER" value=""/>
         <param name="MENU_FILTER_ON_AXIS" value=""/>
         <param name="MENU_SELECT_FILTER" value=""/>
         <param name="MENU_FILTER_ON_AXIS_CHART" value=""/>
         <param name="MENU_FILTER_CHART" value=""/>
         <param name="MENU_FILTER_DRILL_DOWN" value=""/>
         <param name="MENU_DRILL_UP_GIS" value=""/>
         <param name="MENU_DRILL_DOWN" value=""/>
         <param name="MENU_EXCHANGE_OBJECTS" value=""/>
         <param name="MENU_REMOVE_DRILL_DOWN" value=""/>
         <param name="MENU_SWITCH_AXIS" value=""/>
         <param name="MENU_HIERARCHY_NODE_DRILL" value=""/>
         <param name="MENU_HIERARCHY_DRILL" value=""/>
         <param name="MENU_HIERARCHY_STATE" value=""/>
         <param name="MENU_SORT" value=""/>
         <param name="MENU_CALCULATE_RESULT" value=""/>
         <param name="MENU_CALCULATE_VALUE" value=""/>
         <param name="MENU_CUMULATE_VALUE" value=""/>
         <param name="MENU_DISPLAY_DOCUMENTS" value=""/>
         <param name="MENU_DOCUMENT_CREATE" value=""/>
         <param name="MENU_DISPLAY_DOCUMENT_PROP" value=""/>
         <param name="MENU_DISPLAY_DOCUMENT_SELEC" value=""/>
         <param name="MENU_RRI" value=""/>
         <param name="MENU_EXPORT_TO_CSV" value=""/>
         <param name="MENU_EXPORT_TO_XLS" value=""/>
         <param name="MENU_BOOKMARK" value=""/>
         <param name="MENU_CHARACTERISTIC_PROPERTIES" value=""/>
         <param name="MENU_VALUE_PROPERTIES" value=""/>
         <param name="MENU_QUERY_PROPERTIES" value=""/>
         <param name="MENU_VARIABLE_SCREEN" value=""/>
         <param name="MENU_CURRENCY_CONVERSION" value=""/>
         <param name="MENU_ENHANCED" value=""/>
         TEMPLATE PROPERTIES
</object>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft DHTML Editing Control">
<TITLE>SAP BW Reporting Print Page</TITLE>
<link href="/sap/bw/Mime/BEx/StyleSheets/BWReports.css" type="text/css" rel="stylesheet"/>
<script type"text/javascript">
<!--
//   Global Variable Definition
var dataTable = "";
var pageRowCnt = 0;
var prevPage = 0;
var ColumnCnt = 0;
var PrintDateTimeStamp = new Date();
var rptWidth = 0;
//DATE STAMP FUNCTION
function datestamp(){
           var Today = new Date()
           document.write(Today);
function getReportTitle() {
                var myQueryString = window.location.search;
                var startOfRptTitle = myQueryString.indexOf("QTITLE=");
                if (startOfRptTitle != -1)
                     var endOfRptTitle = myQueryString.indexOf("&", startOfRptTitle + 7);
                     var myTitle = unescape(myQueryString.substring(startOfRptTitle + 7, endOfRptTitle));
                     var rpttitle = "";
                     for(i=0;i<myTitle.length;i++){
                         if (myTitle.substring(i,i+1) == "+"){
                             rpttitle = rpttitle + ' ';
                         else
                             rpttitle = rpttitle + (myTitle.substring(i,i+1));
                else
                     var rpttitle =  "Unspecified Query Title";
                return rpttitle;
queryTitle=getReportTitle();
function getHeading2() {
                var myQueryString = window.location.search;
                var startOfHdr2 = myQueryString.indexOf("HDR2=");
                if (startOfHdr2 != -1)
                     var endOfHdr2 = myQueryString.indexOf("&", startOfHdr2 + 5);
                     var myHdr2 = unescape(myQueryString.substring(startOfHdr2 + 5, endOfHdr2));
                     var hdr2 = "";
                     for(i=0;i<myHdr2.length;i++){
                         if (myHdr2.substring(i,i+1) == "+"){
                             hdr2 = hdr2 + ' ';
                         else
                             hdr2 = hdr2 + (myHdr2.substring(i,i+1));
                else
                     var hdr2 =  "#";
                return hdr2;
header2=getHeading2();
function getHeading3() {
                var myQueryString = window.location.search;
                var startOfHdr3 = myQueryString.indexOf("HDR3=");
                if (startOfHdr3 != -1)
                     var endOfHdr3 = myQueryString.indexOf("&", startOfHdr3 + 5);
                     var myHdr3 = unescape(myQueryString.substring(startOfHdr3 + 5, endOfHdr3));
                     var hdr3 = "";
                     for(i=0;i<myHdr3.length;i++){
                         if (myHdr3.substring(i,i+1) == "+"){
                             hdr3 = hdr3 + ' ';
                         else
                             hdr3 = hdr3 + (myHdr3.substring(i,i+1));
                else
                     var hdr3 =  "#";
                return hdr3;
header3=getHeading3();
function getAsOfDate() {
                var myQueryString = window.location.search;
                var startOfRelevance = myQueryString.indexOf("ASOFDATE=");
                if (startOfRelevance != -1)
                     var endOfRelevance = myQueryString.indexOf("&", startOfRelevance + 9);
                     var myRelevance = unescape(myQueryString.substring(startOfRelevance + 9, endOfRelevance));
                     var asof = "";
                     for(i=0;i<myRelevance.length;i++){
                         if (myRelevance.substring(i,i+1) == "+"){
                             asof = asof + ' ';
                         else
                             asof = asof + (myRelevance.substring(i,i+1));
                else
                     var asof =  "";
                return asof;
asofDateTime=getAsOfDate();
function getPaperSize() {
                var myQueryString = window.location.search;
                var startOfPaperSize = myQueryString.indexOf("PSIZE=");
                if (startOfPaperSize != -1)
                     var endOfPaperSize = myQueryString.indexOf("&", startOfPaperSize + 6);
                     var myPaperSize = unescape(myQueryString.substring(startOfPaperSize + 6, endOfPaperSize));
                     var psize = "";
                     for(i=0;i<myPaperSize.length;i++){
                             psize = psize + (myPaperSize.substring(i,i+1));
                else
                     var psize =  "0";    // default if none supplied  (normal 8x11)
                return psize;
varPaperSize=getPaperSize();
var PaperSizeParamString='&PSIZE=' + escape(varPaperSize);
   switch(varPaperSize){
        case "0":    // Landscape - Letter
                       var WidthMax = 910;
                       var RowsPerPageMax = 38;
                       break;
        case "1":    // Landscape - Legal
                       var WidthMax = 1190;
                       var RowsPerPageMax = 38;
                       break;
        case "2":    // Portrait - Letter
                       var WidthMax = 660;
                       var RowsPerPageMax = 54;
                       break;
function getTotalColumns() {
   var myHTML = dataTable.rows[1].innerHTML;
   var TotalTDs = 0;
   var nextTD = 0;
   for (i=0;i<myHTML.length;i++) {
       nextTD =  myHTML.indexOf("<TD", i);
       if (nextTD != -1) {
          i=nextTD;
          TotalTDs++;
       else break;
   return TotalTDs;
function GetPageHeadings() {
   var headingHTM = "";
   var leftspancnt = 0;
   var rightspancnt = 0;
   var headingspancnt = 2;
   if (header2 != '#') headingspancnt = headingspancnt + 1;   // adjust for extra headings
   if (header3 != '#') headingspancnt = headingspancnt + 1;  
   if (currPage > 1) {
      headingHTM += '<TR style="page-break-before:always; display:none; visibility:hidden; "><TD Colspan="' + ColumnCnt + '"></td></tr>';
   else {
      headingHTM += '<TABLE  id="THEREPORT" name="MYREPORT" cellSpacing=0 cellPadding=0 width=' + WidthMax + ' border=0>';
   if (ColumnCnt == 1) {
      headingHTM += '<TR><TD vAlign=top align=left nowrap><font Size=3><STRONG>';
      headingHTM += queryTitle;
      headingHTM += '</STRONG></font></TD><TD Rowspan="' + headingspancnt + '" align="right" vAlign="top"><input type="image" border="0" name="SAPLogo" src="/sap/bw/Mime/Customer/Images/images.jpg" alt="SAP Logo"></TD></TR>';
      if (header2 != '#') headingHTM += '<TR><TD vAlign="top" align="left"><FONT Size=1>' + header2 + '</FONT></TD></TR>';
      if (header3 != '#') headingHTM += '<TR><TD vAlign="top" align="left"><FONT Size=1>' + header3 + '</FONT></TD></TR>';
      headingHTM += '<TR><TD vAlign="top" align="left"><FONT Size=1>' + asofDateTime + '</FONT></TD></TR>';
      headingHTM += '<TR><TD vAlign="top" align="left" Colspan="2"><hr size=2 color=black align=left></TD></TR>';
      headingHTM += '<tr>' + dataTable.rows[0].innerHTML + '<TD> </TD></TR>';
   else {
      leftspancnt = Math.floor(ColumnCnt/2);
      rightspancnt = ColumnCnt - leftspancnt;
      headingHTM += '<TR><TD vAlign=top align=left nowrap Colspan="' + leftspancnt + '"><font Size=3><STRONG>';
      headingHTM += queryTitle;
      headingHTM += '</STRONG></font></TD><TD Rowspan="' + headingspancnt + '" Colspan="' + rightspancnt  + '" align="right" vAlign="top"><input type="image" border="0" name="SAPLogo" src="/sap/bw/Mime/Customer/Images/images.jpg" alt="SAP Logo"></TD></TR>';
      if (header2 != '#') headingHTM += '<TR><TD vAlign="top" align="left" Colspan="' + leftspancnt + '"><FONT Size=1>' + header2 + '</FONT></TD></TR>';
      if (header3 != '#') headingHTM += '<TR><TD vAlign="top" align="left" Colspan="' + leftspancnt + '"><FONT Size=1>' + header3 + '</FONT></TD></TR>';
      headingHTM += '<TR><TD vAlign="top" align="left" Colspan="' + leftspancnt + '"><FONT Size=1>' + asofDateTime + '</FONT></TD></TR>';
      headingHTM += '<TR><TD vAlign="top" align="left" Colspan="' + ColumnCnt + '"><hr size=2 color=black align=left></TD></TR>';
      headingHTM += '<tr>' + dataTable.rows[0].innerHTML + '</TR>';
   return headingHTM;
function GetPageFooting() {
   var footingHTM = "";
   var leftspancnt = 0;
   var rightspancnt = 0;
   if (ColumnCnt == 1) {
      footingHTM += '<TR><TD vAlign="top" align="left" Colspan="2"><hr size=2 color=black align=left></TD></TR>';
      footingHTM += '<TR><TD vAlign="top" align="left" nowrap><FONT Size=1>Prepared: ';
      footingHTM += PrintDateTimeStamp;
      footingHTM += '</FONT></TD><TD vAlign="top" align="right"><FONT Size=1>';
      footingHTM = footingHTM + 'Page ' + currPage.toString() + ' of ' + varPageTotal.toString();
      footingHTM += '</FONT></TD></TR>';
   else {
      leftspancnt = Math.floor(ColumnCnt/2);
      rightspancnt = ColumnCnt - leftspancnt;
      footingHTM += '<TR><TD vAlign="top" align="left" Colspan="' + ColumnCnt + '"><hr size=2 color=black align=left></TD></TR>';
      footingHTM += '<TR><TD vAlign="top" align="left" nowrap Colspan="' + leftspancnt + '"><FONT Size=1>Prepared: ';
      footingHTM += PrintDateTimeStamp;
      footingHTM += '</FONT></TD><TD vAlign="top" align="right" Colspan="' + rightspancnt + '"><FONT Size=1>';
      footingHTM = footingHTM + 'Page ' + currPage.toString() + ' of ' + varPageTotal.toString();
      footingHTM += '</FONT></TD></TR>';
   return footingHTM;
function GetReportFooting() {
   var footingHTM = "";
   footingHTM += '</TABLE>';
   return footingHTM;
function formatToPrint() {
   var PrintHTM = "";
   PrintHTM += GetPageHeadings();
   if (ColumnCnt != 1) {
      for (var i=1;i<dataTable.rows.length;i++) {
           (currPage > prevPage)?prevPage=currPage:"";  //increment current page count
           if ((pageRowCnt + 1)>RowsPerPageMax){
               PrintHTM += GetPageFooting();
               pageRowCnt = 0;
               currPage++;
           if (prevPage != currPage) {
               PrintHTM += GetPageHeadings();
           else
               PrintHTM += '<tr>' + dataTable.rows<i>.innerHTML + '</tr>';
               pageRowCnt++;
   PrintHTM += GetPageFooting();       
   PrintHTM += GetReportFooting();
   return PrintHTM;
function DisplayPrintNotice() {
// Paper Size "0" is Letter with Landscape
// Paper Size "1" is Legal with Landscape
// Paper Size "2" is Letter with Portrait
if (varPaperSize == "0") {var varMessage ="nn From your browser File Menu, select Page Setup and do the following: nn 1) Adjust the Printer Orientation to Landscape n 2) select Print menu, then select the Print button.";}
if (varPaperSize == "1") {var varMessage ="nn From your browser File Menu, select Page Setup and do the following: nn 1) Adjust the Paper Size to Legal n 2) Adjust the Printer Orientation to Landscape n 3) select Print menu, then select the Print button.";}
//if (varPaperSize == "2") {var varMessage ="nn From your browser File Menu, select Page Setup and do the following: nn 1) Adjust the Paper Size to Letter n 2) Adjust the Paper Source (if necessary) n 3) Adjust the Orientation to Portrait (default) n 4) Select the Okay button nn Again select the File Menu, select Print, then select the Print button.";}
alert(varMessage);
//window.print()
/*   SAP BW Reporting Stylesheet Revisions        */        
function writeStyleRevisions() {
function writeDynamicFontRevisions(dynafont) {
//Writes the Dynamic Stylesheet
-->
</script>
</HEAD>
<BODY>
<TABLE  id="tp1" cellSpacing=0 cellPadding=0 width=660 border=0 >
    <TR>
    <TD vAlign=top align=left nowrap>
<object>
         <param name="OWNER" value="SAP_BW"/>
         <param name="CMD" value="GET_ITEM"/>
         <param name="NAME" value="MYQUERY"/>
         <param name="ITEM_CLASS" value="CL_RSR_WWW_ITEM_GRID"/>
         <param name="DATA_PROVIDER" value="DATAPROVIDER_1"/>
         <param name="GENERATE_CAPTION" value=""/>
         <param name="GENERATE_LINKS" value=""/>
         <param name="WIDTH" value="660"/>
         <param name="BORDER_STYLE" value="NO_BORDER"/>
         <param name="SUPPRESS_REPETITION_TEXTS" value=""/>
         <param name="BLOCK_SIZE" value="3500"/>
         <param name="SHOW_PAGING_AREA_TOP" value="X"/>
         <param name="TARGET_DATA_PROVIDER_1" value="DATAPROVIDER_1"/>
         ITEM:            MYQUERY
</object>
    </TD>
  </TR>
</TABLE>
<SCRIPT type="text/javascript">
<!--
        var tbls = document.body.getElementsByTagName("TABLE");
        for (var i=0;i<tbls.length;i++) {
              if (tbls<i>.name == "MYQUERY"){
                    var dataTable = tbls<i>;
                    break;
        document.title = queryTitle;
        rptWidth = dataTable.clientWidth;
        rptHeight = dataTable.clientHeight;
        originalRptWidth = rptWidth;
        originalRptHeight = rptHeight;
        originalRowHeight = Math.floor(rptHeight/(dataTable.rows.length+1));
        rptPageHeightMax = 580;                                                                                //660 less basic header and footer of 80
        if (header2 != '#') rptPageHeightMax = rptPageHeightMax - 20;   // adjust for extra headings
        if (header3 != '#') rptPageHeightMax = rptPageHeightMax - 20;  
        if (dataTable.rows.length == 1) {
            ColumnCnt = 1;                //No Applicable Data found message
        else {
            ColumnCnt = getTotalColumns();
        startingFont = 65;
        varFontSize = startingFont;
        if (rptWidth > WidthMax) {
            while ((rptWidth > WidthMax) && (varFontSize > 15))
                writeDynamicFontRevisions(varFontSize);
                rptWidth = dataTable.clientWidth;
                rptHeight = dataTable.clientHeight;
                varFontSize = varFontSize - 5;
            // calculate max rows per page
            rowHeight = Math.floor(rptHeight/(dataTable.rows.length+1)) + 1;        // add 1 for 2 row heading, add 1 for padding
            RowsPerPageMax = Math.floor(rptPageHeightMax/rowHeight) - 2;   // adjust for column headings
        if (dataTable.rows.length == 1) {
            varPageTotal = 1;                //No Applicable Data found message
        else {
            totalRows = dataTable.rows.length-1;                                       // total rows less headings
            varPageTotal = Math.floor(totalRows/RowsPerPageMax);       // compute total pages
            if (totalRows != (varPageTotal * RowsPerPageMax)) {
                varPageTotal = varPageTotal + 1;                                        // if not a complete last page, add 1 for partial page
        currPage = 1;
        document.write(formatToPrint());
        document.all.tp1.style.display = "none";
        document.all.tp1.style.visibility = "hidden";
//        DisplayPrintNotice();
-->
</SCRIPT>
<STYLE>
input.ie55   { display: none }
</STYLE>
<!-- special style sheet for printing -->
<STYLE media=print>
.noprint     { display: none }
</STYLE>
<script defer>
function window.onload() {
    if (!factory.object) {
        return
    else {
//     factory.printing.header = "SAP"
//     factory.printing.footer = "SAP"
        if ( varPaperSize == "2" ) { factory.printing.portrait = true; }
        else { factory.printing.portrait = false; }
        factory.printing.Print(true);
        // enable control buttons
  /*  var templateSupported = factory.printing.IsTemplateSupported();
       var controls = idControls.all.tags("input");
       for ( i = 0; i < controls.length; i++ ) {
           controls<i>.disabled = false;
           if ( templateSupported && controls<i>.className == "ie55" )
              controls<i>.style.display = "inline";
</script>
<P>
<div id=idControls class="noprint" style="VISIBILITY: hidden">
<input disabled type="button" value="Print this page"
onclick="factory.printing.Print(true)">
<input disabled type="button" value="Page Setup..."
onclick="factory.printing.PageSetup()">
<input class=ie55 disabled type="button" value="Print Preview..."
onclick="factory.printing.Preview()">
<input class=ie55 disabled type="button" value="Landscape"
onclick="factory.printing.portrait=false">
<input class=ie55 disabled type="button" value="Portrait"
onclick="factory.printing.portrait=true">
</div>
</BODY>
</HTML>

Similar Messages

  • CONVERTING SMARTFORM INTO PDF AND PRINTING DIRECTLY

    Hai guys,
       I got a problem.
    First the Smartform I created doesnt show all TABLE LINES(the rows coloumns)...
    so I have converted the SMART FORM to ADOBE FORM PROGRAMITICALY ...
    now in order to PRINT ..
    one has to first SAVE the FORM(adobe form) onto desktop(or whereever) and give it to PRINT...
    unfortunately my CLIENT doeasnt like the EXTRA STEP..
    so i best i can SAVE the file to a hardcoded location and
    OPEN it ..
    But then CAN I
    a)PRINT DIRECTLY without SAVING??
    b)ISSUE PRINT PROGRAMITICALY
    c)I learnt that a SMARTFORM can be GENERATED INTO PDF only at RUNNTIME(from SMARTFORMS>UTILITIES etc)..i briefly tried that..can I use that to GET THE PDF to PRINT when one gives PRINT from SPOOL REQUEST(sp01)
    hoping to give some quick points

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

  • Convert ALV report into PDF and mail ( Hierarchical List View )

    Hi All,
    I see many posts of PDF download but none resolve my issue.
    I am writing a report in APO SNP which fetches data and displays an alv using REUSE_ALV_HIERSEQ_LIST_DISPLAY as i need to show the result as a Hierarchical sequential list.
    I need to provide the functionality of PDF download ( online ) and Email with PDF as attachement ( Background ) for the list output.
    I read the post http://www.sapdev.co.uk/reporting/rep_spooltopdf2.htm which provides a sample program and tried to incorporate but the control doesn't come back from the ALV function module.
    How do i trigger the spool creation while still showing the output  and then send email?
    Suggestions and pointers are highly appreciated
    Regards,
    KD

    Hi.,
    Check this wiki: [Convert ALV as PDF  Attachment|http://wiki.sdn.sap.com/wiki/display/Snippets/SENDALVGRIDASPDFATTACHMENTTOSAPINBOXUSINGCLASSES]
    hope this helps u.,
    Thanks & Regards,
    Kiran

  • Converting a crystal report to pdf and then opening the pdf automatically

    I am successfully exporting a crystal report to a pdf file using code in vb.net 2008 in a windows application.   The crystal report is open in the viewer control and the user presses a button to export it.
    I create a variable with the report name and the location..  All works correctly.  However, I want the pdf to be open once it is saved which I believe is the case when you create  the pdf using the build in crystal export control.  But I am not using that.
    I presume I could call another form and use the adobe com control, but i prefer to do this in one place.
    How can I accomplish this.
    Thanks
    smHaig

    How about if I filter the open dialog box using the pdf name and folder.  Then that one would be the only one open in the dialog box and if the user selects it, it would open.  Have not tested yet, but this popped into my mind.   Seems better than a button on the form with the crystal view  to open another form .  Or I could have the adobe com object over laying the cr viewer and just make it visible if they press a button to open the abode  file..
    Maybe people have tried this and could comment on the better choice to view the pdf
    1.  call another form that contains  the adobe com
    2.  place the adobe control over the cr viewer and make visible if user requests to see pdf.   
    3.  use a filtered open dialog box.

  • PDF and Print Control in Reports.

    Dear All,
    I want to set particular format for every report in PDF and Print control option like want to place client's logo in header and page number and date in fotter , how can i achive this,is there any way we can set it globally coz doing on every report is very time consuming.
    Regards,
    Tarang Jain

    You need Firebug....to know how your Dashboard works!!!!!!
    Check these 2 blogs and play.....
    http://oraclebizint.wordpress.com/2008/01/03/oracle-bi-ee-101332-customizing-download-links/
    http://oraclebizint.wordpress.com/2007/10/26/oracle-bi-ee-101332-styles-and-skins-firebug-to-your-rescue/
    i hope i helped....
    http://greekoraclebi.blogspot.com/
    Close the question.....and add a new thread...
    Give if you wish the appropriate points...

  • Interactive-adobe form Converting into PDF without print dialog

    Hi Friends,
    I would like to convert Interactive - adobe form into PDF without print dialog.which adobe form interface type is Smart Forms-compatible Interface.I have tried for solution.but I could not succeeded.How can resolve the issue.please help me.
    Thanks
    Ramesh M

    Hi Friends,
    I would like to convert Interactive - adobe form into PDF without print dialog.which adobe form interface type is Smart Forms-compatible Interface.I have tried for solution.but I could not succeeded.How can resolve the issue.please help me.
    Thanks
    Ramesh M

  • How to convert Classical Report into PDF format..........

    Hi Experts,
    I have written a classical report with write statements and when i am downloading in excel the format is mismatching and now i want to convert into PDF format.
    How to convert into PDF format from Classical report ?
    Yusuf

    Hi yusuf,
    please find the below report,,
    please make two include programs before executing it,
    there codes are pasted below,
    INCLUDE zimpr_data_declaration.
    INCLUDE zimpr_performs_wrap.
    REPORT  zimpr_word_wrap NO STANDARD PAGE HEADING LINE-SIZE 115..
                INCLUDE for DATA DECLARATION                               *
    INCLUDE zimpr_data_declaration.
                INCLUDE for all performs.                                  *
    INCLUDE zimpr_performs_wrap.
    TOP-OF-PAGE--
    TOP-OF-PAGE.
      PERFORM f_top_page.                     "TOP OF THE REPORT PAGE,I.E. HEADER.
    START-OF-SELECTION.
      SET PF-STATUS 'SEL_SCREEN'.             "PF-STATUS OF THE SELECTION SCREEN.
      PERFORM f_data_retrieval.               "PERFORM FOR ALL SELECT STATEMENTS.
      PERFORM f_report_display.               "REPORT DISPLAY,WRITE STATEMENTS.
    --Define the actions to be performed for pf-status-----
    AT USER-COMMAND.
      wf_ok_code = sy-ucomm.
      wf_save_ok = wf_ok_code.
      CLEAR wf_ok_code.
      CASE wf_save_ok.
        WHEN 'PDF'.          "WHEN PDF ICON IS CLICKED,REPORT WILL CONVERT INTO PDF.
          loc_repid  = sy-repid.   "PROGRAM NAME
    --THIS FM SETS  THE PARAMETERS FOR LAYOUT OF PDF OUTPUT--
          CALL FUNCTION 'GET_PRINT_PARAMETERS'
            EXPORTING
              layout                 = loc_paart             "LANDSCAPE LAYOUT
              line_size              = loc_linsz                  "CHARACTER WIDTH OF REPORT
              no_dialog              = 'X'
              user                   = sy-uname              "USERNAME
            IMPORTING
              out_parameters         = loc_print_parms        "OUTPUT PARAMETERS WILL BE COLLECTED HERE.
              valid                  = loc_valid
            EXCEPTIONS
              archive_info_not_found = 1
              invalid_print_params   = 2
              invalid_archive_params = 3
              OTHERS                 = 4.
    --FOR GENERATING THE SPOOL NUMBER--
          NEW-PAGE PRINT ON NO DIALOG PARAMETERS loc_print_parms.                        " This allocates the spool no
          "to the screen without the dialog screen.
          PERFORM f_top_page.
          PERFORM f_report_display.
          NEW-PAGE PRINT OFF.                                                      "This marks the end of the screen for which the spool no was generated.
          wf_id = sy-spono.                                                      " This assign the spool no of the screen to the variable.
    --PERFORM FOR GETTING THE PDF OUTPUT--
          PERFORM f_pdf_display.
    --PERFORM FOR DOWLOADING FILE TO A LOCAL DISK--
          PERFORM f_download_local.
        WHEN 'BACK'.
          LEAVE PROGRAM.
      ENDCASE.
    include data declaration----
    *&  Include           ZIMPR_DATA_DECLARATION
    TYPE-POOLS : shlp.
    DATA : wf_ordert TYPE aufk-auart.                      "ORDER TYPE
    DATA : wf_order TYPE aufk-aufnr.                       "ORDER NUMBER
    DATA : wf_bdate TYPE afko-gstrp.                       "BASIC START DATE
    DATA : wf_status(4) TYPE c ."rihea-i_astatin.                 "STATUS
    DATA : wf_objnr TYPE jest-objnr VALUE 'OR%'.           "Object number
    DATA : wf_aufnr TYPE aufk-aufnr.
    DATA : wf_name TYPE thead-tdname.                      "NAME TO PASS IN FM READ_TEXT
    DATA : wf_date1(12) TYPE c.                            "DATE
    DATA : wf_i1(3) TYPE n,wc_i1(3) TYPE n VALUE '1'.      "COUNTERS FOR REPORT DISPLAY
    DATA : wf_i2(3) TYPE n,wc_i2(3) TYPE n VALUE '1'.
    DATA : wf_kopf TYPE tdid VALUE 'KOPF',wf_aufk TYPE tdobject VALUE 'AUFK'.
    DATA : wf_save_ok TYPE sy-ucomm ,wf_ok_code TYPE sy-ucomm.
    DATA: wf_id TYPE tsp01-rqident ,                         " For storing Spool request number
          wf_bytes TYPE i .                                  " For storing the bytes of data to be converted to PDF.
    DATA : wf_langu(2) TYPE c VALUE 'EN'.
    DATA: wf_pripar TYPE pri_params,                         " Structure for Passing Print Parameters
          wf_rcpar TYPE arc_params.                          " ImageLink structure
    DATA : wf_statu TYPE dfies-fieldname VALUE 'STATUS',
           wf_field TYPE help_info-dynprofld VALUE 'S_STATUS'.
    &--SELECTION SCREEN--
    SELECTION-SCREEN BEGIN OF BLOCK b_1 WITH FRAME TITLE text-000.
    SELECTION-SCREEN SKIP 1.
    SELECT-OPTIONS:  s_ordert FOR wf_ordert .                  "ORDER TYPE
    SELECT-OPTIONS:  s_order FOR wf_order OBLIGATORY.          "ORDER NUMBER
    SELECT-OPTIONS:  s_bdate FOR wf_bdate.                      "BASIC START DATE
    SELECT-OPTIONS:  s_status FOR wf_status matchcode object zei_sys .  "SYSTEM STATUS
    SELECTION-SCREEN SKIP 1.
    SELECTION-SCREEN END OF BLOCK b_1.
    *--INTERNAL TABLES--
    TYPES : BEGIN OF ty_aufk,
          aufnr TYPE aufk-aufnr,              "OREDR NUMBER
          auart TYPE aufk-auart,              "ORDER TYPE
          objnr TYPE aufk-objnr,              "OBJECT NUMBER
          ktext type aufk-ktext,              "SHORT TEXT
          gstrp TYPE afko-gstrp,              "BASIC START DATE
          END OF ty_aufk.
    TYPES : BEGIN OF ty_tj02t,
          objnr TYPE aufk-objnr,              "OBJECT NUMBER
          txt04 TYPE tj02t-txt04,             "STATUS
          istat TYPE tj02t-istat,             "Object status
          spras TYPE tj02t-spras,             "LANGUAGE KEY
          END OF ty_tj02t.
    TYPES : BEGIN OF ty_temp,
          objnr TYPE aufk-objnr,
          status(300) TYPE c,
           END OF ty_temp.
    TYPES : BEGIN OF ty_wrap,
           line(54) TYPE c,                     "LONG TEXT
           END OF ty_wrap.
    TYPES : BEGIN OF ty_wrap2,
           line(25) TYPE c,                     "STATUS
           END OF ty_wrap2.
    TYPES : BEGIN OF ty_f4,
            txt04 TYPE tj02t-txt04,
            txt30 TYPE tj02t-txt30,
            END OF ty_f4.
    types :  begin of ty_sta,
            istat type tj02t-istat,
            objnr type jest-objnr,
            end of ty_sta.
    data : int_sta type table of ty_sta with header line.
    DATA : int_f4 TYPE TABLE OF ty_f4 WITH HEADER LINE.
    DATA: int_pdf TYPE TABLE OF tline WITH HEADER LINE.            "TABLE FOR PDF CONVERSION
    DATA: int_wrap TYPE TABLE OF ty_wrap WITH HEADER LINE.         "TABLE FOR LONGTEXT
    DATA: int_wrap2 TYPE TABLE OF ty_wrap2 WITH HEADER LINE.       "TABLE FOR STATUS
    DATA: int_temp TYPE TABLE OF ty_temp WITH HEADER LINE.         "Table for concatenation of system status.
    DATA: int_aufk TYPE TABLE OF ty_aufk WITH HEADER LINE.
    DATA: int_tj02t TYPE TABLE OF ty_tj02t WITH HEADER LINE.
    DATA: int_tline TYPE STANDARD TABLE OF tline WITH HEADER LINE. "TABLE FOR READ_TEXT.
    DATA : int_fld TYPE TABLE OF dfies ,wa_fld LIKE LINE OF int_fld.                     " Field Type for FM for F4 help
    DATA :int_return   TYPE TABLE OF ddshretval WITH HEADER LINE .
    DATA:
      loc_print_parms LIKE pri_params,          "PRINT PARAMETERS
      loc_valid(1)      TYPE c,
      loc_file type SDOK_CHTRD,
      loc_bytecount     TYPE i,                 "NUMBER OF BYTES TRANSFERRED
      loc_length        TYPE i,                 "LINE-LENGTH
      loc_rqident       LIKE tsp01-rqident,     "SPOOL NUMBER
      loc_rq2name(12)   TYPE c.
    DATA: loc_filename LIKE rlgrap-filename.     "FILENAME
    DATA:loc_repid LIKE sy-repid,                    " Report to execute
         loc_linsz LIKE sy-linsz VALUE 115,          " Line size
         loc_paart LIKE sy-paart VALUE 'X_65_132'.   " Paper Format
    Include           ZIMPR_PERFORMS_WRAP----
    *&  Include           ZIMPR_PERFORMS_WRAP
    *&      Form  f_top_page
         top-of the page
    -->  p1        text
    <--  p2        text
    FORM f_top_page .
    *--HEADER--
      FORMAT COLOR 1 .
      WRITE : text-010.
      FORMAT COLOR 1 OFF.
      WRITE : / text-011,sy-datum NO-GAP.
      WRITE : / text-012,sy-uzeit NO-GAP,90 text-013,101 sy-uname.
      ULINE .
      FORMAT COLOR 1 INTENSIFIED OFF .
      WRITE : 1 sy-vline,                "HEADINGS
      2 text-014 NO-GAP,
      7 sy-vline,
      8 text-015 NO-GAP,
      20 sy-vline,
      21 text-016 NO-GAP,
      76 sy-vline,
      77 text-017 NO-GAP,
      88 sy-vline,
       89 text-018  NO-GAP,
      115 sy-vline.
      WRITE : /1 sy-vline,
        2 text-019 NO-GAP,7 sy-vline,
        20 sy-vline,76 sy-vline,77 text-020 NO-GAP,88 sy-vline,115 sy-vline.
      ULINE.
      FORMAT COLOR 1 OFF.
    ENDFORM.                    " f_top_page
    *&      Form  f_data_retrieval
         select statements
    -->  p1        text
    <--  p2        text
    FORM f_data_retrieval .
    SELECTING ORDER TYPE,ORDER NO.,OBJECT NO. AND BASIC START DATE
      SELECT  p~aufnr
               p~auart
               p~objnr
               p~ktext
               r~gstrp
               FROM  ( aufk AS p INNER JOIN afko AS r ON raufnr = paufnr )
               INTO TABLE int_aufk
               WHERE p~aufnr IN s_order AND
                     p~auart IN s_ordert AND
                     r~gstrp IN  s_bdate AND
                     p~objnr LIKE wf_objnr.
      IF sy-subrc <> 0.
        MESSAGE s101(zipm).                "no values found for selection criteria.
        STOP.
      ENDIF.
      SORT int_aufk BY aufnr.
      DELETE ADJACENT DUPLICATES FROM int_aufk.
      SELECT q~istat
           p~objnr
           FROM ( jest AS p INNER JOIN tj02t AS q ON pstat = qistat )
           INTO TABLE int_sta
           FOR ALL ENTRIES IN int_aufk
           WHERE p~objnr = int_aufk-objnr
                 AND q~txt04 IN s_status and
                 q~spras = wf_langu and
                 p~inact = ''.
      IF sy-subrc <> 0.
        MESSAGE s101(zipm).                "no values found for selection criteria.
        STOP.
      ENDIF.
      SORT int_sta BY objnr.
      DELETE ADJACENT DUPLICATES FROM int_sta.
    *--SELECTING OBJECT NO.,STATUS AND LANGUAGE--
      IF int_sta[] IS NOT INITIAL.
        SELECT p~objnr
               q~txt04
               q~istat
               q~spras
               FROM ( jest AS p INNER JOIN tj02t AS q ON pstat = qistat )
               INTO TABLE int_tj02t
               FOR ALL ENTRIES IN int_sta
               WHERE p~inact = '' AND
                     p~objnr = int_sta-objnr AND
                     q~spras = wf_langu AND
                    q~txt04 IN s_status AND
                     p~objnr LIKE wf_objnr.
        IF sy-subrc <> 0.
          MESSAGE s101(zipm).               "no values found for selection criteria.
          STOP.
        ENDIF.
      ENDIF.
    ENDFORM.                    " f_data_retrieval
    *&      Form  f_report_display
          report display
    -->  p1        text
    <--  p2        text
    FORM f_report_display .
      LOOP AT int_tj02t.              "concatenating the status into a internal table
        AT NEW objnr.
          CLEAR int_temp-status.
        ENDAT.
        CONCATENATE int_temp-status int_tj02t-txt04 INTO int_temp-status SEPARATED BY space.
        AT END OF objnr.
          int_temp-objnr = int_tj02t-objnr.       "key field.
          APPEND int_temp.
          CLEAR int_temp.
        ENDAT.
        CLEAR int_tj02t.
      ENDLOOP.
      LOOP AT int_aufk.
        CONCATENATE sy-mandt int_aufk-aufnr INTO wf_name .    "concatenating client number and order number
    *--THIS FM CAPTURES THE LONG TEXT AND STORES IT IN INTERNAL TABLE--
        CALL FUNCTION 'READ_TEXT'
          EXPORTING
            id                      = wf_kopf         "TEXT ID
            language                = sy-langu       "LANGUAGE
            name                    = wf_name        "TEXT NAME
            object                  = wf_aufk         "TEXT OBJECT
          TABLES
            lines                   = int_tline      "LINES OF LONG TEXT.
          EXCEPTIONS
            id                      = 1
            language                = 2
            name                    = 3
            not_found               = 4
            object                  = 5
            reference_check         = 6
            wrong_access_to_archive = 7
            OTHERS                  = 8.
        IF sy-subrc <> 0.
          int_tline-tdline = int_aufk-ktext.
          APPEND int_tline.
          CLEAR :int_tline.
        ENDIF.
        LOOP AT int_tline.
    *--THIS FM WRAPS THE LONG TEXT INTO 54 CHARACTERS EACH--
          CALL FUNCTION 'RKD_WORD_WRAP'
            EXPORTING
              textline            = int_tline-tdline          "LONG TEXT LINE
              outputlen           = 54                        "OUTPUT LENGTH
            TABLES
              out_lines           = int_wrap                  "INTERNAL TABLE
            EXCEPTIONS
              outputlen_too_large = 1
              OTHERS              = 2.
          IF sy-subrc <> 0.
            CLEAR :int_tline.
          ENDIF.
        ENDLOOP.
    *-- THIS FM WRAPS THE STATUS INTO 25 CHARACTERS EACH--
        READ TABLE int_temp WITH KEY objnr = int_aufk-objnr.
        CALL FUNCTION 'RKD_WORD_WRAP'
          EXPORTING
            textline            = int_temp-status
            outputlen           = 25
          TABLES
            out_lines           = int_wrap2
          EXCEPTIONS
            outputlen_too_large = 1
            OTHERS              = 2.
        IF sy-subrc <> 0.
         CONTINUE.
        ENDIF.
        IF NOT int_wrap2[] IS INITIAL.
          ULINE AT (115).
        ENDIF.
        DESCRIBE TABLE int_wrap LINES wf_i2.         "COUNTING THE NO. OF LINES FOR TABLE INT_WRAP
        DESCRIBE TABLE int_wrap2 LINES wf_i1.        "COUNTING THE NO. OF LINES FOR TABLE INT_WRAP2
        WHILE ( wc_i1 LE wf_i1 OR wc_i2 LE wf_i2 ).
          IF ( wc_i2 LE wf_i2 ).
            READ TABLE int_wrap INDEX wc_i2 .        "READING THE INTERNAL TABLE INT_WRAP WITH INDEX
            wc_i2 = wc_i2 + 1.
          ENDIF.
          IF ( wc_i1 LE wf_i1 ).
            READ TABLE int_wrap2 INDEX wc_i1 .       "READING THE INTERNAL TABLE INT_WRAP2 WITH INDEX
            wc_i1 = wc_i1 + 1.
          ENDIF.
    *--THIS FM CONVERTS THE DATE FROM SYSTEM FORMAT TO OUTPUT FORMAT--
          CALL FUNCTION 'CONVERSION_EXIT_SDATE_OUTPUT'
            EXPORTING
              input  = int_aufk-gstrp
            IMPORTING
              output = wf_date1.
          IF NOT int_wrap2[] IS INITIAL .
    *--REPORT DISPLAY--
            WRITE : /1 sy-vline, 2 int_aufk-auart COLOR = 4 INTENSIFIED OFF NO-GAP ,
                    7 sy-vline ,8 int_aufk-aufnr COLOR = 4 INTENSIFIED OFF NO-GAP,
                    20 sy-vline,21 int_wrap-line,
                    76 sy-vline ,77  wf_date1 ,
                    88 sy-vline ,89 int_wrap2-line,
                    115 sy-vline.
    *--CLEARING THE VARIABLES--
            wf_date1 = ''.
            CLEAR: int_aufk,int_temp,int_wrap2-line,int_wrap-line.
          ENDIF.
        ENDWHILE.
        wc_i1 = 1.
        wc_i2 = 1.
        CLEAR :int_wrap,int_wrap2.
        REFRESH : int_wrap,int_wrap2,int_tline.
      ENDLOOP.
      ULINE AT (115).
    ENDFORM.                    " f_report_display
    *&      Form  F_PDF_DISPLAY
         pdf conversion
    -->  p1        text
    <--  p2        text
    FORM f_pdf_display .
    *--THIS FM CONVERTS THE SPOOL REQUEST INTO PDF REPORT--
      CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
        EXPORTING
          src_spoolid              = wf_id                 "SPOOL NUMBER
          no_dialog                = space
          pdf_destination          = 'X'
        IMPORTING
          pdf_bytecount            = loc_bytecount        "NUMBER OF BYTES TRANSFERRED
        TABLES
          pdf                      = int_pdf                                  "TABLE FOR PDF REPORT
        EXCEPTIONS
          err_no_abap_spooljob     = 1
          err_no_spooljob          = 2
          err_no_permission        = 3
          err_conv_not_possible    = 4
          err_bad_destdevice       = 5
          user_cancelled           = 6
          err_spoolerror           = 7
          err_temseerror           = 8
          err_btcjob_open_failed   = 9
          err_btcjob_submit_failed = 10
          err_btcjob_close_failed  = 11
          OTHERS                   = 12.
    ENDFORM.                    " F_PDF_DISPLAY
    *&      Form  f_download_local
         download to local system
    -->  p1        text
    <--  p2        text
    FORM f_download_local .
    ---------------------THIS FM DOWNLOADS THE PDF REPORT INTO LOCAL MACHINE
    data  loc_ret TYPE iwerrormsg.
      CALL FUNCTION 'IW_C_GET_SAPWORKDIR'
       IMPORTING
         SAPWORKDIR       = loc_file
        ERROR_MSG        =  loc_ret
      loc_filename = loc_file.
      if loc_ret is initial.
      concatenate loc_filename '\work order header long text_  ' sy-timlo '.pdf' into loc_filename.
      endif.
      CALL FUNCTION 'DOWNLOAD'
        EXPORTING
          bin_filesize = loc_bytecount      "NO. OF BYTES
          filename     = loc_filename       "DEFAULT FILE NAME
          filetype     = 'BIN'
        IMPORTING
          act_filename = loc_filename
        TABLES
          data_tab     = int_pdf.
    ENDFORM.                    " f_download_local
    if you have any doubts,,
    please revert
    Regards,
    Talwinder

  • Converting webi reports into Xml

    Hi all ,
    Can we convert the BO Edge 3.1 Webi reports into XML Format?
    Pls suggest me a solution and if we can convert, pls describe the procedure to be followed inorder to convert the reports into xml files?
    Thanks in advance,
    Thanks & regards,
    Amrita.B

    Hello,
    While this is not possible (directly) for the entire report, you could do one of the following:
    1. If you're on SP2 (or higher), you could publish Webi Report Content as a web service. There is more information in the pdf at http://help.sap.com/businessobject/product_guides/boexir31SP2/en/xi31_sp2_webi_rich_en.pdf (pg 304) .
    2.  Use QAAWS to publish queries used in the report as web services.
    Best,
    Srinivas

  • Converting report to PDF and mailing

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

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

  • How to convert a oracle 6i Report to pdf and also mailed at run time.

    I need the code of oracle report to convert it into pdf and aslo mail it to specified email address at run time.
    I need full code using add_parameter() built in.

    Hi!
    R u talking about FORMS report or u want to generate any EXCEL report from Oracle PL/SQL?
    Regards.
    Satyaki De.

  • Export webi documnet into PDF without blank reports

    Hi all,
    is there any option to export webi document into PDF without blank reports?
    Best regards,
    Martin Zluky

    Hi Zluky,
    Select your Report and then go to Properties of the report
    Click the Plus sign next to Page layout and uncheck start on new page.
    If you are using section then you will have to select the section and then do the same.
    Regards
    Kumar

  • How do I get a PDF document put into an attachment form that I can drag to an e-mail.  Usually I get an icon showing an spiral note book which then becomes an attachment when I drag it to the e-mail, but occasionally it stays in PDF and prints out on the

    How do I get a PDF document put into an attachment form that I can drag to an e-mail.  Usually I get an icon showing an spiral note book which then becomes an attachment when I drag it to the e-mail, but occasionally it stays in PDF and prints out on the e-mail.  What have I done differently?

    Thanks again for the detailed instructions Srini!
    And I really hate to be a pest . . . but . . .
    Using your example and not modifying it, I get the e-mail form filled out correctly and the pdf attached, however, I'm not prompted to sign it.
    Any more clues?

  • How to convert a coloured document into black and white pdf .

    I have to write a script in c++ to convert a coloured document into black and white pdf .can anybody help.

    You've posted on a forum dedicated to discussions of a resource center called the "Adobe Exchange" that has nothing at all to do with Acrobat.

  • Convert xml file into .pdf and .html

    hi all,
    can any one let me know how can i show xml file values into pdf and html by using java
    thanks in advance

    sreeks27 wrote:
    hi all,
    can any one let me know how can i show xml file values into pdf and html by using java
    thanks in advanceTake a look at Apache FOP:
    http://xmlgraphics.apache.org/fop/

  • Setting Font for converting multiple text files into PDF using VB 6.0

    Dear All,
    Am converting multiple text files into PDF using VB6.0. Currently, am unable to control the font face and size for the generated files. Below is the procedure am using for each file;
    Public Sub proc_convert_to_PDF(srcFilename As String, destFilename As String)
    Dim p_AcroApp As CAcroApp
    Dim p_VDoc As CAcroAVDoc
    Dim p_DDoc As CAcroPDDoc
    Dim IsOk As Boolean
    Set p_AcroApp = CreateObject("AcroExch.App")
    Set p_VDoc = CreateObject("AcroExch.AVDoc")
    Call p_VDoc.Open(srcFilename, "")
    Set p_VDoc = p_AcroApp.GetActiveDoc
    If p_VDoc.IsValid Then
    Set p_DDoc = p_VDoc.GetPDDoc
    ' Fill in pdf properties.
    p_DDoc.SetInfo "Title", Format(Date, "dd-mm-yyy")
    p_DDoc.SetInfo "Subject", srcFilename
    If p_DDoc.Save(1 Or 4 Or 32, destFilename) <> True Then
    MsgBox "Failed to save " & srcFilename
    End If
    p_DDoc.Close
    End If
    'Close the PDF
    p_VDoc.Close True
    p_AcroApp.Exit
    'Clear Variables
    Set p_DDoc = Nothing
    Set p_VDoc = Nothing
    Set p_AcroApp = Nothing
    End Sub
    What I need;
    1) to be able to set the font face of the destination file ( destFilename)
    2) to be able to set the font size of the destination file ( destFilename)
    Am using Adobe Acrobat 7.0 Type Library
    Kindly Help.
    Thanks in advance

    We didn't say it doesn't work. We said it isn't supported.
    There are a number of other ways to make a PDF. The one which would
    give the most control is if your application directly printed to GDI,
    controlling the font directly. This could print to Adobe PDF.
    You could look for an application that gives control of font for
    printing.
    You could use a text-to-PostScript system and distill the result. You
    could even look for a non-Adobe text-to-PDF.
    Working in the unsupported and dangerous world you chose, the font
    size for text conversion is set (and this is very bad design from
    Adobe) in the settings for Create PDF > From Web Page. There is no API
    to this.
    Aandi Inston

Maybe you are looking for