Query with SQL-SP gives error, if not used for few days

Hi All,
I have observed that if we do not use some of queries (which usage SQL SPs) for few days, then it stops working.
But when we go in SQL and execute the SP, the query in SAP starts working, without making any change either in query or the SQL-SP.
Can anybody throw light on this ? I guess it has some connection with SQL-SP behaviour.
Thanking you in advance ,
Samir Gandhi
Edited by: Rui Pereira on May 1, 2009 1:28 PM

Hi Gordon,
Please note the function of the SP is to bring selected data from tables, for example to bring Purchase details (I have copy pasted the SP at bottom of this message).
These are not SP_notif...
These SPs are called from the SBO query.
Once we execute the SP in SQL, then it starts working with SBO also.
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO
ALTER Procedure [dbo].[pGetPurchaseRegister]
     @StartDate datetime,
     @EndDate  datetime
as
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[tmpPurchaseReg1]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
     drop table tmpPurchaseReg1
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[tmpPurchaseReg2]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
     drop table tmpPurchaseReg2
SELECT T1.LineNum,T0.DocNum AS 'Document Number', T0.DocDate AS 'Posting Date', T0.CardCode AS 'Vendor Code',
       T0.CardName AS 'Vendor Name', T0.NumAtCard as 'Vendor Ref. No', T0.VatSum AS 'Total Tax', T0.DocTotal AS 'Document Total' ,
       T1.AcctCode AS 'Account Code',T1.LineTotal AS 'Basic Amount', T1.ItemCode AS 'Item No.', T1.Dscription AS 'Item/Service Description',
       T2.SuppCatNum, T1.INMPrice AS 'Item Cost', T1.Quantity AS 'Quantity',T3.ItmsGrpNam AS'ItemGroup'
into tmpPurchaseReg1
FROM  [dbo].[OPCH] T0
      INNER  JOIN [dbo].[PCH1] T1  ON  T1.DocEntry = T0.DocEntry
      INNER  JOIN [dbo].[OITM] T2  ON  T1.ItemCode = T2.ItemCode
      INNER  JOIN [dbo].[OITB] T3  ON  T2.ItmsGrpCod = T3.ItmsGrpCod
      --WHERE T0.DocDate >= CONVERT(DATETIME, [%0], 112)   AND  T0.DocDate <= CONVERT(DATETIME, [%1], 112)  
     WHERE T0.DocDate >=@StartDate  AND  T0.DocDate <=@EndDate
ORDER BY T0.DocNum
select  * into tmpPurchaseReg2 from tmpPurchaseReg1
declare @Total int
declare @TmpCardCode varchar(200)
declare @DocNum int
declare  PurchseRegister_Cursor cursor LOCAL for
     select  [Document Number] from tmpPurchaseReg1 group by [Document Number] having count([Document Number]) > 1 order by [Document Number]
open PurchseRegister_Cursor
                        fetch next from PurchseRegister_Cursor into @DocNum
                        while @@fetch_status = 0
                        begin
                                    begin
                            drop table tmpPurchaseRegTemp
                             select top 1 * into tmpPurchaseRegTemp from tmpPurchaseReg2 where [Document Number] = @DocNum 
                         select @TmpCardCode =[LineNum]  from tmpPurchaseRegTemp     
                         update tmpPurchaseReg2 set [Vendor Name] = '',[Total Tax] = 0,[Document Total] = 0
                                               where  [Document Number] = @DocNum  and [LineNum] <> @TmpCardCode
                                    end
                                   fetch next from PurchseRegister_Cursor into @DocNum   
                        end
close PurchseRegister_Cursor
deallocate PurchseRegister_Cursor
BR
Samir Gandhi

Similar Messages

  • ABAP Program gives error after running  successfully for few days / months

    I have a problem that sometimes my programs start giving errors or does not run at all after successfully running for few days / months.
    But, when I copy the same program with a different name (without any changes ) it starts running again.
    Yesterday I had another problem. I was sending a request to be transported to Production Client, and the request was not getting transported. But when I changed just the name of the program, It was transported to Production Client.
    I can't understand where the problem lies and what happens to the programs after running successfully for few days. All I have to do is just copy that programm into another name and it starts running.
    Can anyone help me?
    Regards,
    SK Daniel

    about the transport thing..i had the same problem few months back the reason was,  i included a table which is having different package  from my program..so wot im thinking is when you creating a different program u might be assigning different package to this new program  and this package is same as all the tables included in your program...
    regards

  • Stopped downloading Podcasts 'cos not listened for few days

    Why does I-Tunes stop downloading my Podcasts when I've not listened to them for a few days? How do I turn this annoying function OFF?

    It's an option the Podcast producer has chosen to help save them money on downloads that are not listened to. Although Apple provide the function, the choice to set it is down to the Podcaster, not Apple.
    This is not correct: it's inherent in iTunes, see this page:
    http://support.apple.com/kb/TA23353
    which states:
    You've subscribed to a podcast but have more than five unplayed episodes. iTunes will stop automatically downloading newer episodes. You may get the following message:
    iTunes has stopped updating this podcast because you have not listened to any episodes recently. Would you like to resume updating this podcast?
    You can click Yes to continue downloading additional episodes. Or you can just listen to any part of any episode and a new episode will download at the next update.
    There is an AppleScript available which will apparently deal with this (I've not tried it):
    http://dougscripts.com/itunes/scripts/ss.php?sp=updateexpiredpodcasts

  • Search function not working for few days ??

    I try to search for object that I have searched before and got results.
    now I don't get any result on any search query I give. yesterday I thought , OK I will wait for tomorrow then it will be resolved. but now it's still not working ?
    for instance search on CL_SALV_TABLE is giving no results ?
    am I the only one experiencing this problem or is it community wide ?
    kind regards
    arthur

    Hi Arthur,
    we are aware of the current search problem and our development team is working on it. In future please report such bugs to [email protected]
    Regards,
    Folkert

  • Unplug if not using for several days?

    If I am going out of town for several days, I always turn off my mac. Would it be a good idea to unplug it too? I never have before, but I was thinking today that that tangle of wires plugged into the surge protector seems like a waste of energy.
    Advice appreciated.
    Thanks very much in advance.

    Thank you all so much for your advice. Sorry to be so long in saying 'thanks', I was out of town. I decided against unplugging the computer. The storm chances are fairly low, and it would be awful to run down the memory battery, as the closest Apple store is over an hour away in Austin. Thank you all again for your help.
    Regards,
    Jane

  • HP B210a goes into a sleep mode if not used for several hours,

    Running my B210a eprinter in windows vista. The printer goes into a sleep mode if not used for several hours.  The power button is slowly flashing dim then bright, and I need to manually touch the printer's screen to enable it to print. If printer not used for several days, the only way I can make it work is to unplug and plug. Any suggestions or help appreciated.  J Rice

    What OS?  Wired or wireless connection?
    Say thanks by clicking the Kudos Thumbs Up to the right in the post.
    If my post resolved your problem, please mark it as an Accepted Solution ...
    I worked for HP but now I'm retired!

  • My code not give error nut not give pdf report output

    hi master
    sir see my code not give error nut not give pdf report output
    String reportSource = "./WEB-INF/reports/mfa.jasper";
    String reportDest = "./reports/mfa1.html";
    Connection conn = null ;
    Statement msqlStatement = null ;
    ResultSet mrs = null ;
    Connection mconn = null ;
    ExternalContext econtext = getExternalContext();
    InputStream stream = econtext.getResourceAsStream(reportSource);
    if (stream == null) {
    throw new IllegalArgumentException("Unknown report name '" + reportSource
    + "' requested");
    try {
    String mfat = ac_categoryDataProvider.getCachedRowSet().getDataSourceName();
    javax.naming.Context mctx = new javax.naming.InitialContext() ;
    DataSource mds = (DataSource)mctx.lookup(mfat);
    Connection mcon= mds.getConnection();
    mcon.setAutoCommit(false) ;
    JasperPrint jasperPrint = null;
    //getSessionBean1().getTripRowSet(),
    //getSessionBean1().getAc_categoryRowSet(), mfat getSessionBean1().getAc_categoryRowSet()
    jasperPrint = JasperFillManager.fillReport(stream, null,mcon);
    JRExporter exporter = null;
    HttpServletResponse response = (HttpServletResponse)econtext.getResponse();
    FacesContext fcontext = FacesContext.getCurrentInstance();
    exporter = new JRPdfExporter();
    exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
    exporter.setParameter(JRExporterParameter.OUTPUT_STREAM,
    response.getOutputStream());
    exporter.exportReport();
    fcontext.responseComplete();
    } catch (Exception ex) {
    log(" Error Description" , ex);
    error("Error counting rows: " + ex.getMessage() );
    error("Error counting rows: " + ex );
    please give me idea
    thank's
    aamir

    Thanks Sven.
    The query works but the other way. The output is for all the targets, not for the respective target which we select from :p1_target.
    select target_name,target_type, column_label,
    warning_threshold,critical_threshold,occurrence_count
    from sysman.MGMT$TARGET_METRIC_SETTINGS@crmodem
    where target_name in (select MEMBER_TARGET_NAME from MGMT$TARGET_FLAT_MEMBERS@crmodem
    where upper(AGGREGATE_TARGET_NAME) like '%X' || :P1_TARGET || '%')
    Thanks again.

  • Problem accessing Infosets using Query with SQL

    Hi,
    I have Lumira desktop version 1.18.0.
    Using the Query with SQL connection, I successfully connected to SAP R/3 6. I was able to view the User Groups under CATALOG_VIEW, but it seems I cannot go beyong this point and select an Infoset. When I click on an Infoset I expect the Query pane to be populated with the SQL statement but nothing happens.
    I attached a screenshot for clarification
    Thanks
    Dany

    Hi Dany,
    A suggestion for you would be to use another client tool & check if the behavior is the same. I suggest that you use Information Design Tool (from BOE 4.1), create a connection to your ERP, then a data foundation on top of that connection and check if the behavior is the same. This way we can isolate if the problem is caused by the client tool or by the backend.
    My 2 cents
    Antoine

  • - 0 fatal error(s), 3 error(s)     ----------- Payload: Adobe Photoshop Lightroom 5 5.6.0.0 Adobe_Lightroom_x64.msi_5.6 -----------  ERROR: Key not valid for use in specified state.    ERROR: Install MSI payload failed with error: 1603 - Fatal error durin

    I keep getting this error code when trying to download         
    - 0 fatal error(s), 3 error(s) ----------- Payload: Adobe Photoshop Lightroom 5 5.6.0.0 Adobe_Lightroom_x64.msi_5.6 ----------- ERROR: Key not valid for use in specified state. ERROR: Install MSI payload failed with error: 1603 - Fatal error during installation. MSI Error message: Key not valid for use in specified state. ERROR: Third party payload installer Adobe_Lightroom_x64.msi failed with exit code: 1603

    Generally this error happens because of an encrypted folder or insufficient permissions on that folder: http://support.microsoft.com/kb/834484 (MS Explanation)
    Adobe has a page here: Error 1603: A fatal error occurred during installation

  • HT4059 want to order text book on iPad 3 with ibook app  get error of not enough memory.   how do i get library full of books

    hello
    want to order text book on iPad 3 with ibook app  get error of not enough memory

    There are some threads on the use of Calibre with the iPad on their forums. This thread might be of help:
    http://www.mobileread.com/forums/showthread.php?t=79093&highlight=Ipad
    and if not searching that forum for "iPad" may turn up additional suggestions.
    Good luck.

  • SQL*Loader-930: Error parsing insert statement for column

    we upload data on daily basis in application throug apps user and these table are invloved
    1. DEV_RA_INTERFACE_LINES_ALL(owner is a apps)
    2.RA_INTERFACE_LINES_ALL(owner is a AR)
    we do steps
    1 delete record from DEV_RA_INTERFACE_LINES_ALL table
    2 delete record from      RA_INTERFACE_LINES_ALL table
    3 load data using sql loader with apps user
    4 insert in RA_INTERFACE_LINES_ALL table
    we want to change user i mean these step do dataupload user not apps
    we give the proper rights to dataupload like select,delete and insert rights on these table to dataupload user but when i going to load data throug sql loader we receive error
    SQL*Loader-930: Error parsing insert statement for column APPS.DEV_RA_INTERFACE_
    LINES_ALL.ORIG_SYSTEM_BILL_ADDRESS_ID.
    ORA-00904: "F_ORIG_SYSTEM_BILL_ADDR_REF": invalid identifier
    and if i insert data through apps then done.

    make sure that u have no speces left
    between lines.
    give the path of control file path correctly.

  • SQL*Loader-929: Error parsing insert statement for table

    Hi,
    I get the following error with SQL*Loader:
    Table MYTABLE loaded from every logical record.
    Insert option in effect for this table: INSERT
    Column Name Position Len Term Encl Datatype
    IDE FIRST * ; CHARACTER
    SQL string for column : "mysequence.NEXTVAL"
    CSI_NBR 1:10 10 ; CHARACTER
    POLICY_NBR 11:22 12 ; CHARACTER
    CURRENCY_COD 23:25 3 ; CHARACTER
    POLICY_STAT 26:27 2 ; CHARACTER
    PRODUCT_COD 28:35 8 ; CHARACTER
    END_DAT 44:53 10 ; CHARACTER
    FISCAL_COD 83:83 1 ; CHARACTER
    TOT_VAL 92:112 21 ; CHARACTER
    SQL*Loader-929: Error parsing insert statement for table MYTABLE.
    ORA-01031: insufficient privileges
    I am positive that I can SELECT the sequence and INSERT into the table with the user invoking sql*loader.
    Where does that "ORA-01031" come from?
    Regards
    ...

    Options:
    1) you are wrong about privileges OR
    2) you have the privilege only when you connect via SQL*Plus (or whichever other tool you used to test the insert).
    Is it possible that during your test you enabled the role which granted you the INSERT privilege - and that SQL*Loader doesn't do this?
    Can you see the table in this list?
    select *
    from user_tab_privs_recd
    where table_name='MY_TABLE'
    and owner='table owner whoever';
    select *
    from user_role_privs;Any roles where DEFAULT_ROLE is not YES?
    HTH
    Regards Nigel

  • Mac: With my user profile, it is not possible for me to announce me to the Creative Cloud, with a different user profile, it goes without problems.

    With my user profile, it is not possible for me to announce me to the Creative Cloud, with a different user profile, it goes without problems. Creative Cloud Desktop has been uninstalled and reinstalled. There is no error message.

    john beardsworth wrote:
    John Waller wrote:
    However, Adobe will soon introduce Cloud only features into Lightroom CC for which LR6 (perpetual license) owners will have to wait until LR7 (paid upgrade).
    That is possible, John, but it is only speculation on your part. Might, not will.
    kwdaves wrote:
    There is a "Lightroom 6" upgrade available for US $79 if you have a valid license for any of the earlier versions. From what I can tell, the only difference between Lightroom 6 Full, Lightroom 6 Upgrade and LightroomCC is in the license. The download file is the same.
    Other differences - with CC you get LrMobile/LrWeb and they throw in a free copy of Photoshop too.
    Yes, but when I bought my standalone license and clicked on the "Download" button it took me to the LightroomCC page. The downloaded file is named Lightroom 6, but in the CC app the installed program is LightroomCC (2015).

  • Pending Move Transaction ****Error: Status not applicable for this Locator.

    Hi guys,
    Let me know if you have experienced the following error in the pending move tranasctions with Back flush process?
    Message error:
    Status not applicable for this Locator.
    Transaction processor error
    Thanks,

    the receiving with locator works only if there is a valid default locator defined in the system.
    There is no option to enter the Locator manually in the receiving pages of iProcurement.
    Locator and/or serial controlled Items must be received in the Core PO Receipt Form and not in iProcurement.
    Cannot Receive Requisitions For Inventory Items Which Are Locator And/Or Serial Controlled (Doc ID 809408.1)
    Also refer to the below,
    Unable To Receive Inventory Item In iProcurement or Core Apps Receiving Due To Locator Error (Doc ID 819083.1)

  • Error: "can not scan for wireless networks" 1st gen iphone running 3.1.2

    My iphone will no longer scan for wireless networks. I am running an airport network via my imac and the rest of the computers, as well as two iphone 3GS phones can see it, but my 1st Gen iphone now gives me the error "can not scan for wireless networks". I have done the Home + Power button thing, reset the network settings and no help yet.
    Any suggestions?

    OK. There are reports of bad wifi chips, but lets try some more things first.
    I assume your router is set to b/g compatible & not "n" only, correct? The iphone only works on g. Next, try this: Shut down the WiFi, and turn off "Ask to Join Networks". Then turn the iPhone completely off, by holding the top button down until the red slider came up, slid it off, and wait a few moments.
    Turn the phone back on, then turn on the WiFi, and then "Ask to Join Networks".
    See if that helps.

Maybe you are looking for