Last fetched predicate  sybase database table

Env: IDM 8.0
My last fetched predicate is defined as:
LastModDateTime > '$(LastModDateTime)' where LastModUpdateTime is a Datatype of DATETIME in sybase. LastModDateTime is defined both in the left and right side of my database schema, but it seems to be ignored. Active sync evaluates every record every scan. The is no IAPI_resource in config but there is a SYNC_resource in XmData. Can anyone shed some light on this

I'm using IDM 7.1.1 with an Oracle back-end so take this with a grain of salt. I've had similar problems in the past and it had to do with IDM's translation of the date as a string to the date as a JDBC date object. This had to do with Oracle's default timestamp format versus IDM's representation of the time as a string. You might be experiencing something similar with Sybase.
This is what I have for a search predicate and it works for me:
eventtime > to_timestamp('$(eventtime)' , 'yyyy-mm-dd hh24:mi:ss.ff')The key is the to_timestamp function. If I don't have the "to_timestamp" function then it fails to do the comparison properly and, like you, returns all rows in the table. WIthout the to_timestamp function the database is trying to compare dates in the format "yyyy-mm-dd hh24:mi:ss.ff" with the default database format of "mm-dd-yyyy" and of course it fails.
Hopefully that helps.
-Mike

Similar Messages

  • Last Fetched Predicate statement in active sync process

    Can anybody tell me what should be the Last Fetched Predicate and Static Search Predicate for a changelog table with seqno column for polling to a sql database.
    From this post, http://forum.java.sun.com/thread.jspa?forumID=764&threadID=5104031
    let say I have a polling to a changelog db table with a seq number and it will have to read from this table. But, in my case, I just need to look for a code in the table to fire a workflow.What would be the good approach to achieve this requirement?

    Hi,
    If lastmod is a varchar2 in the database,
    then you need to say:
    lastmod > '$(var)'
    where var is the identity manager variable
    that lastmod is mapped to in the resource schema.
    Basically, if you say:
    x > '$(y)'
    x must be a field name in the database
    y must be the identity manger variable it
    maps to in the schema in the
    resource adapter configuration.
    If you edit the resource schema from the
    identity manager web interface, you should
    be able to see the mapping.
    Hope this helps,
    John I

  • How to get the last row of a database table.

    HI ,
    I want to get record exactly from the last row of a database table.
    How is that possible?

    Hi,
    To fetch last record from an internal table, just do find the number of records in it and read using index.
    DESCRIBE TABLE ITAB LINES L_LINES.
    READ TABLE ITAB INDEX L_LINES.
    You can also use LOOP .. ENDLOOP but the above method is better (performance wise).
    using LOOP .. ENDLOOP.
    LOOP AT ITAB.
    **do nothing
    ENDLOOP.
    **process ITAB (Header record of ITAB).
    **after ENLOOP, ITAB will have the last record of the internal table.
    [here ITAB is internal table as well as header record.]
    But what is the requirement?
    If you are looking for the current record of an employee then you can use ENDDA = HIGH_DATE.
    My advice is to review your requirement again and try to fetch only that record which you need.
    Mubeen

  • How to control the number of rows selected from a sybase database table?

    Hi, JDBC guru,
    I'm working on project using Sybase 11.9.x database.We need to process a record in a table,first select it from the table,then do some computing,finally write it to a dbf file, if the above steps succeed,remove the original row in the table.Quite evidently, all these operation should be put into one transaction. But how can I select just a number of rows from the sybase database table?
    Any hints?
    Thank you in advance.
    Regards,
    Jusitne

    Statement stmt...
    stmt.setMaxRows(20);

  • Selecting the last record from a database table

    In my ABAP Program, I have to use a select statement to retrieve the last record from the database table with the same key.  In other words, the Program will get more than one hit on the database table for the selected keys and I need to retrieve values from only the last record and not the first.  I know I can use an internal table to sort the records first and then retrieve the right value.   But to make things easier, is there a SELECT statement keyword than I can use to do this in one single step?  Thanks!

    hi,
    tables:mara.
        data: begin of it_mara occurs 0,
                matnr like mara-matnr,
                meins like mara-meins,
                mtart like mara-mtart,
                end of it_mara.
    select-options:s_matnr for mara-matnr.
    select matnr
              meins
              mtart
    from mara
    into table it_mara
    where matnr in s_matnr.
    if not it_mara[] is initial.
    sort it_mara by matnr descending.
    read table it_mara index 1.
    endif.
    then you get the last record of the select statement.
    reward points if useful,
    venkat.

  • Retrive last inserted  record  from database table

    Hi,
    some body inserting a record into table 'A' through some procedure/java program.i want to retrive the last inserted record from database table.records are not stored in order.Can any body help me.

    In general, unless you are storing a timestamp as part of the row or you have some sort of auditing in place, Oracle has no idea what the "first" or "last" record in a table is. Nor does it track when a row was inserted.
    - If you have the archived logs from the point in time when the row was inserted, you could use LogMiner to find the timestamp
    - If the insert happened recently (i.e. within hours), you may be able to use flashback query to get the value
    - If you're on 10g or later and the table was built with ROWDEPENDENCIES and the insert happened in the last few days and you can deal with a granularity of a few seconds and you don't need 100% accuracy, you could get the ORA_ROWSCN of the row and convert that to a timestamp.
    If this is something you contemplate needing, you need to store the data in the row or set up some sort of auditing.
    Justin

  • Read the last record in the database table..

    Hi..
    I am new to ABAP. So i have one condition to read the address number field in the last record from database table by using the person number where clause field.
    But the person number is same for some the records.
    So can any tell me the logic for to read the addressnumber field in the last record of selected records from database where personnumber is equal to some thing.
    Please help me..
    Thanks
    venki

    Hi Venkat ,
    u mean to say
    person number  addressnumber
    aa1            0000000000001
    aa1            0000000000002
    aa1            0000000000003
    aa1            0000000000004
    aa2            0000000000021
    aa3            0000000000110
    if i have to read the addressnumber 00000000000004
    of the person number aa1
    u can go like
    data v_address number like addressnumber.
    sort itab by personnumber addressnumber
    loop at itab .
    at end of personnumber.
    move addressnumber to v_addressnumber ..
    endat.
    endloop.
    so using control break statements i can fetch the last record of my person number if at all the same person number is having more than one address number ..
    hope this helps,
    Regards,
    Vijay
    Message was edited by: Vijay

  • Long time taken to fetch data from Database Table

    Moved to correct forum by moderator.
    I had a requirement where i need to fetch records from table A912 for the matching entries in an internal table and satisfying some conditions.
    The Internal Table(it_out) has 1,206 entries, while Databse table(A912) has 9,758,234 entries.
    The Structure of Internal Table and Select Query are,
    TYPES : BEGIN OF ty_a912,
              matnr LIKE a912-matnr,  "Material
              kunwe LIKE a912-kunwe,  "Ship-to party
              datbi LIKE a912-datbi,  "Validity end dt
              datab LIKE a912-datab,  "Validity start
              knumh LIKE a912-knumh,  "Cond rec no.
            END OF ty_a912.
    TYPES : BEGIN OF ty_out,
              erdat LIKE vbak-erdat,  "Date
              vbeln LIKE vbak-vbeln,  "Sales document
              posnr LIKE vbap-posnr,  "Item
              kunnr LIKE vbpa-kunnr,  "Customer
              fkdat LIKE vbkd-fkdat,  "Billing Date
              ndc   LIKE zndc-zndc,   "EAN/UPC
              matnr LIKE vbap-matnr,  "Material
              zr00p LIKE konv-kbetr,  "ZR00 Price       
              zcarp LIKE konv-kbetr,  "ZCAR Price
              zrfcp LIKE konv-kbetr,  "ZRFC Price
              ctrnr TYPE char80,      "Contract#
              ctrnm TYPE char80,      "Contract Name
              a912p TYPE konv-kbetr,                        
            END OF ty_out.
    SELECT
          matnr kunwe datbi datab knumh
          FROM a912
          INTO TABLE t_a912
          FOR ALL ENTRIES IN t_out
          WHERE matnr EQ t_out-matnr
            AND kunwe EQ t_out-kunnr
            AND datbi GE t_out-fkdat
            AND datab LE t_out-fkdat.
    It takes very long time to process this select query, is there any alternate way?
    Please suggest some valid solution for this issue.
    Edited by: Matt on Dec 3, 2008 10:08 AM

    Prabhakar Manoharan wrote:>
    > Moved to correct forum by moderator.
    >
    > I had a requirement where i need to fetch records from table A912 for the matching entries in an internal table and satisfying some conditions.
    > The Internal Table(it_out) has 1,206 entries, while Databse table(A912) has 9,758,234 entries.
    >
    Hi,
    can you give us an SQL trace in ST05? The SQL Trace (ST05) – Quick and Easy
    The FAE will be processed in a special way: see https://forums.sdn.sap.com/click.jspa?searchID=-1&messageID=6630311
    If an index is NOT supported the FAE part will take forever...
    if t_out is filled by another table you may go for a join? But again, index support is the key
    bye
    yk
    Edited by: YukonKid on Dec 4, 2008 10:31 AM

  • Fetching data form database tables

    Hi all,
    i have a requirment as below:
    i have to fetch EINA-LIFNR, EINE-EKORG, MARA-MTART, EINA-IDNLF,
    EINA-MATNR(also there in MARA), MARA-LVORM, EINA-LOEKZ.
    for a given vendor LFA1-LIFNR.
    we should not use joins in this.
    is there any other way other than FOR ALL ENTRIES.
    please help me with code in any of the way, it is very urgent...
    thanks,
    Rama

    Hi Rama,
    Please use the following code for your required Query with FOR ALL ENTRIES:-
    tables: EINA, EINE , MARA, LFA1.
    TYPES: BEGIN OF GS_DATA1,
           LIFNR TYPE LFA1-LIFNR,
           END OF GS_DATA1,
           BEGIN OF GS_DATA2,
           LIFNR TYPE EINA-LIFNR,
           IDNLF TYPE EINA-IDNLF,
           MATNR TYPE EINA-MATNR,
           LOEKZ TYPE EINA-LOEKZ,
           END OF GS_DATA2,
           BEGIN OF GS_DATA3,
           LIFNR TYPE EINA-LIFNR,
           IDNLF TYPE EINA-IDNLF,
           MATNR TYPE EINA-MATNR,
           LOEKZ TYPE EINA-LOEKZ,
           EKORG TYPE EINE-EKORG,
           END OF GS_DATA3,
           BEGIN OF GS_DATA4,
           LIFNR TYPE LFA1-LIFNR,
           IDNLF TYPE EINA-IDNLF,
           LOEKZ TYPE EINA-LOEKZ,
           EKORG TYPE EINE-EKORG,
           MATNR TYPE MARA-MATNR,
           MTART TYPE MARA-MTART,
           LVORM TYPE MARA-LVORM,
           END OF GS_DATA4.
    DATA: ITAB1 TYPE STANDARD TABLE OF GS_DATA1,
          ITAB2 TYPE STANDARD TABLE OF GS_DATA2,
          ITAB3 TYPE STANDARD TABLE OF GS_DATA3,
          ITAB4 TYPE STANDARD TABLE OF GS_DATA4,
          WA1 LIKE LINE OF ITAB1,
          WA2 LIKE LINE OF ITAB2,
          WA3 LIKE LINE OF ITAB3,
          WA4 LIKE LINE OF ITAB4.
    START-OF-SELECTION.
    SELECT LIFNR FROM LFA1 INTO CORRESPONDING FIELDS OF TABLE ITAB1.
    SELECT LIFNR
            IDNLF
            MATNR
            LOEKZ
            FROM  EINA
            INTO CORRESPONDING FIELDS OF TABLE ITAB2
            FOR ALL ENTRIES IN ITAB1
            WHERE LIFNR = ITAB1-LIFNR.
    SELECT LOEKZ
           EKORG
           FROM EINE
           INTO CORRESPONDING FIELDS OF TABLE ITAB3
           FOR ALL ENTRIES IN ITAB2
           WHERE LOEKZ = ITAB2-LOEKZ.
    SORT ITAB2 BY LOEKZ.
    LOOP AT ITAB3 INTO WA3.
    READ TABLE ITAB2 INTO WA2 WITH KEY LOEKZ = WA3-LOEKZ BINARY SEARCH.
    IF SY-SUBRC = 0.
      WA3-IDNLF = WA2-IDNLF.
      WA3-MATNR = WA2-MATNR.
      WA3-LIFNR = WA2-LIFNR.
      MODIFY ITAB3 FROM WA3 TRANSPORTING IDNLF MATNR LIFNR.
    ENDIF.
    ENDLOOP.
    SELECT MATNR
           MTART
           LVORM
           FROM MARA
           INTO CORRESPONDING FIELDS OF TABLE ITAB4
           FOR ALL ENTRIES IN ITAB3
           WHERE MATNR = ITAB3-MATNR.
    SORT ITAB3 BY MATNR.
    LOOP AT ITAB4 INTO WA4.
    READ TABLE ITAB3 INTO WA3 WITH KEY LOEKZ = WA4-LOEKZ BINARY SEARCH.
    IF SY-SUBRC = 0.
      WA4-LIFNR = WA3-LIFNR.
      WA4-IDNLF = WA3-IDNLF.
      WA4-LOEKZ = WA3-LOEKZ.
      WA4-EKORG = WA4-EKORG.
      MODIFY ITAB4 FROM WA4 TRANSPORTING LIFNR IDNLF LOEKZ EKORG.
    ENDIF.
    ENDLOOP.
    Hope this will solve your problem.
    Reward points are useful.
    Regard,
    Shilpi

  • Foreign keys in source tables (sybase database)

    Hi,
    Foreign key / primary key constraints are not captured / converted in oracle model nor they are generated.
    I am migrating sybase database tables to oracle. These tables have foreign keys, but while capturing and then converting the table to oracle model and then generating, these foreign keys are not present in the ddl script.
    In the source connection ( in the tool) to the sybase database, these keys are shown,
    and logically when the generation is done for table, the foreign / primary key syntax should be present in the ddl generated
    Am more worried about the foreign key not getting converted
    Please help
    Regards

    Hello,
    do you have a very simple example showing this behaviour ?
    What is your sybase version ? And what about Sqldev version ?
    Do you tested migration with offline method ?
    As testcase, a emp and dept schema with foreign key should be ideal.
    Thanks
    Regards,
    Marcello

  • Can IdM use TimeStamp files in its Active Sync for Database table ?

    I have an IdM 7.1 implementation that I inherited
    and have a Database Table resource adapter with Active Sync.
    Here's a few ways to set up Active Sync, but I want to explore the latter.
    -Static Search Predicate (clause)
    You can use a flag (column) in your data table. Does not require any mapping, and presumably whatever process you're kicking off would turn off the flag, so the record is not picked up subsequently.
    -Last Fetched Predicate (documented in the Resource Reference, under Database Table),
    Normally, you'd be doing a comparison based on timestamps, and the mapping between a timestamp-User Extended Attribute AND timestamp-Database Column
    In this implementation, I do not see a User Extended Attribute (UXA) but I do see a 0 byte timestamp file on the server. Did not see anything like this discussed in the docs, but my hypothesis is that this is being used, or has been configured somehow. I wonder if I am right ?
    Let's call it 'MyTS'
    I see MyTS both in ActiveSync logs, as well as in the 'XML Data' object, resource_SYNC, that A/S creates. Maybe this is a hidden feature, or mostly undocumented, or from an earlier version. Anyone care to offer a suggestion or explanation ? Your thoughts would be welcome.
    thanks

    'MyTS' would be a resource attribute. Have a look in the schema map for your resource.
    It doesn't need to be, and would not normally be, a user extended attribute.

  • Logical database vs direct access of database table

    Hi
    I have created a FI report.    I am trying to get data from large FI tables like BSAK, BSEG, BKPF, RSEG.  eventhough there are 10 records as per my criteria, system is taking morethan an hour time even in background processing.  This may be becaz of lot of conditions that I am applying to filter the data.  But still trying to improve the performance
    For fetching data which is the better way for getting optimum performance of the report.
    a) directly fetching data from database tables
    b) using logical database collecting data into an itab
    regards,
    mallik

    Hi,
    If you are accessing the database tables more than once with different criteria then definetly it will take more time. In such case write only one Select statement on the table and get all the required data into an internal table and then process this internal table as per your logic.
    Use of LDBs is definetly faster but filter conditions might not match with your filter conditions. In such case direct access of database table is preferable but as i said in above paragraph.
    thanks,
    sksingh

  • Fetch last record from database table

    hi,
    how to fetch last record from database table.
    plz reply earliest.
    Regards,
    Jyotsna
    Moderator message - Please search before asking - post locked
    Edited by: Rob Burbank on Dec 11, 2009 9:44 AM

    abhi,
    just imagine the table to be BSEG or FAGLFLEXA... then what would be performance of the code ?
    any ways,
    jyotsna, first check if you have a pattern to follow like if the primary key field have a increasing number range or it would be great if you find a date field which stores the inserted date or some thing..
    you can select max or that field or order by descending using select single.
    or get all data.. sort in descending order.(again you need some criteria like date).
    read the first entry. using read itab index 1

  • How to fetch the customer debit balances form the KNC1 database table

    Hi Experts,
    I am creating a ABAP report which would dispaly the customer credit balances for the currenct fiscal year.
    I am fetching the values form KNC1 database table.....But in this table values are stored year wise.
    But I want to display for the current fiscal year that means if teh user selects the 07/2011 as the month on the sleection screen then the debit balances from 072010 to 062011 should be dispalyed.
    Could anyone please help me out to fetch this the debit balaces form KNC1 database table in the above format.
    Or is there any other way to solve this problem?
    Awating your urgent reply.
    Many Thanks,
    Komal.

    Hi Komal,
    First, you have to compute the initial period and the final period.
    Next, you must read table KNC1 for the years comprised between these two periods.
    Last, you must read the fields of table KNC1. For that, you should compose dynamically the name of the field, and then ASSIGN it to a FIELD-SYMBOL.
    Now, just add up the values!
    Please try the following code:
    FIELD-SYMBOLS: <fs>.
    DATA: t_knc1 TYPE TABLE OF knc1 WITH HEADER LINE.
    DATA: d_debits LIKE knc1-um01s.
    PARAMETERS: p_kunnr LIKE knc1-kunnr,
                p_bukrs LIKE knc1-bukrs,
                p_spmon TYPE spmon.
    DATA: l_fieldname(20) TYPE c.
    DATA: l_date LIKE sy-datum,
          l_date_from LIKE sy-datum,
          l_date_to LIKE sy-datum.
    DATA: l_period(2) TYPE n.
    DATA: l_num_times TYPE i.
    START-OF-SELECTION.
    "Compute the initial and final periods
      CONCATENATE p_spmon '01' INTO l_date.
      CALL FUNCTION 'RE_ADD_MONTH_TO_DATE'
        EXPORTING
          months  = '-1'
          olddate = l_date
        IMPORTING
          newdate = l_date_to.
      CALL FUNCTION 'RE_ADD_MONTH_TO_DATE'
        EXPORTING
          months  = '-12'
          olddate = l_date
        IMPORTING
          newdate = l_date_from.
    "Read table KNC1
      SELECT *
        INTO CORRESPONDING FIELDS OF TABLE t_knc1
        FROM knc1
        WHERE kunnr = p_kunnr
          AND bukrs = p_bukrs
          AND gjahr BETWEEN l_date_from(4) AND l_date_to(4).
    "this will yield at most 2 records, one for present year, and another one for the previous year.
    "but if you select i.e. period '01.2012', initial_date = '01.01.2011' and final_date = '31.12.2011'
    " --> thus only one year --> one record
      CLEAR: d_debits.
      LOOP AT t_knc1.
    " If there's no year change
        IF l_date_from(4) = l_date_to(4).
          DO 16 TIMES.
            l_period = sy-index.
            CONCATENATE 'UM'      "compute dynamically the field name
                        l_period
                        'S'
              INTO l_fieldname.
            ASSIGN COMPONENT l_fieldname OF STRUCTURE t_knc1 TO <fs>.   "assign
            ADD <fs> TO d_debits.                  "and add up
          ENDDO.
        ELSE.
    " If there IS a year change
          IF t_knc1-gjahr = l_date_from+0(4).
            l_num_times = 16 - l_date_from+4(2) + 1.    "you must loop 16 - initial_period + 1 times for the first year
            DO l_num_times TIMES.
              l_period = sy-index + l_date_from+4(2) - 1.
              CONCATENATE 'UM'                "compute dynamically the field name
                          l_period
                          'S'
                INTO l_fieldname.
              ASSIGN COMPONENT l_fieldname OF STRUCTURE t_knc1 TO <fs>.    "assign
              ADD <fs> TO d_debits.              "and add up
            ENDDO.
          ELSE.
            l_num_times = l_date_to+4(2).            "you must loop final_period times for the second year
            DO l_num_times TIMES.
              l_period = sy-index.
              CONCATENATE 'UM'               "compute dynamically the field name
                          l_period
                          'S'
                INTO l_fieldname.
              ASSIGN COMPONENT l_fieldname OF STRUCTURE t_knc1 TO <fs>.     "assign
              ADD <fs> TO d_debits.        "and add up
            ENDDO.
          ENDIF.
        ENDIF.
      ENDLOOP.
    You'll have the result on variable 'd_debits'.
    I hope this helps. Kind regards,
    Alvaro

  • How to fetch data from single database table using 2 internal tables.

    Hi friends,
    i am a new user of ABAP and also SDN.
    i need a help. 
    i want to fetch data from one database table based on primary keys of 2 internal tables.  how to put in where clause.
    Thanks in advance.

    hii
    refer to following code ..i hope it will help you
    SELECT matnr                         " Material Number
        FROM mara
        INTO TABLE i_mara
       WHERE matnr IN s_matnr.
      IF i_mara[] IS NOT INITIAL.
        SELECT matnr                       " Material Number
               werks                       " Plants
               prctr                       " Profit Center
          FROM marc
          INTO TABLE i_marc
           FOR ALL ENTRIES IN i_mara
         WHERE matnr = i_mara-matnr
           AND werks IN s_werks.
      ENDIF.                               " IF i_mara[] IS NOT INITIAL
      i_output = i_marc.
      IF i_marc[] IS NOT INITIAL.
        SELECT matnr                       " Material Number
               werks                       " Plants
               lgort                       " Storage Location
          FROM mard
          INTO TABLE i_mard
           FOR ALL ENTRIES IN i_marc
         WHERE matnr EQ i_marc-matnr
           AND werks EQ i_marc-werks
           AND lgort IN s_lgort.
      ENDIF.                               " IF i_mara[] IS NOT INITIAL
    regards
    twinkal

Maybe you are looking for