Printing previous Invoice

I'm having problem in printing previous invoice not the current one this happens almost 4 times a day, printing around 10000 vouchers per day can anyone explain me why?
First i update data by using ExecuteScalar and getting Auto-Gen Number from Database
Then I'm Updating Invoice Number to another Table for Invoice numbering system
TicketNumberUpdate()
lbl_Status.Text = "Updating Ticket Number..."
Application.DoEvents()
System.Threading.Thread.Sleep(200)
then i wait and filter according to my ticket number and populate data to richtextbox 
PrintFunc(" WHERE dbo.tbl_Tickets.TicketNo='" & txtTicket.Text & "' AND dbo.tbl_Tickets.Ticket_Type='" & cboTicketType.Text.Trim & "'")
lbl_Status.Text = "Loading Ticket ..."
Application.DoEvents()
System.Threading.Thread.Sleep(200)
and save that html text to temporary html file 
rtb_TicketFormat.Rtf = rtb_TicketFormat.Rtf.Replace("Duplicate.png", "Original.png")
Dim myFileName As String = IO.Path.Combine(IO.Path.GetTempPath, "_.html")
rtb_TicketFormat.SaveFile(myFileName, RichTextBoxStreamType.PlainText)
lbl_Status.Text = "Printing Ticket ..."
Application.DoEvents()
System.Threading.Thread.Sleep(200)
and wait for Save that Invoice in html format after that i call for PrintTktz for printing that file
Private Sub PrintTktz()
Dim webBrowserForPrinting As New WebBrowser()
AddHandler webBrowserForPrinting.DocumentCompleted, New _
WebBrowserDocumentCompletedEventHandler(AddressOf PrintDocumentz)
webBrowserForPrinting.Url = New Uri(IO.Path.GetTempPath & "_.html")
End Sub
Private Sub PrintDocumentz(ByVal sender As Object, _
ByVal e As WebBrowserDocumentCompletedEventArgs)
Dim webBrowserForPrinting As WebBrowser = CType(sender, WebBrowser)
webBrowserForPrinting.ScriptErrorsSuppressed = True
webBrowserForPrinting.Print()
webBrowserForPrinting.Dispose()
End Sub
when testing this works fine do you guys think some time when printing if below code could not save the file it gives that error? 
rtb_TicketFormat.SaveFile(myFileName, RichTextBoxStreamType.PlainText)
Thank you every one for you kind help!...

I'm not certain. However from the code you display you are constantly creating a WebBrowser object then never disposing of it when you are done with it. So I would imagine at some point your applications memory is getting really high as you seem to create
10,000 of them a day or something. Which means 10,000 created objects doing nothing and never to be used again are sitting in your applications memory.
The code is "Dim webBrowserForPrinting As New WebBrowser()".
It's possible the code for the sub PrintTktz could be altered as below which should dispose of the WebBrowser object when the code is done with it. But you will need to test it obviously. There's two subs. One has a Using statement which may not work and
the other has a loop that runs until the WebBrowser finishes. Both may not work really.
If neither work the issue still needs to be corrected. Of course if the loop runs for a long time the UI could freeze. And if the end using statement occurs prior to the WebBrowser loading well that's not good either of course.
WebBrowser.IsBusy
Private Sub PrintTktz()
Using webBrowserForPrinting As New WebBrowser()
AddHandler webBrowserForPrinting.DocumentCompleted, New _
WebBrowserDocumentCompletedEventHandler(AddressOf PrintDocumentz)
webBrowserForPrinting.Url = New Uri(IO.Path.GetTempPath & "_.html")
End Using
End Sub
Private Sub PrintTktz()
Dim webBrowserForPrinting As New WebBrowser()
AddHandler webBrowserForPrinting.DocumentCompleted, New _
WebBrowserDocumentCompletedEventHandler(AddressOf PrintDocumentz)
webBrowserForPrinting.Url = New Uri(IO.Path.GetTempPath & "_.html")
Do Until WebBrowserForPrint.IsBusy = False
Loop
webBrowserForPrinting.Dispose()
End Sub
La vida loca

Similar Messages

  • RFKORDES : PRINT SELF-INVOICE FOR SPAIN FOR PREVIOUS FISCAL YEARS

    Hi,
    our accounting department would like to print self-invoice for transaction from 2006/2007/2008 for tax audit. Unfortunately, it doesn't work. I get message :
    "Print report RFKORDES in company code ES11 has not selected any data for SAPE1"
    Message no. FB475
    When implemented few OSS notes for 2010 VAT Package for Spain.
    Does anybody knows how to fix it?
    Thanks
    Anthony

    someone please help me with this ..

  • Batch Printing of Invoice VF31

    Hi All,
    i am printing invoices in Batch ie. VF31.
    Few invoices of particular division are printed wrongly
    ie. some conditions with values of previous invoice are also printed on current invoice(on current invoice its correct values are also printed)
    any configuration is missing?my abaper is saying some config. is missing.
    Reg.
    Amol

    Hi,
    i got the same error in my last project..
    wt i did .. i created a scenarion in dev client means i took 15 invoices list and started getting output in vf31..
    finally i got the same issue there also..
    then i asked to My abaper to debug the error..
    finally we come to know that was due to optisuite..
    there was overlapping of data there in optisuite itself...
    then technical guy did miror changes.. eventually i got my solution..
    hope u also follow the same.. i agree this is time taking and boaring job to take bunch of output.. bt this will keep coming ..so etter to prevent repition..
    thanks
    mahesh

  • AR "Invoice Print Selected Invoices" program

    Hi to All,
    When we run the "Invoice Print Selected Invoices" program in AR. What table and column is used to store the flag for printing the invoice. When we look at the invoice, the more tab has the Print Option/Print Date. Where is the print date, time stamp stored?

    Hi.
    Have a look on RA_CUSTOMER_TRX_ALL table and columns PRINTING_LAST_PRINTED, PRINTING_ORIGINAL_DATE, etc.
    Octavio

  • Switch from OINV to ODRF in Crystal Report layout for print the Invoice?

    Hi,
    I have imported in Sap Business One some standard report developed by Sap with Crystal Report (like Sales Invoice).
    I have try to print my Invoices and all is OK, then I have try to print a Draft Invoice and, even in this case, is all ok. Then I have open the Crystal Report designer for this print module, and the entry point is the OINV table. How can he print succesful the Draft Invoice (that is in the ODRF table ObjType = 13)? Formula Field? I don't understand!!
    Thank for the help!!
    Marco

    Hi Marco,
    You only need a single Crystal report for this. Base it on a stored procedure which has two INT type parameters @DocKey and @ObjectId. Within your SQL create IF blocks to handle different @ObjectId values:
    IF @ObjectId = 13 then use the invoices tables OINV/INV1 etc.
    IF @ObjectId = 112 then use the draft tables ODRF/DRF1 etc.
    Don't forget to put the @ symbol at the end of the parameter in the report itself. That is all that is needed to create a single report that works for both added invoices and draft invoices. You could extend the SQL to handle other @ObjectId values like 14 for AR Credit Notes and so on.
    Regards,
    Andrew.

  • Invoice Print Selected Invoices program is failing when language is not US

    Hi All,
    I am trying to run "Invoice Print Selected Invoices" for multiple languages.
    When language in customer setup under "Account Site Information" is 'US' then EN-US: (Invoice Print Selected Invoices) is completing successfully.
    But when I am changing the language from US to some other language let’s say "F”, then "FR-FR: (Invoice Print Selected Invoices)" getting submitted and it is completing in error.
    These are the log messages which I am getting:-
    +-----------------------------
    | Starting concurrent program execution...
    +-----------------------------
    Arguments
    p_order_by='TRX_NUMBER'
    p_customer_id='10044'
    p_open_invoice='N'
    p_check_for_taxyn='N'
    p_choice='SEL'
    p_header_pages='1'
    p_debug_flag='N'
    p_message_level='10'
    APPLLCSP Environment Variable set to :
    Current NLS_LANG and NLS_NUMERIC_CHARACTERS Environment Variables are :
    FRENCH_FRANCE.AL32UTF8
    Entrer mot de passe :
    MSG-00100: DEBUG: AfterPForm_Trigger +
    MSG-00100: DEBUG: Multi Org established.
    MSG-00100: DEBUG: AfterParam_Procs.Get_Country_Details
    MSG-00100: DEBUG: AfterParam_Procs.Switch_On_Debug
    MSG-00100: DEBUG: AfterParam_Procs.Get_Trx_Number_Low
    MSG-00100: DEBUG: AfterParam_Procs.Get_Trx_Number_High
    MSG-00100: DEBUG: AfterParam_Procs.Get_Tax_Option
    MSG-00103: lp_trx_date_clause = and a.trx_date = a.trx_date
    MSG-00100: DEBUG: BeforeReport_Trigger.Build_Where_Clause
    MSG-00100: DEBUG: P_Choice: SEL
    MSG-00100: Oracle Error in call to Before Report Trigger -6502
    REP-1419: 'afterpform': Abandon du programme PL/SQL.
    Report Builder: Release 10.1.2.3.0 - Production on Ma Avr 2 05:59:27 2013
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    Can anyone please tell me what is the problem or is there any mistake in my approach?
    Regards
    Akash

    Please see the following docs.
    R12: Invoice Print Errors With REP-0069, REP-57054, REP-1419 [ID 557171.1]
    Invoice Print Error: Printing Selected Invoices (Multiple Languages) Is Erroring Out With REP-0069: Internal error [ID 731171.1]
    Thanks,
    Hussein

  • URG:11i to R12.1.3: Invoice print Selected Invoices fails with REP-1419

    Hi,
    Invoice print Selected Invoices fails with the following error: Forcing NLS_NUMERIC_CHARACTERS to: '.,' for XDO processing
    APPLLCSP Environment Variable set to :
    Current NLS_LANG and NLS_NUMERIC_CHARACTERS Environment Variables are :
    American_America.UTF8
    REP-1419: 'beforereport': PL/SQL program aborted.
    Checked the setups based on 557171.1, 375693.1,1101855.1.
    Still the issue is existing.
    May i know the cause of the issue or is it a bug?
    Thanks
    Nancy

    Hi ,
    The cause of the issue is the standard rdf is set to run for single operating unit. But R12 is a moac setup enable application. Hence The operating unit mode is changed to Single from null in system administration concurrent program setting for the XML report concurrent program.
    This fixed the issue.
    Thanks
    Nancy

  • Printing SAP invoice on SAP printer using custom SAP report

    Hi SAP Experts,
    We have the following requirement.
    We need to create a custom report in ABAP to print the Invoice on the printer specifed in the input selection screen.We don't want to use the external commad using GUI.Can annyone please suggest how can we create a spool directly using the invoicve no in sap.
    Thanks,
    Prathamesh

    Hi Prathamesh,
    Follow this approach.
    Get NAST entry corresponding to invoice number(invoice number = objky).
    insert this piece of code :
         gwa_nast-vstat = 1.
         gwa_nast-erdat = sy-datum.
         gwa_nast-eruhr = sy-uzeit.
         gwa_nast-usnam = sy-uname.
         gwa_nast-manue = 'X'.
         gwa_nast-vstat = 0.
         gwa_nast-LDEST = P_printername_from_selection_screen.
         CLEAR gwa_nast-datvr.
         CLEAR gwa_nast-uhrvr.
         CLEAR gwa_nast-cmfpnr.
       MOVE gwa_nast TO nast.
       PERFORM einzelnachricht_dialog IN PROGRAM rsnast00 USING sy-subrc.
       IF sy-subrc NE 0.
         PERFORM objekt_entsperren IN PROGRAM rsnast00.
         IF sy-subrc EQ 9.
           RAISE print_error_dial.
         ELSE.
           RAISE print_error.
         ENDIF.
       ENDIF.
       SET SCREEN 0.
       PERFORM objekt_entsperren IN PROGRAM rsnast00.
       COMMIT WORK AND WAIT.
    the above will generate a spool.
    Thanks,
    Anil

  • Print Excise invoice in Series grp 111 using J1IP for Billing document 1234

    Dear Gurus,
    I have an issue in which I create Sales Document>>Delivery Document and after that if I save my Billing Document a message pops up like:
    Print Excise invoice in Series grp 111 using J1IP for Billing document 12345
    And Excise Invoice gets generated automatically without J1IIN, to which I can view in the display mode in J1IIN.
    I wish to Create Excise Invoice by using T Code: J1IIN not automatically.
    I have checked all the number ranges and search the forum extensively but couldnu2019t found a possible solution.
    Please help me!
    Regards,
    Ashu

    Hi,
    Create Excise Invoice Automatically
    Instructs the system to automatically create an outgong excise invoice immediately you create a commercial invoice or a pro forma invoice.
    The system creates the excise invoice in the background.
    Dependencies
    If you want to make use of this function, you must also define the default plant, excise group, and series groups in Customizing for Excise Duty, by choosing Business Transactions -> Outgoing Excise Invoices -> Maintain Default Excise Groups and Series Groups
    SPRO>Logistics General>Tax on Goods Movement>India>Basic Settings-->Maintain Excise Groups.
    Under the Outgoing Excise invoice tab there is a check box (Excise invoice during billing)
    Regards,
    Saju.S

  • Print preview invoice issue for a parcular invoice in vf03

    Hi,
    I am facing an issue with the print preview invoice. I have 2 billing document nos., for billing document 3117101008 when I go to "Billing Document"->"Issue to output"-> and click on "print preview" I get an output, but for the other billing document 3117101007 when I click on "Print preview" nothing happens, it just keeps on loading and everything gets hanged.
    Do I need to do any modifications in my custom include "YV0023INV_PRINT_F01" or is there anything linked with the header details table 'IT_HU_HEAD'.
    Please advise, appreciate your efforts.
    Thanks

    Hello Bawneet,
    Are you facing this issue only to this billing document ?
    Did you check the same for 1008 billing document ? First try to open 1007 and then next open 1008 document, here please check are you facing the same issue like screen keeps on loading issue.
    Please check this and come back with your issues.
    Thanks & Regards,
    Lakshmi S

  • Xml report to print AR invoices to multiple companies

    Hi,
    can anyone help me to work on this issue, I need to Develop one XMLP report that prints AR invoices for multiple companies, and multiple invoices for each company.
    It will be thankful, if anyone help me to come out of this issue. I need it urgently
    Thanks

    Hi
    Are you working in EBusiness Suite or another ERP app? IF so then there are already invoice reports built out of the box that you can use quite quickly.
    If not then you need to find out from your users what they want to see on the invoice, then map that to the columns in tables and then write the query to extract the data.
    Tim

  • How to print the invoice(Billing document) using program RSNAST00

    Hi,
      I want to print the invoice using the program RSNAST00,
    but when i fill in selection screen with the following details,
    Output Application : V3
    Object Key : Billing Document Number
    Output Type : ZPFM
    Transmission Medium : 1
    But it is throwing an Information Message "0 outputs were processed in total (0 successfully,0 incorrectly)
    So please guide me, what are settings i have to do and what abap code i have to write to overcome this error.
    Regards,
    Shasiraj.C

    Hi,
      As you told I am using the function module RV_MESSAGE_DIALOG in my program when I directly execute my program its not printing invoice,but when i keep the break point and execute a pop up comes in which i click on the PRINT button that time it is printing the invoice.
    But I dont want to click on Print button manually, my code should automatically take care of printing also.
    Can guide me in this issue.
    Regards,
    Shasiraj.C

  • Items of invoice include services from previous invoice of a current case..

    Hi colleagues,
    I have one problem, I've never faced with that one before.  I have a case and one invoice for the case, for example later I want to add 2 new services and create a new one invoice for these two services - in this case a system creates invoice with these two new services and with all services from previous invoice for the same case with cost 0.
    Could you please tell me what might be a reason for this? Has anybody faced with this one?
    Thank you very much for your time.
    Kind regards,
    Alexander.

    Hi Alexander
    Sorry for my late response, I've been quite busy lately.
    Wel, happened to me once in a customer, and I never found the cause of the error. Anyway, I could solve it.
    In my case, if you see the field VBRP-ISHBELNRF and VBRP-ISHPOSNRF of the already billed service, points to a NLKZ record that does not exists in NKSP. (or something like that, I dont't remember very well, but truly, there is an inconsistency between what is stored in VBRP-ISHBELNRF and VBRP-ISHPOSNRF and what you see in the insurance verifcation tables)
    It seams that, if you use the Standard IV and then the Extended IV, somehow the NLKZ records are grooped into one position of NKSP.
    The solution I've found is to filter those already fully billed services before they are processed.
    To do so you must enhance the form CHECK_SELECT_SERVICES_xx of the include LN090FXX (XX is the country version, depending on the country version your are using another form could be called)
    F p_nfal-abrkz IS NOT INITIAL.
    SELECT SINGLE * into lv_zihacase FROM zihacase
       WHERE einri = p_nfal-einri
         AND falnr = p_nfal-falnr.
    IF sy-subrc = 0.
      lt_nlei = p_nlei[].
      CLEAR lt_rnabi1.
      REFRESH lt_rnabi1.
      LOOP AT lt_nlei ASSIGNING .
    Esta función estándar analiza si la prestación ha sido facturada. Tiene en cuenta anulaciones
        CALL FUNCTION 'ISH_CHECK_ABGERECHNET'
          EXPORTING
            einri               = p_nfal-einri
            falnr               = p_nfal-falnr
            lnrls               = -lnrls
            zeitr               = 'X'
          I_NLEI              =
           DETAILED            = 'X'
          READ_PER_CASE       = 'X'
            read_buffer         = 'X'
          EXACT_ABDAT         = ' '
         IMPORTING
            lei_abger           = lv_abger
         TABLES
            e_rnabi1            = lt_rnabi1
        CHANGING
          HIGH_ABDAT          =
        EXCEPTIONS
          NO_EINRI            = 1
          NO_FALNR            = 2
          NO_LNRLS            = 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.
    Si el campo LV_ABGER es inicial, quiere decir que no ha sido facturada
        CHECK lv_abger IS NOT INITIAL.
        lv_abmen_p = 0.
        lv_vproz   = 0.
        LOOP AT lt_rnabi1 ASSIGNING -vproz.
        ENDLOOP.
    Si hay multicobertura por importe, la cantidad del campo LV_ABMEN_P tiene que sumar 1
    Si hay multicobertura por porcentaje, el campo LV_VPROZ debe ser 100
    Si se da alguna de estas condiciones, quiere decir que la prestación fue facturada.
    se mantiene el >= ya que es posible que, por inconsistncias, las prestacions hayan sido facturadas varias veces.
        IF lv_abmen_p >= 1 OR lv_vproz >= 100.
          DELETE TABLE  p_nlei FROM .
        ENDIF.
      ENDLOOP.
    ENDIF.
    ENDIF.
    I hope it helps.
    With best regards
    Matías

  • Duplex printing of invoice list in smartform

    Hi,
    I am new to smartforms and I have to handle duplex printing.  I need information like how to give the page sequence for duplex printing.
    I have 2 pages, page 1 prints the header list of the invoice. Page 2 prints the invoice list and has the main window, hence if the data in the 2nd page overflows then the invoice list will be printed on the 3rd page. In this scenario I have to get terms & conditions printed behind all the 3 pages.
    I created page3 with terms & conditions. This is the way I gave:
    PAGE1 - Print mode: D; Next page: Page3
    PAGE3 - Print mode: ' '; Next page: Page1
    PAGE2 - Print mode: D; Next page: Page3
    I have a doubt like if the 3rd page is printed with invoice list then will the 3rd page contain the terms & conditions? Please correct me if I am doing wrong.
    Thanks & Regards,
    Kate.

    Hi
    It depends on where you've placed those data, if they are in the bottom of the main, yes you're right: they'll be printed only in the last page.
    If they're are in another window, they are printed in every page (where the window is defined).
    Max

  • Problem in Printing Multiple Invoice data

    Hi,
    My re quirement goes like this...
    My SMARTFORM receives 2 internal tables :
    1. Header data for all Invoices
    2.Item data for all invoices.
    Now I need to print each invoice in a new Page.
    I have done like this.
    First I am reading the header table with Index. After that I am incrementing the Index number.
    v_index = v_index + 1.
    READ TABLE HEADER index v_index.
    So, first time the fist invoice will be processed and Its item data will be printed in the main window.
    In the MAIN WINDOW after Item Table, i kept one COMMAND as Go TO NEW PAGE.
    So, that its starts processing the page again. and Next invoice will be read.
    Its working fine and Printing all the header data and footer data respective to that Invoice.
    But, its not displaying that data which is there in MAIN window. Its displaying MAIN window as EMPTY.
    I have seen in the debugging, when the NEW PAGE command is triggered, its processing all the secondory windows and PROGRAM LINES under that. But, it is not going into MAIN window Program Lines.
    Please let me know, how can I solve My problem.
    Thanks,
    Sandeep

    HI,
    You can give a page break after every new header invoice. using a command window just assign the first value of the table to a local variable when it is passing into the loop and whenever the value changes, GOTO newpage.
    Check the wiki,
    [Pagebreak in smartforms|https://wiki.sdn.sap.com/wiki/display/ABAP/PageBreakin+SMARTFORMS]
    Regards
    Sarves

Maybe you are looking for

  • Re: [iPlanet-JATO] from a non jato application to jato application

    Without getting into the details, the session id is passed around in a cookie, but once you leave your JATO app "sandbox", you no longer have access to the same session. This is not a JATO limitation, but a J2EE spec constraint. The war file creates

  • Purchase order price and Invoice price is different

    Hi Experts, We have scenario like                                                 EUR    Exchange rage           Soudhi currency PO  on     25.05.2008            -- 342000 * 5.91620            =  2023340.4 GR  on     26.10.2008            -- 342000 *

  • I'm really worried

    I had tried to put more music than can fit on my iPod, on my iTunes, and a window popped up that said that it was going to make a new folder of my selected songs. I was downloading some music at the time, and I put it on my iPod, and accidentally era

  • Newbie question. Trying to set up connection using OLEDB with C++

    I have been able to create a C#.Net program using OLEDB to connect to my Oracle server. C++ is a different beast! I can't seem to get any traction. What files should I include? What syntax do I use, things of that nature. I've been looking for code e

  • 3D tumble not really 3D

    Just learning AE, I do stereoscopic imaging so the z axis is a huge deal for me! BUT I applied a Movement Transition to a layer- the "3D Tumble" effect, but it looks to be NOT 3D at all, some kind of simulation whose z-space remains unchanged. Is thi