Smart form   out put  into PDF ????

How to download into PDF file  after the execute Smart form out put ????

hi,
pls try this code.
*& Report : ZPDF_FORMAT
*& Description : Conversion of Purchase Order into PDF format
*& used in the workflow (Do Not Change or Delete).
REPORT zpdf .
*& Tables used
TABLES: nast, tsp01, t024, spop, lfa1, tnapr.
*& Data declaration
DATA: spoolno LIKE tsp01-rqident.
DATA: rcode LIKE sy-subrc.
*data: doc_auth like zoutput-ztag.
DATA: cancel.
DATA: pdf LIKE tline OCCURS 0 WITH HEADER LINE.
DATA: numbytes TYPE i,
pdfspoolid LIKE tsp01-rqident,
jobname LIKE tbtcjob-jobname,
jobcount LIKE tbtcjob-jobcount,
is_otf.
DATA: client LIKE tst01-dclient,
name LIKE tst01-dname,
objtype LIKE rststype-type,
type LIKE rststype-type.
DATA: dir_loc(3).
DATA: t_docno LIKE vbak-vbeln..
DATA: spoolreq1 LIKE tsp01sys.
DATA: spoolreq LIKE rsporq OCCURS 0 WITH HEADER LINE.
DATA: t_frgke LIKE ekko-frgke.
DATA: okcode(10),
flag,
t_ekgrp LIKE ekko-ekgrp,
t_lifnr LIKE ekko-lifnr,
s_mail.
Data Declartion for mailing system - Start.
DATA: objpack LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE.
DATA: objhead LIKE solisti1 OCCURS 0 WITH HEADER LINE.
DATA: objbin LIKE solisti1 OCCURS 0 WITH HEADER LINE.
DATA: objtxt LIKE solisti1 OCCURS 0 WITH HEADER LINE.
DATA: reclist1 LIKE somlreci1 OCCURS 500 WITH HEADER LINE.
DATA: reclist LIKE somlreci1 OCCURS 500 WITH HEADER LINE.
DATA: itab LIKE somlreci1 OCCURS 50 WITH HEADER LINE."RKU 220802
DATA: doc_chng LIKE sodocchgi1.
DATA: BEGIN OF bdcdata OCCURS 0.
INCLUDE STRUCTURE bdcdata.
DATA: END OF bdcdata.
DATA: tab_lines LIKE sy-tabix.
DATA: verkf LIKE ekko-verkf.
DATA: bemail(250), vemail(250).
Data acceptance
SELECTION-SCREEN BEGIN OF BLOCK blk0_input WITH FRAME .
PARAMETERS: docno LIKE ekko-ebeln OBLIGATORY LOWER CASE.
SELECTION-SCREEN SKIP.
SELECTION-SCREEN END OF BLOCK blk0_input.
Initialisation
*initialization.
Screen Parameters Validation
*at selection-screen.
AT SELECTION-SCREEN.
SELECT SINGLE frgke INTO t_frgke FROM ekko
WHERE ebeln = docno
AND frgke = 'R'.
IF sy-subrc <> 0.
MESSAGE 'DOCUMENT NOT RELEASED' TYPE 'E'.
ENDIF.
Execution Part
START-OF-SELECTION.
For PO related operation
Dislay Buyer Group, Name and Email id
SELECT SINGLE
ekgrp
lifnr
verkf
INTO (t_ekgrp, t_lifnr, verkf)
FROM ekko
WHERE ekko~mandt = sy-mandt
AND ebeln = docno.
IF sy-subrc = 0.
SELECT SINGLE * FROM lfa1
WHERE lfa1~mandt = sy-mandt
AND lifnr = t_lifnr.
ENDIF.
Get message status from NAST or assign msg status NAST stru
Pass the message status and get spool data
PERFORM check_output_create_spool.
IF rcode NE 0.
IF rcode = 9.
message s185 with text-e04.
ELSE.
message s185 with text-e01.
ENDIF.
EXIT.
ENDIF.
find the spool
PERFORM find_spool_request_id.
IF sy-subrc <> 0.
message s185 with text-003.
EXIT.
ENDIF.
READ TABLE spoolreq
WITH KEY rq0name = nast-dsnam
rq1name = 'LP01'
rqclient = '800'
rq2name = sy-uname
rqowner = sy-uname.
IF sy-subrc <> 0.
CASE sy-subrc.
WHEN 1.
message s185 with text-e03.
WHEN OTHERS.
message s185 with text-e02.
ENDCASE.
EXIT.
ENDIF.
spoolno = spoolreq-rqident.
Convert SPOOL job to PDF
PERFORM convert_spool_to_pdf.
Send through mail
PERFORM assign_data_4_mail.
PERFORM send_mail_with_attachment.
Delete created spool request
spoolreq1-rqident = spoolno.
PERFORM delete_spool_job.
*& Form check_output_create_spool
text
--> p1 text
<-- p2 text
FORM check_output_create_spool.
SELECT SINGLE * FROM nast WHERE objky = docno
AND kappl = 'EF'
AND kschl = 'NEU'
AND aktiv = space
AND nacha = '1'.
IF sy-subrc EQ 0.
COUNT = COUNT + 1.
PERFORM mssage_status_field_value.
nast-vsztp = '4'.
PERFORM einzelnachricht_dialog(rsnast00) USING rcode.
ELSE.
CLEAR nast-uhrvr.
CLEAR nast-cmfpnr.
CLEAR nast-datvr.
PERFORM mssage_status_field_value.
nast-vsztp = '4'.
PERFORM einzelnachricht_dialog(rsnast00) USING rcode.
else.
rcode = 9.
ENDIF.
ENDFORM. " check_output_create_spool
*& Form mssage_status_field_value
text
--> p1 text
<-- p2 text
FORM mssage_status_field_value .
nast-mandt = '800'.
nast-kappl = 'EF'.
nast-kschl = 'NEU'.
nast-objky = docno.
nast-ldest = 'LP01'.
nast-anzal = 1.
nast-dimme = 'X'.
nast-delet = 'X'.
nast-nacha = '1'.
nast-vsztp = '2'.
nast-spras = 'E'.
nast-vstat = '0'.
nast-manue = 'X'.
nast-erdat = sy-datum.
nast-eruhr = sy-uzeit.
nast-usnam = sy-uname.
nast-tdreceiver = sy-uname.
concatenate sy-uzeit+2(4) 'PDF' into nast-dsnam.
ENDFORM. " mssage_status_field_value
*& Form find_spool_request_id
text
--> p1 text
<-- p2 text
FORM find_spool_request_id.
CALL FUNCTION 'RSPO_FIND_SPOOL_REQUESTS'
EXPORTING
allclients = '800'
authority = ' '
datatype = '*'
has_output_requests = '*'
rq0name = nast-dsnam "'*'
rq1name = '*'
rq2name = '*'
rqdest = 'LP01'
rqident = 0
rqowner = sy-uname
TABLES
spoolrequests = spoolreq
EXCEPTIONS
no_permission = 1
OTHERS = 2.
ENDFORM. " find_spool_request_id
*& Form convert_spool_to_pdf
text
--> p1 text
<-- p2 text
FORM convert_spool_to_pdf.
SELECT SINGLE * FROM tsp01 WHERE rqident = spoolno.
IF sy-subrc <> 0.
WRITE: / 'Spool order does not exist'
COLOR COL_NEGATIVE.
EXIT.
ENDIF.
client = tsp01-rqclient.
name = tsp01-rqo1name.
CALL FUNCTION 'RSTS_GET_ATTRIBUTES'
EXPORTING
authority = 'SP01'
client = client
name = name
part = 1
IMPORTING
type = type
objtype = objtype
EXCEPTIONS
fb_error = 1
fb_rsts_other = 2
no_object = 3
no_permission = 4.
IF objtype(3) = 'OTF'.
is_otf = 'X'.
ELSE.
is_otf = space.
ENDIF.
IF is_otf = 'X'.
CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = spoolno
no_dialog = ' '
IMPORTING
pdf_bytecount = numbytes
pdf_spoolid = pdfspoolid
btc_jobname = jobname
btc_jobcount = jobcount
TABLES
pdf = 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.
case sy-subrc.
when 1.
write: / text-001 color col_positive.
when 2.
write: / text-002 color col_negative.
exit.
when 3.
write: / text-003 color col_negative.
exit.
when 4.
write: / text-004 color col_negative.
exit.
when others.
write: / text-005 color col_negative.
exit.
endcase.
endif.
ELSE.
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = spoolno
no_dialog = ' '
DST_DEVICE =
PDF_DESTINATION =
IMPORTING
pdf_bytecount = numbytes
pdf_spoolid = pdfspoolid
LIST_PAGECOUNT =
btc_jobname = jobname
btc_jobcount = jobcount
TABLES
pdf = 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.
case sy-subrc.
when 0.
*write: / 'Funktion CONVERT_ABAPSPOOLJOB_2_PDF erfolgreich
*(successful)'.
color col_positive.
when 1.
write: / text-001 color col_positive.
when 2.
write: / text-002 color col_negative.
exit.
when 3.
write: / text-003 color col_negative.
exit.
when 4.
write: / text-004 color col_negative.
exit.
when others.
write: / text-005 color col_negative.
exit.
endcase.
ENDIF.
ENDFORM. " convert_spool_to_pdf
*& Form delete_spool_job
text
--> p1 text
<-- p2 text
FORM delete_spool_job .
CALL FUNCTION 'RSPO_IDELETE_SPOOLREQ'
EXPORTING
spoolreq = spoolreq1
IMPORTING
RC =
STATUS =
EXCEPTIONS
error = 1
OTHERS = 2
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. " delete_spool_job
*& Form ASSIGN_DATA_4_MAIL
text
--> p1 text
<-- p2 text
FORM assign_data_4_mail .
Text content of the mail
move 'Purchase order: ' to objtxt.
append objtxt.
move verkf to objtxt.
append objtxt.
move lfa1-name1 to objtxt.
append objtxt.
concatenate lfa1-ort01 lfa1-pstlz
into objtxt separated by space.
append objtxt.
clear: objtxt.
append objtxt.
append objtxt.
CLEAR objtxt.
CONCATENATE 'Purchase Order - ' docno
' has been released.'
INTO objtxt SEPARATED BY space.
APPEND objtxt.
clear: objtxt.
append objtxt.
append objtxt.
MOVE ' ' TO objtxt.
APPEND objtxt.
clear: objtxt.
append objtxt.
append objtxt.
concatenate 'Note:- This is an automatic mail sender.'
' Please do not reply to this mail ID.'
into objtxt.
append objtxt.
concatenate
' Any query, please send the mail to the respective buyer'''
's mail id.' into objtxt.
append objtxt.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
input = docno
IMPORTING
output = docno.
TLINE format will be coverted as 255 char foramt
CALL FUNCTION 'QCE1_CONVERT'
TABLES
t_source_tab = pdf
t_target_tab = objbin
EXCEPTIONS
convert_not_possible = 1
OTHERS = 2.
DESCRIBE TABLE objtxt LINES tab_lines.
creation of the entry for the compressed document
CLEAR objpack.
objpack-transf_bin = ''.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = 'RAW'.
objpack-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ).
APPEND objpack.
creation of the entry for the Attachemnt
DESCRIBE TABLE objbin LINES tab_lines.
objpack-transf_bin = 'X'.
objpack-head_start = 1.
objpack-head_num = 1.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = 'PDF'.
CONCATENATE docno '.PDF' INTO objpack-obj_name.
objpack-obj_descr = objpack-obj_name.
objpack-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objbin ).
APPEND objpack.
For Object Header
CONCATENATE docno '.PDF' INTO objhead.
APPEND objhead.
doc_chng-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objbin ).
CONCATENATE 'Purchase Order - ' docno ' has been released'
INTO doc_chng-obj_descr.
doc_chng-obj_prio = 1.
recipient Details
CLEAR reclist1.
CLEAR reclist.
REFRESH reclist1.
REFRESH reclist.
SELECT SINGLE * FROM t024
WHERE t024~mandt = sy-mandt
AND ekgrp = t_ekgrp.
reclist1-receiver = t024-smtp_addr.
reclist1-rec_type = 'U'.
reclist1-com_type = 'INT'.
reclist1-receiver = '[email protected]'.
modify table reclist transporting rec_type receiver COM_TYPE .
where rec_type is initial.
APPEND reclist1 TO reclist.
ENDFORM. " ASSIGN_DATA_4_MAIL
*& Form send_mail_with_attachment
text
--> p1 text
<-- p2 text
FORM send_mail_with_attachment.
sending the document
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = doc_chng
put_in_outbox = 'X'
commit_work = 'X'
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.
PERFORM flush_mail.
message 'Mail sent successfully' type 'I'.
when 1.
message 'No authorization for sending to the specified number'
*type 'E'.
when 2.
message 'Document could not be sent to any recipient' type 'E'.
when 4.
message 'No send authorization' type 'E'.
when others.
message 'Error occurred while sending' type 'E'.
ENDCASE.
ENDFORM. " send_mail_with_attachment
Start new screen *
FORM bdc_dynpro USING program dynpro.
CLEAR bdcdata.
bdcdata-program = program.
bdcdata-dynpro = dynpro.
bdcdata-dynbegin = 'X'.
APPEND bdcdata.
ENDFORM. "bdc_dynpro
Insert field *
FORM bdc_field USING fnam fval.
CLEAR bdcdata.
bdcdata-fnam = fnam.
bdcdata-fval = fval.
APPEND bdcdata.
ENDFORM. "bdc_field
*& Form AUTOMATE
text
--> p1 text
<-- p2 text
FORM flush_mail .
PERFORM bdc_dynpro USING 'SAPMSSY0' '0120'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=PDIA'.
PERFORM bdc_dynpro USING 'SAPLSPO4' '0300'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=FURT'.
PERFORM bdc_field USING 'BDC_CURSOR'
'SVALD-VALUE(01)'.
PERFORM bdc_field USING 'SVALD-VALUE(01)'
'int'.
PERFORM bdc_dynpro USING 'SAPMSSY0' '0120'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=BACK'.
PERFORM bdc_dynpro USING 'SAPMSSY0' '0120'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=BACK'.
CALL TRANSACTION 'SCOT' USING bdcdata
MODE 'N'
UPDATE 'S'.
ENDFORM. " AUTOMATE
regards,
Latheesh

Similar Messages

  • Priniting out put to pdf file

    Hi All,
    I am using oracle reports 6i under sun Solaris environment. I may finally deploy these reports on web. Is it possible to send the out put to pdf when ever user select from my web deployed form, I mean when ever user select reports from the web is it possible to send the out put to pdf file it should open on client browser. Please help me. I appreciate any ones help.
    Thanks,
    Kate.
    null

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by VK:
    set the DESFORMAT system parameter PDF. DESFORMAT make sense only if the DESTYPE is file. you have to set these parameters dynamically
    <HR></BLOCKQUOTE>
    I think, well, I am sure that DESTYPE=cache also works, as long as your web server outputs proper mime header for pdf files. Here is an example (sensitive information replaced with # character):
    --------------- http://###.example.com/db/rp?server=Rep60.example.com&report=XXXXXXInvoice.rdf&userid=XXXX/XXXX@XXXX&desformat=pdf&destype=cache&P_1=218
    null

  • Error in calling/converting smart form from ECC to pdf in portal.

    Hi,
    We have a requirement in our project where we have to show IT form in portal exactly in the way payslip are shown in ESS
    Screen, that is in the pdf form in ess portal screen.
    For this my HR abap consultant has made one customize smart form which is being called from a RFC FM.
    After the FM lf_fm_name gets executed , the OTF data is being captured and then converted in to PDF.
    After that the PDF is then converted into XSTRING format which is then supplied to the portal side through export parameter
    of the RFC.
    Now when we debugged the RFC, the conversion is taking place perfectly fine in to XSTRING.This is wat we assume.
    Portal Side: I have used Iframe ui ELEMENT in my webdynpro java and its property source I have binded with a value attribute
    of type string and I am executing above customize RFC given to me by my HR abap consultant and after executing that RFC with
    userID and payroll year as its import parameter I am taking export parameter of that RFC with name pdf_string of type XSTRING
    of that RFC into my webdynpro java value attribute which i binded to source property of Iframe.
    Now when we see the output in portal , first of all pdf is not getting generated and its showing the error message:
    file does not begin with '%pdf-' and secondly errored Adobe form getting opened outside Iframe window its not coming within
    Iframe window like what payslip comes inside Iframe UI element.
    I want to know what mistake we are doing in our ABAP coding or portal coding.
    Please help.

    Hi Satyam,
    You can use the existing SAP GRT framework for developing the app.
    Its easy and provides more features.
    See this wiki:
    http://wiki.sdn.sap.com/wiki/display/WDJava/HowtodevelopcustomWebDynproESSapplicationsusingGenericReportingTool%28GRT%29
    Regards
    Yugandhar Reddy

  • Binary out put to pdf on saop request

    Dear Friends,
    In the  soap to server proxy scenario on the request of soap if i send a binary data from service proxy can a soap response can convert that into pdf.
    I have BAPI_GET_PAYSLIP_PDF bapi which gives a binary out put if i provide this to a .net or java can they convert
    into pdf... is it possible..
    Regards
    Vijay

    Hi satish,
    Today we have converted the BAPI output into PDF in .net...
    Now thw issue is the output of the BAPI_GET_PAYSLIP_PDF is the hexadecimal format and which is of huge size it almost storing in 50000 lines in a table. So now if i transfer this hexacode to .net portal is really hectic...as every line it takes as one output string element in payload
    Now can we send this output in any other means to .net in soap response..or any indirect method..
    Like once the request is send to R3 after executing the BAPI in proxy class and converting that into PDF and sending as attachment in soap response is this possible..
    Only consern here there are lot of applications i need to do in the same so that server performace should not effet.. for example..
    CTC View,Payslip view,IT declarion view... many such ... in .net and websphere parallel.. and every request will increase the traffic in xi...
    Any kind of approach for all this ...
    Regards
    Vijay
    Edited by: vijay Kumar on Jul 13, 2009 8:38 AM

  • Is Any Body Tell Me How to Creat a Script Form(converting script into pdf)

    waiting for u r responce, pls help me in this concernd

    Welcome to SDN.
    If you want to conver SCRIPT to PDF format check this link -
    hi, hoe to convert script form into pdf format
    how to convert script into PDF
    If you want to convert it to Adobe Forms refer this -
    Adobe Forms
    Regards,
    Amit
    Reward all helpful replies.

  • Smart form to download in PDF

    Hello All,
    I have created an smart forms for Shipping Instruction . As per Requirement the smart forms should be downloaded in PDF and Auto mail to Consignee.
    Can some one Please provide me details with example how can this will possible.
    Thanks in advance.
    Swati Namdeo.

    Hi,
    For downloading,check this code.For mailing, check this link.I am explaining the mail concept here.
    https://sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/8fd773b3-0301-0010-eabe-82149bcc292e
    DATA: form_name TYPE rs38l_fnam.
    DATA: wa_ctrlop TYPE ssfctrlop,
    wa_outopt TYPE ssfcompop.
    DATA: t_otfdata TYPE ssfcrescl,
    t_pdf_tab LIKE tline OCCURS 0 WITH HEADER LINE.
    DATA: t_otf TYPE itcoo OCCURS 0 WITH HEADER LINE.
    DATA: w_filesize TYPE i.
    DATA: w_bin_filesize TYPE i.
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
    formname = 'ZSMARTFORM_SWAR'
    VARIANT = ' '
    DIRECT_CALL = ' '
    IMPORTING
    fm_name = form_name
    EXCEPTIONS
    no_form = 1
    no_function_module = 2
    OTHERS = 3
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    wa_ctrlop-getotf = 'X'.
    wa_ctrlop-no_dialog = 'X'.
    wa_outopt-tdnoprev = 'X'.
    CALL FUNCTION form_name
    EXPORTING
    control_parameters = wa_ctrlop
    output_options = wa_outopt
    user_settings = 'X'
    mydate = p_date
    reason = p_rea
    IMPORTING
    DOCUMENT_OUTPUT_INFO =
    job_output_info = t_otfdata
    JOB_OUTPUT_OPTIONS =
    EXCEPTIONS
    formatting_error = 1
    internal_error = 2
    send_error = 3
    user_canceled = 4
    OTHERS = 5
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    t_otf[] = t_otfdata-otfdata[].
    CALL FUNCTION 'CONVERT_OTF'
    EXPORTING
    format = 'PDF'
    max_linewidth = 132
    ARCHIVE_INDEX = ' '
    IMPORTING
    bin_filesize = w_bin_filesize
    TABLES
    otf = t_otf
    lines = t_pdf_tab
    EXCEPTIONS
    err_max_linewidth = 1
    err_format = 2
    err_conv_not_possible = 3
    OTHERS = 4
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CALL FUNCTION 'WS_DOWNLOAD'
    EXPORTING
    bin_filesize = w_bin_filesize
    filename = 'd:     est.PDF'
    filetype = 'BIN'
    IMPORTING
    filelength = w_filesize
    TABLES
    data_tab = t_pdf_tab
    FIELDNAMES =
    EXCEPTIONS
    file_open_error = 1
    file_write_error = 2
    invalid_filesize = 3
    invalid_type = 4
    no_batch = 5
    unknown_error = 6
    invalid_table_width = 7
    gui_refuse_filetransfer = 8
    customer_error = 9
    OTHERS = 10
    IF sy-subrc <> 0.
    MESSAGE i003(z00) WITH 'File not downloaded succesfully'.
    ELSE.
    MESSAGE i003(z00) WITH 'File Test.pdf downloaded succesfully '
    'under D drive'.
    ENDIF.

  • How  convert a report out put to pdf and sending it via an email

    Hi all,
            i have convert the sap list or report output to a pdf file then i have to send it via an email that is given in the selection screen. if anyone knows the solutions for this please make it soon. i will be very thankful.
    Thanks & Regards,
    Poorna

    generate spool request of ur report output and execute the standard program RSTXPDFT4 with tht spool reuest.it will download it in PDF format on ur PC and to send it via mail as attachment ,just copy this below code -
    *& Report  ZGILL_SENDMAIL_PDF                                          *
    REPORT  ZGILL_SENDMAIL_PDF                      .
    INCLUDE ZGILL_INCMAIL.  "SEE BELOW FOR INCLUDE PROGRAM CODE.
    DATA
    DATA : itab LIKE tline OCCURS 0 WITH HEADER LINE.
    DATA : file_name TYPE string.
    data : path like PCFILE-PATH.
    data : extension(5) type c.
    data : name(100) type c.
    SELECTION SCREEN
    PARAMETERS : receiver TYPE somlreci1-receiver lower case DEFAULT '[email protected]'.
    PARAMETERS : p_file LIKE rlgrap-filename
    OBLIGATORY DEFAULT 'C:\TEMP\SALARY_SLIP1.PDF'.
    AT SELECTION SCREEN
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
    CLEAR p_file.
    CALL FUNCTION 'F4_FILENAME'
    IMPORTING
    file_name = p_file.
    START-OF-SELECTION
    START-OF-SELECTION.
    PERFORM ml_customize USING 'Tst' 'Testing'.
    PERFORM ml_addrecp USING receiver 'U'.
    PERFORM upl.
    PERFORM doconv TABLES itab objbin.
    PERFORM ml_prepare USING 'X' extension name.
    PERFORM ml_dosend.
    SUBMIT rsconn01
    WITH mode EQ 'INT'
    AND RETURN.
    FORM
    FORM upl.
    file_name = p_file.
    CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
    filename = file_name
    filetype = 'BIN'
    TABLES
    data_tab = itab
    EXCEPTIONS
    file_open_error = 1
    file_read_error = 2
    no_batch = 3
    gui_refuse_filetransfer = 4
    invalid_type = 5
    no_authority = 6
    unknown_error = 7
    bad_data_format = 8
    header_not_allowed = 9
    separator_not_allowed = 10
    header_too_long = 11
    unknown_dp_error = 12
    access_denied = 13
    dp_out_of_memory = 14
    disk_full = 15
    dp_timeout = 16
    OTHERS = 17.
    path = file_name.
    CALL FUNCTION 'PC_SPLIT_COMPLETE_FILENAME'
    EXPORTING
    complete_filename = path
    CHECK_DOS_FORMAT =
    IMPORTING
    DRIVE =
    EXTENSION = extension
    NAME = name
    NAME_WITH_EXT =
    PATH =
    EXCEPTIONS
    INVALID_DRIVE = 1
    INVALID_EXTENSION = 2
    INVALID_NAME = 3
    INVALID_PATH = 4
    OTHERS = 5
    ENDFORM. "upl
    *********************iNCLUDE pROGRAM********************************************
    *&  Include           ZGILL_INCMAIL                                    *
    Data
    DATA: docdata LIKE sodocchgi1,
    objpack LIKE sopcklsti1 OCCURS 1 WITH HEADER LINE,
    objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE,
    objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE,
    objbin LIKE solisti1 OCCURS 10 WITH HEADER LINE,
    objhex LIKE solix OCCURS 10 WITH HEADER LINE,
    reclist LIKE somlreci1 OCCURS 1 WITH HEADER LINE.
    DATA: tab_lines TYPE i,
    doc_size TYPE i,
    att_type LIKE soodk-objtp.
    DATA: listobject LIKE abaplist OCCURS 1 WITH HEADER LINE.
    FORM
    FORM ml_customize USING objname objdesc.
    Clear Variables
    CLEAR docdata.
    REFRESH objpack.
    CLEAR objpack.
    REFRESH objhead.
    REFRESH objtxt.
    CLEAR objtxt.
    REFRESH objbin.
    CLEAR objbin.
    REFRESH objhex.
    CLEAR objhex.
    REFRESH reclist.
    CLEAR reclist.
    REFRESH listobject.
    CLEAR listobject.
    CLEAR tab_lines.
    CLEAR doc_size.
    CLEAR att_type.
    Set Variables
    docdata-obj_name = objname.
    docdata-obj_descr = objdesc.
    ENDFORM. "ml_customize
    FORM
    FORM ml_addrecp USING preceiver prec_type.
    CLEAR reclist.
    reclist-receiver = preceiver.
    reclist-rec_type = prec_type.
    APPEND reclist.
    ENDFORM. "ml_customize
    FORM
    FORM ml_addtxt USING ptxt.
    CLEAR objtxt.
    objtxt = ptxt.
    APPEND objtxt.
    ENDFORM. "ml_customize
    FORM
    FORM ml_prepare USING bypassmemory whatatt_type whatname.
    IF bypassmemory = ''.
    Fetch List From Memory
    CALL FUNCTION 'LIST_FROM_MEMORY'
    TABLES
    listobject = listobject
    EXCEPTIONS
    OTHERS = 1.
    IF sy-subrc <> 0.
    MESSAGE ID '61' TYPE 'E' NUMBER '731'
    WITH 'LIST_FROM_MEMORY'.
    ENDIF.
    CALL FUNCTION 'TABLE_COMPRESS'
    IMPORTING
    COMPRESSED_SIZE =
    TABLES
    in = listobject
    out = objbin
    EXCEPTIONS
    OTHERS = 1
    IF sy-subrc <> 0.
    MESSAGE ID '61' TYPE 'E' NUMBER '731'
    WITH 'TABLE_COMPRESS'.
    ENDIF.
    ENDIF.
    Header Data
    Already Done Thru FM
    Main Text
    Already Done Thru FM
    Packing Info For Text Data
    DESCRIBE TABLE objtxt LINES tab_lines.
    READ TABLE objtxt INDEX tab_lines.
    docdata-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ).
    CLEAR objpack-transf_bin.
    objpack-head_start = 1.
    objpack-head_num = 0.
    objpack-body_start = 1.
    objpack-body_num = tab_lines.
    objpack-doc_type = 'TXT'.
    APPEND objpack.
    Packing Info Attachment
    att_type = whatatt_type..
    DESCRIBE TABLE objbin LINES tab_lines.
    READ TABLE objbin INDEX tab_lines.
    objpack-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objbin ).
    objpack-transf_bin = 'X'.
    objpack-head_start = 1.
    objpack-head_num = 0.
    objpack-body_start = 1.
    objpack-body_num = tab_lines.
    objpack-doc_type = att_type.
    objpack-obj_name = 'ATTACHMENT'.
    objpack-obj_descr = whatname.
    APPEND objpack.
    Receiver List
    Already done thru fm
    ENDFORM. "ml_prepare
    FORM
    FORM ml_dosend.
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
    document_data = docdata
    put_in_outbox = 'X'
    commit_work = 'X' "used from rel. 6.10
    IMPORTING
    SENT_TO_ALL =
    NEW_OBJECT_ID =
    TABLES
    packing_list = objpack
    object_header = objhead
    contents_bin = objbin
    contents_txt = objtxt
    CONTENTS_HEX = objhex
    OBJECT_PARA =
    object_parb =
    receivers = reclist
    EXCEPTIONS
    too_many_receivers = 1
    document_not_sent = 2
    document_type_not_exist = 3
    operation_no_authorization = 4
    parameter_error = 5
    x_error = 6
    enqueue_error = 7
    OTHERS = 8
    IF sy-subrc <> 0.
    MESSAGE ID 'SO' TYPE 'S' NUMBER '023'
    WITH docdata-obj_name.
    ENDIF.
    ENDFORM. "ml_customize
    FORM
    FORM ml_spooltopdf USING whatspoolid.
    DATA : pdf LIKE tline OCCURS 0 WITH HEADER LINE.
    Call Function
    CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
    EXPORTING
    src_spoolid = whatspoolid
    TABLES
    pdf = pdf
    EXCEPTIONS
    err_no_otf_spooljob = 1
    OTHERS = 12.
    Convert
    PERFORM doconv TABLES pdf objbin.
    ENDFORM. "ml_spooltopdf
    FORM
    FORM doconv TABLES
    mypdf STRUCTURE tline
    outbin STRUCTURE solisti1.
    Data
    DATA : pos TYPE i.
    DATA : len TYPE i.
    Loop And Put Data
    LOOP AT mypdf.
    pos = 255 - len.
    IF pos > 134. "length of pdf_table
    pos = 134.
    ENDIF.
    outbin+len = mypdf(pos).
    len = len + pos.
    IF len = 255. "length of out (contents_bin)
    APPEND outbin.
    CLEAR: outbin, len.
    IF pos < 134.
    outbin = mypdf+pos.
    len = 134 - pos.
    ENDIF.
    ENDIF.
    ENDLOOP.
    IF len > 0.
    APPEND outbin.
    ENDIF.
    ENDFORM. "doconv
    **********************INCLUDE END********************************

  • Smart form print preview in PDF format

    Hi ABAP Experts,
    I have 2 requirements
    1) I want to print preview of a smartform in pdf format
    2) I also want to attach a local pdf file to the smartform which is displaying in the pdf print preview format
    or to rephrase:
    I want a pdf attached to a smartform which i want to open in the pdf print preview format.
    Regards,
    Niloufer

    Use following function modules:
    Please see the below code to download a PDF file on to your computer.
    PERFORM F_CONVERT_OTF.
    FORM F_CONVERT_OTF .
    PERFORM F_CALL_SMARTFORM. " Call the smartform to get data in I_OTF_FINAL
    **appending the otf data into the final table & save the pdf file.
      CALL FUNCTION 'CONVERT_OTF'
        EXPORTING
          FORMAT                = C_PDF_U      "Value is 'PDF'
        IMPORTING
          BIN_FILESIZE          = L_BIN_FILESIZE         "L_BIN_FILESIZE TYPE I,
        TABLES
          OTF                   = I_OTF_FINAL
          LINES                 = I_PDF_TAB    "It is of type TLINE
        EXCEPTIONS
          ERR_MAX_LINEWIDTH     = 1
          ERR_FORMAT            = 2
          ERR_CONV_NOT_POSSIBLE = 3
          ERR_BAD_OTF           = 4
          OTHERS                = 5.
    * Check if the file is already existing.
      CALL FUNCTION 'TMP_GUI_GET_FILE_EXIST'
        EXPORTING
          FNAME                = L_FILE1   " Path where file is saved
       IMPORTING
         EXIST                = L_RESULT
    *   ISDIR                =
    *   FILESIZE             =
       EXCEPTIONS
         FILEINFO_ERROR       = 1
         OTHERS               = 2
    PERFORM F_GUI_DOWNLOAD USING L_FILE.
    ENDFORM.
    FORM F_GUI_DOWNLOAD  USING P_FILE TYPE STRING.
    CONSTANTS: C_BIN(10)       TYPE C VALUE 'BIN'.
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          FILENAME                = P_FILE     "same as L_FILE
          FILETYPE                = C_BIN
          CONFIRM_OVERWRITE       = C_X   "value 'X'
        TABLES
          DATA_TAB                = I_PDF_TAB
        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.
      ELSE.
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    <removed by moderator>
    Edited by: vishalmurgai58 on Mar 6, 2012 1:43 PM
    Edited by: Thomas Zloch on Mar 6, 2012 - please do not ask for ...

  • Alters Microsoft Word Document when Put into PDF, help!

    Hi All,
    I wonder if someone can help me. I am trying to convert some microsoft word documents into a PDF format, however each time I do it, the end pdf document isn't what the word document is like .The text and pictures are moved and altered.
    I have tried converting it on 3 different computer, but no luck.
    Does anyone know why?
    Thanks 

    Hi fantabell,
         Welcome to the forum!
    Just out of curiosity… have you checked the page size for the conversion process? I have found that Adobe being a US company have the “letter” page size set as standard where as us Europeans would predominantly use A4 sized paper.
    Click on the Adobe PDF menu in Word and scroll down to “Change Conversion Settings”. Click on the Advanced Settings button and change the default page size to 210mm wide and 297mm high and see if that makes any difference!
    You should also check the New Document and Convert To PDF settings in the Preferences section of the Edit menu in Adobe Acrobat itself and make the same changes to the page size.
    Hope this helps!
    Mark

  • Excel tables turn into black boxes when put into PDF

    I'm working in Framemaker 8 and when I try to turn the document into a PDF, any excel table in the document turns into a black box.  Is there any way to fix this?!

    Add the following to your CSS
    a img { border: none; }
    Also, externalize your CSS.
    Put all your CSS rules (currently all rules are pasted separately into the <head> of every webpage) into a single external stylesheet e.g. dubzz.css.
    Then delete all the CSS rules in the <head> of every page and link every page to that stylesheet (dubzz.css) and upload everything.
    That way, you only have to maintain your CSS rules for the entire website from one tiny file. Then upload and every page will be instantly up to date.

  • Probelm in Smart forms Download/upload into Ecc6.0

    Dear Friends,
    i m working on Sap4.6c version i want to download smartform(report) from 4.6c and upload it into ECC6 so is there is any utility to do this.
    regarding sapscript there is one program rstxscrp to do this, is there is any such program for smartform.
    thanks in advance
    regards,
    Bhaskar.

    Hi,
    I dont think it is available.
    Save the smartforms in a  request and ask the Basis to transport to the ECC6.0 system.
    This is very simple and easy to do, as you will not miss out anything even if you had to redo the same in Ecc6.0
    Regards
    Subramanian

  • Out put to PDF Format

    Hi,
    Can anyone help me to convert O/p To PDF Format.
    Regards
    Amit Gupta

    hi,
    Plz refer following points  and hope it helps in solving u r problem.
    1. Note Spool Request No.
    2. Go to SE38
    3.Enter a programme RSTXPDFT4
    4.In subject- Click Documentation
    5. Then do Debugging
    6. Enter Spool request no and desired location
    7.Execute
    8.In ABAP DEBUGGER -Press F8
    9. Select the desired location and file name and save.
    10.View the desired o/p in PDF.
    Regards,
    Jaiprakash.P.T

  • Smart form with Migo

    Hi ...
    I want to attach a smart form out put type with migo .. when we print that out form should displayed ... kindly help that for which program i make a Z copy and where should i attach that Zprogram and Smartform in SPRO .....
    Regards
    Ammad

    Hi,
        The Developed Zsmartform is to be placed in the Smartform name and the Driver program need to be copied to Z with all includes.
    The following link shows how to copy a std program to ZProgram.
    [Re: Printing Purchase Order from ME9F using custom program and smartform]
    Regards,
    Vijaya Lakshmi.T

  • Smart forms convert to pdf binary data

    Dear All,
    I'm working on smart forms integrations with .net and  I need to send the smart forms PDF binary data though custom rfc .
    For that i'm  converting smart forms otf  data  to pdf in and pass this data  through rfc but this idata is is not wokring on .net guys when they are converting this on pdf..
    so is there any need of decoded smart forms otf data before passing through or i'm missing some basic step?
    Please guide me?
    Rg
    Anuj

    hi,
    Have a look on this wiki:
    [http://wiki.sdn.sap.com/wiki/display/Snippets/SmartformoutputtoPDFformat]
    And maybe this one could also interest you:
    [|http://wiki.sdn.sap.com/wiki/display/Snippets/SmartformtoMailasPDF+attachment]
    regards
    mickael

  • Hi, After migration of smart form into adobe form, while checking( syntax )

    hi,
    After migration of smart form into adobe form, while checking( syntax ) the error message will be displayed like the Sender Country is not filled. if i fill the sender country then only the adobe form activate but no sender country is provided in smart form. how can we rectify this problem in migration of smart form into adobe forms ( Address node ).
    sender country is not mandatory in smart form but comes into adobe form it is mandatory. How can we handle this type of issues.
    Thanks&regards,
    Ashok Reddy

    I too have the same query..to check Adobe form after migrating from smartform.
    Can anybody answer in this regard?
    Thanks in advance..

Maybe you are looking for