FindByProperty Returns Same Record Twice

I have a curious situation in which the findByProperty method is returning the same record twice. I have only two records in the file for this test, and they are both tied to the same contact ID. But, instead of bringing back both records, it brings back the first record twice. Any ideas?
ContactNote entity
@Entity
@Table(name = "CONTNOTEP", schema = "CRMLIB", catalog = "S657567F", uniqueConstraints = {})
public class ContactNote implements java.io.Serializable
     // Fields
     @Id
     @Column(name = "CONTACTID", unique = false, nullable = false, insertable = true, updatable = true, precision = 5, scale = 0)
     private Long                    contactId;
     @Temporal(TemporalType.DATE)
     @Column(name = "CNDATE", unique = false, nullable = false, insertable = true, updatable = true, length = 10)
     private Date                    lastUpdatedDate;
     @Temporal(TemporalType.TIME)
     @Column(name = "CNTIME", unique = false, nullable = false, insertable = true, updatable = true, length = 8)
     private Date                    lastUpdatedTime;
     @Column(name = "CNNOTE", unique = false, nullable = false, insertable = true, updatable = true, length = 100)
     private String                    note;
     @Column(name = "CNSALMNUM", unique = false, nullable = false, insertable = true, updatable = true, length = 2)
     private String                    salesmanNumber;
     @ManyToOne(fetch = FetchType.LAZY, cascade = {})
     @JoinColumn(name = "CONTACTID", insertable = false, updatable = false)
     private Contact                    contact;
     @Transient
     private GregorianCalendar     date;
ContactServiceImpl
     public List<ContactNote> getContactNotes(String sessionId, Long contactId) throws AuthenticationFault
          authenticateSession(sessionId);
          List<ContactNote> contactNoteList = contactNoteDao.findByProperty("contactId", contactId);
          if (contactNoteList.size() == 0)
               ContactNote contactNote = new ContactNote();
               contactNoteList.add(contactNote.defaultContactNote());
          return contactNoteList;
JUnit Test Method
     @SuppressWarnings("unchecked")
     public void runGetContactNotes() throws Exception
          UserDao userDao = (UserDao) applicationContext.getBean("userDao");
          User user = userDao.login("[email protected]", "password");
          assertNotNull(user);
          ContactService dao = (ContactService) applicationContext.getBean("contactService");
          List<ContactNote> contactNoteList =
               dao.getContactNotes(user.getSessionId(), 1276L);
          for (ContactNote note : contactNoteList)
               System.out.println(note.getContactNoteId() + " " + note.getNote());
Results of Test
[TopLink Fine]: 2007.10.02 08:50:30.988--ClientSession(7339385)--Connection(6964063)--Thread(Thread[main,5,mai
n])--SELECT CONTACTID, CNTIME, CNNOTE, CNDATE, CNSALMNUM FROM CRMLIB.CONTNOTEP WHERE (CONTACTID = CAST (? AS B
IGINT ))
     bind => [1276]
1276 Jason requested to get Sinclair gift card "backs" because they have so many returned/used gift cards
1276 Jason requested to get Sinclair gift card "backs" because they have so many returned/used gift cardsThanks for any help that can be provided. This has me stumped.
R. Grimes
Message was edited by:
rdgrimes

I was able to resolve this situation by splitting the ContactNote entity in two: ContactNoteId and ContactNote. I had combined them because it seemed kind of silly to have the id, date, time in the ContactNoteID entity, while the ContactNote entity just had two fields beyond the embedded id.
R. Grimes

Similar Messages

  • While loop return same record twice

    I have script below returns 2nd row twice 
    File ID: 2 File Location Drive : D:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\MSDBLog.ldf
    File ID: 2 File Location Drive : D:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\MSDBLog.ldf
    it should return result 
    File ID: 1 File Location Drive : D:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\MSDBData.mdf
    File ID: 2 File Location Drive : D:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\MSDBLog.ldf
    Any idea whats wrong?
     DECLARE @dbdatafile2 VARCHAR(500), @fileid2 int, @i2 int;
     set @i2 = 1
     while (@i2 <= 2)
      begin 
      select  @fileid2 = file_id, @dbdatafile2 = physical_name from sys.master_files where database_id = 4;
        PRINT 'File ID: ' +( CONVERT(VARCHAR, @fileid2))+' File Location Drive : ' + @dbdatafile2 ;
     set @i2 = @i2 + 1
     end;
     GO

    select  @fileid2 = file_id, @dbdatafile2 = physical_name from sys.master_files where database_id = 4;
    If you query this way, you will always get the same (random) file_id; you have to change your query in this way (marked in bold):
    set @i2 = 1
    while (@i2 <= 2)
    begin
    select @fileid2 = file_id, @dbdatafile2 = physical_name
    from sys.master_files
    where database_id = 4
    and file_id = @i2;
    PRINT 'File ID: ' +( CONVERT(VARCHAR, @fileid2))+' File Location Drive : ' + @dbdatafile2 ;
    set @i2 = @i2 + 1
    end;
    GO
    Olaf Helper
    [ Blog] [ Xing] [ MVP]

  • Why two remote keys are genrated in data manager when i'm syndicating the same records twice

    Hi Experts,
    Please guide me that will there be any problem if two remot keys are getting generated for the same system thougt we are expecting to update the same Business Partner Number in ECC.
    Also We are able to see two different business partner number(in ECC this is KUNNR in KNA1)
    Please guide me how to proceed so that when we syndicate the same set of records we want to get update the records in ECC for the same KUNNR.
    We don't want to get another KUNNR for the same records.
    Thanks!
    Pankaj

    "barbara" wrote in message
    news:506500000008000000FAC20000-1077587809000@exch​ange.ni.com...
    > I'm using the simulation interface toolkit V2.0 but it works only the
    > first time after the installation. When I restart again my computer it
    > doesn't work any more. Why??????????
    >
    ---snip
    I am not familiar with the different software that you mentioned but as a
    first step I would check compatibility which is done as below:
    Get original operating system CD that was used to install Windows XP on the
    machine in your post. When Windows XP is inserted into CD ROM drive it
    normally will ask you to conduct compatibility check for the current
    installation. See what it says.
    HTH
    Mohan Pawar
    ----snip

  • "Find Finder Items" returns same file twice

    Hey y'all,
    I'm trying to jerry-rig a photobooth for my wedding. I'm using automator to grab 3 stills from a webcam, and place them all in a folder. When I use "Find Finder Items" to send these images to an action that will rotate them, it finds one of the images twice. That is, the results for "Find Finder Items - where: path whose: name contains 'snap' " will return pictures/path/snap3.tiff, pictures/path/snap1.tiff, pictures/path/snap2.tiff, pictures/path/snap3.tiff. This means that when I send these results to my Rotate 90 Degrees action, Snap3 is rotated 180, and when I send them all into a PDF, I get snap3 twice.
    This also happens when I "Find Finder Items" and just look for all the .tiff files in /path, and when use "Get Folder Contents" on /path.
    Background: Running 10.5.8 Leopard on a PPC Mac mini. Fairly new to the world of Mac, so I may be missing something obvious.
    I've been searching for answers for a day or two now, and haven't come across this sort of issue; I apologize if this is old hat, but I really have made a goodfaith attempt to search these and other forums.
    Any help would be greatly appreciated.
    Edited to add: The folder only contains the 3 .tiff files, and the PDF I'm trying to dump them into. I thought maybe I was somehow creating a 4th identical file, but it's not the case.

    Hello & a warm welcome!
    no idea what is happening, other than Apple Software is usually the worst to accomplish thing the way YOU want to.
    GraphicConverter has a powerful Browse Folder function, & many tools for manipulation, & you can keep your Pics wherever you want...
    http://www.lemkesoft.com/

  • Oracle query returns every expected record twice

    I have a query that at times could return a very large number of records, but I want to process them in blocks within a time budget, so I will process as many as I can within a time budget and then close the ResultSet. I looked at the two obvious ways to control how many rows I get back, using "ROWNUM <= N" and "setFetchSize()".
    I think the latter is the more common way of doing this, but I noticed that it's considered a "hint". I think it's likely it would always be used, but because of that small doubt I decided to try using the "ROWNUM <= N" strategy first.
    It seemed to be working fine, but I noticed an oddity where it was often returning all the relevant rows twice. I'd gotten the set of records to operate on down to a very small number (8), and I entered the query it uses directly into a SQL browser, and it returned the 8 records I expected. My query was using "ROWNUM <= 20". I stepped into the ResultSet "next()" loop, and I watched it process the 8 records, and then instead of returning "false" from the following call to "rs.next()", it returned true and started at the beginning of the 8 records again. It eventually processed all 8 records twice.
    So, I just tried changing it from using "ROWNUM" to using "setFetchSize()". The results were exactly the same. It still processed all 8 records twice.
    The query is very simple. It just looks like this, with most of the column names removed, and the table name changed:
    SELECT ID, ... FROM TABLE_NAME tn WHERE tn.CREATION_DATE = ?
    The somewhat elided code for the loop looks like this:
    try {
    rs = getRecords(connection);
    // Indicates whether at least one row was found.
    boolean foundOne = false;
    while (rs.next()) {
    foundOne = true;
    final Record record = makeRecord(rs);
    processRecord(record, counters);
    ++ recordsProcessed;
    if (!foundOne) {
    break;
    if (overTimeBudget(startTime)) {
    break;
    logInfo("Processed " + recordsProcessed + " record" +
    (recordsProcessed == 1 ? "" : "s") + " so far.");
    What could be going wrong here?

    Never mind. Dumb mistake. It wasn't an Oracle problem. I was doing the query inside a loop because of an earlier design decision.

  • Return to same record on previous page after using form

    Hi,
    I have an application that contains a table with tasks and subtasks (which are linked to a task), and for every task, there is a 'add subtask' link, which links to a form where I can create new subtasks for that task.
    My problem is that when I have created a new subtask, and return to the previous page (with the overview of tasks and their subtasks) automatically by clicking the 'create'-button, that the report starts again at line 1. I would like it to go back to the same task for which I just added a subtask.
    In my search for the answer, I came across these two discussions on this forum:
    Re: navigate to previous record
    after edit, return to the table where the record is at the same position
    I tried to implement the solution they came up with in those discussions, but it didn't work for me.
    The reason of this might be:
    - It are old discussions, maybe some things have changed
    - I use a standard report with custom template, they do not
    - My link is on a field that has the same value for all records, being just a text item 'Add subtask', in the other discussions they made the link on an actual DB-field, in my case this would be for example task_id.
    When I try to implement the solution on the second forum exactly (well, not exactly, I did of course adapt this to my situation), there is one step which doesn't work for me. It's the very last step:
    "With these values: #LINK_&P2_EMPNO."
    When I put the # in there, the button deletes all the information about the link when I click 'Apply changes'. When I don't use the # (just LINK_&P2_EMPNO.) he doesn't delete the information, but the link to the same record doesn't work.
    This is how I implemented it:
    Source page (overview of tasks and subtasks):
    Link attributes: LINK_#TASK_ID#
    Target: Page in this application     Page: 4 (form)
    Item 1: Name: P4_TASK_ID, Value: #TASK_ID#
    Item 2 (not important for returning to the source page): Name: P4_YEAR, Value: #YEAR#
    Item 3 (not important for returning to the source page): Name: P4_TEAM, Value: #TEAM#
    Target (form):
    Action when button clicked: Redirect to page in this application
    Page: 3 (source page)
    With these values: LINK_&P4_TASK_ID.
    It doesn't return to the correct record, but the task_id is included in the link as follows (when I tried to create a new subtask for task 02.01.08 and returned to the source page) f?p=37080:3:5503066190863::NO:::LINK_02.01.08 which is almost the same as they say in the discussion: f?p=&APP_ID.:1:&SESSION.::&DEBUG.:2::#LINK_&P2_EMPNO. (missing the '#'-sign and 1 less ':' before the link-item though).
    Why isn't it working for me? How can I solve the problem?
    Could I get some help with this please? It would be a very useful functionality in my application as there are a lot of records.
    Thank you.
    Kind regards,
    NDG

    I'm new on Jdev, I'm Pl/sql developer learning Jdev ....
    I need to do this on the Task Flow Right? can you give me some stesp to follow?
    thank you

  • JCA DB Adapter process the same file twice in a clustered envrionment causing duplicate records

    We have 2 Nodes in a OSB Cluster and for one of the webservices we use DB Adapter to process the records and send it to external system.
    When ever we catch up with below exception and when the same records are reprocessed/retried the message is processed/sent by both the nodes which is causing a duplicate of records. 
    'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <1e3df38069b38bbe:3fdbec90:14c7cca0f5f:-8000-0000000000000006> <1428935826370> <BEA-000000> <<oracle.tip.adapter.db.InboundWork handleException> BINDING.JCA-11624
    DBActivationSpec Polling Exception.
    Query name: [XYZDBAdapterSelect], Descriptor name: [XYZDBAdapter.ABCEnrollment]. Polling the database for events failed on this iteration.
    Caused by JTS transaction was marked rollback only.
    Please advice!
    Thanks!

    You have to use MOVE operation, if there is any remote exception occured, then move the file to someother folder and again move back to the same folder where the file pickup will start.
    In that way you will be use the same file picked up next time when the polling happens.
    It is considered good etiquette to reward answerers with points (as "helpful" - 5 pts - or "correct" - 10pts).
    Thanks,
    Vijay

  • Global Temp Table, always return  zero records

    I call the procedure which uses glbal temp Table, after executing the Proc which populates the Global temp table, i then run select query retrieve the result, but it alway return zero record. I am using transaction in order to avoid deletion of records in global temp table.
    whereas if i do the same thing in SQL navigator, it works
    Cn.ConnectionString = Constr
    Cn.Open()
    If FGC Is Nothing Then
    Multiple = True
    'Search by desc
    'packaging.pkg_msds.processavfg(null, ActiveInActive, BrandCode, Desc, Itemtype)
    SQL = "BEGIN packaging.pkg_msds.processavfg(null,'" & _
    ActiveInActive & "','" & _
    BrandCode & "','" & _
    Desc & "','" & _
    Itemtype & "'); end;"
    'Here it will return multiple FGC
    'need to combine them
    Else
    'search by FGC
    SQL = "BEGIN packaging.pkg_msds.processavfg('" & FGC & "','" & _
    ActiveInActive & "','" & _
    BrandCode & "',null,null); end;"
    'will alway return one FGC
    End If
    ' SQL = " DECLARE BEGIN rguo.pkg_msds.processAvedaFG('" & FGC & "'); end;"
    Stepp = 1
    Cmd.Connection = Cn
    Cmd.CommandType = Data.CommandType.Text
    Cmd.CommandText = SQL
    Dim Trans As System.Data.OracleClient.OracleTransaction
    Trans = Cn.BeginTransaction()
    Cmd.Transaction = Trans
    Dim Cnt As Integer
    Cnt = Cmd.ExecuteNonQuery
    'SQL = "SELECT rguo.pkg_msds.getPDSFGMass FROM dual"
    SQL = "select * from packaging.aveda_mass_XML"
    Cmd.CommandType = Data.CommandType.Text
    Cmd.CommandText = SQL
    Adp.SelectCommand = Cmd
    Stepp = 2
    Adp.Fill(Ds)
    If Ds.Tables(0).Rows.Count = 0 Then
    blError = True
    BlComposeXml = True
    Throw New Exception("No Record found for FGC(Finished Good Code=)" & FGC)
    End If
    'First Row, First Column contains Data as XML
    Stepp = 0
    Trans.Commit()

    Hi,
    This forum is for Oracle's Data Provider and you're using Microsoft's, but I was curious so I went ahead and tried it. It works fine for me. Here's the complete code I used, could you point out what are you doing differently?
    Cheers,
    Greg
    create global temporary table abc_tab(col1 varchar2(10));
    create or replace procedure ins_abc_tab(v1 varchar2) as
    begin
    insert into abc_tab values(v1);
    end;
    using System;
    using System.Data;
    using System.Data.OracleClient;
    class Program
        static void Main(string[] args)
            OracleConnection con = new OracleConnection("data source=orcl;user id=scott;password=tiger");
            con.Open();
            OracleTransaction txn = con.BeginTransaction();
            OracleCommand cmd = new OracleCommand("begin ins_abc_tab('foo');end;", con);
            cmd.Transaction = txn;
            cmd.ExecuteNonQuery();
            cmd.CommandText = "select * from abc_tab";
            OracleDataAdapter da = new OracleDataAdapter(cmd);
            DataSet ds = new DataSet();
            da.Fill(ds);
            Console.WriteLine("rows found: {0}", ds.Tables[0].Rows.Count);
            // commit, cleanup, etc ommitted for clarity
    }

  • SQL Command returns multiple records, but I see only one record in report

    I work with Crystal Reports XI R2 SP3 and Oracle 10g R2 database.
    I have an SQL Command that returns multiple records. Command name is "CommDivisionNames" and it returns column "CommDivisionNames.DIVISION_NAME". When I place this field into report details section of the report, I can see all 10 records returned and this is how it should be. I actually need this field to be placed in the report header section, and when I place the field there, then I see only the first record. I set that field as "can grow = true". When I do "browse field data" for this field, I see that all 10 records are there, but only the first one is displayed in report header section.
    I thought that I can place SQL Command field anywhere on the report (page header, footer, details) and that it will always show all records that it returns from the database. Can that be done?
    My "main part" of the report returns different set of records, and that's what I have in "report details" section. I need this list of divisions to be in the report header section, so user can see that the report was executed for DivA, DivC, DivE.
    Thank you,
    Milan

    sharonamt:
    Users select divisions from parameter, but the parameter multi values are division_numbers (1,5,10), not division_names. Division_names are visible in parameter_prompt_window as description, but parameter remembers only numbers and I don't know how I can reuse division_names later in formula.
    I do join for division_numbers and make them into one string variable and pass to sub-report, but I think that I can only get these division_names by calling an SQL command or calling stored procedure.
    If I try to do join({MySQLcommand.DIVISION_NAME}) I get error message "A string array is required here".
    Carl:
    I'm playing with cross-tab and I can use it to see all division_names in the report-header section. Since I need them in only one column or only one row, I have to edit cross-tab object and turn all unneeded border lines to white to make them look invisible. So, cross-tab could be a solution for my problem here.
    Another option could be to re-write my SQL command. Since I've read here that SQL command could be written in the same way as I would write a stored procedure, then I could use a bit more complex code to get all multiple division names from the database table into a local cursor, and then use do-while loop to concatenate them into one string, and then to return that string as one record (like 'DivA, DivB, DivC'), and then it should not be a problem to display only that one record/string in report header. It is my understanding that Crystal Reports can call stored procedure that works with many cursors/recordsets and CR will use only the last recordset from the stored procedure. Do you think it could be done this way?
    Thank you,
    Milan

  • End user receving same mail , twice in a day .

    Hi,
    Throu this report , i am sending mail to a user. I the scheuld this program as background job.
    But My problem is end user receving same mail twice a day.I am sure , Program is executed onces in day.
    Plz help me to solve the problem
    REPORT  zplm008_tdr_mail_alert        .
    *DATA DECLARATION.
    DATA: it_ztdr TYPE TABLE OF ztdr WITH HEADER LINE.
    DATA  wa_maktx TYPE makt-maktx..
    *SELECTION SCREEN
    PARAMETER: p_date TYPE sy-datum DEFAULT sy-datum MODIF ID dat .
    *START-OF-SELECTION
    START-OF-SELECTION.
      SELECT * FROM  ztdr INTO TABLE it_ztdr
             WHERE  rlddt  = p_date.
      IF it_ztdr[] IS NOT INITIAL.
        LOOP AT it_ztdr.
          PERFORM send_mail.
        ENDLOOP.
      ENDIF.
    *&      Form  SEND_MAIL
          text
    -->  p1        text
    <--  p2        text
    FORM send_mail .
      DATA: lt_message TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
                       WITH HEADER LINE.
      DATA:   ls_message TYPE char255.
      DATA: lt_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
            lt_contents LIKE solisti1 OCCURS 0 WITH HEADER LINE,
            lt_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
            lt_attachment LIKE solisti1 OCCURS 0 WITH HEADER LINE,
            gf_cnt TYPE i,
            gf_sent_all(1) TYPE c,
            gs_doc_data LIKE sodocchgi1,
            gf_error TYPE sy-subrc.
          Adds text to email text table
      lt_message = 'Hi,'.
      APPEND lt_message.CLEAR lt_message.APPEND lt_message.
      lt_message = 'Requested design is released. Pls raise the TPR (If required to be ordered).'.
      APPEND lt_message.CLEAR: lt_message.APPEND lt_message.
      lt_message = 'Details of the released design:'. APPEND lt_message.
      lt_message = '*******************************'.APPEND lt_message.CLEAR: lt_message.APPEND lt_message.
      MOVE : 'TDR No '  TO lt_message.
      lt_message+21(1) = ':'.
      lt_message+22(40) = it_ztdr-tdrid   .APPEND lt_message.
      MOVE  : 'PED Part no '  TO lt_message.
      lt_message+21(1) = ':'.
      lt_message+22(40) = it_ztdr-matnr.
      APPEND lt_message.
      CLEAR: wa_maktx.
      SELECT SINGLE maktx FROM makt INTO  wa_maktx WHERE matnr = it_ztdr-matnr.
      MOVE 'PED Part Description' TO lt_message.
      lt_message+21(1) = ':'.
      lt_message+22(40) = wa_maktx   .APPEND lt_message.
      MOVE : 'PED Part Rev no' TO lt_message .
      lt_message+21(1) = ':'.
      lt_message+22(40) = it_ztdr-matnr_rv .APPEND lt_message.
      MOVE: 'Rnd part No  ' TO lt_message .
      lt_message+21(1) = ':'.
      lt_message+22(40) = it_ztdr-ref_matnr . APPEND lt_message.
      MOVE : 'Rnd Part Rev '  TO lt_message .
      lt_message+21(1) = ':'.
      lt_message+22(40) = it_ztdr-ref_matnr_rv .APPEND lt_message.
      CLEAR: lt_message.
      APPEND lt_message.
      APPEND lt_message.
      lt_message = 'To View the Design:'.
      APPEND lt_message.
      lt_message = '*******************'.APPEND lt_message.
      CLEAR: lt_message.
      APPEND lt_message.
      lt_message ='For Standard gauge, use Transaction: ZPED_TOOLPRINT'.
      APPEND lt_message.
      lt_message ='For Non-Standard gauge, use Transaction:  ZCV04N or CV04N'.
      APPEND lt_message.
    *Send email message, although is not sent from SAP until mail send
    *program has been executed(rsconn01)
    Fill the document data.
      gs_doc_data-doc_size = 1.
      DATA subject TYPE string.
      CONCATENATE 'Design Released for'  it_ztdr-tdrid  'of'  it_ztdr-ref_matnr
            INTO subject SEPARATED BY space.
    Populate the subject/generic message attributes
      gs_doc_data-obj_langu = sy-langu.
      gs_doc_data-obj_name  = 'TDREQ'.
      gs_doc_data-obj_descr = subject .
      gs_doc_data-sensitivty = 'O'.
    Describe the body of the message
      CLEAR lt_packing_list.
      REFRESH lt_packing_list.
      lt_packing_list-transf_bin = space.
      lt_packing_list-head_start = 1.
      lt_packing_list-head_num = 0.
      lt_packing_list-body_start = 1.
      DESCRIBE TABLE lt_message LINES lt_packing_list-body_num.
      lt_packing_list-doc_type = 'RAW'.
      APPEND lt_packing_list.
      CLEAR lt_receivers.
      REFRESH lt_receivers.
    Add the recipients email address
    For SAP mail
    IF NOT GSCR_UNAME IS INITIAL.
      lt_receivers-receiver = it_ztdr-reqnm.
      lt_receivers-rec_type = 'U'.
      APPEND lt_receivers.
    ENDIF.
    For external mail
    IF NOT gs_outtab-reqnm IS INITIAL.
       lt_receivers-receiver = gs_outtab-reqnm.
       lt_receivers-rec_type = 'U'.
       APPEND lt_receivers.
    ENDIF.
    Call the FM to post the message to SAPMAIL
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          document_data              = gs_doc_data
          put_in_outbox              = 'X'
          commit_work                = 'X'
        IMPORTING
          sent_to_all                = gf_sent_all
        TABLES
          packing_list               = lt_packing_list
          contents_txt               = lt_message
          receivers                  = lt_receivers
        EXCEPTIONS
          too_many_receivers         = 1
          document_not_sent          = 2
          document_type_not_exist    = 3
          operation_no_authorization = 4
          parameter_error            = 5
          x_error                    = 6
          enqueue_error              = 7
          OTHERS                     = 8.
    Store function module return code
      gf_error = sy-subrc.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
               WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    Get lt_receivers return code
      LOOP AT lt_receivers.
      ENDLOOP.
      PERFORM initiate_mail_execute_program.
        CLEAR:lt_message[] , lt_message , gs_doc_data ,gf_sent_all,lt_packing_list[]
        ,lt_packing_list ,lt_receivers[], lt_receivers.
    ENDFORM.                    " SEND_MAIL
    *&      Form  INITIATE_MAIL_EXECUTE_PROGRAM
          text
    -->  p1        text
    <--  p2        text
    FORM initiate_mail_execute_program .
      WAIT UP TO 2 SECONDS.
      SUBMIT rsconn01 WITH mode = 'INT'
                    WITH output = 'X'
                    AND RETURN.
    ENDFORM.                    " INITIATE_MAIL_EXECUTE_PROGRAM

    Hi,
    In your code
    You are looping the perform in which you are calling below FM.
    LOOP AT it_ztdr.
       PERFORM send_mail.
    ENDLOOP.
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
    document_data = gs_doc_data
    put_in_outbox = 'X'
    commit_work = 'X'
    IMPORTING
    sent_to_all = gf_sent_all
    TABLES
    packing_list = lt_packing_list
    contents_txt = lt_message
    receivers = lt_receivers
    EXCEPTIONS
    too_many_receivers = 1
    document_not_sent = 2
    document_type_not_exist = 3
    operation_no_authorization = 4
    parameter_error = 5
    x_error = 6
    enqueue_error = 7
    OTHERS = 8.
    So keep your FM after the loop.
    Pls. reward if useful...

  • Query returns zero records in coldfusion context, but works fine in Navicat

    I've got a query that's returning zero records when I load a page.  If I copy and paste that same query (from the debug output) into navicat, I get rows returned (as I expect).  Has anyone seen this?  It happens locally (CF9) AND remotely on our staging server (CF10).  Even weirder, it's a query that was previously working fine - I simply added an if statement to the where clause, and all of a sudden... 
    Here's the query:
            <CFQUERY name="LOCAL.getEncounterServices" datasource="#REQUEST.dsn#"> 
            SELECT
                a.EncounterProductID,
                a.DateTime AS ServiceDate,
                aa.CartItemID,
                aaa.CartID,
                aaaaa.CartStatus,
                b.ProductID,
                b.ProductName,
                b.CPTCode,
                b.Price,
                c.EncounterID,
                c.DateTimeClosed AS EncounterClosedDate,
                d.FirstName,
                d.LastName
            FROM
                EncounterProducts a
                    LEFT JOIN CartItemProduct aa ON (a.EncounterProductID = aa.EncounterProductID AND aa.Active = 1)
                    LEFT JOIN CartItem aaa ON (aa.CartItemID = aaa.CartItemID)
                    LEFT JOIN Cart aaaa ON (aaa.CartID = aaaa.CartID)
                    LEFT JOIN CartStatus aaaaa ON (aaaa.CartStatusID = aaaaa.CartStatusID),
                Product b,
                Encounters c,
                Contacts d,
                EncounterStatuses e
            WHERE
                1 = 1
                AND (aa.CartItemID IS NULL OR aaaaa.CartStatus = 'Deleted')
                AND a.Active = 1
                AND a.ProductID = b.ProductID
                AND a.EncounterID = c.EncounterID
                AND c.PatientID = d.ContactID
                AND c.EncounterStatusID = e.EncounterStatusID
                AND e.EncounterStatus = 'Closed'
              <CFIF IsDefined("ARGUMENTS.encounter") AND IsObject(ARGUMENTS.encounter)>
                     AND c.EncounterID = <CFQUERYPARAM cfsqltype="cf_sql_integer" value="#ARGUMENTS.encounter.getID()#">
             <CFELSE>
                    AND c.DateTimeClosed >= <CFQUERYPARAM cfsqltype="cf_sql_date" value="#ARGUMENTS.startDate#">
                    AND c.DateTimeClosed < <CFQUERYPARAM cfsqltype="cf_sql_date" value="#DateFormat(DateAdd('d', 1, ARGUMENTS.endDate), 'yyyy-mm-dd')# 00:00:00">
               </CFIF>
                AND c.LocationID = <CFQUERYPARAM cfsqltype="cf_sql_integer" value="#ARGUMENTS.locationID#">
                AND c.CustomerID = <CFQUERYPARAM cfsqltype="cf_sql_integer" value="#ARGUMENTS.customerID#">
            </CFQUERY>
    All of this worked just fine before I added the lines:
             <CFIF IsDefined("ARGUMENTS.encounter") AND IsObject(ARGUMENTS.encounter)>
                     AND c.EncounterID = <CFQUERYPARAM cfsqltype="cf_sql_integer" value="#ARGUMENTS.encounter.getID()#">
             <CFELSE>
                    AND c.DateTimeClosed >= <CFQUERYPARAM cfsqltype="cf_sql_date" value="#ARGUMENTS.startDate#">
                    AND c.DateTimeClosed < <CFQUERYPARAM cfsqltype="cf_sql_date" value="#DateFormat(DateAdd('d', 1, ARGUMENTS.endDate), 'yyyy-mm-dd')# 00:00:00">
              </CFIF>
    Previously, it had just been:
                    AND c.DateTimeClosed >= <CFQUERYPARAM cfsqltype="cf_sql_date" value="#ARGUMENTS.startDate#">
                    AND c.DateTimeClosed < <CFQUERYPARAM cfsqltype="cf_sql_date" value="#DateFormat(DateAdd('d', 1, ARGUMENTS.endDate), 'yyyy-mm-dd')# 00:00:00">
    With no IF/ELSE statement.
    Anyone seen anything like this before?  Any ideas? 
    Thanks.

    Right, I'll start disabusing myself of the DateFormat!
    I'm sorry, I should've posted the actual query too.  It's inserting the first part - "AND c.EncounterID = ....."
    Here's the full query:
    LOCAL.getEncounterServices (Datasource=xmddevdb, Time=9ms, Records=0) in /Applications/ColdFusion9/wwwroot/XMD_NEW/xmd_dev/cfc/ShoppingGateway.cfc @ 16:56:28.028
    SELECT
                a.EncounterProductID,
                a.DateTime AS ServiceDate,
                aa.CartItemID,
                aaa.CartID,
                aaaaa.CartStatus,
                b.ProductID,
                b.ProductName,
                b.CPTCode,
                b.Price,
                c.EncounterID,
                c.DateTimeClosed AS EncounterClosedDate,
                d.FirstName,
                d.LastName
            FROM
                EncounterProducts a
                    LEFT JOIN CartItemProduct aa ON (a.EncounterProductID = aa.EncounterProductID AND aa.Active = 1)
                    LEFT JOIN CartItem aaa ON (aa.CartItemID = aaa.CartItemID)
                    LEFT JOIN Cart aaaa ON (aaa.CartID = aaaa.CartID)
                    LEFT JOIN CartStatus aaaaa ON (aaaa.CartStatusID = aaaaa.CartStatusID),
                Product b,
                Encounters c,
                Contacts d,
                EncounterStatuses e
            WHERE
                1 = 1
                AND (aa.CartItemID IS NULL OR aaaaa.CartStatus = 'Deleted')
                AND a.Active = 1
                AND a.ProductID = b.ProductID
                AND a.EncounterID = c.EncounterID
                AND c.PatientID = d.ContactID
                AND c.EncounterStatusID = e.EncounterStatusID
                AND e.EncounterStatus = 'Closed'
                     AND c.EncounterID = ?
                AND c.LocationID = ?
                AND c.CustomerID = ?
    Query Parameter Value(s) -
    Parameter #1(cf_sql_integer) = 28
    Parameter #2(cf_sql_integer) = 16
    Parameter #3(cf_sql_integer) = 6
    Thansk again for the help!

  • Use same table twice in subform

    Hi,
    i´ve created a form like this
    subformA   -> positioned
    --subformB -> flowed
    table
    header
    body row
    Everything is working fine and a I´m able to see the expected data.
    But when my table includes more than 10 rows it destroys the layout of my page.
    My idea:
    Create a second subform with same table data and place it right beside it. And using FormCalc to show data from row 11 to end.
    But only the first subform is filled. There is no data in second subform (FormCalc code is not implemented).
    It seems, that I can´t use same tabele twice.
    Any ideas?
    Regards
    Andy

    Hi Andy,
    Have both the subforms as flowed and page breaked, it should work.
    As per as having 2 tables techically i believe its not possible.reason behind.
    When you do data binding for 1st table and say multiple rows, at runtime data is iterated and displayed in the 1st table.
    when it reaches to the 2nd table the pointer on the table data source is already eof i.e., last record so it will not display it again.
    to acheive this on form load of the 2nd table you need to initialize and iterate through the data source again.
    I have never tested this scenario but read it in some adobe fourms.
    Check it and let me know, if its still not working i can design a sample form with this scenario for you.
    Cheers,
    Sai

  • Query result shows the same data twice

    Hello All,
    I've created UDFs like Supplier Name, Supplier Address, and (Excise Details like)Supplier ECC No,
    Supplier Range.
    And I've created Query for Supplier Name and Supplier Address, and I assigned to FMS, Its working Correctly.
    I've created Query for Supplier ECC No. the Query is,
    SELECT  T0.[ECCNo],T1.[CardName]
    FROM CRD7 T0  INNER JOIN OCRD T1 ON T0.CardCode = T1.CardCode
    WHERE T0.[ECCNo]  Like  '[%]'
    I saved the Query, and assigned to FMS.
    At this stage (i.e. Query for Supplier ECC No.) the above Query showing the same data twice.
    Please suggest to rectify the problem.
    Thanks,
    Pratheeviraj

    You can get rid of the duplicates by changing the query to
    SELECT DISTINCT T0.ECCNo,T1.CardName
    FROM CRD7 T0 INNER JOIN OCRD T1 ON T0.CardCode = T1.CardCode
    WHERE T0.ECCNo Like '[%]'
    But it is always worth understanding why you are getting multiple records to check that you are getting back what you want.  I think you may be seeing this because CRD7 can have multiple records for a business partner - maybe one for each of 'pay-to' and 'ship-to' address?

  • Displaying Same ResultSet Twice In A JSP Page

    I have a table that lists team names in my database. I'm trying to create a page with 2 dropdown boxes where each lists all the teams in the league (in other words, the data read in from the table). I got the first dropdown box to populate w/ this info. My question is about the 2nd dropdown box:
    Since I already have the ResultSet from the 1st dropdown, I would think it would be a waste to make another DB-read to fill in the 2nd dropdown. However, when I tried to call ResultSet.first() it gave me the error that it was TYPE_FORWARD_ONLY. I checked the documentation for Connection and it looks like there are some overloaded methods for createStatement. However, the API documentation (see below) is pretty confusing. I'm not sure what "resultSetConcurrency" or "resultSetHoldability" I need if I just want to read the same data twice. Can someone point me in the right direction?
    Statement createStatement(int resultSetType, int resultSetConcurrency)
    Creates a Statement object that will generate ResultSet objects with the given type and concurrency.
    Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability)
    Creates a Statement object that will generate ResultSet objects with the given type, concurrency, and holdability.

    I am also having a very similar problem.
    I am having a table having 20 fileds.some of them r to be displayed in one table
    others in some other table.
    for this i am using a bean which returns a resultset which is then used in jsp page
    for display.But i have to call the javabean method twice which fires the query & returns the resultset.
    I cannot store so many fileds with so many rows of values in list of objects also i do not want to
    fire query twice.
    rs.movefirst() does not work, so what should i do.

  • Using index in a query return few records than full table access

    Today we have an issue with a query, when it use the ok index the returned are not all records that apply to where clause condition.
    See bellow
    explain plan for
    select * from movdb.zan_m03 where
    M00AF = TO_DATE('11/01/28','YY/MM/DD') AND
    M00za = 10 AND
    m00AC = 50 AND
    M00AD between 136906 and 136999
    SELECT * FROM TABLE(dbms_xplan.display);
    PLAN_TABLE_OUTPUT
    Plan hash value: 1882720105
    | Id | Operation | Name |
    | 0 | SELECT STATEMENT | |
    | 1 | TABLE ACCESS BY INDEX ROWID| ZAN_M03 |
    |* 2 | INDEX RANGE SCAN | PK_ZAN_M03 |
    Predicate Information (identified by operation id):
    PLAN_TABLE_OUTPUT
    2 - access("M00AF"=TO_DATE('11/01/28','YY/MM/DD') AND "M00ZA"=10 AND
    "M00AC"=50 AND "M00AD">=136906 AND "M00AD"<=137141)
    filter("M00AD"<=137141 AND "M00AD">=136906)
    Note
    - rule based optimizer used (consider using cbo)
    20 rows selected.
    The query above return only one row insted 1579 record that apply to this conditions.
    When forcing a full table acess with a hint, the query return all records that apply, the 1579 record.
    select /*+ FULL(zan_m03) */ M00AF, M00za, m00AC , M00AD from movdb.zan_m03 where
    M00AF = TO_DATE('11/01/28','YY/MM/DD') AND
    M00za = 10 AND
    m00AC = 50 AND
    M00AD between 136906 and 137141
    Can you help me to identify what's happening?
    I am with Oracle 10g R2 10.2.0.4 standard edition
    the statistics are up to date
    the opitimizer_mode are rule, but altering in session level to all_rows happens the same issue.
    Nothing about corruption in the alert log.
    Thanks in advance
    Regards
    Cristiano

    Yes the query are the same and correct restriction for where clause are M00AD between 136906 and 137141.
    I've pasted, by mistake, another test query
    The corrects are:
    select M00AF, M00za, m00AC , M00AD from movdb.zan_m03 where
    M00AF = TO_DATE('11/01/28','YY/MM/DD') AND
    M00za = 10 AND
    m00AC = 50 AND
    M00AD between 136906 and 137141
    This use pk index and return one row
    select /*+ FULL(zan_m03) */ M00AF, M00za, m00AC , M00AD from movdb.zan_m03 where
    M00AF = TO_DATE('11/01/28','YY/MM/DD') AND
    M00za = 10 AND
    m00AC = 50 AND
    M00AD between 136906 and 137141
    This does a full table access and return 1579 records
    I´ve been searching for wrong results bugs on my oracle support, but not found one that mentions something like our issue.
    I checked the dba_tables and dba indexes and the number of rows are different, and I think this would be the same because it's is a pk.
    Look this
    SQL> select NUM_ROWS from dba_tables where table_name = 'ZAN_M03'
    2 /
    NUM_ROWS
    228527878
    select NUM_ROWS from dba_indexes where index_name = 'PK_ZAN_M03';
    SQL> select NUM_ROWS from dba_indexes where index_name = 'PK_ZAN_M03';
    NUM_ROWS
    217510185
    Is normal a index for pk having much fewer rows than table? I think not, but not sure.
    Again
    Thanks in advance
    Regards
    Cristiano

Maybe you are looking for