Converting binary data into pdf and placing into application server
Hi Friends,
I am able to get PO details in binary format and then using GUI_DOWNLOAD with file type with 'bin' and file name with 'sample.pdf' extension , got PO in pdf format.
But i need to get with pdf extension in application server without using GUI_DOWNLOAD.
Is there any functional modules for it?
With Warm Regards,
Madhu!!!
Hi Madhu,
Check this code.
*& 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.
Hope this resolves your query.
<b>Reward all the helpful answers.</b>
Regards
Similar Messages
-
How to convert binary data to PDF and attach to the particular po
our client wants to attach the pdf coming from portal as attachment to that particular PO. From portal the pdf will come in binary format. Find how will we convert that binary data back to pdf and attach to the PO in R/3?
Hi,
You can downlaod Binary data into PDF using GUI_DOWNLOAD...pass the binary data and the BINSIZE...
santhosh -
Convert Script output into PDF and save into Unix Directory
Hi,
I had Sales Order Acknowledgement Output and wants to converted to PDFs and then these PDFs to be placed in Unix Directory
on their way to Docs Library.
I am using the following code
CALL FUNCTION 'CLOSE_FORM'
IMPORTING
RESULT = itcpp
TABLES
otfdata = lt_otf " OTF Data
EXCEPTIONS
unopened = 1
OTHERS = 2.
After this form , table ltf_otf is empty, So i am not converting into PDF .
So i need the logic to convert to PDF , and most importantly logic to save into UNIX Directory.
ThanksHi,
If you are using the Function Module "OPEN_FORM" to open the form for printing then in this function module there is an IMPORTING parameter OPTIONS which is of type ITCPO to this parameter "OPTIONS-TDGETOTF" needs to be passed as 'X' which will give you the OTF output in the FM "CLOSE_FORM".
After this call the FM "CONVERT_OTF" and pass the FORMAT as "PDF" which will give you the PDF output in LINES table Parameter. Most important please pass some dummy variable to BIN_FILESIZE variable.
Now by using OPEN DATASET file name FOR OUTPUT IN BINARY MODE and the LOOP the PDF table and use the TRANSFER statement to place the data in the UNIX File and then Finally use the CLOSE DATASET file name.
Hope will help to address your issue.
Regards,
SRinivas -
Binary Data to PDF and Word Doc
All,
We have requirement to open a PDF or DOC in a new window from a BAPI output structure. The field returned from the BAPI is a binary field. Following is the code that is implemented for this scenario.
for(int i=0;i<wdcontext.nodeOutput().nodePtx_Drao().size();i++)
IWDCachedWebResource resource = WDwebResource.getWebResource(wdcontext.nodeOutput().nodePtx_Drao().getPtx_DraoElementAt(i).getOrblk(), WdWebResourcetype.PDF);
IWDWindow win = wdComponentAPI.getWindowManager().createNonModalExternalWindow(resource.getUrl(WDFileDownloadBehaviour.OPEN_PLACE.ordinal()), "test");
win.open();
The problem we are facing here is when we try to open the PDF it throws an error saying "File does not begin with '%PDF-'". If we try to open a word document by changing the resource type some junk values are coming.
Has anyone come across this type of development issues?
Appreciate all your replies and new inputs in this regard.
Thanks & Regards,
Nagarajan.Hi,
I also tried with the same using the below code. Even I am getting the same error.
byte[] test=new byte[9];test[0]=2;
IWDCachedWebResource resource = WDWebResource.getWebResource(test,WDWebResourceType.PDF);
When i tried the same code with other file type its working file.
IWDCachedWebResource resource = WDWebResource.getWebResource(test,WDWebResourceType.DOC);
From where are you getting this actual byte array? from R/3?. In internet if you search about this error we are getting the results like "The PDF file has a .mme extension rather than a .pdf extension".
Note: This is not the problem with Window or LinkToURL ui elments.
Posting this to give you an idea.
Regards,
Charan -
Convert Binary Data into Pdf & send it as attachment in a mail in Workflow
Hi,
Scenario:
The interactive form saved in WebDynpro Application is sent to R/3 in binary format. It has to be converted into pdf and sent it as an attachment in mail to the respective person in workflow.
Kindly help on these issues :
1. How to receive the binary data in R/3 sent by the WebDynpro Application ?
To my knowledge we can receive the binary in XSTRING data type. Plz correct me if am wrong.
2. How do i convert the received binary data into pdf ?
Thanks,
Bharath KaushikHi Bharath,
I think you should try to write dat being sent to R/3 to spool first, as in R/3 there is FM <i>CONVERT_ABAPSPOOLJOB_2_PDF</i> , with the help of which you will be able to convert Binary data to PDF format.
Pls find one of the threads related to this , and see if this is useful to you.
Problem in CONVERT_ABAPSPOOLJOB_2_PDF.
Hope this atleast helps to start off.
Regds,
Akshay Bhagwat
PS: Some points would be nice if it helps:) -
Convert Binary Data into Pdf & send it as attachment in a mail
Hi Friends,
Scenario :
The interactive form saved in WebDynpro Application is sent to R/3 in binary format. It has to be converted into pdf and sent it as an attachment in mail to the respective person.
Kindly help on these issues :
1. How to receive the binary data in R/3 sent by the WebDynpro Application ?
2. How do i convert the received binary data into pdf ?
Regards & Thanks,
Bharath Kaushik KrishnanCheck thread Data Conversion
if it is useful for you. -
Convert Binary Data into Pdf & send it as attachment in a mail from R/3
Hi,
Scenario:
The interactive form saved in WebDynpro Application is sent to R/3 in binary format. It has to be converted into pdf and sent it as an attachment in mail to the respective person in workflow.
Kindly help on these issues :
1. How to receive the binary data in R/3 sent by the WebDynpro Application ?
To my knowledge we can receive the binary in XSTRING data type. Plz correct me if am wrong.
2. How do i convert the received binary data into pdf ?
Thanks,
Bharath Kaushik KrishnanHI Bharath,
I think You can reuse teh XString for binary data.there are certain function modules in R/3 for creating pdf/for sending it as pdf attatchment.please search in abap forums you will find more information
With Regards
Naidu -
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
kumarHere 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> -
Converting to PDF and Inserting into another PDF?
Is there a way to convert a file to PDF and then insert that file into another pdf using JavaScript?
Thanks,
ToddHi Paul,
Thanks for the response, this is actually an adobe form that has been saved as an adobe dynamic XML pdf. Is there a way to do this in a form via code?
What I would like to do is attach a supporting document to the form and Print both the form and the supporting document with a simple click, is this possible?
Any help or a point in the right direction would be appreciated.
Thanks,
Todd -
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 advancesreeks27 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/ -
I am having problems with my music collection, after burning all of my music to the computer I organized it into folders and placed it in the iTunes Folder. As of now i realize this was a mistake. Starting on a new computer now. I cant get my music to transfer from the itunes folder on the old computer? I keep getting error "Can't Read from the source file or disk." Whenever I got to folder properties its always checked read only. But when i play the song it works just fine. Im sure this is just because I added music into itunes folder but is there anyway to fix it?
WMA files are 'window media audio' files, which is a Microsoft format. If you want to add them to your iTunes library on your Mac then you will need to convert them into a compatible format first. If you still have your windows machine then iTunes for Windows can convert them from WMA to MP3 format : https://discussions.apple.com/message/24158701#24158701
Or try a search for, for example, 'convert wma to mp3' to find programs to convert them. -
To store PDF into BLOB and retrieve into OLE/OCX
We would like to:
1. Store a PDF file (output of a report saved in file server) into a BLOB
column.
2. Retrieve previously stored PDF in the BLOB column and display using either
OLE automation or ActiveX (OCX) control.
I read all related documents in metalink that addresses this issue however cant
get this to work. We have Acrobat Reader 4.0. Here are some issues from the
tests that I did:
1. To load the PDF file the program code that uses BFILE and LOADFROMFILE does
not work since the database is on a remote server and the PDF file is on a
local file server. The DIRECTORY created on the database is unable to find the
PDF file.
2. Though I want the loading of the file to be programmatic, I tried
right-click on the OLE container and inserted object from file. This loaded the
file into the container (Icon on the container appeared) however I was not able
to view the document by double-clicking. An error in Adobe occured: 'There was
an error opening this document. A file read error occured'. My guess is the
'Insert Object' did not insert the file properly into the BLOB.
3. When trying to display the PDF file stored in file server (in case storing
into BLOB does not work), I used an OCX control, right-clicked and Insert
Object and select Adobe Control for ActiveX. The problem here is when I run the
form, the OCX control shows up empty and I have to 'Insert Object' again in
runtime. Once I manually insert object from runtime the GET_INTERFACE POINTER &
SET_PROPERTY works fine is displaying the document. Is there any way to
maintain the control property of the OCX when the form is run?
4. Are there any workarounds and better solution to store PDFs into BLOBs and
retrieve and display in OLE/OCX controls? Using temporary file into local drive
is not an issue.
5. Would I be able to make use of 'PDF.PdfCtrl.1' OLE class?
6. Does OLE automation work for Acrobat Reader 4.0.?
I would appreciate all the help.
ShyamIm facing a similar kind of problem. I want to store and retrieve Office files, PDF and Jpegs into/from the database to view them on web in disconnected mode. Please reply as I cant find any help/documentation regarding saving BLOB data into files. I was able to store file data into BLOB, using DBMS_LOB package.
Shahzad -
XML document convert into String and Insert into Database
Hello all,
In the FIle to File Scenario I want to send the data to the Reciever System in xml Document and convert into String and insert into Database.
Please can you tell me exact way how to send it.
Thanks & Regards,
RajHI,
As per my understanding your scenario is File to file where you will get output fiel in XML format.
Now that XMl payload need to be passed as single string in the database via XI.
You cauld do this but you need to imply some manipulations such as
With the help of standard API you need to concatenate the XML tags and create the structre along with the data.
For e.g. in your outpuf file the XML structre contain data as
<field1>ABCD</field1>
Then in mapping
The source field will be mappeda s concat(<field1>) + value of Source field "ABCD" + concat(</field1>) to the target field.
This is the way that you could achive the requirments else there is no direct way avaialble for it.
thanks
Swarup -
Smartform into PDF and store in folder of application server
Hi Gurus,
I have to solve this issue please help meu2026
1.Convert Smartform into PDF and store in folder of application server
2.print the PDF stored in folder(Application Server) automatically
Please give suggestion for the above..
Moderator message: "spec dumping", please work yourself first on your requirement.
Edited by: Thomas Zloch on Oct 7, 2011 10:39 AMhi uma,
http://www.kodyaz.com/articles/sap-smartforms-download-as-smartform-pdf-using-ws_download-and-cl_gui_frontend_services.aspx
check this out...
thanks,
ram -
How to extract data from xml and insert into Oracle table
Hi,
I have a large xml file. which will have hundreds of the following transaction tags having column names and there values.
There is a table one of the schema with coulums "actualCostRate","billRate"....etc.
I need to extract the values of these columns and insert into the table
<Transaction actualCostRate="0" billRate="0" chargeable="1" clientID="NikuUK" chargeCode="LCOCD1" externalID="L-RESCODE_UK1-PROJ_UK_CNT_GBP-37289-8" importStatus="N" projectID="TESTPROJ" resourceID="admin" transactionDate="2002-02-12" transactionType="L" units="11" taskID="5017601" inputTypeCode="SALES" groupId="123" voucherNumber="ABCVDD" transactionClass="ABCD"/>
<Transaction actualCostRate="0" billRate="0" chargeable="1" clientID="NikuEU" chargeCode="LCOCD1" externalID="L-RESCODE_US1-PROJ_EU_STD2-37291-4" importStatus="N" projectID="TESTPROJ" resourceID="admin" transactionDate="2002-02-04" transactionType="L" units="4" taskID="5017601" inputTypeCode="SALES" groupId="124" voucherNumber="EEE222" transactionClass="DEFG"/>Re: Insert from XML to relational table
http://www.google.ae/search?hl=ar&q=extract+data+from+xml+and+insert+into+Oracle+table+&btnG=%D8%A8%D8%AD%D8%AB+Google&meta=
Maybe you are looking for
-
How to "catch" ERROR_MESSAGE
Hello, i´ve written a FM which also calls SAP FM´s. Somewhere there is this statement: else. message w207(m7) with ymcha-charg ymcha-matnr. endif. This line throws an error... Because the FM is used in a job, this job
-
Removing duplicates in iPhoto 6
I have an iBook which I was using for a while and builtup a collection of photos on it. I then got an iMac which i used more due to the larger screen. As soon as I got it I should have copied the contents of the iBook onto it but instead continued us
-
HOW TO FIND INFOTYPES OF A LOGICAL DATA BASE
Hi all, Can u help me 1) how to find the infotypes , if i know the logical database in ABAP-HR. 2 )If i know the infotype , then how to find the logical database ? Thanks in advace Ravi
-
Can I set html input with digital
If I use html in iphone,Can I set the "input=text" only digital allowed,just like the keyboard number pad! Thanks!
-
PDF not faithful to source document
Using Create PDF Online I can no longer exactly replicate the source MS/Word document as a pdf. Every conversion option including the default 'Screen' results in a readable (OCR) document that paginates differently from the original. No good for lega