Query creating duplicate records

Hi
I need to create a report that gives the po number, po line item number, material number and the delivery post code.
I have created a query with the following tables:
EKKO, EKPO, EBAN, VBEP, VBAK, VBPA, ADRC.
I have deleted the wrong link between EKKO and EKPO and retained all other links as suggested.
Could anybody let me know why there are duplicate records in the report pls?
Thanks
Desp09

Desp09 wrote:
Hi
>
> I have connected
>
> EKKO-EBELN to EKPO
>
>  EKPO -EBELN and EKPO-EBELP  to the same of EBAN
>
> also EKPO-BANFN and EKPO-BNFPO to the same of EBAN
>
> EBAN-BANFN and EBAN-BNFPO to VBEP
>
> VBEP-VBELN to VBAK-VBELn
>
> VBAK-VBELN to VBPA-VBELN
>
> VBPA-ADRNR to ADRC-ADDRNUMBER.
>
> This is the first time I have created a query so if you can kindly explain the logic of the error it would help in my future reports.
>
> Thanks
> Priya
Hi Priya,
You can simplify the process if you make use of the LDB, which will fetch the same report with std LDB available in the system.
You can define multiple infosets and  pull the fields for easier approach.
Regards
Shiva

Similar Messages

  • Need a query for duplicate records deletion

    here is one scenario...
    23130 ----> 'A'
    23130 ----> 'X'
    23130 ----> 'c'
    These are duplicate records.. when we remove duplicates, the record must get 'c', if it contains A,C,X. If it contains A and X, then the record must get 'X'. That means the priority goes like this C-->X-->A. for this i need query.. this is one scenario. It would be great if u reply me asap.

    Hello
    It's great that you gave examples of your data, but it is quite helpful to supply create table and insert statements too along with a clear example of expected results. Anyway, I think this does what you are looking for.
    CREATE TABLE dt_dup (ID NUMBER, flag VARCHAR2(1))
    INSERT INTO dt_dup VALUES(23130, 'A');
    insert into dt_dup values(23130, 'X');
    insert into dt_dup values(23130, 'C');
    INSERT INTO dt_dup VALUES(23131, 'A');
    INSERT INTO dt_dup VALUES(23131, 'X');
    DELETE
    FROM
      dt_dup
    WHERE
      ROWID IN (  SELECT
                    rid
                  FROM
                    (   SELECT
                          rowid rid,
                          ROW_NUMBER() OVER (PARTITION BY ID ORDER BY CASE
                                                                        WHEN flag = 'A' THEN
                                                                          3
                                                                        WHEN flag = 'X' THEN
                                                                          2
                                                                        WHEN flag = 'C' THEN
                                                                          1
                                                                      END
                                            ) rn
                        FROM
                          dt_dup
                  WHERE
                    rn > 1
    select * from dt_dup;HTH
    David
    Edited by: Bravid on Jun 30, 2011 8:12 AM

  • How to create duplicate records in end routines

    Hi
    Key fields in DSO are:
    Plant
    Storage Location
    MRP Area
    Material
    Changed Date
    Data Fields:
    Safety Stocky
    Service Level
    MRP Type
    Counter_1 (In flow Key figure)
    Counter_2 (Out flow Key Figure)
    n_ctr  (Non Cumulative Key Figure)
    For every record that comes in, we need to create a dupicate record. For the original record, we need to make the Counter_1 as 1 and Counter_2 as 0. For the duplicate record, we need to update Changed_Date to today's date and rest of the values will remain as is and update the counter_1 as 0 and counter_2 as -1. Where is the best place to write this code in DSO. IS it End
    routine?
    please let me know some bais cidea of code.

    Hi Uday,
    I have same situation like Suneel and have written your logic in End routine DSO as follows:
    DATA: l_t_duplicate_records TYPE TABLE OF TYS_TG_1,
          l_w_duplicate_record TYPE TYS_TG_1.
    LOOP AT RESULT_PACKAGE ASSIGNING <result_fields>.
        MOVE-CORRESPONDING <result_fields> TO l_w_duplicate_record.
        <result_fields>-/BIC/ZPP_ICNT = 1.
        <result_fields>-/BIC/ZPP_OCNT = 0.
        l_w_duplicate_record-CH_ON = sy-datum.
        l_w_duplicate_record-/BIC/ZPP_ICNT = 0.
        l_w_duplicate_record-/BIC/ZPP_OCNT = -1.
        APPEND l_w_duplicate_record TO  l_t_duplicate_records.
    ENDLOOP.
    APPEND LINES OF l_t_duplicate_records TO RESULT_PACKAGE.
    I am getting below error:
    Duplicate data record detected (DS ZPP_O01 , data package: 000001 , data record: 4 )     RSODSO_UPDATE     19     
    i have different requirement for date. Actually my requirement is to populate the CH_ON date as mentioned below:
    sort the records based on the key and get the latest CH_ON value with unique Plant,sloc, material combination and populate
    that CH_ON value for duplicate record.
    Please help me to resolve this issue.
    Thanks,
    Ganga

  • Data loader : Import -- creating duplicate records ?

    Hi all,
    does anyone have also encountered the behaviour with Oracle Data Loader that duplicate records are created (also if i set the option: duplicatecheckoption=externalid) When i am checking the "import request queue - view" the request parameters of the job looks fine! ->
    Duplicate Checking Method == External Unique ID
    Action Taken if Duplicate Found == Overwrite Existing Records
    but data loader have created new records where the "External Unique ID" is already existent..
    Very strange is that when i create the import manually (by using Import Wizard) exactly the same import does work correct! Here the duplicate checking method works correct and the record is updated....
    I know the data loader has 2 methods, one for update and the other for import, however i do not expect that the import creates duplicates if the record is already existing, rather doing nothing!
    Anyone else experiencing the same ?? I hope that this is not expected behaviour!! - by the way method - "Update" works fine.
    thanks in advance, Juergen
    Edited by: 791265 on 27.08.2010 07:25
    Edited by: 791265 on 27.08.2010 07:26

    Sorry to hear about your duplicate records, Juergen. Hopefully you performed a small test load first, before a full load, which is a best practice for data import that we recommend in our documentation and courses.
    Sorry also to inform you that this is expected behavior --- Data Loader does not check for duplicates when inserting (aka importing). It only checks for duplicates when updating (aka overwriting). This is extensively documented in the Data Loader User Guide, the Data Loader FAQ, and in the Data Import Options Overview document.
    You should review all documentation on Oracle Data Loader On Demand before using it.
    These resources (and a recommended learning path for Data Loader) can all be found on the Data Import Resources page of the Training and Support Center. At the top right of the CRM On Demand application, click Training and Support, and search for "*data import resources*". This should bring you to the page.
    Pete

  • BAPI_PO_CREATE1 condition type are creating duplicate records

    Hello Experts,
    Currently I am creating Purchase orders using BAPI_PO_CREATE1 . When I am passing Condition related records to the same BAPI , second line item onwards , it creates multiple records of same condition type .
    I have also looked into threads in SDN for the same , and they have suggested to create PO using BAPI_PO_CREATE and later use BAPI_PO_CHANGE to pass condition records. I have tried the same , but still second line item onwards it creates multiple records. Please tell me how do I resolve this issue.
    Thanks
    Trishna

    Hello All,
    This duplicate condition record creation may happen due to a setting in the MM configuration, where the system tries to pull in the history condition records ,based on the same set of condition record determination parameters.
    Please contact the MM functional consultant in your team for settings change in detrmination of condition records under " MM-Purchasing " section.
    Best Regards,
    Kumaar.S

  • Oracle.jbo.AttrValException: Attribute test in TestEO is required. (When trying to create duplicate Record)

    I am facing an issue when trying to create a Duplicate Record.
    Ist time when I create a record, its created Successfully.
    I have Attribute validations which should not accept duplicate values, So to check that I tried to create the record with same values to display proper warning message.
    After entering all the values (same values which i already entered in 1st record), when I tab out its showing as Red color border for that field, its expecting behaviour so no problem with that...
    Then I click on Submit or Next button, now it's showing pop-up with expected warning message along with unexpected Exception message.
    oracle.jbo.AttrValException: Attribute test in TestEO is required
    The test field is mandatory in EO, VO and .jsff.  Could any body please help me what i missed here.
    My JDEV version: 11.1.17.0
    Regards
    Gowreenath

    Hi Popz,
    Thanks for your reply. 
    I am using fnd:applicationsPanel next button as nextAction="next", so i didn't find immediate property in fnd:applicationPanel. 
    So, I tried 2 things based on your comment.
    1. nextPartialSubmit ="true"... this option is also not worked.
    2. In my Test attribute added immediate="true" this is also not worked.
    If you have any id how to set immediate property or related property in fnd:applicationPanel for nextAction.  Please let me know.
    Thanks
    Gowreenath

  • How to tune the query for duplicate records while joining the two tables

    hi,i am executing the query which has retrieving multiple tables,in which one of them has duplicate record,how to get single record

    Not enough info...subject says "tune" the query, message says "write" the query...and where is actual query that you had tried ?

  • Af:query : Delete duplicate records from results manually

    Hi
    I have an ADF page with af:quey on a view object.  I have created a viewcriteria to choose few attributes from the view object.
    The view object is created manually using a sql query, where the query has joins to various other tables (it has outer joins too).
    On submit, due to one to many relationship in the joins, i am getting duplicate rows in the results.
    I am currently using 11.1.1.7.0 jDeveloper (We can't upgrade to upper versions due to other constraints of the project).  I thought the property 'Selected in Query = false' on the view object attribute would fix this problem (to eliminate duplicate rows).  But, i guess, 11.1.1.7.0 don't seem to be supporting this option.
    Hence, i was thinking of manually deleting the duplicates from the results of the af:query before displaying it to the user.
    Please let me know, if there is a better way to solve the problem, if not, how can i manually remove duplicates from the resultset before displaying the results.
    I created a new QueryLIstener method to delete the duplicates, by executing the view object, but it retruns all the records without applying the criteria.  May be i am doing something wrong.
    Please suggest the best way.
    Thanks
    Pradeep

    Hi Frank,
    I do have a distinct in my sql but due to 1->M joins i get duplicate rows.  I can avoid it only if i can unselect the attributes in the select.
    I like to display the attributes to the user to choose the criteria (which adds as a predicate to the sql).  But I would like to unselect the 1-M attributes from the results, so i get distinct rows as i have mentioned distinct in the sql.
    Is there a way to restrict duplicate rows ?
    Thanks
    Pradeep

  • ABAP Query Shows duplicate records

    Hi
    I have a ABAP query which links the VIQMEL table(notifcation number) and the VBAK table(order & net value).  The report outputs as:
    Notification A   Order 10   SO value 1000
    Notification B   Order 10   SO value 1000
    Notification C   Order 10   SO value 1000
    Notification D   Order 10   SO value 1000
    The problem is the value is repeated 4 times when we only want it shown the once, is this possible to do and if so how can this be done?
    thanks
    Joe

    Desp09 wrote:
    Hi
    >
    > I have connected
    >
    > EKKO-EBELN to EKPO
    >
    >  EKPO -EBELN and EKPO-EBELP  to the same of EBAN
    >
    > also EKPO-BANFN and EKPO-BNFPO to the same of EBAN
    >
    > EBAN-BANFN and EBAN-BNFPO to VBEP
    >
    > VBEP-VBELN to VBAK-VBELn
    >
    > VBAK-VBELN to VBPA-VBELN
    >
    > VBPA-ADRNR to ADRC-ADDRNUMBER.
    >
    > This is the first time I have created a query so if you can kindly explain the logic of the error it would help in my future reports.
    >
    > Thanks
    > Priya
    Hi Priya,
    You can simplify the process if you make use of the LDB, which will fetch the same report with std LDB available in the system.
    You can define multiple infosets and  pull the fields for easier approach.
    Regards
    Shiva

  • Query displaying duplicate records

    I have written a query to display  materials having no purchasing group.
    Can any one plz tell me that why it is displaying duplicate results.
    Thanks
    aprr

    Apprr,
    You have given us no information to help you.
    Please list the Datasource:  Table Join, Direct Read, Logical database, or program.
    Please list any Table or Tables you are using.
    If you are using Table join(s), please list the joined tables and all linking fields.
    Rgds,
    DB49

  • QUERY - No Duplicate records from 2nd table ???

    Hi Experts,
    I really need help with this. I have 2 tables A and B. See below
    <b>A -
         B</b>
    X -
         XB1
    XB2
    XB3
    Y----
    YB
    Z----
    ZB
    I select a record from A and get its record from B and give it on the output. For entry X I have 3 records in Table B. I want the output to give only 1 record from B for X. It can be any record. How can this be achieved in Query ?
    Is there a special Join ? or can this be achieved by coding in Query ? If so how ?
    I really appreciate your help.
    Thanks !!

    First get the data from table A.
    select * from table (A) into table i_a.
    loop at i_a.
    select single * from table B into table i_b.
    move b reord to final internal table
    append final internal table.
    endloop.

  • Query - Remove duplicate records based on value of  one field

    Hi,
    Pleae see the data below,
    how to remove records when its count 0
    AND those records (name ) repeat with count > 0
    existing data
    name                       loc                            count
    aaa          a1          10
    aaa          a1          0
    bbb          b1          0
    ccc          c1          0
    dcc          d1          11
    dcc          d1          0
    required output
    name                       loc                            count
    aaa          a1          10
    bbb          b1          0
    ccc          c1          0
    dcc          d1          11
    remove these records -
    aaa          a1          0
    dcc          d1          0Thanks.

    i assume that loc always corresponds to name. So to find the rows to remain is just a simple group by
    with data as(
    select 'aaa' name,'a1' loc,10 count from dual union all
    select 'aaa','a1',0 from dual union all
    select 'bbb','b1',0 from dual union all
    select 'ccc','c1',0 from dual union all
    select 'dcc','d1',11 from dual union all
    select 'dcc','d1',0 from dual )
    select
      name
    , loc
    , max(count) cnt
    from data
    group by
      name
    , loc
    order by
      name
    , loc
    NAME     LOC     CNT
    aaa     a1     10
    bbb     b1     0
    ccc     c1     0
    dcc     d1     11to find the other is just a minus
    with data as(
    select 'aaa' name,'a1' loc,10 count from dual union all
    select 'aaa','a1',0 from dual union all
    select 'bbb','b1',0 from dual union all
    select 'ccc','c1',0 from dual union all
    select 'dcc','d1',11 from dual union all
    select 'dcc','d1',0 from dual )
    select name,loc,count from data
    minus
    select
      name
    , loc
    , max(count) cnt
    from data
    group by
      name
    , loc
    order by
      name
    , loc
    NAME     LOC     COUNT
    aaa     a1     0
    dcc     d1     0so a delete would be
    delete from data
    where
    (name,loc,count)
    in
    (select name,loc,count from data
    minus ..regards

  • SAP query returning duplicate records

    Hi all,
    I'll try to elaborate as much as possible so here goes:
    I have a query that I am trying to run in SAP B1 8.8 which is not returning the true set of results I am expecting.
    Essentially I am trying to filter by product based on delivery notes. I have the query as follows -
    SELECT count(*), sum(T0.[DocTotal]-T0.[VatSum]) as "Order Value"
    FROM ODLN T0  INNER JOIN OCRD T1 ON T0.CardCode = T1.CardCode
    WHERE DateName(mm,T0.DocDate) = 'November'
    and DateName(yyyy,T0.DocDate) = '2011'
    and (T1.[GroupCode] = '102' or T1.[GroupCode] = '107')
    This returns the correct result of 1320 row numbers and the given sum.
    When I try to break this query down further by product using the query below, the values are doubled, tripled, quadrupled etc and summed up to give a number that is extremely high.
    The code is as follows:
    SELECT distinct count (*), sum(distinct T0.[DocTotal]-T0.[VatSum]) as "Order Value" from DLN1 T1
    inner join ODLN T0 on T0.DocEntry = T1.DocEntry
    Inner join OITM T2 on T2.ItemCode = T1.ItemCode
    inner join OCRD T3 on T0.CardCode = T3.CardCode
    WHERE DateName(mm,T0.DocDate) = 'November'
    and DateName(yyyy,T0.DocDate) = '2011'
    and (T3.[GroupCode] = '102' or T3.[GroupCode] = '107')
    and (T2.[ItmsGrpCod] = '108' or T2.[ItmsGrpCod] = '112' or T2.[ItmsGrpCod] = '115')
    This also returns 1819 rows where there should be less based on the product.
    Please let me know if I am not explaining myself well or need further clarification.
    Thanks!

    hi,
    try to run this code from your SQL management studio
    SELECT     SUM(T0.DocTotal - T0.VatSum) AS [Order Value], T0.DocTotal - T0.VatSum AS [Order Value], T0.DocNum, T0.DocDate, T0.CardCode, T0.CardName, T0.DocTotal,
                          T1.ItemCode, T1.Dscription, T1.Quantity, T2.GroupCode, T3.ItmsGrpCod
    FROM         ODLN AS T0 INNER JOIN
                          DLN1 AS T1 ON T0.DocEntry = T1.DocEntry INNER JOIN
                          OCRD AS T2 ON T0.CardCode = T2.CardCode INNER JOIN
                          OITM AS T3 ON T1.ItemCode = T3.ItemCode
    GROUP BY T0.DocTotal - T0.VatSum, T0.DocNum, T0.DocDate, T0.CardCode, T0.CardName, T0.DocTotal, T1.ItemCode, T1.Dscription, T1.Quantity, T2.GroupCode,
                          T3.ItmsGrpCod
    HAVING      (T2.GroupCode = 102 OR
                          T2.GroupCode = 107) AND (T3.ItmsGrpCod = 108 OR
                          T3.ItmsGrpCod = 112 OR
                          T3.ItmsGrpCod = 115) AND (T0.DocDate BETWEEN CONVERT(DATETIME, '2011-11-01 00:00:00', 102) AND CONVERT(DATETIME, '2011-11-17 00:00:00', 102))
    regards,
    Fidel

  • Duplicate records in Fact Tables

    Hi,
    We are using BPC 7.0 MS SP7. BPC created duplicate records in WB and Fac2 tables. We faced similar issue before and the solution was to reboot the server and cleanup the additional data created. I think it should not be an issue with the script logic files we have. We had the issue across all applications. Data is fine now after the server reboot and running the same logic files.  I want to know if any one faced this issue and if there is any solution other than reboot. I appreciate your help.
    Thanks
    Raj

    Hi Sorin,
    I know this thread is rather old, but i have a problem which is pretty much related to this thread and appreciate if you could assist me. I have client running on 7.0 MS who has been using it for the past 3 years.
    It is a heavily customized system with many batch files running daily to update dimensions, copy data and sort. And Yes we do use custom packages that incorporates stored procedures.
    Recently, with no change in environment, we encountered our factwb ballooning up out of no where. fact table only contains less then 1 gb data but, factwb has 200 gb data and practically paralayzed the system. There is also equilavent 300 gb increase in the log files.
    We are not able to find out what caused this? Or if even the 200gb records in wb are even valid records that are duplicated. Is there a way to troubleshoot this?

  • Re: ICR - Duplicate records in FBICRC003A

    Hi Ralph,
    It seems that FBICA3 creates duplicate records in FBICRC003A if assigned items were subsequently unassigned. I believe this is due to program error. These are the steps that I went through to get this error:
    1) Post cross-company FI document (FB01)
    2) Run FBICS3
       FBICRC003A records 1 and 2 were created with RTYPE = 'blank'
    3) Run FBICA3
       FBICRC003A records 3 and 4 were created with RTYPE = '2'
    4) Run FBICR3 and unassign the items
       FBICRC003A records 3 and 4 were changed with RTYPE = '1'
       ZUONR was set to the record number of the unassigned record (ie: 1 or 2)
    5) Run FBICS3
    6) Run FBICA3
       FBICRC003A records 3 and 4 were changed with RTYPE = '2'
       Duplicate FBICRC003A records 5 and 6 were created with RTYPE = '2'
    Are you aware of this issue ? FYI, OSS notes 863630 and 1062292 are both implemented in our system.
    Thank you.
    Regards,
    Siong

    Hello Siong,
    This is not a known issue. I suggest that you create a service ticket.
    Best regards,
    Ralph

Maybe you are looking for

  • Batch processing of white balance with RAW photo's in v.5

    Hi, I have the plugin for RAW to use with Photoshop Elements 5.0 but there doesn't seem to be a way to correct a whole group of photos in raw for white balance or some other correction in a batch. Maybe I'm missing something or maybe this can't be do

  • 'DBIF_RSQL_INVALID_RSQL' short dump

    Hello All, I have a dynamic where_clause in a select query. ie its created at runtime. I get a short dump 'DBIF_RSQL_INVALID_RSQL' at the select statement. The reason shown in ST22 is: Possible errors: o The maximum size of an SQL statement has been

  • Silent Install Firefox 29 Windows

    I've been scouring the internet for a while looking for a way to do a silent install of Firefox via command-line. As I have come to find out, the -ms and /INI methods only work in much older versions of Firefox. When I try the -ms silent install, the

  • Oracle BI Scheduler service inactive

    Hi all, when I try to save an Ibot, I get the following error: Oracle BI Scheduler Error: [nQSError: 76012] The Scheduler client connection was closed. Impactos del error Códigos de error: GYFPI8RN I have the Scheduler Service running and the Present

  • Feh showing black images when opening certain .bmp files

    Hi all, I've been using feh (I'm using imagemagick too) from quite a bit and today I noticed it shows plain black images when opening certain .bmp files, those files are obtained from a Java WebService and they may not be correcty formed, still firef