How to enforce unique records in a Qualified Table

Our main table is Customers.  We have a qualified table that stores Company Code information.  We need to ensure that each customer in the main table has only one record per company code in the Company Code qualifeid table. 
Company ABC can be linked to Company Code 1, Company Code 2, Company 3 (three records in the Company Code qualified table)
Company ABC cannot be linked to Company Code 1, Company Code 2, Company 2 (three records in the Company Code qualified table where two are duplicates)
Company code is a the only Non-Qualifer field in the Company Code qualifeid table.  I have set field a Unique in the console but i can still add duplicate records.

Hi Tammi,
Don't expect to get many answers from this forum, which is Business Process Expert General.
Your question sounds more like an ABAP problem.  Actually, it seems to have nothing to do with SAP; it really sounds more like a general programming problem.
You will probably have better luck in one of the ABAP forums, maybe
ABAP Development
Good Luck,
DB49

Similar Messages

  • Force one unique record in a qualified table in data manager

    Our main table is Customers. We have a qualified table that stores Company Code information. We need to ensure that each customer in the main table has only one record per company code in the Company Code qualifeid table.
    Company ABC can be linked to Company Code 1, Company Code 2, Company 3 (three records in the Company Code qualified table)
    Company ABC cannot be linked to Company Code 1, Company Code 2, Company 2 (three records in the Company Code qualified table where two are duplicates)
    Company code is a the only Non-Qualifer field in the Company Code qualifeid table. I have set field as Unique in the console but i can still add duplicate records

    Tammi,
    Choosing Qualified table is wise option, when we really want to maintain possible duplicate data!
    otherwise Normal Lookup table would be ideal option.
    befor we proceed further, cud u pls explain me the unique factor to choose qualified in ur Business requirement?
    thanks
    Alexander

  • How to enforce uniqueness to my database table

    Hello
    One of my database will be updated based on two columns c1 and c2.
    Previous i created an index on these two columns. But forgot to enforce uniqueness. Now my table has some duplicate data.Means columns c1 and c2 contained same value for more than one record. Now i deleted all the duplicate data. And i also want to allow any duplicate data into my table in future. While i was creating an unique index on these two columns it is not allowing and prompting errors. Can someone guide me how to enforce uniqueness for my table

    And i also want to allow any
    duplicate data into my table in future.
    Can someone guide
    me how to enforce uniqueness for my tableSo you want to enforce uniqueness or not?
    Look at alter table add constraint clause in sql reference manual.
    http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14200/clauses002.htm#g1053592
    In case you have duplicate values you can
    "ENABLE NOVALIDATE ensures that all new DML operations on the constrained data comply with the constraint. This clause does not ensure that existing data in the table complies with the constraint and therefore does not require a table lock."
    Gints Plivna
    http://www.gplivna.eu

  • How to create a unique group field in Qualifier table

    Hi,
    I am trying to use a qualified table in Product maintable like "Site items".
    However I would like to have two non-qual field in that like 'Plant' and 'item#' which should be an unique combination.
    I have tried to create a table(X) with the above two fields with display and another table (Y)that uses the table X for lookup (site-item) so as to make it dispaly and unique both. However when i am using this Y table as a lookup for the qualified table(site items) , not able to load data.
    Error message:
    "Import failed. Unable to find source column index for 'Site Item ID' field"
    Another issue also not able to populate data for the qualified flds even if when able to load data without making a group unique field for this qualified table.
    In MDM 5.5 sp4. Thanks in advance for any tips.
    -reo

    Hi Beena,
                    In the above post of mine I suggested you to use STRING data type.
    As you are telling that when creating TABLE MAINTANENCE GENERATOR you are
    getting an error saying that " Datatype STRING is not supported ". I tried this, what you said is right.
                      After your reply I did research on this and I also met my heads,
    The conclusion is <b>IT IS NOT POSSIBLE TO GENERATE TABLE MAINTANENCE</b> for the table which is using STRING type. At last I can give you one suggestion, i.e., In the short text of that field write STANDARD TEXT name.So that whenever you want, go to this standard text, but the problem is you have to maintain it manually.
    <b>Reward all helpful answers.</b>
    Regards,
    V.Raghavender.

  • How to process each records in the derived table which i created using cte table using sql server

    I want to process each row from the CTE table I created, how can I traverse from first row to second row and so on....
    how to process each records in the derived table which i created using  cte table using sql server

    Ideally you would be doing a set based processing rather than traversing row by row as thats more efficient. To answer it specific to your scenario we may need more info. Can you explain with some sample data your exact requirement?
    Please Mark This As Answer if it solved your issue
    Please Mark This As Helpful if it helps to solve your issue
    Visakh
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • How to check the records in Master Data Table?

    Hi,
       I am trying to load the Master Data Table using the Flat File.Now how to check the records in Master Data Table?
    I done the following way:
    Info Provider->Info Object->Right Click->Display Data or Maintain Master Data
    But it's not showing the records.It's asking like CID from......To......
                                                                        CID(SID)from.............To.......
                                                                         here CID means customer id(characteristic).
    and showing some settings.
    Please guide me.
    Thanks & Regards

    Hi Sri,
    Go to T- code RSD1 and type your info object name and open the P- table in the infoobject then select execute symbol to see the updated  data in to master data info object.
    regards
    sap

  • Help needed to get unique record from an internal table

    Hi Everybody,
    I have to get unique record from an internal table. i know we can use read statement with key condition .
    But the problem is i have to use some relational operators like GE or LE.
    eg
    read table itab into wa with key width GE itab-widthfrom
                                                       width LE itab-widthto
                                                       machno eq itab-machno.
    Its giving me error when I use the operators GE , LE.( I think since it can't find a unique record with those relational
    operators in the with key statement)
    Is there any other way to get unique record from internal table without using the loop?
    Thanks,
    Sunny

    Using the read statement you will need some kind of loop. For example.
    DO.
    READ TABLE......
      WITH KEY ......
                        READ = SPACE
    IF SY-SUBRC EQ 0
      TABLE-READ = 'X'.
      MODIFY TABLE
      ADD 1 TO W_FOUND.
    ELSE
      EXIT.
    ENDIF
    ENDDO.
    IF W_FOUND EQ 1.
    ...record is unique.
    ENDIF.

  • How to Insert a record in a database table in debugging mode in production

    Hi,
    How to Insert a record in a database table in debugging mode in production ?
    Waiting for kind response.
    Best Regards,
    Padhy
    Moderator Message : Duplicate post locked.
    Moderator message : Warning. Don't create multiple threads for same question.
    Edited by: Vinod Kumar on May 12, 2011 11:02 AM
    Edited by: Vinod Kumar on May 12, 2011 11:04 AM

    Hi Senthil,
    Regards,
    Phani Raj Kallur
    Message was edited by: Phani Raj Kallur

  • How to retrieve unique records with more than one column

    I have a table sps_prod as described below -
    POGNAME VARCHAR2(1500)
    INDEX#VERSION VARCHAR2(200)
    POG_MODEL_STATUS VARCHAR2(100)
    POG_LAYOUT_TYPE VARCHAR2(500)
    POG_MARKET_SPECIFIC VARCHAR2(500)
    POG_CONTACT_NUMBER VARCHAR2(100)
    AREA_SUPPORTED VARCHAR2(500)
    POG_COMMENTS VARCHAR2(1500)
    POG_FOOTER_COMMENTS VARCHAR2(1500)
    POG_ELECTRICAL_LIST_1 VARCHAR2(1500)
    POG_ELECTRICAL_LIST_2 VARCHAR2(1500)
    POG_CARPENTRY_1 VARCHAR2(1500)
    POG_CARPENTRY_2 VARCHAR2(1500)
    INSTALLATION_INSTRUCTION_1 VARCHAR2(1500)
    INSTALLATION_INSTRUCTION_2 VARCHAR2(1500)
    FIXTURE_REORDER_NUMBER VARCHAR2(200)
    FIXTURE_ID VARCHAR2(200)
    FIXTURE_NAME VARCHAR2(500)
    FIXTURE_IMAGE VARCHAR2(500)
    PART_REORDER_NUMBER_9 VARCHAR2(500)
    PART_FIXTURE_ID_9 VARCHAR2(500)
    PART_FIXTURE_NAME_9 VARCHAR2(500)
    PART_FIXTURE_IMAGE_9 VARCHAR2(500)
    UPC VARCHAR2(50)
    ITEM_NUMBER VARCHAR2(50)
    DESCRIPTION VARCHAR2(700)
    MERCH_TYPE VARCHAR2(20)
    HEIGHT VARCHAR2(100)
    WIDTH VARCHAR2(100)
    DEPTH VARCHAR2(100)
    CREATE_TS DATE
    There are 4 millions records in it and many with the same combination of POGName,Index#Version,POG_Model_Status,POG_Layout_Type,POG_Market_Specific, POG_Contact_Number and Fixture_Name. How do I retrive records with all the columns above but with unique fixture_name and reorder_number combination. There are no keys defined on the table.
    I guess this is a simple problem but the fact that I am trying to retrieve all the columns is stumbling me.
    Thanks in advance.

    Hi,
    Sanders_2503 wrote:
    ... There are 4 millions records in it and many with the same combination of POGName,Index#Version,POG_Model_Status,POG_Layout_Type,POG_Market_Specific, POG_Contact_Number and Fixture_Name. How do I retrive records with all the columns above but with unique fixture_name and reorder_number combination. I don't see a column called reorder_number. Do you mean fixture_reorder_number or part_reorder_number_9?
    So you want only one row for each distinct combination of fixture_name and some other column (I'll assume that's fixture_reorder_number). Does it matter which row? They won't necessarily have the same values for the other columns.
    The query below returns the one with the first pogname (in sort order):
    WITH     got_r_num     AS
         SELECT  pogname, index#version, pog_model_status, pog_layout_type
         ,     pog_market_specific, pog_contact_number, fixture_name
         ,     ROW_NUMBER () OVER ( PARTITION BY  fixture_name
                                   ,                    fixture_reorder_number
                             ORDER BY        pogname
                           )         AS r_num
         FROM    sps_prod
    SELECT  pogname, index#version, pog_model_status, pog_layout_type
    ,     pog_market_specific, pog_contact_number, fixture_name
    FROM     got_r_num
    WHERE     r_num     = 1
    ;If there happens to be a tie (that is, two or more rows with the same fixture_name, fixture_number, and first pogname) then one of the will be chosen arbitrarily.
    Instead of "ORDER BY pogname", you can ORDER BY any other columns or expressions, but you must have an analytic ORDER BY clause. You can make it "ORDER BY NULL" if you really want to pcik an arbitrary row.
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only), and also post the results you want from that data (or a couple of examples of acceptable results).
    Explain, using specific examples, how you get those results from that data.
    Always say which version of Oracle you're using.

  • How to enforce unique primary key constraint in xsd

    Hi,
    I'm trying to enforce primary key constraint in xsd. I'm using the following xsd to generate the xmls .
    <?xml version="1.0" encoding="UTF-8"?>
    <!--<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
    elementFormDefault="qualified" attributeFormDefault=
    "unqualified">-->
    <xs:schema targetNamespace="http://TBD-URI" elementFormDefault="qualified"
    attributeFormDefault="unqualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
          <xs:element name="Employees">
                <xs:annotation>
                      <xs:documentation>Contains All Employee information</xs:documentation>
                </xs:annotation>
                <xs:complexType>
                      <xs:sequence>
                            <xs:element name="Employee" maxOccurs="unbounded">
                                  <xs:complexType>
                                        <xs:sequence>
                                              <xs:element name="Empno" type="xs:int" />
                                              <xs:element name="Ename" type="xs:string" />
                                              <xs:element name="Sal" type="xs:float" />
                                              <xs:element name="Deptno" type="xs:int" />
                                        </xs:sequence>
                                  </xs:complexType>
                            </xs:element>
                      </xs:sequence>
                </xs:complexType>
                <xs:key name="PK_Employee_Empno">
                      <xs:selector xpath=".//Employee" />
                      <xs:field xpath="Empno" />
                </xs:key>
          </xs:element>
    </xs:schema>Here's the generated XML
    <?xml version="1.0" encoding="UTF-8"?>
    <Employees xmlns="http://TBD-URI"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://TBD-URI file:/C:/Documents%20and%20Settings/ctsuser/workspace/JAXB/src/test/resources/TEST.xsd">
        <Employee>
            <Empno>0</Empno>
            <Ename>Ename0</Ename>
            <Sal>0</Sal>
            <Deptno>0</Deptno>
        </Employee>
        <Employee>
            <Empno>0</Empno>
            <Ename>Ename1</Ename>
            <Sal>0</Sal>
            <Deptno>0</Deptno>
        </Employee>
    </Employees>The generated XML allow the same Empno on which the primary key constraint has been defined. I'll appreciate if someone can provide pointers on how to enforce this constraint so that it doesn't allow the same Empno to be repeated.
    Thanks

    Could you please append your solution?
    There is a chance that someone in the future may have a similar problem, and might find this entry. As the entry exists now, all they will find out is that you solved it -- which does not help them at all.

  • How to restrict the records in source qualifier?

    What is your source system?If it's Oracle, you could use the following trick:Wrap your original SQL query (which retrieves all the columns which you need plus "ROWNUM AS row_num") into a "common table expression" which returns records based on this "row_num", like this: SELECT a1, a2, a3,... an FROM(select *, rownum as row_num FROM tab1, tab2 WHERE...)WHERE row_num between 11 and 15 Other than that I would recommend you insert an Expression transformation into your mapping right after the Source Qualifier. Within this EXP, define a variable port "v_rownum" of type BigInt with this expression:  v_rownum + 1Then define an output port ROWNUM of type BigInt and set it to this expression:  v_rownumForward all the data from the SQ plus "ROWNUM" from the EXP into a Filter.Define two mapping parameters $$FIRST_ROW and $$LAST_ROW of type BigInt (if possible, I can't try myself at this moment).Set the Filter expression like this:  ROWNUM >= $$FIRST_ROW AND ROWNUM <= $$LAST_ROW This works for all sorts of source systems. Regards,Nico

    I Have loading 10 record on first run , inserted in DB,and again load 5 records in second run in this restrict the first 10 records in source qualifier and took only 5 records to the target?

  • How to create unique combined fields in Qual table

    Furhther clarification of my prev question:
    Can I make a unique combined field for a Qualified table. If so how?
    How  the unique field option for combine fields in Main table can be enabled?
    This is for MDM5.5 sp4
    Thanks in advance for the help
    -reo

    Hi,
    Please go through this link,
    http://wiki.sdn.sap.com/wiki/display/ABAP/CreationofView+Cluster
    Hope it helps you,
    Regards,
    Abhijit G. Borkar

  • Creates new record in the Qualifier Table while importing.

    Hi Guys,
    When sending new bank details to MDM, then MDM creates a new record in the Bank Detail qualified lookup table. This is OK. But when sending exactly same bank details again to MDM, then MDM creates again a new record in the Bank Detail qualified lookup table. I would expect that it
    first performs the Automap and only if it cannot find a value, it will add a new record!
    Can you guys help me out from this?
    Best Regards
    Devaraj PK

    Hi Devaraj,
    Please check these configuration options of Import Manager
    1. Default Qualified Update - The default setting for whether incoming source subrecords either are appended to, completely replace,or update the set of existing qualified links of a qualified lookup field when updating existing records.
    2. Default Matching Qualifiers - The default setting for which qualifiers to use as matching qualifiers when matching existing qualified links when updating existing records.
    Any operation on the qualified tables will depend on the above two options.
    Reward if found useful
    Regards,
    Jitesh Talreja

  • Extracting unique records from two different tables record

    Hello,
    In the following code of two different tables www.testing.com exists in both tables. I want to compare two different columns of the two different tables to get unique records.
    SQL> select unique(videoLinks) from saVideos where sa_id=21;
    VIDEOLINKS
    www.testing.com
    SQL> ed
    Wrote file afiedt.buf
      1* select unique(picLinks) from saImages where sa_id=21
    SQL> /
    PICLINKS
    test
    test14
    www.hello.com
    www.testing.comThanks & best regards

    Unfortunatly you didn't mention the expected output. I guess it would be the one line
    "www.testing.com"
    in that case simply join the two tables.
    select *
    from saVideos v
    join saImages i on i.sa_id = v.sa_id and i.picLinks = v.videoLinks
    where v.sa_id=21;If needed then you could change the select list to retrieve only distinct values.
    select unique v.sa_id, v.videolinks
    from saVideos v
    join saImages i on i.sa_id = v.sa_id and i.picLinks = v.videoLinks
    where v.sa_id=21;I usually avoid distinct/unique whereever possible. This requires the database to do a sort and makes the query slow.
    Edited by: Sven W. on Feb 10, 2011 1:55 PM

  • How to insert null record (some col) in table using loop

    Hi,
    How to insert null record (for some columns) in table using loop.
    sample data of x_tab
    order_id order_name
    231 xxx
    123
    345
    111 vvvv
    Thanks,
    Lakshman
    Edited by: kolipaka on Jul 5, 2012 1:37 PM

    You have a table
       CREATE TABLE tab (
          col1  NUMBER,
          col2  NUMBER,
          col3  NUMBER,
          col4  NUMBER
          col5  NUMBER)Now you insert:
       INSERT INTO tab (col2, col4) VALUES (5, 7);col1, col3 and col5 are NULL by default (there is no DEFAULT clause for these columns so they are NULL).

Maybe you are looking for

  • Unit of measure is not an ISO code

    Dear Expert, Unit of measure M has ISO code MTR and Dimension length.  the UOM is in sync with ECC6 . However when trying to order from srm it bounces back with error message Unit of Measure M is not an ISO code.  Further checking in CUNI shows that

  • ABAP Mapping example????

    Hi All, Can any one give me example of some complicated ABAP mapping, or refer me some existing document on SDN? Where source name of node and target name of nodes is different and source structure and target structure is different. Because "How To U

  • Scheduling a signature update through MC

    How can you schedule a signature update to take place for example at 3:00 in the morning? When I do a signature update through MC, I select the sensor I want to update then click continue and it updates at that time. Can I schedule this somehow? I am

  • RMI Class Loader

    Hi, i Have an application which uses RMI and I need to change at runtime the codebase property to point to a local directory which is not on the CLASSPATH environment variable, so the JVM default Class Loader cannot load the classes located at that l

  • IPhone replacement unit (Black Box unit)

    I just bought an iPhone 4s, when i activated the handsfreespeaker(loud speaker) was not working,it was not even 24 hours since i bought, i went to the store they also confirmed it arrived with broken speaker, they gave me an option to replace my iPho