Event on Print Button

Hello ABAPers,
I use an ALV in a screen, and use a copy of the standard status (from the function group SALV) STANDARD_FULLSCREEN, which contains the menu and ALV toolbars.
If the user chooses Print (fcode = $RNT) and executes the printing, I must execute some code (e. g. change some ALV data).
1) Is it possible to catch the event of clicking the Print menu button?
2) How could I implement my own user_command to handle the function codes (right now it goes to the standard user_command provided by the standard status)
Thanks in advance,
Ivson

Hi Ivson,
Write a class which implements the method handle_user_command for the event user_command of class cl_gui_alv_grid.
In this method you have to handle the print.
Set handler for the alv.
Then the control goes to the method when the print button is selected on the alv toolbar.
check the program : BCALV_TEST_GRID_EVENTS
you can handle the event : user_command or before_user_command.
hope this helps you.
regards,
prasanth
reward all helpful points

Similar Messages

  • Printer Button Event

    Hi,
    We are wanting to record each time a report is printed off. We are using VS.NET2005 and CRXI.
    We want to do this by entering a ReportName and DateTime record into a Table that will hold information about the Report Print
    We are trying to find the event that is associated with the OK button of the PrintDialog form in CrystalViewer.
    Can anyone help, or offer an alternative method. Perhaps the event for the Print button in the CrystalViewer that shows this PrintDailog form??
    Many thanks Stuart
    Edited by: Stuart Kearney on Feb 3, 2010 5:09 PM

    Imports CrystalDecisions.CrystalReports.Engine
    Imports CrystalDecisions.Shared
    Imports CrystalDecisions.Windows.Forms
    Public Class Form1
        Dim myopenDialog As OpenFileDialog
        Public Sub New()
            ' This call is required by the Windows Form Designer.
            InitializeComponent()
            CrystalReportViewer1.ReportSource = "C:\Crystal\test\printer\portrait.rpt"
            CrystalReportViewer1.ShowPrintButton = False
            ' Add any initialization after the InitializeComponent() call.
            HideCRVImage(CrystalReportViewer1)
        End Sub
        'Private Sub InitializeComponent()
        'End Sub
        Friend WithEvents myLoadReport As ToolStripButton
        Private Sub ToolStripButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles myLoadReport.Click
            Dim crReportDocument As New CrystalDecisions.CrystalReports.Engine.ReportDocument()
            Dim printDialog1 As New System.Windows.Forms.PrintDialog
            crReportDocument.Load("C:\Crystal\test\printer\portrait.rpt")
            If printDialog1.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
                'Get the Copy times
                Dim intCopy As Int16 = printDialog1.PrinterSettings.Copies
                'Get the number of Start Page
                Dim intFromPage As Int16 = printDialog1.PrinterSettings.FromPage
                'Get the number of End Page
                Dim intToPage As Int16 = printDialog1.PrinterSettings.ToPage
                'Get the printer name
                crReportDocument.PrintOptions.PrinterName = printDialog1.PrinterSettings.PrinterName
                If printDialog1.PrinterSettings.DefaultPageSettings.Landscape = True Then
                    crReportDocument.PrintOptions.PaperOrientation = PaperOrientation.Landscape
                Else
                    crReportDocument.PrintOptions.PaperOrientation = PaperOrientation.Portrait
                End If
                crReportDocument.PrintToPrinter(printDialog1.PrinterSettings, printDialog1.PrinterSettings.DefaultPageSettings, True) '(intCopy, True, intFromPage, intToPage)
            End If
        End Sub

  • ALV Print event in Custom Button

    Hi,
    I have requirement to call ALV print event in Custom Button after some condition. Can anyone give me the solution or link to achieve this requirement.
    Thank in advance.

    Hi Mani,
    On that ALV button event, write the following code.
      DATA lo_component TYPE REF TO if_wd_component.
      DATA lo_appl      TYPE REF TO if_wd_application.
      lo_component = wd_comp_controller->wd_get_api( ).
      lo_appl      = lo_component->get_application( ).
      lo_appl->print_page( ).
      DATA lo_app_info TYPE REF TO if_wd_rr_application .
      lo_app_info = lo_appl->get_application_info( ).
      DATA lv_app_name TYPE string .
      lv_app_name = lo_app_info->get_name( ).
    It helps you to print the table contents. Hope this helps you.
    Thanks
    KH

  • Crystalreportviewer print button event postback issue

    Post Author: krishna.moorthi
    CA Forum: Crystal Reports
    I have the VS2003.Net and crystalreports10 for developing reports in our appliction.
    When the print button clicked in the crystalreportsviewer,based on the entered no of pages in printerdialog the page_load is happening multiply with the no of pages .
    Example: I have entered Pages =2 then the page_load will execute the 4 time (CRViewer having the 7 pages)
    why this is happening ...in behind any reason for this ..help would be highly appreciated.
    thanks in advance.

    Look for the search box in the top right corner of this web page. Enter the following string: 'Communication error crystal net'. You should get a number of results. See if any of those help.
    Ludek
    Follow us on Twitter http://twitter.com/SAPCRNetSup
    Got Enhancement ideas? Try the [SAP Idea Place|https://ideas.sap.com/community/products_and_solutions/crystalreports]

  • Using the print button to print then close a document

    I use Live Cycle Designer to create my Adobe documents.  I am working on a kiosk project and one of the menus navigates to a document page that has PDF documents and forms for users to print out.  The way the kiosk is designed, I would like for my pdf file to close after the print button is selected.  I recieved a solution in the general Adobe forum, but later found out the script does not work if the document was made using Live Cycle.  Any suggestions???  Is it possible??? Thanks.

    Open your PDF file in adobe livecycle designer, select print button on PDF.
    Go to windows(in adobe designer menu bar) and select Script Editor - In Show dropdown list select postPrint event and copy paste the code below-
    app.execMenuItem("Close");
    Regards-
    Chalukya.

  • Print button issues.

    Hello everyone,
    In order to 'flatten' our pdf forms so that they cannot easily be modified, we have decided to print all of our completed forms to a virtual .pdf writer. Now, we could have all of our users click file-->print-->select 'cutePDF Writer' from the printer drop-down-->hit OK-->Type in a file name for the new .PDF-->hit OK... but I was hoping that I could make their lives easier by adding a button to do most of this for them.
    After scowering the depths of the internet, I found this script that I've added to the click event of a button:
    var objPrintParams = event.target.getPrintParams();
    objPrintParams.interactive = objPrintParams.constants.interactionLevel.silent;
    objPrintParams.printerName = "cutePDF Writer";
    event.target.print(objPrintParams);
    This effectively handles everything up to 'Type in a file name for the new .PDF' step... but there are some issues.
    The first is that some of our users may not have cutePDF installed. As it is, the script doesn't throw an error if the printer does not exist. Without the printer installed, clicking the button seems to have no effect. Both pre- and post-print events fire as if the printing worked, even though it didn't. I would like to have a helpful message for the user, but I can't think of a way to check if it failed. If I could get a list of printers, I could check it before trying to print... but event.target.printerNames(); doesn't work, and that was the only thing that i could find to list printer names.
    The second issue is that a message is displayed to inform the users the the document is trying to print. "This document is trying to print..." I get that this is a security measure, but the user is pressing a button called print, and having to click a second time may get annoying. Additionally, if they click no by accident, this response is stored until they restart reader... clicking the print button again does nothing.
    Ultimately, I'd like to get rid of this message... but if I can't do that, I'd like for it to show each time that the user presses it, both for consistancy, and to allow them to change their minds without having to close out reader, losing all of the filled fields that they entered.
    I know that this might be asking the impossible, but I would appreciate any help with this.
    - Scott

    In the designer, highlight the print button. On the Object palette locate the presence dropdown (near the bottom of the palette). Change the pressence to "Visible (Screen Only)".

  • Sharepoint 2010 SSRS Report Viewer Print button not doing anything

    We are having trouble printing reports from report viewer integrated in SharePoint 2010. On IE 11 compatible mode clicking print button does nothing.

    Hi,
    Please test the issue on different browsers and client PCs.
    Did you find any related error message in ULS log or event log?
    If you are recieving the error “Unable to load client print control”, please refer to the link below and see if it can be help:
    http://blogs.msdn.com/b/mariae/archive/2010/04/13/error-unable-to-load-client-print-control-when-printing-reports-in-reporting-services-summary-of-all-possible-causes-at-april-2010.aspx
    Regards,
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected] .
    Rebecca Tu
    TechNet Community Support

  • Different validations in a print button -- Urgent !

    Hi,
    I've adopted the script stated in HightlightOneRequiredField.pdf so that the print button in my form can detect and prevent null field before pop up the print dialog.
    However, there's an email field (in my form) with a validate event, i.e. to validate if the email address is in general format "[email protected]", which I want the same print button to check this email validation too (apart from the normal null field checking)
    In other words, what I want is that the print button will check:
    1) when a null field is detected, then pop up alert message and disable print and;
    2) when a field with validate event scripted is detected, and if its validation is not passed, then pop up its existing validation error message, then disable print
    Can someone help on this ?
    Thanks in advance.
    Alex

    Hi Alex,
    xfa.form.execValidate();
    This will check all validations on your form, display the error message for each, and return true or false. True if all validations pass and false otherwise. Use this in your print button to check the validations before printing. So. . .
    if (xfa.form.execValidate())
    xfa.host.print(yada yada);
    A word of caution though. I don't think this is fool-proof. A user can always print using the menu or a shortcut key in Acrobat/Reader, which bypasses your print button.
    Hope this helps.
    Jared Langdon
    www.jlangdon.ca

  • Print button in Webdynpro

    Hi all,
    This is a very old functionality am stuck with..
    I need to print the Table in Webdynpro Screen.
    Donts :
    I dont have a PrintButton UI element present in my NWDS7.0 Version.Sp13.
    I dont have the "com.sap.tc.webdynpro.clientserver.print.api" API to get the Print Service.
    I dont want to export the Table into EXCEL and then give a print, due to some performance issues.
    Could anyone pls suggest if there is any solution for this.
    Thanks & Regards,
    Sirisha.RS

    hi,
    Overwrite the following javascript to the click event of the print button...
    xfa.host.print(0, "0", (xfa.host.numPages -1).toString(), 0, 1, 0, 0, 0);
    By
    Parthi

  • Create a print button to print one frame

    I am trying to create a print button on the last frame that will allow the user to print just that frame.  I've tried using the printjob object, but all that I can get to happen is print a blank sheet of paper.  Here is the code that I have so far:
    function printScore(event:MouseEvent):void
        var printJob:PrintJob = new PrintJob();
        var sprite:Sprite = new Sprite();
        printJob.start();
        printJob.addPage(sprite);
        printJob.send();
    btn_print.addEventListener(MouseEvent.CLICK, printScore);
    If I right-click and choose print while viewing the .swf file, it prints correctly.  What am I missing in order to make my last frame print through my print button?

    I just found my answer on this thread: http://forums.adobe.com/message/57234#57234

  • Print button requires a second click to print after changing presence of another page to visible

    I'm having trouble getting a print button to execute two separate lines of code.  I need it to make the second page of a form printable and then print, it makes page 2 visible but then when the print dialog box comes up the only page that is there is page 1.  Can I get them to execute one after the other with one click???  I've played around with the prePrint and no luck there either.  Page2 is set to hidden again on the postPrint which works fine.
    I've created a very simple version of this problem, 2 pages, page 2 is set to hidden on initialize.  On page 1 is a button with only this code on the click event:
    event:click
    Pg2.presence = "visible";
    xfa.host.print(1, "0", (xfa.host.numPages -1).toString(), 0, 0, 0, 0, 0);
    And it still only displays page 1 in the print dialog even though on the preview behind that pop-up I can see the document is 2 pages long now!!  What am I missing here?
    Thanks

    The layout model didn't have a chance to update right after you set the presence to "visible". Therefore the numPages property didn't update and only sees there being the one page.
    You need to force a 'refresh' with xfa.layout.relayout() right after you change the presence property of Pg2. Then instead of using a host property (numPages), use a layout method. In other words replace xfa.host.numPages with xfa.layout.pageCount().
    Your end result will be:
    Pg2.presence="visible";
    xfa.layout.relayout();
    xfa.host.print(1, "0", (xfa.layout.pageCount() -1).toString(), 0, 0, 0, 0, 0);
    Kyle

  • Question about print button

    Good morning everyone,
    Quick question for you this morning, im playing around with the print button and so far i get it to do what i want. Which is basically print in "FIT" mode like this:
    xfa.host.print(1, "0", (xfa.host.numPages -1).toString(), 0, 1, 0, 0, 0);
    now this takes care of people who press my custom print button, but i dont have control over the folks that might activate that from the print icon or from the print menu options.
    Now for this i know that using PRE:PRINT would solve it for sure, but i dont know how to write the code in there so it works.
    What i did at first is copy the print code above in that section, but if i press my Print button where the same code is, i create a endless loop.
    Im just trying to cover my self and make sure that what ever one of the 3 print choices they choose, i will be able to execute the code above and without any infinite loops
    Any ideas how i could set this up?
    Thank you very much again!!!

    Hi,
    you can disallow printing form the menu items or key combination with a bit of scripting.
    But first you need a variable you add under the form properties with a default value like 0.
    Lets name it "usedPrintButton".
    Ok, now the scripting part.
    There are 3 scripts in 3 different events neccassary. You can use all those events of your print button.
    1. click event
    // Modify the variable to imply user has started printing from this button
    usedPrintButton.value = "1";
    xfa.host.print(1, "0", (xfa.host.numPages -1).toString(), 0, 1, 0, 0, 0);
    2. prePrint event
    // Check the variable and cancel printing when it's 0
    if (usedPrintButton.value == "0") {
              xfa.event.cancelAction = true;
    3. postPrint event
    // Set the variable back to 0
    usedPrintButton.value = "0";
    Hope this helps.

  • How do I create a print button to print a specific range of the document.

    How do I create a print button to print a specific range of the document.  I've found JavaScript to print a specific page, but a range or even multiple ranges.  Form is created in Adobe 9 Pro.  Any help would be truly appreciated! 

    Sure, I'll give it a test.  Its just that I have a 128 page form that not all of it needs to be printed.
    Currently,  I have an index page where I want to set up a print button queues per form, however there are several form scattered throughout the document that make up a specific section, but it does not require printing the entire document.  Does that make sense?
    I did find this JavaScript during my reseach, but have not be able to get it to work.
    var pp = event.target.getPrintParams() ;
    pp.interactive = pp.constants.interactionLevel.full;
    pp.printRange=[[1, 1], [3, 4]];
    event.target.print(pp);

  • How to know  when it pushed browser print button

    Hi anyone knows how to get the print browser button event ?
    I mean I have a jsp and I want to know when then IE 5 print button is pushed.
    How to get the event?

    It's possible there's something in JavaScript you can do to catch the event, but I've never seen it done. There's no way to do this with JSP.
    Another possibility is to disable the print button in the browser and then make you're own (may only be able to do this with an applet, not sure) so you can get the callback.

  • Crystal reportviewer print button problem

    Post Author: ftsoft
    CA Forum: .NET
    in the click event for a button, the reportview.reportsource is set string reportPath = Server.MapPath("rptCensusTract.rpt");        CrystalReportViewer1.ReportSource = reportPath;  this works fine. the report is displayed, and the print button works. when I change the code to use a report document ( for setting the logon infor )     private ReportDocument myreport;..... myreport = new ReportDocument();        string reportPath = Server.MapPath("rptCategoryHour.rpt");        myreport.Load(reportPath);.....CrystalReportViewer1.ReportSource = myreport;  the report is displayed, but nothing happens when the print button is clicked.  not even an error message. any idea what is happening here? thanks for any help  

    Make sure you have SP 2:
    https://smpdl.sap-ag.de/~sapidp/012002523100009038092009E/cr2008win_sp2.exe
    with FP 2.5 on top:
    https://smpdl.sap-ag.de/~sapidp/012002523100002975192010E/cr2008fp25.exe
    If the issue persists, since it is in the CR designer, post to the CR design forum:
    SAP Crystal Reports
    You need to resolve this in the designer, before trying to resolve it in a .NET application.
    Ludek
    Follow us on Twitter http://twitter.com/SAPCRNetSup

Maybe you are looking for