Display logo In PDF output ( Spool to PDF output )
Hi Experts,
In my requirement i am using 'REUSE_ALV_GRID' to display logo.
In our functionality we are executing report in background and we are converting spool into PDF output. Now our requirement is to display LOGO in PDF output.
Any pointers on this are appreciated.
Regards,
Bhanu.R
Hello,
Use the top-of-page parameter of the FM 'REUSE_ALV_GRID_DISPLAY' and use the FM REUSE_ALV_COMMENTARY_WRITE to add the logo to the I_LOGO export parameter to get the logo in the ALV output. Now convert this to spool and to pdf and you can get the logo in the pdf as well
Vikranth
Similar Messages
-
Urgent : Display logo in Smartform with XSF+ HTML as Output Format
Hi,
Through the Portal we are displaying ESS Salary Statement of a Employee for last 24 monthys in the iView using the Customized Smartform ZHR_ESS_PAYSLIP_TO_PDF which is copy of Standard Smartform HR_ESS_PAYSLIP_TO_PDF .
Requirement is that we have to change the Output Option to "XSF+HTML" and Display a logo at Top-Middle of the form.
But the problem is that Logo is only visible only when Output Option is "Standard Output". and not visible when Output Option is "XSF+HTML".
Please tell me how to display the Logo in the Smartform so that it is visible in "XSF+HTML" or "XSF" as Output Option.
Asnwers will be suitably rewarded.
Thanks,
Ajay JangidHi Ajay,
Following threads may help you
Smartforms to Xsf & Html format
/message/1484753#1484753 [original link is broken]
Regards,
Manoj -
Sapscript output(Spool) to PDF problem when viewed
We have a number of documents which are output in Russian using the Cyrillic courier font within our Uincode SAP system. They look fine on the spool when viewed, print okay, and all look fine when converted to a PDF file (using RSTXPDFT4) and viewed via Adobe PDF viewer (vers 9.1.20), except one form, the invoice, which will not display properly in Adobe, showing square blocks with crosses through them when viewed. The strange thing is that when this same PDF is viewed via Sumatra (Open source PDF viewer) it looks perfect, but will not display via the Adobe PDF viewer, even though all the other delivery/dispatch docuemnts (all Sapscript) print and view fine via the Adobe PDF viewer.
I guess I could suggest that we just use Sumatra from now on, but that is not really the answer when you have a multinational company which has Adobe already installed on all hardware as default.
Has anyone come across this problem before. I was wondering if there could be anything in Sapscript that might have caused this as this is a copy of SAP standard Russian Invoice Sapscript (J_3RVINVOICE)?
I'm going to check OSS to see if there's a fault with the PDF convertion program (RSTXPDFT4) but I would like to hear from anyone that may have encountered the same problem.
Regards
GaryHi Gary
How the issue is resolved, please let me know. Since i am also facing same issue.
Thanks
M G Shankar -
Spool to PDF output in application server
Hi Experts,
I have a problem with converting spool to PDF. If I download the spool to presentation, the outputs is fine, BUT when I download it to application server and try to view it in al11, a set of characters comes out and if I try to save it on my local drive, an error message pops out stating that it could not read the file because it is either not a supported file type or because the file has been damaged. Please help me. I've tried doing everything I can already. I cannot run the convertion of spool file to presentation because it always ends up as run time error, that's why I have no choice but to run it in background. These files needs to be distributed to all branch offices. Please, please.......help......I'm desperate......Hi Nikhil,
I'm sorry....but I'm still stucked. If I try to view the pdf output in AL11 this characters are still displayed "═䑆ⴱ⸳ഊ◢팍ਲ扪ഊ⽗楮䅮獩䕮捯摩湧ഊ敮摯扪ഊ㌠〠潢樍਼㰍ਥ䑥癴祰攠偏協㈠⁆潮琠䍏啒䥅删潲浡氠䱡湧⁅不ਯ呹灥 䙯湴ഊ⽓畢瑹灥 呹灥ㄍਯ䉡獥䙯湴 䍯畲楥爍ਯ乡浥 䘰", and when the basis transferred it to the local folder the same error came out that the file could not be read either it is corrupted or file type is not supported. Please.....I've been on it for hours and can't seem to get the problem. Here's what I did with the program....Please tell me where I went wrong.....Help......
PARAMETERS: p_file TYPE LOCALFILE DEFAULT TEXT-F02 OBLIGATORY.
DATA: gd_buffer TYPE STRING OCCURS 0 WITH HEADER LINE.
lt_conv LIKE gd_buffer OCCURS 0 WITH HEADER LINE.
DATA lv_string TYPE string.
LOOP AT it_pdf_output.
TRANSLATE it_pdf_output USING '~'.
CONCATENATE gd_buffer it_pdf_output INTO gd_buffer.
ENDLOOP.
TRANSLATE gd_buffer USING '~'.
APPEND gd_buffer.
DO.
counter = strlen( gd_buffer ).
IF counter GE 255.
lt_conv = gd_buffer(255).
APPEND lt_conv.
SHIFT gd_buffer LEFT BY 255 PLACES.
ELSE.
lt_conv = gd_buffer(counter).
APPEND lt_conv.
EXIT.
ENDIF.
ENDDO.
IF lt_conv[] IS NOT INITIAL.
OPEN DATASET p_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc EQ 0.
IF sy-subrc <> 0.
MESSAGE e398(00) WITH 'Error creating file' p_file.
ENDIF.
LOOP AT lt_conv INTO lv_string.
TRANSFER lv_string TO p_file.
ENDLOOP.
CLOSE DATASET p_file.
IF sy-subrc EQ 0.
ELSE.
MESSAGE e398(00) WITH 'Error closing file' p_file.
ENDIF.
ELSE.
MESSAGE e398(00) WITH 'Error creating file' p_file.
ENDIF.
ENDIF. -
Convert ABAP Spool to PDF and display in BSP
Hello SDNers,
I have a requirement to display an R/3 report in Portal as PDF. I have chosen the route of creating a BSP which will show the report as PDF.
I will then create a BSP iView in Portal pointing to this application.
I am following the weblog /people/sap.user72/blog/2004/11/10/bsphowto-generate-pdf-output-from-a-bsp
and few SDN forums:
Display result of standard report RPTEDT00 within BSP
Re: PDF Output
I am new to BSP development and I am not able to put all the pieces of code together.
I would really appreciate if you can help me put the pieces together and help me out with this.
More details:
This custom report displays the summary of Benefits Cost Accounting (by PERNR and current year).
Once the report is run, I would like to get hold of the spool and convert the spool to PDF.
In my BSP I would like to get the spool (or the binary of the PDF) and display the report as PDF in the BSP application.
I have created the BSP application using the code given in the above weblog.
I am not sure how to proceed further with the requirement.
Looking forward for your suggestions and help.
Thanks,
KalyanHi kalyan,
go thru this wiki and you will have what you need all at one place. the piece you might want to look at is ABAP spool to PDF. It even contains complete code.
https://www.sdn.sap.com/irj/sdn/wiki?path=/display/bsp/pdf
hope this helps. -
Convert ABAP list output to PDF without spool
Hi All,
We have used the FM 'CONVERT_ABAPSPOOLJOB_2_PDF' to convert the list output to PDF. It creates the spool number in SP01 and PDF is getting generated.
But, in our SAP ECC 6.0 server all spools are redirected to printer by default and get printed because it configured like that. We requested BASIS people to reconfigure but they said no for a single report.
So we need to find the alternate solution to generate the PDF without spool. We have searched in sdn, but didnot get any alternate solution.
Please help us in this regard.
Thanks in advance.data: begin of i_list occurs 0,
line(255),
end of i_list.
data:i_mara like mara occurs 0 with header line.
parameters: p_matnr like mara-matnr.
start-of-selection.
set pf-status 'PDFFILE'.
select *
from mara
into table i_mara
where matnr = p_matnr.
loop at i_mara.
write:i_mara-matnr,i_mara-ernam,i_mara-pstat.
endloop.
at user-command.
if sy-ucomm = 'PDF'.
DO.
READ LINE SY-INDEX.
IF SY-SUBRC NE 0.
EXIT.
ELSE.
I_LIST = SY-LISEL.
APPEND I_LIST.
ENDIF.
ENDDO.
NEW-PAGE PRINT ON DESTINATION 'LP03' IMMEDIATELY ' ' COVER TEXT ' ' KEEP IN SPOOL 'X' NEW LIST IDENTIFICATION 'X' LINE-SIZE 132 LINE-COUNT 65 NO DIALOG.
LOOP AT I_LIST.
IF I_LIST-LINE IS INITIAL.
SKIP.
ELSE.
at first.
write: TEXT-001.
endat.
WRITE: I_LIST-LINE+0(132).
ENDIF.
ENDLOOP.
NEW-PAGE PRINT OFF.
data:filename like RLGRAP-filename value 'C:\PDFFILE.PDF'.
DATA: SPOOL TYPE TSP01-RQIDENT.
SPOOL = SY-SPONO.
SUBMIT rstxpdft4
WITH spoolno = spool
WITH download = 'X'
WITH p_file = filename
AND RETURN.
if sy-subrc = 0.
write: 'pdf file generated'.
else.
write:'pdf file not generated'.
EXIT.
endif.
endif.
please paste this code and check once ,if it works modify the code according to ur requirement.
regards,
padmaja -
While Changing ABAP List from Spool to PDF Whole List is not displaying
Hi,
There is Z Program to convert Payslip ABAP List to PDF, when it is generating in PDF from Spool, I cannot view whole Payslip.
Previously it is dislpaying fully in PDF file, But not Now.
Please Help me...............
With Regards,
Gaurav.Hi,
Thank you very much. My problem has been solved
Thanks & Regards,
Gaurav Mittal -
Sending smartform output as PDF attachment, Error opening PDF attachment
Hi Experts,
I am using the code form the following link to send a smartform output as PDF attachment. I can able to see the message, but can not open PDF document.
https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/convertSmartformtoPDFformat&
The information should be on my smartform are some text, company logo and a barcode.
With all of these received error: "There was an error opening this document. The file is damaged and could not be repaired."
I tried different ways like only text, text with company logo, text with barcode. I got the following errors:
An unrecognized token 'Td0' was found
There was problem reading this document(16).
There was problem reading this document(111).
Does anyone have idea of these ? Your help is greatly appreciated.
Thank you,
Suryaplease see this code ... for sending the Email as PDF attach file,
*& 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.
reward points if it is usefull ....
Girish -
ALV output converted into PDF format and send that PDF to user through mail
Hi Experts,
I have report earlier its output was in alv grid.
Now i want that ALV output converted into PDF format.And that PDF output send to user through mail.
Can u please tell how to do?
My code is here(output is displaying in ALV grid).
INCLUDE <icon>.
TYPE-POOLS: slis, kkblo.
TABLES : zmsd_freight_hdr, zmsd_freight_det, zmsd_blinfo, zmsd_diheader.
TABLES : lfa1.
DATA : t_hdr LIKE zmsd_freight_hdr OCCURS 0 WITH HEADER LINE,
T_DET LIKE ZMSD_FREIGHT_DET OCCURS 0 WITH HEADER LINE,
t_bl LIKE zmsd_blinfo OCCURS 0 WITH HEADER LINE,
t_di LIKE zmsd_diheader OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF t_det OCCURS 0.
INCLUDE STRUCTURE zmsd_freight_det.
DATA type(30).
DATA: END OF t_det.
DATA: v_target2(30),
v_zsammg LIKE t_det-zsammg,
v_gsttotal LIKE t_det-zamount.
DATA : BEGIN OF t_data OCCURS 0,
zsammg LIKE zmsd_freight_hdr-zsammg,
zdidbl LIKE zmsd_freight_hdr-zdidbl,
zvkorg LIKE zmsd_freight_hdr-zvkorg,
zinvno LIKE zmsd_freight_hdr-zinvno,
zttlamt LIKE zmsd_freight_hdr-zttlamt,
zstatus LIKE zmsd_freight_hdr-zstatus,
ztype LIKE zmsd_freight_hdr-ztype,
zconfirm LIKE zmsd_freight_hdr-zconfirm,
zconfirmdate LIKE zmsd_freight_hdr-zconfirmdate,
erdat LIKE zmsd_freight_hdr-erdat,
ernam LIKE zmsd_freight_hdr-ernam,
erzet LIKE zmsd_freight_hdr-erzet,
aedat(10),
aenam LIKE zmsd_freight_hdr-aenam,
aezet LIKE zmsd_freight_hdr-aezet,
zline LIKE zmsd_freight_det-zline,
zfptype LIKE zmsd_freight_det-zfptype,
zchrcode LIKE zmsd_freight_det-zchrcode,
zcurcode LIKE zmsd_freight_det-zcurcode,
zqty LIKE zmsd_freight_det-zqty,
zuom LIKE zmsd_freight_det-zuom,
zrate LIKE zmsd_freight_det-zrate,
zamount LIKE zmsd_freight_det-zamount,
zexrate LIKE zmsd_freight_det-zexrate,
zccode LIKE zmsd_blinfo-zccode, "MADK991565
zccode like ZMSD_FREIGHT_HDR-zfcode, "MADK991565
zbldate(10),
zbl LIKE zmsd_blinfo-zbl,
type(3),
waerk LIKE zmsd_freight_det-zcurcode,
zamountl LIKE zmsd_freight_det-zamount,
END OF t_data.
DATA : w_layout TYPE slis_layout_alv,
w_catalog TYPE slis_fieldcat_alv,
t_catalog TYPE slis_t_fieldcat_alv,
w_sort TYPE slis_sortinfo_alv,
t_sort TYPE slis_t_sortinfo_alv.
DATA V_ZINVNO like T_HDR-ZINVNO. "MADK991565
DATA : v_count TYPE i.
SELECTION-SCREEN BEGIN OF BLOCK a0 WITH FRAME TITLE text-001.
PARAMETERS : p_zvkorg LIKE zmsd_freight_hdr-zvkorg OBLIGATORY .
SELECT-OPTIONS : s_zdidbl FOR zmsd_freight_hdr-zdidbl ,
s_zccode FOR lfa1-lifnr ,
s_status FOR zmsd_freight_hdr-zstatus ,
s_ztype FOR zmsd_freight_hdr-ztype ,
s_erdat FOR zmsd_freight_hdr-erdat ,
s_ernam FOR zmsd_freight_hdr-ernam ,
s_zconfd FOR zmsd_freight_hdr-zconfirmdate .
PARAMETERS : p_zconf AS CHECKBOX .
SELECTION-SCREEN END OF BLOCK a0.
SELECTION-SCREEN BEGIN OF BLOCK a1 WITH FRAME TITLE text-002.
PARAMETERS : p_hdr RADIOBUTTON GROUP rad DEFAULT 'X' ,
p_det RADIOBUTTON GROUP rad .
SELECTION-SCREEN END OF BLOCK a1.
INITIALIZATION.
AT SELECTION-SCREEN.
START-OF-SELECTION.
PERFORM get_data.
PERFORM process.
PERFORM display.
END-OF-SELECTION.
PERFORM fm_get_num_pages.
AT USER-COMMAND.
AT LINE-SELECTION.
TOP-OF-PAGE.
PERFORM fm_top_of_page USING '7010' sy-title space.
FORM get_data.
SELECT *
FROM zmsd_freight_hdr
INTO TABLE t_hdr
WHERE zvkorg EQ p_zvkorg
AND zdidbl IN s_zdidbl
AND zstatus IN s_status
AND ztype IN s_ztype
AND erdat IN s_erdat
AND ernam IN s_ernam
AND zconfirmdate IN s_zconfd
AND ZFCODE IN S_ZCCODE. "MADK991565
IF p_zconf = 'X'.
DELETE t_hdr WHERE zconfirm NE 'C'.
ENDIF.
CHECK NOT t_hdr[] IS INITIAL.
SELECT *
FROM zmsd_blinfo
INTO TABLE t_bl
FOR ALL ENTRIES IN t_hdr
WHERE zsammg = t_hdr-zsammg.
SORT t_bl BY zsammg.
SELECT *
FROM zmsd_diheader
INTO TABLE t_di
FOR ALL ENTRIES IN t_hdr
WHERE zsammg = t_hdr-zsammg.
SORT t_di BY zsammg.
IF P_DET = 'X'. "MADK933361
SELECT *
FROM zmsd_freight_det
INTO TABLE t_det
FOR ALL ENTRIES IN t_hdr
WHERE zsammg = t_hdr-zsammg
AND ZINVNO = T_HDR-ZINVNO . "MADK991565
SORT t_det BY zsammg zline. "MADK991565
SORT T_DET BY ZSAMMG ZINVNO ZLINE. "MADK991565
ENDIF. "MADK933361
ENDFORM.
FORM process.
REFRESH t_data.
CLEAR v_gsttotal. "MADK933361
LOOP AT t_hdr.
Start of MADK933361
CLEAR: v_target2.
v_zsammg = t_hdr-zsammg.
V_ZINVNO = T_HDR-ZINVNO. "MADK991565
AT NEW zsammg. "MADK991565
AT NEW ZINVNO. "MADK991565
PERFORM get_gst_value.
ENDAT.
End of MADK933361
PERFORM move_header.
CHECK t_data-zccode IN s_zccode.
IF p_det = 'X'.
CSF Project Changes Starts DEV34 MADK985782
LOOP AT T_DET WHERE ZSAMMG = T_HDR-ZSAMMG..
LOOP AT t_det WHERE zsammg = t_hdr-zsammg AND
zinvno = t_hdr-zinvno.
CSF Project Changes Ends DEV34 MADK985782
PERFORM move_header.
CHECK t_data-zccode IN s_zccode.
MOVE-CORRESPONDING t_det TO t_data.
t_data-zamountl = t_data-zamount * t_data-zexrate.
APPEND t_data.
CLEAR t_data.
ENDLOOP.
ELSE.
APPEND t_data.
CLEAR t_data.
ENDIF.
AT END OF zsammg.
CLEAR v_gsttotal.
ENDAT.
*Start of changes for IS090901289-PIA MADK991565
AT END OF ZINVNO.
CLEAR V_GSTTOTAL.
ENDAT.
*End of changes for IS090901289-PIA MADK991565
ENDLOOP.
ENDFORM.
FORM move_header.
MOVE-CORRESPONDING t_hdr TO t_data.
t_data-zttlamt = t_data-zttlamt + v_gsttotal. "MADK933361
t_data-waerk = 'SGD'.
IF NOT t_hdr-aedat IS INITIAL.
WRITE: t_hdr-aedat TO t_data-aedat.
ELSE.
CLEAR : t_data-aedat.
ENDIF.
READ TABLE t_bl WITH KEY zsammg = t_hdr-zsammg BINARY SEARCH.
IF sy-subrc EQ 0.
t_data-zccode = t_bl-zccode. "MADK991565
T_DATA-ZCCODE = T_HDR-ZFCODE. "MADK991565
IF NOT t_bl-zbldate IS INITIAL.
WRITE: t_bl-zbldate TO t_data-zbldate.
ENDIF.
t_data-zbl = t_bl-zbl.
t_data-type = 'DBL'.
ELSE.
READ TABLE t_di WITH KEY zsammg = t_hdr-zsammg BINARY SEARCH.
IF sy-subrc EQ 0.
t_data-zccode = t_di-zdiforcode. "MADK991565
T_DATA-ZCCODE = T_HDR-ZFCODE. "MADK991565
t_data-type = 'DI'.
ENDIF.
ENDIF.
ENDFORM.
FORM display.
IF t_data[] IS INITIAL.
MESSAGE s398(00) WITH 'No Data Selected'.
EXIT.
ENDIF.
DATA : l_repid LIKE sy-repid.
l_repid = sy-repid.
REFRESH t_catalog.
CLEAR t_catalog.
w_layout-cell_merge = 'X'.
PERFORM map_fields.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = l_repid
i_callback_user_command = 'ALV_USER_COMMAND'
is_layout = w_layout
it_fieldcat = t_catalog[]
i_grid_title = sy-title
i_save = 'A'
it_sort = t_sort[]
TABLES
t_outtab = t_data
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
ENDIF.
ENDFORM.
FORM map_fields.
Sort Order
CLEAR v_count.
PERFORM sf USING 'ZDIDBL' 'X' 'X'.
Fields to be displayed
CLEAR v_count.
IF p_hdr = 'X'.
PERFORM af USING :
DESCRIPTION FIELD LEN RTABLE RFIELD
'DI/DBL ' 'ZDIDBL' '14' ' ' ' ',
'Type ' 'TYPE' '04' ' ' ' ',
'Forwarder Code ' 'ZCCODE' '14' ' ' ' ',
'BL Number ' 'ZBL' '14' ' ' ' ',
'BL Date ' 'ZBLDATE' '10' ' ' ' ',
'Invoice Number ' 'ZINVNO' '15' ' ' ' ',
'Extraction ' 'ZSTATUS' '05' 'ZMSD_FREIGHT_HDR' 'ZSTATUS ',
'Freight Type ' 'ZTYPE' '05' 'ZMSD_FREIGHT_HDR' 'ZTYPE ',
'Confirmation ' 'ZCONFIRM' '05' 'ZMSD_FREIGHT_HDR' 'ZCONFIRM',
'Confirm Date ' 'ZCONFIRMDATE' '10' 'ZMSD_FREIGHT_HDR'
'ZCONFIRMDATE',
'Total Amount ' 'ZTTLAMT' '18' ' ' ' ',
'Created On ' 'ERDAT' '10' ' ' ' ',
'Created By ' 'ERNAM' '10' ' ' ' ',
'Changed On ' 'AEDAT' '10' ' ' ' ',
'Changed By ' 'AENAM' '10' ' ' ' '.
ELSE.
PERFORM af USING :
DESCRIPTION FIELD LEN RTABLE RFIELD
'DI/DBL ' 'ZDIDBL' '14' ' ' ' ',
'Type ' 'TYPE' '04' ' ' ' ',
'Forwarder Code ' 'ZCCODE' '14' ' ' ' ',
'BL Number ' 'ZBL' '14' ' ' ' ',
'BL Date ' 'ZBLDATE' '10' ' ' ' ',
'Invoice Number ' 'ZINVNO' '15' ' ' ' ',
'Extraction ' 'ZSTATUS' '05' 'ZMSD_FREIGHT_HDR' 'ZSTATUS ',
'Freight Type ' 'ZTYPE' '05' 'ZMSD_FREIGHT_HDR' 'ZTYPE ',
'Confirmation ' 'ZCONFIRM' '05' 'ZMSD_FREIGHT_HDR' 'ZCONFIRM',
'Confirm Date ' 'ZCONFIRMDATE' '10' 'ZMSD_FREIGHT_HDR'
'ZCONFIRMDATE',
'Total Amount ' 'ZTTLAMT' '18' ' ' ' ',
'Freight Payment ' 'ZFPTYPE' '14' ' ' ' ',
'Charge Code ' 'ZCHRCODE' '10' ' ' ' ',
'Currency ' 'ZCURCODE' '08' ' ' ' ',
'Quantity ' 'ZQTY' '13' ' ' ' ',
'UoM ' 'ZUOM' '04' ' ' ' ',
'Rate ' 'ZRATE' '15' ' ' ' ',
'Amt(Foreign Curr)' 'ZAMOUNT' '16' ' ' ' ',
'Exchange Rate ' 'ZEXRATE' '13' ' ' ' ',
'Amt(Local Curr) ' 'ZAMOUNTL' '16' ' ' ' ',
'Created On ' 'ERDAT' '10' ' ' ' ',
'Created By ' 'ERNAM' '10' ' ' ' ',
'Changed On ' 'AEDAT' '10' ' ' ' ',
'Changed By ' 'AENAM' '10' ' ' ' '.
ENDIF.
ENDFORM.
FORM af USING text
field
len
table
reffield.
v_count = v_count + 1.
w_catalog-col_pos = v_count.
w_catalog-fieldname = field.
w_catalog-ref_tabname = table.
w_catalog-ref_fieldname = reffield.
w_catalog-seltext_s = text.
w_catalog-seltext_m = text.
w_catalog-seltext_l = text.
w_catalog-outputlen = len.
IF field = 'ZTTLAMT' OR field = 'ZAMOUNTL'.
w_catalog-no_zero = 'X'.
w_catalog-cfieldname = 'WAERK'.
w_catalog-datatype = 'CURR'.
ENDIF.
IF FIELD = 'ZRATE' OR FIELD = 'ZAMOUNT'.
IF field = 'ZAMOUNT'.
w_catalog-no_zero = 'X'.
w_catalog-cfieldname = 'ZCURCODE'.
w_catalog-datatype = 'CURR'.
ENDIF.
IF field = 'ZQTY' OR field = 'ZRATE'.
w_catalog-no_zero = 'X'.
w_catalog-datatype = 'DEC'.
ENDIF.
APPEND w_catalog TO t_catalog.
CLEAR w_catalog.
ENDFORM.
FORM sf USING fieldname sortup group.
v_count = v_count + 1.
CLEAR w_sort.
w_sort-fieldname = fieldname.
w_sort-spos = v_count.
w_sort-up = sortup.
w_sort-group = group.
APPEND w_sort TO t_sort.
ENDFORM.
FORM alv_user_command USING in_ucomm LIKE sy-ucomm
in_selfield TYPE slis_selfield.
DATA: lfs_data LIKE t_data.
IF in_ucomm = '&IC1'.
READ TABLE t_data INDEX in_selfield-tabindex INTO lfs_data.
CHECK NOT lfs_data-zdidbl IS INITIAL.
IF lfs_data-type = 'DBL'.
DATA: l_zdbl LIKE zmsd_diheader-zdinum.
l_zdbl = in_selfield-value.
EXPORT l_zdbl TO MEMORY ID 'VBL'.
CALL TRANSACTION 'ZMSD_BL01'.
ENDIF.
IF lfs_data-type = 'DI'.
DATA: v_dinum LIKE zmsd_diheader-zdinum.
v_dinum = in_selfield-value.
EXPORT v_dinum TO MEMORY ID 'VDI'.
CALL TRANSACTION 'ZMSD_DI01'.
ENDIF.
ENDIF.
ENDFORM.
FORM get_gst_value.
LOOP AT t_det WHERE zsammg = v_zsammg
AND ZINVNO = V_ZINVNO. "MADK991565
CHECK t_data-zccode IN s_zccode.
t_det-zamount = t_det-zamount * t_det-zexrate.
SELECT SINGLE y0mmtarget2
INTO v_target2
FROM y0mmipstranslate
WHERE y0mmdatatype = '70' AND
y0mmsource = t_det-zchrcode.
SELECT SINGLE y0mmtarget1
INTO t_det-type
FROM y0mmipstranslate
WHERE y0mmdatatype = '76' AND
y0mmsource = v_target2.
IF t_det-type NE '3Z'.
v_gsttotal = v_gsttotal +
( t_det-zamount * 5 / 100 ).
ENDIF.
ENDLOOP.
Regards,
Raj.Hello,
Following is the procedure to convert alv output to spool and then it to PDF Format.
After we display the ALV, we can check whether it is running in the background using system field u2018sy-batchu2018. Then,we call an function module named u2018GET_JOB_RUNTIME_INFOu2019 to get the current job information. Then go to spool request table tbtcp to get the spool id.
Get current job details
CALL FUNCTION u2018GET_JOB_RUNTIME_INFOu2019
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.
SELECT * FROM tbtcp
INTO TABLE it_tbtcp
WHERE jobname = gd_jobname
AND jobcount = gd_jobcount
AND stepcount = gd_stepcount
AND listident <> u20180000000000u2032
ORDER BY jobname
jobcount
stepcount.
READ TABLE it_tbtcp INTO wa_tbtcp INDEX 1.
Finally, we can call function module u2018CONVERT_ABAPSPOOLJOB_2_PDFu2018 to convert spool reqeust(which is stored in OTF format) to PDF format. Then we can call either function module u2018SO_DOCUMENT_SEND_API1u2032 or SAP BCS (Business Communication Service) to send the pdf as an email attachment.
CALL FUNCTION u2018CONVERT_ABAPSPOOLJOB_2_PDFu2019
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.
Regards,
Sayali
Edited by: Sayali Paradkar on Apr 20, 2010 12:51 PM -
Convert OTF to PDF and print PDF from Spool
Hi,
I have searched all the forums and service market place but could not find solution to my problem.
I am using Function module
CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = p_spool
no_dialog = 'X'
dst_device = 'ISJB'
pdf_destination = 'S'
IMPORTING
pdf_bytecount = lv_bytecount
pdf_spoolid = lv_spoolid
otf_pagecount = lv_pagecount
btc_jobname = lv_jobname
btc_jobcount = lv_jobcount
TABLES
pdf = gt_pdf
EXCEPTIONS
err_no_otf_spooljob = 1
err_no_spooljob = 2
err_no_permission = 3
err_conv_not_possible = 4
err_bad_dstdevice = 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.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
this generates spool in SP01. Ideally it should generate a PDF spool file but it generates a BIN file of Format G_RAW. When I display the spool it displays all kinds of japanese characters which does not make sense,.
I setup printer ISJB with device type JPPDF (PDF converted for Japanese characters). Does any one know where the problem could be? Why I could not print the Spool in PDF?
Thank you,
JagadishHi,
check out this program which will convert spool to pdf
REPORT zsmartform_spool_g.
*************Types Declaration ****************************
TYPES : BEGIN OF gty_tab, " Spool Requests
rqident TYPE tsp01-rqident, " Spool request number
rqdoctype TYPE tsp01-rqdoctype, " Spool: document type
rqo1name TYPE tsp01-rqo1name, " TemSe object name
END OF gty_tab.
*********Work Area ****************************************
DATA: form_name TYPE rs38l_fnam, " Used to get the function module of Smartform
wa_outopt TYPE ssfcompop, " SAP Smart Forms: Smart Composer (transfer) options
gs_tab TYPE gty_tab. " Spool Requests
*******Internal Table Declarations ************************
DATA: gt_tab TYPE STANDARD TABLE OF gty_tab, " Spool Requests
gt_pdf TYPE STANDARD TABLE OF tline, " SAPscript: Text Lines
gt_spoolid TYPE tsfspoolid, " Table with Spool IDs
gt_otfdata TYPE ssfcrescl. " Smart Forms: Return value at end of form prnt
*********Variable Declarations ****************************
DATA: gv_bytecount TYPE i, "#EC NEEDED " PDF Byte Count
gv_file_name TYPE string, " File name
gv_file_path TYPE string, " File Path
gv_full_path TYPE string, " Path
gv_binfilesize TYPE i, " Bin File size
gv_rqident TYPE tsp01-rqident, " Spool request number
gv_name TYPE tst01-dname, " TemSe object name
gv_objtype TYPE rststype-type, " TemSe: Object type name
gv_type TYPE rststype-type. " TemSe: Object type name
START-OF-SELECTION.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'ZPDF_G'
IMPORTING
fm_name = form_name
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
*Get Spool IDs
wa_outopt-tdnewid = 'X'.
wa_outopt-tddest = 'LP01'.
CALL FUNCTION form_name
EXPORTING
output_options = wa_outopt
user_settings = 'X'
IMPORTING
job_output_info = gt_otfdata
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
*Assign the spool id
gt_spoolid = gt_otfdata-spoolids.
Generate spool and pdf for the output of the form
PERFORM sub_generate_spool_pdf.
END-OF-SELECTION.
*& Form sub_generate_spool_pdf
Generate Spool and PDF output
FORM sub_generate_spool_pdf .
DATA: ls_spoolid LIKE LINE OF gt_spoolid.
*----Get the Spool Number
CLEAR ls_spoolid.
READ TABLE gt_spoolid INTO ls_spoolid INDEX 1.
IF sy-subrc = 0.
gv_rqident = ls_spoolid.
ENDIF.
CLEAR gt_tab.
SELECT rqident rqdoctype rqo1name INTO TABLE gt_tab
FROM tsp01 WHERE rqident = gv_rqident.
IF sy-subrc = 0.
CLEAR gs_tab.
Get the TemSe: Object name into variable gv_name
READ TABLE gt_tab INTO gs_tab INDEX 1.
IF sy-subrc = 0.
gv_name = gs_tab-rqo1name.
ENDIF.
ENDIF.
CALL FUNCTION 'RSTS_GET_ATTRIBUTES'
EXPORTING
authority = 'SP01'
client = sy-mandt
name = gv_name
part = 1
IMPORTING
type = gv_type
objtype = gv_objtype
EXCEPTIONS
fb_error = 1
fb_rsts_other = 2
no_object = 3
no_permission = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Check if temse object name type is 'OTF' or 'LIST'
IF gv_objtype(3) = 'OTF'.
PERFORM get_otf_spool_in_pdf.
ELSE.
PERFORM get_abap_spool_in_pdf.
ENDIF.
Generate F4 functionality from spool to pdf
PERFORM write_pdf_spool_to_pc.
ENDFORM. " sub_generate_spool_pdf
*& Form get_abap_spool_in_pdf
Generate the Spool number
FORM get_abap_spool_in_pdf .
REFRESH gt_pdf.
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = gv_rqident
IMPORTING
pdf_bytecount = gv_bytecount
TABLES
pdf = gt_pdf
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.
IF sy-subrc NE 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " get_abap_spool_in_pdf
*& Form get_otf_spool_in_pdf
Generate OTF data from the Spool Number
FORM get_otf_spool_in_pdf .
REFRESH gt_pdf.
CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = gv_rqident
IMPORTING
pdf_bytecount = gv_bytecount
TABLES
pdf = gt_pdf
EXCEPTIONS
err_no_otf_spooljob = 1
err_no_spooljob = 2
err_no_permission = 3
err_conv_not_possible = 4
err_bad_dstdevice = 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.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " get_otf_spool_in_pdf
*& Form write_pdf_spool_to_pc
Generate PDF format
FORM write_pdf_spool_to_pc .
CALL METHOD cl_gui_frontend_services=>file_save_dialog
CHANGING
filename = gv_file_name
path = gv_file_path
fullpath = gv_full_path
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
not_supported_by_gui = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
----DOWNLOADING THE PDF DATA***
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
bin_filesize = gv_binfilesize
filename = gv_full_path
filetype = 'BIN'
TABLES
data_tab = gt_pdf
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
OTHERS = 22.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " write_pdf_spool_to_pc -
Converting spool to pdf to base64
Hello people
I am trying to convert a spool to pdf and then I need to convert the pdf to base64.
I used fm CONVERT_OTFSPOOLJOB_2_PDF to convert the spool to pdf, with the data returned in an internal table it_pdf of type tline.
I then need to convert it_pdf to base64, I did it as follows:
DATA: v_input TYPE xstring,
v_string64 TYPE string,
EXPORT it_pdf[] TO DATA BUFFER v_input. "convert to xstring
CALL FUNCTION 'SCMS_BASE64_ENCODE_STR'
EXPORTING
input = v_input
IMPORTING
output = v_string64
v_string64 seems to contain corrupt data, is this the correct way, anyone have any suggestions here?
Thanx in advance.Just today someone has posted this link somewhere
https://wiki.sdn.sap.com/wiki/display/sandbox/Conversion%20of%20Spool%20Request%20Data%20into%20PDF%20and%20Excel%20Format%20and%20Send%20it%20into%20Mail -
Conversion of spool to pdf format in landscape mode
Hi All,
I have a requirement where I need to print the output from a spool request in SAP to a pdf page .
The page has to be in landscape format. Is it possible to create a pdf page which is always in landscape format?
I am using FM convert abapspool 2pdf for conversion of spool to pdf.
Does this require any setting from BASIS end?
Any ideas/thoughts are welcome..
Thanks -
Harmeet Singh.hi check this...
*& 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,
p_sender LIKE somlreci1-receiver,
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,
venkat appikonda -
Download spool to PDF document on application server
Hi,
I am using function CONVERT_OTFSPOOLJOB_2_PDF to convert a sapscript spool and then downloading the internal table provided to a pdf file on the application server. The sapscript form contains company logos.
After transferring the file from the application server to PC and then opening the pdf document I get the following message:
"There was an error while trying to parse an image."
The PDF doc contains everything except the company logo.
I noticed that this works (i.e. company logo is present in the downloaded file) when I transfer the internal table that contains the PDF contents onto my PC using GUI_DOWNLOAD using mode 'BIN'. However, when I transfer the contents of the same internal
table to a file on the application server using abap statement:
'Open Dataset <filename> FOR OUTPUT IN BINARY MODE'
I get the problem described above.
I noticed that SAP has provided standard program RSTXPDFT4 to convert a spool and download it into a PC file. However is there a similar program that downloads a spool onto the application server? Perhaps there is a 'special' way in downloading PDF documents onto the application server?
I don't this problem with sapscripts that do not have a company logo.
Is there a certain restriction on 'Open Dataset'with transfering logos in PDF documents?
Any help would be greatly appreciated in the form of reward points.
Thanks
LiamHi,
We convert some of our spools to pdf and store them on the app server using following high level process.
CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = p_spool
no_dialog = 'X'
dst_device = 'LOCL'
TABLES
pdf = lt_pdf
EXCEPTIONS
OTHERS = 0.
Write PDF file
CALL FUNCTION 'GUID_CREATE'
IMPORTING
ev_guid_32 = l_guid.
CONCATENATE '/your_path_goes_here/'
l_guid
INTO l_filename.
CONCATENATE l_filename '.pdf' INTO l_filename.
Store
OPEN DATASET l_filename IN TEXT MODE.
IF NOT sy-subrc IS INITIAL. " only write pdf if new
LOOP AT lt_pdf.
TRANSFER lt_pdf TO l_filename.
ENDLOOP.
ENDIF.
CLOSE DATASET l_filename.
If it doesn't work, I would 1st try and play with image type. I'm wondering if it's tripping on image conversion. Perhaps revert to 1st principles and try monochrome bitmap and a few variations thereof. I stand by my code above. Definitely works. HTH, Dave -
Hi,
How can i convert a spool into a pdf format and fill the atributes of the PDF document with title, author, subject and keywords from abap?
Kind regards,
H. HendriksCheck the Below code ......
REPORT ZMAILOUTPUT
MESSAGE-ID ZZ.
* CONSTANTS *
CONSTANTS : C_X(1) TYPE C VALUE 'X', " For constant value
C_OTF(3) TYPE C VALUE 'OTF', " For format
C_U(1) TYPE C VALUE 'U'. " Mail Option
* VARIABLES *
DATA : V_RQIDENT TYPE TSP01-RQIDENT, " For Spool Number
V_RQCLIENT TYPE TSP01-RQCLIENT, " For Client
V_RQO1NAME TYPE TSP01-RQO1NAME, " For Object name
V_SPOOL TYPE TSP01-RQIDENT, " For Spool Number
V_SPOOL1 TYPE TSP01-RQIDENT. " For Spool Number
* FLAGS *
DATA : F_SPOOL TYPE C.
* INTERNAL TABLES *
* Internal table for sending mails
DATA: IT_PDF LIKE TLINE OCCURS 10 WITH HEADER LINE,
IT_XI_PDF LIKE TLINE OCCURS 0 WITH HEADER LINE,
IT_HTML LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
IT_XI_TEMP LIKE BAPIQCMIME OCCURS 0 WITH HEADER LINE,
IT_XI_MIME(255) TYPE C OCCURS 0 WITH HEADER LINE.
* For sending mail
DATA: IT_OBJPACK LIKE SOPCKLSTI1 OCCURS 2 WITH HEADER LINE.
* Internal table for Single List with Column Length 255
DATA : IT_OBJBIN LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
* Internal table for Single List with Column Length 255
DATA : IT_OBJTXT LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
* Internal table for Structure of the API Recipient List
DATA : IT_RECLIST LIKE SOMLRECI1 OCCURS 5 WITH HEADER LINE.
* Structure of the API Recipient List
DATA: X_DOC_CHNG LIKE SODOCCHGI1.
* Internal table for storing the variants
DATA : BEGIN OF IT_VARIANT1 OCCURS 0,
VARIANT LIKE VARID-VARIANT,
END OF IT_VARIANT1.
* Internal table to store variants for the programs
DATA: IT_VARIANT2 LIKE IT_VARIANT1 OCCURS 0 WITH HEADER LINE.
* Internal table for storing the selected values
DATA IT_RETURN TYPE DDSHRETVAL OCCURS 0 WITH HEADER LINE.
* Internal table for storing the mail-ids
DATA : BEGIN OF IT_MAILID OCCURS 0,
KOKRS LIKE CSKS-KOKRS,
KOSTL LIKE CSKS-KOSTL,
DATBI LIKE CSKS-DATBI,
TELX1 LIKE CSKS-TELX1,
END OF IT_MAILID.
* Internal table for storing the mail-ids
DATA : IT_MAILID1 LIKE IT_MAILID OCCURS 0 WITH HEADER LINE.
* SELECTION SCREEN *
DATA : V_CHAR TYPE CHAR50.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS: S_EMAIL FOR V_CHAR NO INTERVALS
LOWER CASE
NO-DISPLAY.
SELECT-OPTIONS: S_EMAIL1 FOR V_CHAR NO INTERVALS
LOWER CASE
NO-DISPLAY.
SELECTION-SCREEN END OF BLOCK B1.
SELECTION-SCREEN BEGIN OF BLOCK A1 WITH FRAME TITLE TEXT-028.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS : P_C1 AS CHECKBOX.
SELECTION-SCREEN COMMENT 3(66) TEXT-026 FOR FIELD P_C1.
SELECTION-SCREEN END OF LINE.
PARAMETERS : P_SET LIKE TSP1D-PAPART MATCHCODE OBJECT ZH_TSP1D.
SELECTION-SCREEN SKIP 1.
PARAMETERS : P_VARA1 TYPE RS38M-SELSET.
SELECTION-SCREEN END OF BLOCK A1.
SELECTION-SCREEN BEGIN OF BLOCK A2 WITH FRAME TITLE TEXT-029.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS : P_C2 AS CHECKBOX.
SELECTION-SCREEN COMMENT 3(56) TEXT-027 FOR FIELD P_C1.
SELECTION-SCREEN END OF LINE.
PARAMETERS : P_SET1 LIKE TSP1D-PAPART MATCHCODE OBJECT ZH_TSP1D.
SELECTION-SCREEN SKIP 1.
PARAMETERS : P_VARA2 TYPE RS38M-SELSET.
SELECTION-SCREEN END OF BLOCK A2.
* AT SELECTION SCREEN ON VALUE REQUEST
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_VARA1.
* For fetching the variants available for the program
PERFORM FETCH_VARIANTS.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_VARA2.
* For fetching the variants available for the program
PERFORM FETCH_VARIANTS1.
* AT SELECTION SCREEN
AT SELECTION-SCREEN.
* For Validation
PERFORM VALIDATION.
* START OF SELECTION *
START-OF-SELECTION.
* To get the output data and mail
PERFORM FETCH_DATA.
* END OF SELECTION *
END-OF-SELECTION.
IF F_SPOOL = C_X.
MESSAGE E000 WITH 'Spool Not Generated'(060).
ENDIF.
*& Form fetch_data
* To get the output data and mail
FORM FETCH_DATA .
* To send the output to spool
PERFORM GENERATE_SPOOL.
ENDFORM. " fetch_data
*& Form generate_spool
* To send the output to spool
FORM GENERATE_SPOOL .
DATA: L_PARAMS LIKE PRI_PARAMS,
L_DAYS(1) TYPE N VALUE 2,
L_COUNT(3) TYPE N VALUE 1,
L_VALID TYPE C,
L_VALID1 TYPE C,
L_PARAMS1 LIKE PRI_PARAMS.
DATA: L_DEVICE TYPE USR01-SPLD.
*Get the printer name for the user
SELECT SINGLE SPLD INTO L_DEVICE FROM USR01 WHERE BNAME = SY-UNAME.
IF L_DEVICE IS INITIAL.
L_DEVICE = 'LOCL'.
ENDIF.
* For report-1
IF P_C1 = 'X'.
* Setting the print parameters
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
DESTINATION = L_DEVICE
COPIES = L_COUNT
LIST_NAME = SY-UNAME
LIST_TEXT = 'SUBMIT ... TO SAP-SPOOL'(008)
RELEASE = C_X
NEW_LIST_ID = C_X
EXPIRATION = L_DAYS
* LINE_SIZE = 255
* LINE_COUNT = 65
LAYOUT = p_set
SAP_COVER_PAGE = SPACE
COVER_PAGE = SPACE
RECEIVER = 'SAP*'(010)
DEPARTMENT = 'System'(011)
NO_DIALOG = C_X
IMPORTING
OUT_PARAMETERS = L_PARAMS
VALID = L_VALID.
IF L_VALID <> SPACE.
CLEAR V_SPOOL.
* Fetch the spool number b4 submit
PERFORM FETCH_RECENT_SPOOL USING V_SPOOL.
* Submitting the program to spool
SUBMIT RKAEP000 TO SAP-SPOOL
USING SELECTION-SET P_VARA1
SPOOL PARAMETERS L_PARAMS
WITHOUT SPOOL DYNPRO
AND RETURN.
CLEAR V_SPOOL1.
* Fetch the spool number after submit
PERFORM FETCH_RECENT_SPOOL USING V_SPOOL1.
IF V_SPOOL = V_SPOOL1.
F_SPOOL = C_X.
IF P_C2 IS INITIAL.
STOP.
ENDIF.
ELSE.
* Checking the format ( ABAP/OTF)
PERFORM FORMAT_CHECK TABLES S_EMAIL.
ENDIF.
ELSE.
MESSAGE E000 WITH 'Problem in print settings'(003).
STOP.
ENDIF.
ENDIF.
* For Report-2
IF P_C2 = 'X'.
* Setting the print parameters
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
DESTINATION = L_DEVICE
COPIES = L_COUNT
LIST_NAME = SY-UNAME
LIST_TEXT = 'SUBMIT ... TO SAP-SPOOL'(008)
RELEASE = C_X
NEW_LIST_ID = C_X
EXPIRATION = L_DAYS
* LINE_SIZE = 200
* LINE_COUNT = 65
LAYOUT = p_set1
SAP_COVER_PAGE = SPACE
COVER_PAGE = SPACE
RECEIVER = 'SAP*'(010)
DEPARTMENT = 'System'(011)
NO_DIALOG = C_X
IMPORTING
OUT_PARAMETERS = L_PARAMS1
VALID = L_VALID1.
IF L_VALID1 <> SPACE.
CLEAR V_SPOOL.
* Fetch the spool number b4 submit
PERFORM FETCH_RECENT_SPOOL USING V_SPOOL.
* Submitting the program to spool
SUBMIT GP3DIEHXY88SNFJ0391V7KF9EK7050 TO SAP-SPOOL
USING SELECTION-SET P_VARA2
SPOOL PARAMETERS L_PARAMS1
WITHOUT SPOOL DYNPRO
AND RETURN.
CLEAR V_SPOOL1.
* Fetch the spool number after submit
PERFORM FETCH_RECENT_SPOOL USING V_SPOOL1.
IF V_SPOOL = V_SPOOL1.
MESSAGE E000 WITH 'Spool Not Generated'(060).
STOP.
ENDIF.
* Checking the format ( ABAP/OTF)
PERFORM FORMAT_CHECK TABLES S_EMAIL1.
ELSE.
MESSAGE E000 WITH 'Problem in print settings'(003).
STOP.
ENDIF.
ENDIF.
ENDFORM. " generate_spool
*& Form fetch_recent_spool
* Fetch the recent spool number generated
FORM FETCH_RECENT_SPOOL USING P_V_SPOOL TYPE TSP01-RQIDENT .
DATA: L_USER LIKE TSP01-RQ2NAME.
CLEAR : V_RQIDENT,
V_RQCLIENT,
V_RQO1NAME.
L_USER = SY-UNAME.
* Get latest Spool No
SELECT SINGLE RQIDENT
RQCLIENT
RQO1NAME
INTO (V_RQIDENT , V_RQCLIENT , V_RQO1NAME)
FROM TSP01
WHERE RQCRETIME = ( SELECT MAX( RQCRETIME )
FROM TSP01
WHERE RQ2NAME EQ L_USER
AND RQFINAL EQ '.' ).
IF SY-SUBRC = 0 .
P_V_SPOOL = V_RQIDENT.
ENDIF.
ENDFORM. " fetch_recent_spool
*& Form format_check
* Checking the format ( ABAP/OTF)
FORM FORMAT_CHECK TABLES P_S_EMAIL STRUCTURE S_EMAIL.
DATA : L_OBJTYPE LIKE RSTSTYPE-TYPE.
CALL FUNCTION 'RSTS_GET_ATTRIBUTES'
EXPORTING
AUTHORITY = 'SP01'(019)
CLIENT = V_RQCLIENT
NAME = V_RQO1NAME
PART = 1
IMPORTING
OBJTYPE = L_OBJTYPE
EXCEPTIONS
FB_ERROR = 1
FB_RSTS_OTHER = 2
NO_OBJECT = 3
NO_PERMISSION = 4.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
IF L_OBJTYPE(3) = C_OTF.
* Convert OTF Spool to PDF
PERFORM CONVERT_OTF2PDF TABLES P_S_EMAIL.
ELSE.
* Convert ABAP Spool to PDF
PERFORM CONVERT_ABAP2PDF TABLES P_S_EMAIL.
ENDIF.
ENDFORM. " format_check
*& Form convert_otf2pdf
* Convert OTF Spool to PDF
FORM CONVERT_OTF2PDF TABLES P_P_S_EMAIL STRUCTURE S_EMAIL .
CLEAR IT_PDF.
REFRESH IT_PDF.
DATA : L_BYTECOUNT TYPE I.
* Fn. to get the PDF format
CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
EXPORTING
SRC_SPOOLID = V_RQIDENT
NO_DIALOG = 'X'
IMPORTING
PDF_BYTECOUNT = L_BYTECOUNT
TABLES
PDF = IT_PDF
EXCEPTIONS
ERR_NO_OTF_SPOOLJOB = 1
ERR_NO_SPOOLJOB = 2
ERR_NO_PERMISSION = 3
ERR_CONV_NOT_POSSIBLE = 4
ERR_BAD_DSTDEVICE = 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.
IF SY-SUBRC = 0.
* For page format
PERFORM PAGE_FORMAT TABLES P_P_S_EMAIL.
ELSE.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " convert_otf2pdf
*& Form convert_abap2pdf
* Convert ABAP Spool to PDF
FORM CONVERT_ABAP2PDF TABLES P_P_S_EMAIL STRUCTURE S_EMAIL.
CLEAR IT_PDF.
REFRESH IT_PDF.
DATA : L_BYTECOUNT TYPE I.
* Fn. to convert to PDF format
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
SRC_SPOOLID = V_RQIDENT
NO_DIALOG = 'X'
IMPORTING
PDF_BYTECOUNT = L_BYTECOUNT
TABLES
PDF = IT_PDF
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.
IF SY-SUBRC = 0.
* For page formatting
PERFORM PAGE_FORMAT TABLES P_P_S_EMAIL.
ELSE.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " convert_abap2pdf
*& Form send_mail
* For sending mail
FORM SEND_MAIL TABLES MAIL STRUCTURE S_EMAIL .
* Structures and internal tables for the send data
DATA: OBJPACK LIKE SOPCKLSTI1 OCCURS 2 WITH HEADER LINE,
OBJHEAD LIKE SOLISTI1 OCCURS 1 WITH HEADER LINE,
OBJBIN LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
OBJTXT LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE,
RECLIST LIKE SOMLRECI1 OCCURS 5 WITH HEADER LINE.
DATA: DOC_CHNG LIKE SODOCCHGI1,
TAB_LINES LIKE SY-TABIX.
* Data for the status output after sending
DATA: SENT_TO_ALL LIKE SONV-FLAG.
CLEAR: IT_RECLIST, IT_RECLIST[],
IT_OBJTXT , IT_OBJTXT[],
IT_OBJPACK, IT_OBJPACK[],
IT_OBJBIN , IT_OBJBIN[],X_DOC_CHNG.
LOOP AT IT_HTML.
OBJBIN-LINE = IT_HTML-LINE.
APPEND OBJBIN.
CLEAR OBJBIN.
ENDLOOP.
* Create the document which is to be sent
DOC_CHNG-OBJ_NAME = 'List'(012).
DOC_CHNG-OBJ_DESCR = 'Mail'(013).
* Heading
OBJTXT-LINE = 'Mail with pdf attachment'(014).
APPEND OBJTXT.
CLEAR OBJTXT.
* Size
DESCRIBE TABLE OBJTXT LINES TAB_LINES.
READ TABLE OBJTXT INDEX TAB_LINES.
DOC_CHNG-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + STRLEN( OBJTXT ).
* Fill the fields of the packing_list for the main document:
CLEAR OBJPACK-TRANSF_BIN.
* The document needs no header (head_num = 0)
OBJPACK-HEAD_START = 1.
OBJPACK-HEAD_NUM = 0.
* Body
OBJPACK-BODY_START = 1.
OBJPACK-BODY_NUM = TAB_LINES.
OBJPACK-DOC_TYPE = 'RAW'(015).
APPEND OBJPACK.
* Create the attachment (the list itself)
DESCRIBE TABLE OBJBIN LINES TAB_LINES.
* Fill the fields of the packing_list for the attachment:
OBJPACK-TRANSF_BIN = 'X'.
* Header
OBJPACK-HEAD_START = 1.
OBJPACK-HEAD_NUM = 0.
* Body
OBJPACK-BODY_START = 1.
OBJPACK-BODY_NUM = TAB_LINES.
OBJPACK-DOC_TYPE = 'PDF'(016).
OBJPACK-OBJ_NAME = 'Attachment'(017).
OBJPACK-OBJ_DESCR = 'Mail with pdf Attachment'(018).
OBJPACK-DOC_SIZE = TAB_LINES * 255.
APPEND OBJPACK.
*-Fill the mail recipient list
LOOP AT MAIL.
RECLIST-RECEIVER = MAIL-LOW.
RECLIST-REC_TYPE = C_U.
APPEND RECLIST.
CLEAR: RECLIST,
MAIL.
ENDLOOP.
*-Send the document by calling the SAPoffice API1 module for sending
*-documents with attachments
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = DOC_CHNG
PUT_IN_OUTBOX = C_X
COMMIT_WORK = C_X
IMPORTING
SENT_TO_ALL = SENT_TO_ALL
TABLES
PACKING_LIST = OBJPACK
OBJECT_HEADER = OBJHEAD
CONTENTS_BIN = OBJBIN
CONTENTS_TXT = OBJTXT
RECEIVERS = RECLIST
EXCEPTIONS
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
OPERATION_NO_AUTHORIZATION = 4
OTHERS = 99.
CASE SY-SUBRC .
WHEN 0.
MESSAGE I000 WITH 'Mail has been sent successfully'(006).
WHEN OTHERS.
MESSAGE E000 WITH 'Problem in sending the mail'(023).
ENDCASE.
ENDFORM. " send_mail
*& Form page_format
* For page foramtting
FORM PAGE_FORMAT TABLES EMAIL STRUCTURE S_EMAIL .
DATA : L_LINES TYPE I,
L_TEMP(500) TYPE C,
L_OFFSET TYPE P,
L_LINESLEN(2) TYPE P,
L_MIMELEN(2) TYPE P,
L_TABIX LIKE SY-TABIX.
CLEAR : IT_XI_PDF,
IT_XI_TEMP.
REFRESH : IT_XI_PDF,
IT_XI_TEMP.
IT_XI_PDF[] = IT_PDF[].
* Reformat the line to 255 characters wide (--code from SAP--)
CLEAR: L_TEMP, L_OFFSET, IT_XI_TEMP.
DESCRIBE TABLE IT_XI_PDF LINES L_LINES.
DESCRIBE FIELD IT_XI_PDF LENGTH L_LINESLEN IN CHARACTER MODE.
DESCRIBE FIELD IT_XI_TEMP LENGTH L_MIMELEN IN CHARACTER MODE.
LOOP AT IT_XI_PDF.
L_TABIX = SY-TABIX.
MOVE IT_XI_PDF TO L_TEMP+L_OFFSET.
IF L_TABIX = L_LINES.
L_LINESLEN = STRLEN( IT_XI_PDF ).
ENDIF.
L_OFFSET = L_OFFSET + L_LINESLEN.
IF L_OFFSET GE L_MIMELEN.
CLEAR IT_XI_TEMP.
IT_XI_TEMP = L_TEMP(L_MIMELEN).
APPEND IT_XI_TEMP.
SHIFT L_TEMP BY L_MIMELEN PLACES.
L_OFFSET = L_OFFSET - L_MIMELEN.
ENDIF.
IF L_TABIX = L_LINES.
IF L_OFFSET GT 0.
CLEAR IT_XI_TEMP.
IT_XI_TEMP = L_TEMP(L_OFFSET).
APPEND IT_XI_TEMP.
ENDIF.
ENDIF.
ENDLOOP.
CLEAR : IT_XI_MIME,
IT_XI_MIME[].
LOOP AT IT_XI_TEMP.
IT_XI_MIME(255) = IT_XI_TEMP-LINE.
APPEND IT_XI_MIME.
CLEAR IT_XI_MIME.
ENDLOOP.
* Final Data
CLEAR : IT_HTML,
IT_HTML[].
IT_HTML[] = IT_XI_MIME[].
* For sending mail
PERFORM SEND_MAIL TABLES EMAIL.
ENDFORM. " page_format
*& Form fetch_variants
* For fetching the variants available for the program
FORM FETCH_VARIANTS .
DATA : L_PROGRAM LIKE RS38M-PROGRAMM VALUE 'RKAEP000',
L_VARA1 TYPE DFIES-FIELDNAME VALUE 'P_VARA1'.
CLEAR : IT_VARIANT1,
IT_VARIANT1[].
* Get variants
PERFORM GET_VARIANTS TABLES IT_VARIANT1
USING L_PROGRAM.
* F4 Help
IF NOT IT_VARIANT1[] IS INITIAL.
PERFORM GET_F4_HELP TABLES IT_VARIANT1
USING L_VARA1
CHANGING P_VARA1.
ELSE.
MESSAGE E000 WITH 'No variants available for report1'(054).
ENDIF.
ENDFORM. " fetch_variants
*& Form validation
* For Validation
FORM VALIDATION .
DATA : L_PRO1 LIKE RS38M-PROGRAMM VALUE 'RKAEP000',
L_PRO2 LIKE RS38M-PROGRAMM VALUE 'GP3DIEHXY88SNFJ0391V7KF9EK7050',
L_C1,
L_C2.
* If both check-box are unchecked
IF P_C1 IS INITIAL
AND P_C2 IS INITIAL.
MESSAGE E000 WITH 'Check any one check-box'(049).
ENDIF.
* If checked without varaint
IF NOT P_C1 IS INITIAL AND P_VARA1 IS INITIAL.
MESSAGE E000 WITH 'Please give any one of the variant for report1'(055).
ENDIF.
* If checked without varaint
IF NOT P_C2 IS INITIAL AND P_VARA2 IS INITIAL.
MESSAGE E000 WITH 'Please give any one of the variant for report2'(061).
ENDIF.
* Reading the variant and fetching the mail-ids
IF P_C1 = C_X.
L_C1 = '1'.
CLEAR : S_EMAIL,
S_EMAIL[].
PERFORM READ_VARIANTS TABLES IT_MAILID
S_EMAIL
USING P_VARA1
L_PRO1
L_C1.
IF S_EMAIL[] IS INITIAL.
MESSAGE E000 WITH 'No Id available for given Cost report1'(066).
ELSE.
SORT S_EMAIL BY LOW.
DELETE ADJACENT DUPLICATES FROM S_EMAIL COMPARING LOW.
ENDIF.
ENDIF.
* Reading the variant and fetching the mail-ids
IF P_C2 = C_X.
CLEAR : S_EMAIL1,
S_EMAIL1[].
L_C2 = '2'.
PERFORM READ_VARIANTS TABLES IT_MAILID1
S_EMAIL1
USING P_VARA2
L_PRO2
L_C2.
IF S_EMAIL1[] IS INITIAL.
MESSAGE E000 WITH 'No Id available for given Cost report2'(067).
ELSE.
SORT S_EMAIL1 BY LOW.
DELETE ADJACENT DUPLICATES FROM S_EMAIL1 COMPARING LOW.
ENDIF.
ENDIF.
ENDFORM. " validation
*& Form GET_VARIANTS
* Fetching Variants
FORM GET_VARIANTS TABLES P_IT_VARIANT STRUCTURE IT_VARIANT1
USING P_V_PROGRAM TYPE RS38M-PROGRAMM.
SELECT VARIANT
FROM VARID
INTO TABLE P_IT_VARIANT
WHERE REPORT = P_V_PROGRAM.
ENDFORM. " GET_VARIANTS
*& Form GET_F4_HELP
* text
FORM GET_F4_HELP TABLES P_IT_VARIANT1 STRUCTURE IT_VARIANT1
USING P_L_VARA1 LIKE DFIES-FIELDNAME
CHANGING P_P_VARA LIKE P_VARA1.
* Fn. for Pop-Up
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
RETFIELD = P_L_VARA1
VALUE_ORG = 'S'
DISPLAY = ' '
TABLES
VALUE_TAB = P_IT_VARIANT1
RETURN_TAB = IT_RETURN
EXCEPTIONS
PARAMETER_ERROR = 1
NO_VALUES_FOUND = 2
OTHERS = 3.
IF SY-SUBRC = 0.
P_P_VARA = IT_RETURN-FIELDVAL.
ELSE.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " GET_F4_HELP
*& Form FETCH_VARIANTS1
* text
FORM FETCH_VARIANTS1 .
DATA : V_PROGRAM1 LIKE RS38M-PROGRAMM VALUE 'GP3DIEHXY88SNFJ0391V7KF9EK7050',
L_VARA2 TYPE DFIES-FIELDNAME VALUE 'P_VARA2'.
CLEAR : IT_VARIANT2,
IT_VARIANT2[].
* Get Variants
PERFORM GET_VARIANTS TABLES IT_VARIANT2
USING V_PROGRAM1.
* F4 Help
IF NOT IT_VARIANT2[] IS INITIAL.
PERFORM GET_F4_HELP TABLES IT_VARIANT2
USING L_VARA2
CHANGING P_VARA2.
ELSE.
MESSAGE E000 WITH 'No variants available for report2'(050).
ENDIF.
ENDFORM. " FETCH_VARIANTS1
*& Form read_variants
* Reading the variant and fetching the mail-ids
FORM READ_VARIANTS TABLES P_IT_MAILID STRUCTURE IT_MAILID
P_S_EMAIL STRUCTURE S_EMAIL
USING P_P_VARA1 LIKE P_VARA1
P_L_PRO1 LIKE RS38M-PROGRAMM
P_L_C1 TYPE C.
DATA : L_TEMP(44),
IT_VALUTAB LIKE RSPARAMS OCCURS 0 WITH HEADER LINE.
RANGES : R_COCEN FOR CSKS-KOSTL.
* Function Module to get the variant contents
CALL FUNCTION 'RS_VARIANT_CONTENTS'
EXPORTING
REPORT = P_L_PRO1
VARIANT = P_P_VARA1
TABLES
VALUTAB = IT_VALUTAB
EXCEPTIONS
VARIANT_NON_EXISTENT = 1
VARIANT_OBSOLETE = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CLEAR : R_COCEN,
R_COCEN[].
LOOP AT IT_VALUTAB WHERE SELNAME = 'KOSTL'
OR SELNAME = '_C-CCTR'.
* Getting the range of cost centers
IF IT_VALUTAB-OPTION = 'BT'.
R_COCEN-LOW = IT_VALUTAB-LOW.
* For Conversion Routine
PERFORM CONVERSION USING R_COCEN-LOW.
R_COCEN-HIGH = IT_VALUTAB-HIGH.
* For Conversion Routine
PERFORM CONVERSION USING R_COCEN-HIGH.
R_COCEN-OPTION = 'BT'.
R_COCEN-SIGN = 'I'.
APPEND R_COCEN.
CLEAR R_COCEN.
ENDIF.
* Getting the single cost centers
IF IT_VALUTAB-OPTION = 'EQ'.
R_COCEN-LOW = IT_VALUTAB-LOW.
* For Conversion Routine
PERFORM CONVERSION USING R_COCEN-LOW.
R_COCEN-OPTION = 'EQ'.
R_COCEN-SIGN = 'I'.
APPEND R_COCEN.
CLEAR R_COCEN.
ENDIF.
ENDLOOP.
* If no cost centers
IF NOT R_COCEN[] IS INITIAL.
SELECT KOKRS
KOSTL
DATBI
TELX1
FROM CSKS
INTO TABLE P_IT_MAILID
WHERE KOSTL IN R_COCEN.
IF P_IT_MAILID[] IS INITIAL.
IF P_L_C1 = '1'.
MESSAGE E000 WITH 'No IDs available for report1'(059).
ELSEIF P_L_C1 = '2'.
MESSAGE E000 WITH 'No IDs available for report2'(062).
ENDIF.
ENDIF.
* Deleting the blank entries
DELETE P_IT_MAILID WHERE TELX1 = SPACE.
CLEAR L_TEMP.
READ TABLE P_IT_MAILID INDEX 1.
L_TEMP = P_IT_MAILID-TELX1.
DATA : L_CHECK.
LOOP AT P_IT_MAILID WHERE TELX1 <> L_TEMP.
L_CHECK = C_X.
ENDLOOP.
* For checking the unique ids
IF L_CHECK = C_X.
IF P_L_C1 = '1'.
MESSAGE E000 WITH 'No unique mail-ids for report1'(058).
ELSEIF P_L_C1 = '2'.
MESSAGE E000 WITH 'No unique mail-ids for report2'(065).
ENDIF.
ENDIF.
* Populating the IDs for the cost centers
LOOP AT P_IT_MAILID.
SET LOCALE LANGUAGE SY-LANGU.
TRANSLATE P_IT_MAILID-TELX1 TO LOWER CASE.
SET LOCALE LANGUAGE SPACE .
CONCATENATE P_IT_MAILID-TELX1 '@allergan.com' INTO L_TEMP.
P_S_EMAIL-LOW = L_TEMP.
P_S_EMAIL-SIGN = 'I'.
P_S_EMAIL-OPTION = 'EQ'.
APPEND P_S_EMAIL.
CLEAR P_S_EMAIL.
ENDLOOP.
ELSE.
IF P_L_C1 = '1'.
MESSAGE E000 WITH 'No Cost Center Available for report1'(057).
ELSEIF P_L_C1 = '2'.
MESSAGE E000 WITH 'No Cost Center Available for report2'(063).
ENDIF.
ENDIF.
ENDFORM. " read_variants
*& Form CONVERSION
* For Conversion Routine
FORM CONVERSION USING P_IT_VALUTAB_LOW TYPE C.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = P_IT_VALUTAB_LOW
IMPORTING
OUTPUT = P_IT_VALUTAB_LOW.
ENDFORM. " CONVERSION -
Convert spool to pdf for Chinese characters
Hi,
I need to convert spool to pdf for chinese font.
Spool is creating successfully, and contents are displaying properly. When try to convert the spool to pdf using 'RSTXPDFT4', the pdf is generated successfully, when trying open the pdf, contents are missing, its like empy white pdf page. This is happening for the Chinese font. The same script is working fine for the English font.
Plz suggets
Thanks
BalajiHi Balaji,
I am having a similar issue with Simplified Chinese, Traditional Chinese, and Thai fonts when saving spools to PDF. Have you found any more information on why the output shows up as a blank screen?
We are printing Purchase Orders and the T&Cs are coming through fine because they are saved as picture files but the smartform does not display at all.
Any information would be appreciated!
Thanks,
Josh
Maybe you are looking for
-
Need to import html stylesheet
I need to print the html data, thus import the html stylesheet which is the xsl file. Does anyone know where should I put this stylesheet i.e., the path in ebusiness suite and import the same in my template. Right now for testing purposes I have put
-
I don't understand why your company would not want to be customer freindly and helpful , If i wou;d have known there wwas no way of communicating with you other than typing i would not have purchased any of the ipod items we own . I think you should
-
Synchronizing on Process Instance Object
Hi, We have a process web service, which is used to create, notify and update BPM process instances. This process web service is accessed from Java code. The java code uses a re-try mechanism to talk to the process web service. We want this to be cha
-
Conference Call Disconnects At Same Point Every Time
Each time I make a conference call on my iPhone, it disconnects after no more than 15 minutes. It just hangs up. I'm not sure what happens. I don't have any other problems with it. Is anyone else having this problem when making a conference call?
-
I would like to achieve the following: I have an oversized moveclip which i will place on the stage. When flash swf is running, I would like to move the movieclip left, right, up or down when i mousedown. Just like the "MOVE" tool in photoshop. Is t