Reg ALV to PDF download

can any one tell us how to download ALV to PDF.

Balaji,
Save Report Output to a PDF File
This report takes another report as input, and captures the output of that report. The output is then converted to
PDF and saved to a local file. This shows how to use some of the PDF function modules, as well as an easy way to
create PDF files.
Source Code Listing
report zabap_2_pdf.
*-- Enhancements: only allow to be run with variant. Then called
*-- program will be transparent to users
*-- TABLES
tables:
tsp01.
*-- STRUCTURES
data:
mstr_print_parms like pri_params,
mc_valid(1) type c,
mi_bytecount type i,
mi_length type i,
mi_rqident like tsp01-rqident.
*-- INTERNAL TABLES
data:
mtab_pdf like tline occurs 0 with header line,
mc_filename like rlgrap-filename.
*-- SELECTION SCREEN
parameters:
p_repid like sy-repid, " Report to execute
p_linsz like sy-linsz default 132, " Line size
p_paart like sy-paart default 'X_65_132'. " Paper Format
start-of-selection.
concatenate 'c:\'
p_repid
'.pdf'
into mc_filename.
*-- Setup the Print Parmaters
call function 'GET_PRINT_PARAMETERS'
exporting
authority= space
copies = '1'
cover_page = space
data_set = space
department = space
destination = space
expiration = '1'
immediately = space
in_archive_parameters = space
in_parameters = space
layout = space
mode = space
new_list_id = 'X'
no_dialog= 'X'
user = sy-uname
importing
out_parameters = mstr_print_parms
valid = mc_valid
exceptions
archive_info_not_found = 1
invalid_print_params = 2
invalid_archive_params = 3
others = 4.
*-- Make sure that a printer destination has been set up
*-- If this is not done the PDF function module ABENDS
if mstr_print_parms-pdest = space.
mstr_print_parms-pdest = 'LOCL'.
endif.
*-- Explicitly set line width, and output format so that
*-- the PDF conversion comes out OK
mstr_print_parms-linsz = p_linsz.
mstr_print_parms-paart = p_paart.
submit (p_repid) to sap-spool without spool dynpro
spool parameters mstr_print_parms
via selection-screen
and return.
*-- Find out what the spool number is that was just created
perform get_spool_number using sy-repid
sy-uname
changing mi_rqident.
*-- Convert Spool to PDF
call function 'CONVERT_ABAPSPOOLJOB_2_PDF'
exporting
src_spoolid= mi_rqident
no_dialog = space
dst_device = mstr_print_parms-pdest
importing
pdf_bytecount = mi_bytecount
tables
pdf = mtab_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.
call function 'DOWNLOAD'
exporting
bin_filesize = mi_bytecount
filename = mc_filename
filetype = 'BIN'
importing
act_filename = mc_filename
tables
data_tab = mtab_pdf.
FORM get_spool_number *
Get the most recent spool created by user/report *
--> F_REPID *
--> F_UNAME *
--> F_RQIDENT *
form get_spool_number using f_repid
f_uname
changing f_rqident.
data:
lc_rq2name like tsp01-rq2name.
concatenate f_repid+0(8)
f_uname+0(3)
into lc_rq2name separated by '_'.
select * from tsp01 where rq2name = lc_rq2name
order by rqcretime descending.
f_rqident = tsp01-rqident.
exit.
endselect.
if sy-subrc ne 0.
clear f_rqident.
endif.
endform." get_spool_number
Don't forget to reward if useful........

Similar Messages

  • Reg: ALV report -  output download

    Hi Friends,
    I am having one issue reg download of  ALV (Grid display) report output. we are having vendor number at 1st colomn. It's displaying correctly in output.
    (eg:0000100069). But, when I download the output into a excel file, last digit of the vendor number getting truncated. (eg: 100069 becomes 10006). 
    Kindly help me regarding this ..
    Thanks in advance.
    Regards,
    Bharat.

    Hi,
    The problem is in formatting in Excel. U download the data. Then select the column u want to format, right click and select format cells. In that, choose Number and assign decimal places to 0. U will get according to the format u needed.
    I worked in this, and got as per the specified format.
    Reward if found useful.

  • Problem in ALV to Excel Download

    Good Morning Experts,
      I am facing one issue related ALV to excel Download.
    I Developed one custom report the output is correct displaying.
    the output is like for example i am taking 3 columns (plant, material, amt).
    plant material amt
    1001  aaa     1000
    1001  bbb     2000
    while downloading to excel
    it displaying like
    plant
    material
    amt
    1001
    aaa
    1000
    1001
    bbb
    2000
    I dont know why its coming like that.
    this is my code
    DEFINE field_cat.
    wa_field-row_pos = &1.
    wa_field-fieldname = &2.
    wa_field-tabname = &3.
    wa_field-seltext_m = &4.
    wa_field-outputlen = &5.
    wa_field-currency = &6.
    wa_field-ref_fieldname = &7.
    wa_field-ref_tabname = &8.
    APPEND wa_field to it_field.
    clear wa_field.
    END-OF-DEFINITION.
    field_cat '1' 'BUKRS' 'IT_FINAL' 'Company Code' '6' '' '' ''.
    field_cat '2' 'BUTXT' 'IT_FINAL' 'Comp Descrip' '25' '' '' ''.
    field_cat '3' 'LIFNR' 'IT_FINAL' 'Vendor No' '10' '' '' ''.
    field_cat '4' 'NAME1' 'IT_FINAL' 'Vendor Name' '35' '' '' ''.
    field_cat '5' 'STRAS' 'IT_FINAL' 'Vendor Addres' '35' '' '' ''.
    field_cat '6' 'FDGRV' 'IT_FINAL' 'Nature Of Work' '30' '' '' ''.
    field_cat '7' 'DMBTR' 'IT_FINAL' 'Net Amount' '16' 'X' 'WAERS' 'IT_FINAL'.
    field_cat '8' 'QBSHB' 'IT_FINAL' 'TDS Amount' '16' 'X' 'WAERS' 'IT_FINAL'.
    field_cat '9' 'TOTAL' 'IT_FINAL' 'Total Amount' '16' 'X' 'WAERS' 'IT_FINAL'.
    it_layout-zebra = 'X'.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
       I_CALLBACK_PROGRAM                = sy-repid
       I_CALLBACK_TOP_OF_PAGE            = 'TOP_OF_PAGE'
       IS_LAYOUT                         = it_layout
       IT_FIELDCAT                       = it_field
       I_SAVE                            = 'X'
      TABLES
        t_outtab                          = it_final
    EXCEPTIONS
       PROGRAM_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.                    " DISPLAY_ALV
    FORM TOP_OF_PAGE.
    REFRESH it_head. CLEAR it_head.
    wa_head-typ = 'H'.
    wa_head-info = 'Vendorwise Expense Details'.
    APPEND wa_head to it_head.
    wa_head-typ = 'S'.
    IF NOT s_MONAT-high is INITIAL.
      CONCATENATE 'Period : ' p_gjahr '.' s_MONAT-low ' to ' p_gjahr '.' s_MONAT-high INTO wa_head-info.
    ELSE.
      CONCATENATE 'Period : ' p_gjahr '.' s_MONAT-low INTO wa_head-info.
    ENDIF.
    APPEND wa_head to it_head.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
      EXPORTING
        it_list_commentary       = it_head.
    ENDFORM.
    Regards,
    Dhina..

    Hi,
    You can also try in this way
    in the output screen
      click List (in app tool bar) -> Export -> Spreadsheet
    and save at your desired location.
    (It will be save in .mhtml format , just rightclick on it and you can open it with excel )
    Then you will be able to view in your required format.
    Regards,
    koolspy.

  • Avoid splitting of columns ALV report while download output to Excel sheet

    Hi friends,
                  I have 170 columns in my ALV report
    while downloading the report to Excel sheet
    the column descriptions and values are splitting in two lines.
    How can i avoid the problem.
    before calling REUSE_ALV_GRID_DISPLAY function module in my code
    for the Layout i assigned LS_LAYOUT-MAX_SIZE = 1023.
    but still the problem is not solved.
    Please help me in this Issue.
    Thanks in Advance,
    Ganesh

    Hi friends,
    I dont want to use and Keyboard shiftcntrl....
    or dont want to change any code in ALV report
    by simply assigning some value to any of the export parameter in ALV function module
    can we achieve the functionality
    Thanks in Advance,
    Ganesh

  • Can I print web pages from firefox using adobe pro 9 (Not using PDF download) and if so how

    Can I print web pages from Firefox 3.6.12 using adobe pro 9 (not using PDF Download) and if so how.

    {Ctrl + P} - do you have a PDF Printer listed in the Printer - Name drop-down?

  • In my "Extra" there is a line: "PDF -download, by Nitro PDF software". When I click on it, appears: "XML-parsefout .." How do I delete a command in "Extra"?

    How do I delete something in "Extra", something I didn't put in! (on my desktop).
    On my laptop the "PDF -download, by Nitro PDF software" doesn't figure and pdf files open normally and not seperatly in the mainframe of for example www.centrum-veurne.be

    Gee, Pat, this is a  real big help.
    Nobody could possibly think anyone would ask for help without first trying to fix the issue oneself. Or maybe you do. I have opened the file and looked under security. I have changed it to owner-notebook (which is what the techs called me) and clicked accept but geepers it didn't work.
    Maybe someone else has an idea.
    Take Ownership of a File or Folder
    The above should be a link. At least I copied and pasted the link. I did what was stated in there. It isn't like brain surgery. But it is not working. I ended up being able to open some pdf files after transferring them from one partition category to another. I wish it was that easy as you seem to think.
    Thanks for the help. Have a great year.

  • Error on opening a PDF download

    Please do not have your subject in all CAPITALS
    HI,
    i am geeting the below error message on trying to open the pdf download
    **"Adobe reader could not open file because it is either not a supported file type or because the file has been damaged (for example, it was sent as an email and wasn't correctly decoded"**
    however on analysis i found the following
    no data on PDF because the  otf internal table is empty.
    actually i am converting a spool containg script into pdf download.
    i am working with  version 3.1i , so i dont use function module and use C function to convert spool to otf and then use convert_pdf to convert to pdf.
    when i debug my call function on the do loop executes once corrcetly  and on the second time of  execution immediately loaded with error message  'end of data' .... and so my otf conversion is not happening . ie otf_page intertal table gets empty without appending .
    sometimes i get error number 2048 ( illegal line length )
    i could not locate the error , as this application was working earlier good and recently got into trouble.
    pl guide if i need to check any settings.
    to my knowledge i found the program , layout and spool informations are okay.
    thanks in advance for your clue towards a progressive solution.
    Edited by: Matt on Mar 12, 2009 3:44 PM

    Please do not have your subject in all CAPITALS

  • I bought a pdf book last year and had no problem reading it for a few months then all of a sudden I could no longer open it and to this day. Any other pdf download off internet I can still open and read, except for that particular book. Operating system i

    I bought a pdf book last year and had no problem reading it for a few months then all of a sudden I could no longer open it and to this day. Any other pdf download off internet I can still open and read, except for that particular book. Operating system is Windows 7 Home Premium, Adobe Reader XI 11.0.07.  When trying to open file I get msg "You did'nt login or your session has expired. Please log in to read this document for the first time". (Like I said I have read it before). So I log in but that prompts me to give the name of the file I want to export or convert to Word or something else, which is not what I want to do of course. I have not purchased any service from Adobe or Acrobat as I only need to read. Thanks for your help..

    Thank you for your reply. Operating system is Windows 7 Home Premium, Adobe Reader XI 11.0.07.  When trying to open file I get msg "You did'nt login or your session has expired. Please log in to read this document for the first time". (Like I said I have read it before). So I log in but that prompts me to give the name of the file I want to export or convert to Word or something else, which is not what I want to do of course. I have not purchased any service from Adobe or Acrobat as I only need to read. Thanks for your help.

  • My Macbook Air is stopping a few seconds into videos (e.g. Youtube and BBC iPlayer) and is doing the same thing with PDF downloads not

    My Macbook Air is stopping a few seconds into videos (e.g. Youtube and BBC iPlayer) and is doing the same thing with PDF downloads which are only partially downloading then stopping. I changed some security settings yesterday but don't think I touched anything else. Can anyone help?

    My Macbook Air is stopping a few seconds into videos (e.g. Youtube and BBC iPlayer) and is doing the same thing with PDF downloads which are only partially downloading then stopping. I changed some security settings yesterday but don't think I touched anything else. Can anyone help?

  • PDF download in IE 7

    I created a pdf download link to a _blank page, and when I
    try to download and view the pdf in IE 7, a new page comes up but
    the page is blank. The pdf does not view. Can someone offer insight
    to the problem? Thanks.

    If you're talking about the link by "Click Here to download a
    PDF version of
    this Recipe Style Guide" I clicked it, waited about 20
    seconds, then saw
    your Recipe Style Guide. It's only about 160K so it's not
    that large (for
    the record, I'm in a coffee shop right now with a not-so-good
    connection).
    It's working fine. Assuming that's what's causing you a
    problem.
    Mad Dog
    Dored wrote:
    > The link is:
    http://www.hadfield.net/copywrite.htm#recipe

  • How do i make a pdf download instead of opening in safari?

    want to make a pdf download instead of opening as a page in safari.  How do I set this preference?

    ImageIcon myIcon = ...
    JButton b = new JButton(myIcon);

  • What to do? When on a site with a PDF download I wish to open, the site commences to open in a new Tab but the information does not come through? This happens on all sites. The advanced Java Script is disabled.

    When on a site with a PDF download I wish to open, when I click on download the site commences to open in a new Tab but the information does not come through? This happens on all sites. The advanced Java Script is disabled. The new tab will sometimes flash black then go white with nothing else happening or just go white & nothing else?

    I had the same problem and also had PDF Download 3.0.02 installed. By removing this addon I can now select a PDF document which then opens up a normal Open With/Save dialogue allowing me to open the file or save it. Hope this helps.

  • I bought several eBooks for Adobe PDF download. Am I able to download with the adobe program that I

    I just purchased a library worth of eBook downloads from the Nonviolent Communication Academy bookstore.  I chose Acrobat PDF download, but do not know how to be sure that the books have been downloaded and saved.  Do I have the Adobe program necessary to contain several eBooks?  Once I close the download page, I cannot have access to it again.  So, now or never.  There is a storm here and with my luck the electricity will go out. Please assist me.

    Which Adobe application are you trying to use?

  • Issue with PDF download

    Hi Guys,
    I am facing problem with the PDF download option. In the answers request I have to use Pivot tables to display data and since these pivot tables do not provide the option of Table Headings, I resorted to HTML to get a similar output. The issue I am facing right now is when I print it through PDF or Powerpoint, the HTML code I have written comes up instead of the result. In the case of excel or answers, I am getting the proper output. Is there some setting I am missing?? I am using the column with the HTML coding in the Columns section of the pivot table.
    Thnx!

    Hi,
    This is a known issue with HTML code embedded in your request, when you try to download the same in PDF, PowerPoint it will show the code.
    You can the following bugs regarding this in metalink.
    Bug 7187501: PDF SHOWS HTML TAGS WHILE PRINTING REPORT WITH BOLD LETTERS -HTML Tags Shown When Print or Export to PDF (Doc ID 1064060.1)
    Bug 9372634: HTML TAGS SHOWN WHEN PRINT/EXPORT TO PDF
    Bug 8899783: HTML TAGS APPEAR IN PDF REPORT
    Thanks,
    Vino

  • PDF download printing.

    I want to print some PDF downloads in book form onto A3 sheets. I want pairs of pages to appear on one side of a sheet of A3. I can do this, but the printed images come up sized as though for A4 sheets, ie they are much too small to appear on an A3 sheet. Can this be achieved. There seems no way of selecting the size of sheet for output.

    I can do this (using Reader XI on Windows 7) by
    clicking Multiple on Page Sizing & Handle, then set Pages per sheet: 2
    Page Setup set paper size to A3
    I do not know how it will actually print, as I do not have an A3 printer.

Maybe you are looking for

  • HELP PLZ - RESOLUTION PROBLEMS

    I am currently using Photoshop Elements to design JPEG's for a websites front page (which scrolls across many images like adverts etc) but I can't seem to be able to change the image resolution after designing the image that is wanted. Does anyone kn

  • FYI Tasks

    Hi, We have a FYI notification workflow associated to the status of Contract. When the Contract status changes, a FYI notification is sent to Contract administrator. Have following questions. 1. If pl/sql Workflows are supported in Fusion 2. As per "

  • Changes to department-approvers in EAM not saved.

    Dear friends, I face a peculiar problem in EAM which suddenly sprang up. I am not able to save changes made to department-approvers in EAM. While saving it opens a 'Note' window with an OK button and does not save at all. I would appreciate any help

  • Downloading a ring tone to my LG Cosmos phone.

    Whenever I try to download a ring tone to my LG Cosmos, for some reason I cannot get it on my phone.  However, Verizon will charge me for that download unless I call and tell them it is not on my phone and to give me a credit.  Can anyone help me wit

  • MAIN MENU

    YOU KNOW WHAT ARE THE IMAGE SUPPORT TRANSPARENCE  IN SAP OR HOW UPLOAD TO SAP IMAGEN WITHOUT BACKGROUND