On-Select & On-fetch ??

Hi Everybody,
Where I can use On-select & on-fetch trigger How they can help Someone.. can somebody give some Example.
Thx in advance
Namrata

Typically you NEVER use on-select or on-fetch. You use these if you are using a special cursor, maybe defined in a package, and open it as a result of an Execute_query statement. Execute_query would cause on-select to run, and in that trigger, you would open the cursor. The on-fetch trigger would run repeatedly, and from there you would use commands like Create_Queried_Record, and then move values into the columns in your data block.
This type of processing is not to be used by any standard forms. It is only used when you want to bypass normal Forms automatic processing. I have only used it twice in many years of Forms programming.

Similar Messages

  • Doubt in Select Option fetch

    Hello Every1,
    I have a select option field for which the input values can be given as in the below example.
    Ex. If the input value is given as 10* as the low value and 100* as the high value, i need to fetch records in this range.Which means it should not only include all values starting with 10 and 100 but also the values between 10 and 100. Please let me know how this can be achieved.
    Best Regards,
    Siva.

    Hi Siva,
    Why dont you have a try by putting % instead of *
    Just its a try...
    Cheers,
    Sampath

  • Select Query Fetching same records multiple time

    Hi ABAPers,
    I have an issue where the select query is fetching the same records more than one time for particular sale order.
    Kindly help to solve the issue.
    Thanks in advance..
    Here is the Select Query:-
    SELECT  VBAK~VKORG VBAK~VTWEG VBAK~VBELN VBAK~KUNNR
                   VBAK~ERDAT VBAK~LIFSK VBKD~INCO1 VBKD~INCO2
                   VBAP~MATNR VBAP~ARKTX VBAP~MATKL VBAK~BSTNK
                   VBAK~BSTDK VBAK~KNUMV VBAP~UEPOS VBAP~POSNR
                   VBAP~KWMENG VBAK~VDATU VBAP~VRKME VBAK~ERNAM VBAK~WAERK
      INTO CORRESPONDING FIELDS OF TABLE IT_PENDING FROM VBAK
      INNER JOIN VBAP ON VBAK~VBELN = VBAP~VBELN
      INNER JOIN VBKD ON VBAK~VBELN = VBKD~VBELN
      WHERE
      VBAK~VBELN IN SO_VBELN AND
      VBAK~ERDAT IN SO_ERDAT AND
      ( AUART EQ 'OR' OR AUART EQ 'ZEO' OR AUART EQ 'TA' OR AUART EQ 'LP' OR AUART EQ 'ZFOC' ) AND
      VKORG IN SO_VKORG AND
      VTWEG IN SO_VTWEG AND
      SPART IN SO_SPART AND
      KUNNR IN SO_KUNNR AND
      MATNR IN SO_MATNR AND
      MATKL IN SO_MATKL AND
      ABGRU EQ '' AND LIFSK <> '35'.
    Edited by: Suhas Saha on Jan 14, 2012 3:42 PM

    Hello Suhale,
    On retrospection, I found the query in my above response STILL HAS ONE ISSUE. When we are making a left outer join on vbkdposnr = vbapposnr we are only fetching vbkdinco1 and vbkdinco2 values where item level entries exist in VBKD which match with vbkdposnr = vbapposnr.
    Actually we should bring inco1 and inco2 from vbkd when a matching entry exists in vbkd where vbkdposnr = vbapposnr and if there is no entry matching vbkdposnr = vbapposnr, then we should fetch inc01 and inco2 from VBKD where posnr = '000000' (i.e., from header).
    This is how SAP behaves when you open an item in VA03 and look at inco1 and inco2. They come from the item if an entry corresponding to that item exists in VBKD otherwise they come from VBKD header record (where vbkd~posnr = '000000')
    We can't use VBKD in the joins and still be able to do the above. So we need to fetch inco1, inco2 from VBKD separately like below.
    FIELD-SYMBOLS: <fs_pending> LIKE LINE OF it_pending.
    SELECT vbak~vkorg vbak~vtweg vbak~vbeln vbak~kunnr
           vbak~erdat vbak~lifsk "vbkd~inco1 vbkd~inco2
           vbap~matnr vbap~arktx vbap~matkl vbak~bstnk
           vbak~bstdk vbak~knumv vbap~uepos vbap~posnr
           vbap~kwmeng vbak~vdatu vbap~vrkme vbak~ernam vbak~waerk
      INTO CORRESPONDING FIELDS OF TABLE it_pending
        FROM vbak INNER JOIN vbap
          ON vbak~vbeln = vbap~vbeln
            WHERE vbak~vbeln IN so_vbeln AND
                  vbak~erdat IN so_erdat AND
                ( vbak~auart EQ 'OR' OR vbak~auart EQ 'ZEO' OR
                  vbak~auart EQ 'TA' OR vbak~auart EQ 'LP' OR
                  vbak~auart EQ 'ZFOC' ) AND
                  vbak~vkorg IN so_vkorg AND
                  vbak~vtweg IN so_vtweg AND
                  vbak~spart IN so_spart AND
                  vbak~kunnr IN so_kunnr AND
                  vbap~matnr IN so_matnr AND
                  vbap~matkl IN so_matkl AND
                  vbap~abgru EQ '' AND
                  vbak~lifsk NE '35'.
      LOOP AT it_pending ASSIGNING <fs_pending>.
        SELECT SINGLE inco1 inco2
          FROM vbkd
            INTO (<fs_pending>-inco1,<fs_pending>-inco2)
              WHERE vbkd~vbeln = <fs_pending>-vbeln AND
                    vbkd~posnr = <fs_pending>-posnr.
        IF sy-subrc NE 0.
          SELECT SINGLE inco1 inco2
            FROM vbkd
              INTO (<fs_pending>-inco1, <fs_pending>-inco2)
                WHERE vbkd~vbeln = <fs_pending>-vbeln AND
                      vbkd~posnr = '000000'.
        ENDIF.
      ENDLOOP.
    Best regards,
    Vishnu Tallapragada.

  • Problem with Select query fetching records.

    Hi All,
    SELECT bukrs belnr gjahr bldat cpudt aedat cputm usnam xblnr bktxt waers
                       FROM bkpf INTO TABLE bkpf_tbl
                       WHERE bukrs IN s_bukrs AND blart IN ('RE' , 'ZL')
    AND ( ( cpudt > prv_date )
                       OR    ( cpudt = prv_date AND cputm >= prv_time ) )
                       OR  ( ( aedat > prv_date )
                       OR    ( aedat = prv_date AND cputm >= prv_time ) )
                       AND gjahr IN s_gjahr
                       AND monat IN s_monat
                       AND belnr IN s_belnr
    My prv_date is 05/04/2010 while debugging.
    CPUDT (Accounting Document Entry Date) in BKPF doesnu2019t have any entries.
    But AEDAT (Date of the Last Document Change by Transaction) is having a single entry on date 05/04/2010.
    While this query is showing number of records around 200000. I feel something is wrong with the AND/OR statements.
    Please suggest some ideas?

    Hi Mishra,
    I dont know the excaly wht u r passing in the prv_date and cpudt . But one thing i notice that blart part.
    SELECT bukrs belnr gjahr bldat cpudt aedat cputm usnam xblnr bktxt waers
                       FROM bkpf INTO TABLE bkpf_tbl
                       WHERE bukrs IN s_bukrs AND blart eq  'RE' or  blart eq 'ZL'
      AND ( ( cpudt > prv_date )
                       OR    ( cpudt = prv_date AND cputm >= prv_time ) )
                       OR  ( ( aedat > prv_date )
                       OR    ( aedat = prv_date AND cputm >= prv_time ) )
                       AND gjahr IN s_gjahr
                       AND monat IN s_monat
                       AND belnr IN s_belnr.
    With Regards,
    Sumodh.P

  • Dynamic selection screen fetching the value from table fields

    hi gurus,
    i have one table say ztable...and i should create a dynamic selection screen which should populate the selection screen by the table field names.
    example..if i have 3 fields im my table..my selection screen should have three selection option fields..and in future if i add one more field in my table it should automatically create another slection-option in selection screen..
    thanks
    Sudheer

    Do you mean like SE16 works. If so, you should notice that if you  amend the selection fields, the screen program is actually re-generated.
    That is what is happening. A program is being created and re-generated.
    To create a dynamic selection screen in a single program is not possible ( I may be wrong ). If it is possible, then you would have problems in defining selection screen field names and using them.

  • Select * first fetches 5th row... Why?

    Dear Experts,
    I developed a z-table, with fields
    rno(6) type n,
    name(20) type c
    and then created ten entries from rno 1 to 10.
    and a z-report which uses this table
    select * from ztable.
    first it displays 5th row and then 1 to 4 and then 6 to 10.
    Can help me why it displays 5th row first?
    Thanks in Adance

    SAP Help
    If you do not use the ORDER BY clause, the sequence of the lines in the selection is indeterminate, and can vary each time the SELECT statement is executed.
    You can sort the selection by any column (not necessarily those of the primary key), and specify the columns either statically or dynamically.

  • Performance issue with select query and for all entries.

    hi,
    i have a report to be performance tuned.
    the database table has around 20 million entries and 25 fields.
    so, the report fetches the distinct values of two fields using one select query.
    so, the first select query fetches around 150 entries from the table for 2 fields.
    then it applies some logic and eliminates some entries and makes entries around 80-90...
    and then it again applies the select query on the same table using for all entries applied on the internal table with 80-90 entries...
    in short,
    it accesses the same database table twice.
    so, i tried to get the database table in internal table and apply the logic on internal table and delete the unwanted entries.. but it gave me memory dump, and it wont take that huge amount of data into abap memory...
    is around 80-90 entries too much for using "for all entries"?
    the logic that is applied to eliminate the entries from internal table is too long, and hence cannot be converted into where clause to convert it into single select..
    i really cant find the way out...
    please help.

    chinmay kulkarni wrote:Chinmay,
    Even though you tried to ask the question with detailed explanation, unfortunately it is still not clear.
    It is perfectly fine to access the same database twice. If that is working for you, I don't think there is any need to change the logic. As Rob mentioned, 80 or 8000 records is not a problem in "for all entries" clause.
    >
    > so, i tried to get the database table in internal table and apply the logic on internal table and delete the unwanted entries.. but it gave me memory dump, and it wont take that huge amount of data into abap memory...
    >
    It is not clear what you tried to do here. Did you try to bring all 20 million records into an internal table? That will certainly cause the program to short dump with memory shortage.
    > the logic that is applied to eliminate the entries from internal table is too long, and hence cannot be converted into where clause to convert it into single select..
    >
    That is fine. Actually, it is better (performance wise) to do much of the work in ABAP than writing a complex WHERE clause that might bog down the database.

  • SQL Query fails with Fetch error

    We are running JDE ERP 9.0 and have a report that gets this error
    “JDB3300020 - Fetch not allowed. Prior successful Select operation required for this request.”
    I’ve been troubleshooting this problem for months, and I am no closer to the root cause and need some help. I’ve engaged Microsoft support, we collected a trace but could not find anything that pointed to the cause.
    Execution details:
    Report runs successfully after database server is rebooted. Otherwise we have to keep rerunning as many as 15 times to get a successful run. When we discovered that report would run after the server reboot, we decided
    to only restart SQL, to see if it was Query plan related but it still failed. How can we determine why the reboot is making a difference?
    Any ideas/help is welcome.

    Using Profiler to capture what JD Edwards sends to SQL Server seems like a good idea. And include the events Error:Exception and Error:UserMessage to see if that captures anything.
    I googled on the message, and I found
    http://www.jdelist.com/ubb/showflat.php?Cat=&Number=111077&page=0&view=collapsed&sb=5&o=
    where the cause was that different indexes were used for SELECT and FETCH. (Whatever that means; I was not able to grasp it.)
    Erland Sommarskog, SQL Server MVP, [email protected]

  • RE:HR-ABAP selection screen problem.

    hi,
    hi friends iam facing one problem regarding hr ABAP  selection screen ,in my program iam using PNP LDB for bonus details report
    i have using selection screen declaration present  for single selection.
    SELECTION-SCREEN BEGIN OF BLOCK B3 WITH FRAME TITLE TEXT-006.        
    SELECT-OPTIONS: S_ABKRS FOR P0001-ABKRS NO INTERVALS NO-EXTENSION,
                    S_WERKS FOR P0001-WERKS NO INTERVALS NO-EXTENSION,
                    S_BTRTL FOR P0001-BTRTL NO INTERVALS NO-EXTENSION,
                    S_PERSG FOR P0001-PERSG NO INTERVALS NO-EXTENSION,
                    S_PERSK FOR P0001-PERSK NO INTERVALS NO-EXTENSION.   
    SELECTION-SCREEN END OF BLOCK B3.
    based on this selection iam fetching the information from infotypes using  macros.
    now my requirement is iam fetch the information for multiple  selections means like payroll areas z1,z2 and z3 payroll informations
    should be  fetching once.  pls any body knows solution please give me reply.
    thanks & regards,
    mgrao.

    You should be using a selection view (HR Report Category in the programs attributes) to filter results from the LDB.
    Why is this in the objects forum?

  • RE:pnp LDB selection screen problem

    hi,
    hi friends iam facing one problem regarding hr ABAP selection screen ,in my program iam using PNP LDB for bonus details report
    i have using selection screen declaration present for single selection.
    SELECTION-SCREEN BEGIN OF BLOCK B3 WITH FRAME TITLE TEXT-006.
    SELECT-OPTIONS: S_ABKRS FOR P0001-ABKRS NO INTERVALS NO-EXTENSION,
    S_WERKS FOR P0001-WERKS NO INTERVALS NO-EXTENSION,
    S_BTRTL FOR P0001-BTRTL NO INTERVALS NO-EXTENSION,
    S_PERSG FOR P0001-PERSG NO INTERVALS NO-EXTENSION,
    S_PERSK FOR P0001-PERSK NO INTERVALS NO-EXTENSION.
    SELECTION-SCREEN END OF BLOCK B3.
    based on this selection iam fetching the information from infotypes using macros.
    now my requirement is iam fetch the information for multiple selections means like payroll areas z1,z2 and z3 payroll informations
    should be fetching once. pls any body knows solution please give me reply.
    thanks & regards,
    mgrao.

    hi jain thanks for your reply, iam already created report category and assigned my report. here iam giving my report selection
    declerations fully   below.
          S E L E C T I O N       S C R E E N                           *
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001. " DECLEARED REPORT CODE LEVEL
    SELECT-OPTIONS: S_DATE   FOR SY-DATUM NO-EXTENSION.    "Bonus for Financial Year
    PARAMETERS:     P_BDATE  TYPE SY-DATUM OBLIGATORY,     "Bous payed as on
                    P_WKDAYS TYPE CHAR6.                                            "No.of Working Days     
    SELECTION-SCREEN END OF BLOCK B1.
    *SELECTION-SCREEN BEGIN OF BLOCK B3 WITH FRAME TITLE TEXT-006.    " COMMENTED report level TAKING FROM LDB PNP    
    *SELECT-OPTIONS: S_ABKRS FOR P0001-ABKRS NO INTERVALS NO-EXTENSION,     "  Payroll area
                   S_WERKS FOR P0001-WERKS NO INTERVALS NO-EXTENSION,                       Personnel area   
                   S_BTRTL FOR P0001-BTRTL NO INTERVALS NO-EXTENSION,                          Personnel  sub area        
                   S_PERSG FOR P0001-PERSG NO INTERVALS NO-EXTENSION,
                   S_PERSK FOR P0001-PERSK NO INTERVALS NO-EXTENSION.   
    *SELECTION-SCREEN END OF BLOCK B3.
    SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-002. "REPORT CODE LEVEL SELECTION
    PARAMETERS: P_FORMCP TYPE PIN_RATE, " char6,    "Form C %    
                P_FORMEP TYPE PIN_RATE, " char6,                 "Exgratia %
                P_FORMBP TYPE PIN_RATE. " char6 .               "Bonus %   
    SELECTION-SCREEN END OF BLOCK B2.
    SELECTION-SCREEN BEGIN OF BLOCK B4 WITH FRAME TITLE TEXT-004.
    PARAMETERS: L_REPORT TYPE ZHRD_FORMC AS LISTBOX VISIBLE LENGTH 40 OBLIGATORY . Report for list box   1 form c
    SELECTION-SCREEN END OF BLOCK B4.                                                                                2 exgratia
    the above selection is iam used first, now iam commented BLOCK B3 SELECTION  PARAMETERS  and taking the parameters from REPORT CATEGORY  ASSINGN MENT.
    MY PROBLEM  is if i select one payroll area example z1 it showing all pay roll employees bonus details it is not filter the remaining payroll areas my requirement is what are the payrolls iam  selecting  those pay roll area details only displaying.
    data fetching from  INFOTYPES 0001,0002,0021 AND 9150 FOR BONUS DETAILS and out put is classical report format.
    please kindly give the reply if you knows the solution.
    thanks & regards ,
    mgr.

  • Attempt to fetch logical page (6:78) in database 5 failed.

    Hello every one:
    I am upgrading to SQL 2005 using sql 2000 datafiles in clustered environment.
    I have followd note 799058 hemogenious system copy. However after attaching the database, we are getting the following error message, when running SQL 2005 upgrade tools.
    I ran dbcheck on source database there is no issue, However dbcheck is failing in new database. I tried dbcheck with repais fast and dbcheck with data loss, however both attempts have failed with exact same message.
    I am not sure how to handle this error.
    Please advice.
    executeSQL is called with following parameters:
    Server: cacgcbcrr518
    Login: integrated security
    Resultset will not be copied
    Ignore errors is false
    Append results is false
    select (@@microsoftversion / 65536) / 256
    executeSQL is called with following parameters:
    Server: cacgcbcrr518
    Login: integrated security
    Resultset will not be copied
    Ignore errors is false
    Append results is false
    select count(*) from master..sysdatabases where name = 'R3T'
    executeSQL is called with following parameters:
    Server: cacgcbcrr518
    Login: integrated security
    Resultset will not be copied
    Ignore errors is false
    Append results is false
    select count(*) from R3T..sysusers where name = 'r3t'
    executeSQL is called with following parameters:
    Server: cacgcbcrr518
    Login: integrated security
    Resultset will not be copied
    Ignore errors is false
    Append results is false
    select count(*) from master..sysprocesses where dbid = db_id('R3T') and program_name like 'R3%' and uid = (select uid from R3T..sysusers where name = 'r3t')
    executeSQL is called with following parameters:
    Server: cacgcbcrr518
    Login: integrated security
    Resultset will not be copied
    Ignore errors is false
    Append results is false
    select (@@microsoftversion / 65536) / 256
    executeSQL is called with following parameters:
    Server: cacgcbcrr518
    Login: integrated security
    Resultset will not be copied
    Ignore errors is false
    Append results is false
    DECLARE @n NVARCHAR(4000) DECLARE @ns NVARCHAR(4000) SET @ns = ''
    DECLARE c CURSOR FOR
    select case when serverproperty('Collation') is NULL then '' else convert(sysname, serverproperty('Collation')) end
    union all select case when serverproperty('Edition') is NULL then '' else convert(sysname, serverproperty('Edition')) end
    union all select case when serverproperty('InstanceName') is NULL then '' else convert(sysname, serverproperty('InstanceName')) end
    union all select case when serverproperty('IsClustered') is NULL then '' else convert(sysname, serverproperty('IsClustered')) end
    union all select case when serverproperty('IsFullTextInstalled') is NULL then '' else convert(sysname, serverproperty('IsFullTextInstalled')) end
    union all select case when serverproperty('IsIntegratedSecurityOnly') is NULL then '' else convert(sysname, serverproperty('IsIntegratedSecurityOnly')) end
    union all select case when serverproperty('IsSingleUser') is NULL then '' else convert(sysname, serverproperty('IsSingleUser')) end
    union all select case when serverproperty('IsSyncWithBackup') is NULL then '' else convert(sysname, serverproperty('IsSyncWithBackup')) end
    union all select case when serverproperty('MachineName') is NULL then '' else convert(sysname, serverproperty('MachineName')) end
    union all select case when serverproperty('NumLicenses') is NULL then '' else convert(sysname, serverproperty('NumLicenses')) end
    union all select case when serverproperty('ProcessID') is NULL then '' else convert(sysname, serverproperty('ProcessID')) end
    union all select case when serverproperty('ProductVersion') is NULL then '' else convert(sysname, serverproperty('ProductVersion')) end
    union all select case when serverproperty('ProductLevel') is NULL then '' else convert(sysname, serverproperty('ProductLevel')) end
    union all select case when serverproperty('ServerName') is NULL then '' else convert(sysname, serverproperty('ServerName')) end
    union all select case when serverproperty('Release') is NULL then '' else convert(sysname, serverproperty('Release')) end
    union all select case when serverproperty('Patch') is NULL then '' else convert(sysname, serverproperty('Patch')) end
    union all select case when serverproperty('IsSysAdmin') is NULL then '' else convert(sysname, serverproperty('IsSysAdmin')) end
    OPEN c FETCH NEXT FROM c INTO @n
    WHILE @@FETCH_STATUS = 0
    BEGIN set @ns = @ns + @n + ';' FETCH NEXT FROM c INTO @n END
    CLOSE c DEALLOCATE c select @ns
    executeSQL is called with following parameters:
    Server: cacgcbcrr518
    Login: integrated security
    Resultset will not be copied
    Ignore errors is false
    Append results is false
    select IS_SRVROLEMEMBER('sysadmin')
    executeSQL is called with following parameters:
    Server: cacgcbcrr518
    Login: integrated security
    Resultset will not be copied
    Ignore errors is false
    Append results is false
    select count(*) from master..sysdatabases where name = 'R3T'
    executeSQL is called with following parameters:
    Server: cacgcbcrr518
    Login: integrated security
    Resultset will not be copied
    Ignore errors is false
    Append results is false
    select count(*) from R3T..sysusers where name = 'r3t'
    executeSQL is called with following parameters:
    Server: cacgcbcrr518
    Login: integrated security
    Resultset will not be copied
    Ignore errors is false
    Append results is false
    select count(*) from R3T..sysusers where name = 'r3t'
    executeSQL is called with following parameters:
    Server: cacgcbcrr518
    Login: integrated security
    Resultset will not be copied
    Ignore errors is false
    Append results is false
    use R3T
    declare @info nvarchar(2000)
    declare @cs nvarchar(100)
    declare @tmp nvarchar(200)
    declare @rel nvarchar(100)
    declare @patch nvarchar(100)
    declare @sql nvarchar(2000)
    declare schema_cursor cursor for
    select name
    from dbo.sysusers
    where islogin = '1'
    open schema_cursor
    select @info = ''
    fetch next from schema_cursor into @cs
    while @@fetch_status = 0
    begin
    select @info = @info + @cs
    select @info = @info + ':'
    select @info = @info + cast(count(*) as varchar(20)) from sysobjects where uid = user_id(@cs) and name not in ('dtproperties')
    select @info = @info + ':'
    select @info = @info + cast(count(*) as varchar(20)) from sysobjects where uid = user_id(@cs) and type = 'U' and name not in ('dtproperties')
    if exists(select * from sysobjects where name = 'CVERS' and uid = user_id(@cs) and type = 'U')
    begin
    select @info = @info + ':1'
    select @sql = 'select @rel = RELEASE, @patch = EXTRELEASE from ' + @cs + '.CVERS where COMPONENT = ''SAP_BASIS'''
    exec sp_executesql @sql, N'@rel nvarchar(100) output, @patch nvarchar(100) output', @rel output, @patch output
    select @info = @info + ':'
    select @info = @info + @rel
    select @info = @info + ':'
    select @info = @info + @patch
    end
    else select @info = @info + ':0'
    if exists(select * from sysobjects where name = 'BC_CVERS' and uid = user_id(@cs) and type = 'U')
    begin
    select @info = @info + ':1'
    end
    else select @info = @info + ':0'
    select @info = @info + ';'
    fetch next from schema_cursor into @cs
    end
    close schema_cursor
    deallocate schema_cursor
    select @info
    executeSQL is called with following parameters:
    Server: cacgcbcrr518
    Login: integrated security
    Resultset will not be copied
    Ignore errors is false
    Append results is false
    use [R3T] select count(*) from sysobjects where name like 'Y%' and type='P' and uid=user_id('r3t')
    executeSQL is called with following parameters:
    Server: cacgcbcrr518
    Login: integrated security
    Resultset will not be copied
    Ignore errors is false
    Append results is false
    select count(*) from R3T..sysusers where name = 'SAPR3TDB'
    executeSQL is called with following parameters:
    Server: cacgcbcrr518
    Login: integrated security
    Resultset will not be copied
    Ignore errors is false
    Append results is false
    DECLARE @n NVARCHAR(4000) DECLARE @ns NVARCHAR(4000) SET @ns = ''
    DECLARE c CURSOR FOR
    select case when serverproperty('Collation') is NULL then '' else convert(sysname, serverproperty('Collation')) end
    union all select case when serverproperty('Edition') is NULL then '' else convert(sysname, serverproperty('Edition')) end
    union all select case when serverproperty('InstanceName') is NULL then '' else convert(sysname, serverproperty('InstanceName')) end
    union all select case when serverproperty('IsClustered') is NULL then '' else convert(sysname, serverproperty('IsClustered')) end
    union all select case when serverproperty('IsFullTextInstalled') is NULL then '' else convert(sysname, serverproperty('IsFullTextInstalled')) end
    union all select case when serverproperty('IsIntegratedSecurityOnly') is NULL then '' else convert(sysname, serverproperty('IsIntegratedSecurityOnly')) end
    union all select case when serverproperty('IsSingleUser') is NULL then '' else convert(sysname, serverproperty('IsSingleUser')) end
    union all select case when serverproperty('IsSyncWithBackup') is NULL then '' else convert(sysname, serverproperty('IsSyncWithBackup')) end
    union all select case when serverproperty('MachineName') is NULL then '' else convert(sysname, serverproperty('MachineName')) end
    union all select case when serverproperty('NumLicenses') is NULL then '' else convert(sysname, serverproperty('NumLicenses')) end
    union all select case when serverproperty('ProcessID') is NULL then '' else convert(sysname, serverproperty('ProcessID')) end
    union all select case when serverproperty('ProductVersion') is NULL then '' else convert(sysname, serverproperty('ProductVersion')) end
    union all select case when serverproperty('ProductLevel') is NULL then '' else convert(sysname, serverproperty('ProductLevel')) end
    union all select case when serverproperty('ServerName') is NULL then '' else convert(sysname, serverproperty('ServerName')) end
    union all select case when serverproperty('Release') is NULL then '' else convert(sysname, serverproperty('Release')) end
    union all select case when serverproperty('Patch') is NULL then '' else convert(sysname, serverproperty('Patch')) end
    union all select case when serverproperty('IsSysAdmin') is NULL then '' else convert(sysname, serverproperty('IsSysAdmin')) end
    OPEN c FETCH NEXT FROM c INTO @n
    WHILE @@FETCH_STATUS = 0
    BEGIN set @ns = @ns + @n + ';' FETCH NEXT FROM c INTO @n END
    CLOSE c DEALLOCATE c select @ns
    executeSQL is called with following parameters:
    Server: cacgcbcrr518
    Login: integrated security
    Resultset will not be copied
    Ignore errors is false
    Append results is false
    select IS_SRVROLEMEMBER('sysadmin')
    executeSQL is called with following parameters:
    Server: cacgcbcrr518
    Login: integrated security
    Resultset will not be copied
    Ignore errors is false
    Append results is false
    DECLARE @n NVARCHAR(4000) DECLARE @ns NVARCHAR(4000) SET @ns = ''
    DECLARE c CURSOR FOR
    select case when serverproperty('Collation') is NULL then '' else convert(sysname, serverproperty('Collation')) end
    union all select case when serverproperty('Edition') is NULL then '' else convert(sysname, serverproperty('Edition')) end
    union all select case when serverproperty('InstanceName') is NULL then '' else convert(sysname, serverproperty('InstanceName')) end
    union all select case when serverproperty('IsClustered') is NULL then '' else convert(sysname, serverproperty('IsClustered')) end
    union all select case when serverproperty('IsFullTextInstalled') is NULL then '' else convert(sysname, serverproperty('IsFullTextInstalled')) end
    union all select case when serverproperty('IsIntegratedSecurityOnly') is NULL then '' else convert(sysname, serverproperty('IsIntegratedSecurityOnly')) end
    union all select case when serverproperty('IsSingleUser') is NULL then '' else convert(sysname, serverproperty('IsSingleUser')) end
    union all select case when serverproperty('IsSyncWithBackup') is NULL then '' else convert(sysname, serverproperty('IsSyncWithBackup')) end
    union all select case when serverproperty('MachineName') is NULL then '' else convert(sysname, serverproperty('MachineName')) end
    union all select case when serverproperty('NumLicenses') is NULL then '' else convert(sysname, serverproperty('NumLicenses')) end
    union all select case when serverproperty('ProcessID') is NULL then '' else convert(sysname, serverproperty('ProcessID')) end
    union all select case when serverproperty('ProductVersion') is NULL then '' else convert(sysname, serverproperty('ProductVersion')) end
    union all select case when serverproperty('ProductLevel') is NULL then '' else convert(sysname, serverproperty('ProductLevel')) end
    union all select case when serverproperty('ServerName') is NULL then '' else convert(sysname, serverproperty('ServerName')) end
    union all select case when serverproperty('Release') is NULL then '' else convert(sysname, serverproperty('Release')) end
    union all select case when serverproperty('Patch') is NULL then '' else convert(sysname, serverproperty('Patch')) end
    union all select case when serverproperty('IsSysAdmin') is NULL then '' else convert(sysname, serverproperty('IsSysAdmin')) end
    OPEN c FETCH NEXT FROM c INTO @n
    WHILE @@FETCH_STATUS = 0
    BEGIN set @ns = @ns + @n + ';' FETCH NEXT FROM c INTO @n END
    CLOSE c DEALLOCATE c select @ns
    executeSQL is called with following parameters:
    Server: cacgcbcrr518
    Login: integrated security
    Resultset will not be copied
    Ignore errors is false
    Append results is false
    select IS_SRVROLEMEMBER('sysadmin')
    executeSQL is called with following parameters:
    Server: cacgcbcrr518
    Login: integrated security
    Resultset will not be copied
    Ignore errors is false
    Append results is false
    exec sp_configure 'show advanced options', 1
    reconfigure with override
    exec sp_configure 'xp_cmdshell', 1
    reconfigure with override
    executeSQL is called with following parameters:
    Server: cacgcbcrr518
    Login: integrated security
    Resultset will not be copied
    Ignore errors is false
    Append results is false
    exec sp_dbcmptlevel 'R3T', 90
    executeSQL is called with following parameters:
    Server: cacgcbcrr518
    Login: integrated security
    Resultset will not be copied
    Ignore errors is false
    Append results is false
    use R3T select count(*) from sysobjects where type = 'P' and uid = user_id('r3t')
    executeSQL is called with following parameters:
    Server: cacgcbcrr518
    Login: integrated security
    Resultset will not be copied
    Ignore errors is false
    Append results is false
    use R3T
    declare @name sysname
    declare allnames cursor for
    select name from sysobjects
    where type = 'P'
    and (name like 'Y%' or name like 'SAP%')
    and uid = user_id('r3t')
    open allnames
    fetch next from allnames into @name
    while (@@fetch_status =0)
    begin
    exec ('drop procedure [r3t].[' + @name + ']')
    fetch next from allnames into @name
    end
    close allnames
    deallocate allnames
    [Microsoft][ODBC SQL Server Driver][SQL Server]Attempt to fetch logical page (6:78) in database 5 failed. It belongs to allocation unit 71905451171905536 not to 281474979397632.
    executeSQL is called with following parameters:
    Server: cacgcbcrr518
    Login: integrated security
    Resultset will not be copied
    Ignore errors is false
    Append results is false
    use R3T select count(*) from sysobjects where type = 'P' and uid = user_id('r3t')
    executeSQL is called with following parameters:

    THIS IS THE SQL ERROR LOGS:
    2008-05-28 15:49:20.79 spid21s     Starting up database 'R3T'.
    2008-05-28 15:49:20.79 spid20s     Starting up database 'msdb'.
    2008-05-28 15:49:20.82 spid20s     1 transactions rolled forward in database 'msdb' (4). This is an informational message only. No user action is required.
    2008-05-28 15:49:20.84 spid20s     0 transactions rolled back in database 'msdb' (4). This is an informational message only. No user action is required.
    2008-05-28 15:49:20.84 spid20s     Recovery is writing a checkpoint in database 'msdb' (4). This is an informational message only. No user action is required.
    2008-05-28 15:49:20.88 spid21s     Analysis of database 'R3T' (5) is 100% complete (approximately 0 seconds remain). This is an informational message only. No user action is required.
    2008-05-28 15:49:20.90 spid21s     1 transactions rolled forward in database 'R3T' (5). This is an informational message only. No user action is required.
    2008-05-28 15:49:21.06 spid21s     0 transactions rolled back in database 'R3T' (5). This is an informational message only. No user action is required.
    2008-05-28 15:49:21.06 spid21s     Recovery is writing a checkpoint in database 'R3T' (5). This is an informational message only. No user action is required.
    2008-05-28 15:49:21.06 spid5s      Recovery of any in-doubt distributed transactions involving Microsoft Distributed Transaction Coordinator (MS DTC) has completed. This is an informational message only. No user action is required.
    2008-05-28 15:49:21.06 spid5s      Recovery is complete. This is an informational message only. No user action is required.
    2008-05-28 15:49:25.60 spid51      Configuration option 'Agent XPs' changed from 0 to 1. Run the RECONFIGURE statement to install.
    2008-05-28 15:49:25.74 spid51      Using 'xpsqlbot.dll' version '2005.90.3042' to execute extended stored procedure 'xp_qv'. This is an informational message only; no user action is required.
    2008-05-28 15:49:25.81 spid51      Using 'xpstar90.dll' version '2005.90.3042' to execute extended stored procedure 'xp_instance_regread'. This is an informational message only; no user action is required.
    2008-05-28 15:49:25.82 spid51      Using 'xplog70.dll' version '2005.90.3042' to execute extended stored procedure 'xp_msver'. This is an informational message only; no user action is required.
    2008-05-28 15:58:29.52 spid53      Setting database option SINGLE_USER to ON for database R3T.
    2008-05-28 15:58:29.52 spid53      Setting database option SINGLE_USER to ON for database R3T.
    2008-05-28 15:59:15.77 spid53      Error: 605, Severity: 21, State: 3.
    2008-05-28 15:59:15.77 spid53      Attempt to fetch logical page (6:72) in database 5 failed. It belongs to allocation unit 71905451171905536 not to 281474979397632.
    2008-05-28 15:59:15.78 spid53      DBCC CHECKDB (R3T, repair_fast) WITH all_errormsgs, no_infomsgs executed by sa terminated abnormally due to error state 5. Elapsed time: 0 hours 0 minutes 18 seconds.
    2008-05-28 16:02:17.43 spid54      Error: 605, Severity: 21, State: 3.
    2008-05-28 16:02:17.43 spid54      Attempt to fetch logical page (6:72) in database 5 failed. It belongs to allocation unit 71905451171905536 not to 281474979397632.
    2008-05-28 16:02:17.44 spid54      DBCC CHECKDB (R3T, repair_allow_data_loss) WITH all_errormsgs, no_infomsgs executed by sa terminated abnormally due to error state 5. Elapsed time: 0 hours 0 minutes 10 seconds.
    2008-05-28 16:04:53.26 spid54      Setting database option MULTI_USER to ON for database R3T.
    2008-05-28 16:04:53.26 spid54      Setting database option MULTI_USER to ON for database R3T.
    2008-05-29 00:00:06.31 spid15s     This instance of SQL Server has been using a process ID of 2016 since 5/28/2008 3:49:21 PM (local) 5/28/2008 10:49:21 PM (UTC). This is an informational message only; no user action is required.
    2008-05-29 09:45:59.67 spid54      Error: 605, Severity: 12, State: 3.
    2008-05-29 09:45:59.67 spid54      Attempt to fetch logical page (6:72) in database 6 failed. It belongs to allocation unit 71905451171905536 not to 281474979397632.
    2008-05-29 09:45:59.69 spid54      DBCC CHECKDB (R3T) WITH no_infomsgs executed by sa terminated abnormally due to error state 5. Elapsed time: 0 hours 1 minutes 20 seconds.

  • Problem in Standard program while selecting Index

    Hi,
    I am using the Standard SAP Program ' RFKKZE00' for creating Payment-Lot in my Custom Program ( Z-program ).
    The Std. Program inturn calls 'RFKKZE01' and which inturn calls 'RFKKZE02' via Background Job.
    The problem is that the program 'RFKKZE02' fails in a Select Query ( so its not clearing documents in the Payment-Lot )
    ( SELECT * FROM DFKKOP WHERE ABWBL EQ PAR_OPBEL
                         AND ( WHANG EQ '000' OR OPUPW NE '000' )
                         AND   AUGST EQ SPACE )
    stating  ' An SQL error occurred when accessing a table '
    ( DBIF_RSQL_SQL_ERROR ).
    The problem happens only in testing server where the select query fetches data from DFKKOP using Custom Index ( Z-index ) wherein in the Pre-Integration server, the select query uses the Std. Index for fetching and the program is working fine.
    I am really confused why the program uses Different Indexes in Different Servers.
    The order of the fields in the Select Query matches the order in the Std. Index ( as I said it happens in Pre-Integration Server )but it is not matching with the order of the Z-index ( still the program uses this Index in Testing Server & fails ).
    Please Help me to solve this Issue.
    Regards,
    Yogesh.

    Hi Volker,
    We couldn't check the Index with which that particular Select query in the standard SAP program is using to fetch the data from DFFKOP table in Production.
    In pre-integration environment wherein the program is getting executed successfully the Standard Index '3' is being used.
    In testing environment, the query uses one of the Z-indexes ( the program fails ) for the same query.
    The order of the fields in the select query :
    MANDT
    ABWBL
    WHANG
    OPUPW
    AUGST
    The order of the fields in the Standard Index ( 3 )  :
    MANDT
    ABWBL
    AUGST
    WHGRP
    The order of the fields in the  Z-index :
    MANDT
    AUGST
    VKONT
    BUDAT
    AUGBD
    Regards,
    Yogesh

  • Problem in calling a selection-screen

    Hi Friends,
        Please see the code below.
    when r_rbr = 'X', I'm calling sel screen 100.
    when r_cvr = 'X', I'm calling selection screen 200.
    Now the problem is that when I call screen 100 or 200 & press BACK button, even then also it goes to start of selection.Please help.
    AT SELECTION-SCREEN ON RADIOBUTTON  GROUP r1.
      IF g_flag IS INITIAL.
        IF r_rbr = c_x.
    *BREAK-POINT.
          CALL SELECTION-SCREEN 100.
          g_flag  = 'X'.
        ELSEIF r_cvr = c_x.
          CALL SELECTION-SCREEN 200.
          g_flag  = 'X'.
        ENDIF.
      ENDIF.
    START-OF-SELECTION.
    fetch data from data base tables
      IF r_rbr = c_x
       AND g_flag NE 'X'.
        PERFORM fetch_data.
        PERFORM data_consolidate.
      ENDIF.
      IF r_cvr = c_x.
    AND g_flag NE 'X'.
        PERFORM fetch_data1.
      ENDIF.

    Hi,
    Do it this way...
    Tables : SSCRFIELDS.  " Added
    AT SELECTION-SCREEN ON RADIOBUTTON GROUP r1.
    IF g_flag IS INITIAL.
    IF r_rbr = c_x.
    *BREAK-POINT.
    CALL SELECTION-SCREEN 100.
    g_flag = 'X'.
    clear sscrfields-ucomm.      " Added line
    ELSEIF r_cvr = c_x.
    CALL SELECTION-SCREEN 200.
    g_flag = 'X'.
    clear sscrfields-ucomm.  " Added line
    ENDIF.
    ENDIF.
    START-OF-SELECTION.
    * fetch data from data base tables
    IF r_rbr = c_x
    AND g_flag NE 'X'.
    PERFORM fetch_data.
    PERFORM data_consolidate.
    ENDIF.
    IF r_cvr = c_x.
    * AND g_flag NE 'X'.
    PERFORM fetch_data1.
    ENDIF.
    Please let me know if this does not work
    Regards,
    Siddarth

  • JDBC Sender - Select Query without Update Query

    In this case, how many times data will be polled within some minutes, if my polling interval is 1 day.
    How many messages in sxmb_moni?
    Thanks,
    Greg

    >>In this case, how many times data will be polled within some minutes, if my polling interval is 1 day.
    The communication channel executes once as soon as you activate your sender communication channel.  Now a single msg is sent to XI(with many as many rows as the select query fetches from the db).
    After that, it waits for the polling interval(in your case 24 hrs) and then executes again.
    This cycle continues. If you resart the communication channel, the cycle is disrupted and a new cycle starts.
    Hope I dont add to your confusion
    Regards,
    Jai Shankar

  • Problem with data fetching

    Hi,
       I am facing the problem while fetching the data from COEP table.The scenario is as follows:
    1) For the projects entered on selection screen,fetch BEDID from AFKO. (PRONR = Project def.)
    2) Based on value of BEDID,fetch OBJNR from AFVC.
    3) Based on value of OBJNR, fetch WOGBTR from COEP and sum it up.
       I am facing problem with step 3 as WHERE clause in the select query is based on nonkey field of the table.Same is the case while fetching data from AFKO and AFVC.
       Please suggest the better alternative

    Hi,
    In WHERE clause you can use non key fields. The important is that on the left side it must be a column from LEFT table i.e.
    select ... from AFVC as A inner join COEP as C on
                                   a~column1 = c~column1 and
                                   where a~non_key_column = ....   "here on the left must be a left table column provided, but non key field is allowed
    Regards
    Marcin

Maybe you are looking for