How to give unique key?

am working with abap dictionary. i have an independent field in my child table that is supposed to be not null and unique. Instead of making it as a primary key field, is there any other way to set these constrains to that field?

If unique you can go for primary key.
How are you going to update this table ?
if its through maintennace then add a validation in table maintenance events. Or try changing the screen layout property as required ( not sure abot this )

Similar Messages

  • BAPI FUNCTION MODULE  BAPI_ACC_DOCUMENT_POST : How to give posting keys?

    Hi ,
    i am using BAPI_ACC_DOCUMENT_POST to post accounting document. This accounting document is used to post amount from reconcilation account to bank GL account.the table parameter am using is ACCOUNTGL (in the function module)Now i want to give posting keys to the function module parameter. can anyone please guide me how to give posting keys?
    Edited by: Santhosh Kumar  Cheekoti on Dec 18, 2008 7:48 AM

    Hi,
    As pointed out in one of the previous post, posting key will be decided by the BAPI depending on the sign of the amount. Have a look at bthe following code:-
    DATA: doc_header LIKE BAPIACHE09,
          criteria   LIKE BAPIACKEC9 OCCURS 0 WITH HEADER LINE,
          doc_item   LIKE BAPIACGL09 OCCURS 0 WITH HEADER LINE,
          doc_ar     LIKE BAPIACGL09 OCCURS 0 WITH HEADER LINE,
          doc_values LIKE BAPIACCR09 OCCURS 0 WITH HEADER LINE,
          return     LIKE bapiret2 OCCURS 0 WITH HEADER LINE,
          extension1 like BAPIACEXTC occurs 0 with header line,
          obj_type   LIKE bapiache08-obj_type,
          obj_key    LIKE bapiache02-obj_key,
          obj_sys    LIKE bapiache02-obj_sys,
          docnum     LIKE bkpf-belnr.
    *DATA:
    *       ITEMNO_ACC     POSNR_ACC
    *       FIELDNAME     FIELDNAME
    *       CHARACTER     ACPI_RKE_CRIGEN
    * Fill Document Header
    doc_header-bus_act = 'RFBU'.
    doc_header-bus_act = 'RMRP'.
    *doc_header-bus_act = 'SD00'.
    doc_header-username = sy-uname.
    doc_header-header_txt = 'TEST BOC BAPI POSTING'.
    doc_header-comp_code = 'IN10'.
    doc_header-compo_acc = 'FICA'.
    doc_header-doc_date = '20060127'.
    doc_header-pstng_date = sy-datlo.
    doc_header-doc_type = 'SA'.
    ** Fill Line 1 of Document Item
    *doc_item-itemno_acc = '1'.
    *doc_item-gl_account = '0000500001'.
    *doc_item-pstng_date = sy-datum.
    *doc_item-item_text = 'TEST POSTING DEBIT ITEM'.
    *doc_item-costcenter = ''.
    *doc_item-quantity = '1'.
    *doc_item-base_uom = 'ST'.
    *APPEND doc_item.
    *CLEAR doc_item.
    ** Fill Line 2 of Document Item
    *doc_item-itemno_acc = '2'.
    *doc_item-customer = '0000000016'.
    *doc_item-gl_account = '0000000016'.
    *doc_item-pstng_date = sy-datlo.
    *doc_item-item_text = 'TEST POSTING CREDIT ITEM'.
    *APPEND doc_item.
    *CLEAR doc_item.
    doc_ar-itemno_acc = '1'.
    doc_ar-gl_account = '0000500001'.
    doc_ar-pstng_date = sy-datum.
    doc_ar-item_text = 'TEST POSTING DEBIT ITEM'.
    doc_ar-costcenter = ''.
    doc_ar-quantity = '1'.
    doc_ar-base_uom = 'ST'.
    APPEND doc_ar.
    CLEAR doc_ar.
    * Fill Line 2 of Document Item
    doc_ar-itemno_acc = '2'.
    doc_ar-customer = '0000000016'.
    doc_ar-gl_account = '0000000016'.
    doc_ar-pstng_date = sy-datlo.
    doc_ar-item_text = 'TEST POSTING CREDIT ITEM'.
    doc_ar-stat_con = ' '.
    doc_ar-costcenter = '0000201681'.
    APPEND doc_ar.
    CLEAR doc_ar.
    * Fill Line 1 of Document Value.
    doc_values-itemno_acc = '1'.
    doc_values-currency_iso = 'INR'.
    doc_values-amt_doccur = '200.00'.
    doc_values-currency = 'INR'.
    doc_values-CURR_TYPE = '00'.  "Doc currency
    APPEND doc_values.
    CLEAR doc_values.
    * Fill Line 2 of Document Value
    doc_values-itemno_acc = '2'.
    doc_values-currency_iso = 'INR'.
    doc_values-amt_doccur = '200.00-'.
    doc_values-currency = 'INR'.
    doc_values-curr_type = '00'.  "Doc currency
    APPEND doc_values.
    CLEAR doc_values.
    * Add tax code in extension1 table.
    extension1-field1 = 'BAPI CALL'.
    APPEND EXTENSION1.
    * Fill CRITERIA for CO-PA
    *refresh criteria.
    *criteria-ITEMNO_ACC = '1'.
    *criteria-FIELDNAME     = 'ARTNR'.
    *criteria-CHARACTER     = '000000000001312251'.
    *Append criteria.
    *criteria-ITEMNO_ACC = '1'.
    *criteria-FIELDNAME     = 'WERKS'.
    *criteria-CHARACTER     = 'IN91'.
    *Append criteria.
    *criteria-ITEMNO_ACC = '1'.
    *criteria-FIELDNAME     = 'KNDNR'.
    *criteria-CHARACTER     = '0000000016'.
    *Append criteria.
    *criteria-ITEMNO_ACC = '1'.
    *criteria-FIELDNAME     = 'FKART'.
    *criteria-CHARACTER     = 'ZIN2'.
    *Append criteria.
    *criteria-ITEMNO_ACC = '1'.
    *criteria-FIELDNAME     = 'KAUFN'.
    *criteria-CHARACTER     = '0000000633'.
    *Append criteria.
    *criteria-ITEMNO_ACC = '1'.
    *criteria-FIELDNAME     = 'KDPOS'.
    *criteria-CHARACTER     = '000010'.
    *Append criteria.
    *criteria-ITEMNO_ACC = '1'.
    *criteria-FIELDNAME     = 'VKGRP'.
    *criteria-CHARACTER     = '009'.
    **Append criteria.
    * All tables filled - now call BAPI.
    CALL FUNCTION 'BAPI_ACC_DOCUMENT_CHECK'
      EXPORTING
        documentheader       = doc_header
      IMPORTING
        OBJ_TYPE             = doc_header-obj_type
        OBJ_KEY              = doc_header-obj_key
        OBJ_SYS              = doc_header-obj_sys
      TABLES
    *    criteria             = criteria
        accountgl            = doc_item
        ACCOUNTRECEIVABLE    = doc_ar
        currencyamount       = doc_values
        return               = return
        EXTENSION1           = EXTENSION1.
    LOOP AT return WHERE type = 'E'.
      EXIT.
    ENDLOOP.
    CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
      EXPORTING
        documentheader       = doc_header
      IMPORTING
        OBJ_TYPE             = doc_header-obj_type
        OBJ_KEY              = doc_header-obj_key
        OBJ_SYS              = doc_header-obj_sys
      TABLES
    *    criteria             = criteria
        accountgl            = doc_item
        currencyamount       = doc_values
        return               = return
        EXTENSION1           = EXTENSION1.
    LOOP AT return WHERE type = 'E'.
      EXIT.
    ENDLOOP.
    IF sy-subrc EQ 0.
      WRITE: / 'BAPI call failed - debug and fix!'.
    ELSE.
      CLEAR return.
      REFRESH return.
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    * EXPORTING
    *   WAIT          =
       IMPORTING
         return        = return.
      WRITE: / 'BAPI call worked!!'.
      WRITE: / doc_header-obj_key, ' posted'.
    ENDIF.
    Regards
    Raju Chitale
    Edited by: Raju Chitale on Dec 18, 2008 8:31 AM

  • How to use Unique key constraint in EJB

    Hi All,
    I am using an entity bean to create my table in MySQL4.1.13
    I have a table called user which has userid,username,password as its columns.
    The userid is a primary key over here.
    But I want the user name to be unique.
    I.e if a user with the name 'Adrian' is present in the database then another user with this user name should not be created.
    I have been told that you can configure a unique key in jbosscmp-jdbc.xml using insert-after-ejb-post-create.
    But i dont know how to use it.
    Can anyone give me a sample code for using this.
    Any help would be appreciated.
    Thanks
    P2

    Please explain your problem better. Really can't figure what you are trying to do.....
    choosing which sql statement to use at runtime
    or creating dynamic sql statement at runtime
    which??
    Regards

  • How to manage unique key ?

    My table has a unique key ... but OWM prevents version enabling
    of a table which has a unique key.
    Before version enabling the unique key means: a same value
    cannot be used twice.
    After version enabling it should mean: a same value cannot be
    used twice at the same time .
    How to manage such a situation ?
    Thank you.

    Workspace Manager currently does not support versioning of tables
    that contain unique constraints. There is some confusion in
    defining what is unique in a multi-version system. Is it unique
    in a branch of versions or does it have to be unique in the
    entire system?
    We plan to address this in the next release. In the meantime, we
    welcome your suggestions. Also, I am interested in knowing the
    application context in which you are using Workspace Manager.
    thanks
    Arun

  • How to control unique key target table mapping!

    Hi all,
    Is there any way to map a source table to target,the source table contains some duplicate rows,and only one of them is needed for the target table,can OWB manage to insert only one of these duplicate rows and ignore other rows according to an unique key and continue to execute the map?
    Thanks in advance!

    If you have duplicates and want to filter them out, try creating a view on the target table and use the rownum() function in the view.
    Than in your mapping use this view as you source and put a filter on it where the rownumber = 1. This will only select the unique records.

  • How to create unique key column in ROLAP fact table?

    Hi all,
    Is there a way to create a single column primary key (or unique index) on my ROLAP cube (and fact tables) in OWB? if so, what I should do in my mappings?
    Thanks!
    - Andrew

    Have you all conformed dimensions between the two facts?

  • How to Check Unique key for a Column in Many to Many relations ship

    senario
    Master Table
    CODE DESC
    ACT1 DESC1
    ACT2 DESC2
    ACT3 DESC3
    Detail Table
    CODE REFF_CODE DESC PRIORITY
    SACT1 ACT1 SDESC1 1
    SACT2 ACT1 SDESC2 2
    SACT3 ACT1 SDESC3 3
    SACT4 ACT1 SDESC4 4
    SACT5 ACT1 SDESC5 5
    SACT6 ACT2 SDESC6 1
    SACT7 ACT2 SDESC7 2
    SACT8 ACT2 SDESC8 3
    SACT9 ACT2 SDESC9 4
    SACT10 ACT3 SDESC10 1
    SACT11 ACT3 SDESC11 2
    SACT12 ACT3 SDESC12 3
    OUTPUT REQUIRED
    PRIORITY COLUMN MUST BE UNIQUE FOR EACH MASTER RECORD IN DETAIL TABLE...
    PLS HELP ME IN THIS REGARDS,

    I am a little bit slow today ...
    You want achieve this being updated in detail table ?
    Detail Table
    CODE REFF_CODE DESC PRIORITY
    SACT1 ACT1 SDESC1 1
    SACT2 ACT1 SDESC2 1
    SACT3 ACT1 SDESC3 1
    SACT4 ACT1 SDESC4 1
    SACT5 ACT1 SDESC5 1
    SACT6 ACT2 SDESC6 2
    SACT7 ACT2 SDESC7 2
    SACT8 ACT2 SDESC8 2
    SACT9 ACT2 SDESC9 2
    SACT10 ACT3 SDESC10 3
    SACT11 ACT3 SDESC11 3
    SACT12 ACT3 SDESC12 3
    ?

  • How to findby unique key

    Hi,
    for CMP, we have findByPrimaryKey, I'm wonding how to implement a findByUniqueKey.
    Can any idea?
    Thanks
    John
    Toronto

    ejb-ql: SELECT object(o) from ejbTable as o WHERE o.a=A AND 0.b=BThanks lots, but can u tell which one
    A.WHERE o.a=A AND 0.b=B
    B.WHERE o.a=?1 AND 0.b=?2
    is more recommanded and their difference?
    John
    Toronto

  • How to generate a Unique key based on a some String value

    Hello every one,
    I am sorry , If I post this question in wrong group... I have a requirement to generate a unique key ( what every it may be alpha, numeric or alpha numeric) based on some String..
    For ex : String str = "AbCX" - Gives a unique key based on "AbCX" value..
    Is there any way we can get the unique value using Java ?
    Thanks

    May be not what you are looking for, but here's may idea:
    use a sequence (db sequence) and add it the the string value. This way the value is unique, because the sequence is unique. So you could omit the string theoretically, but your requirement is met.
    It's very easy to get a unique sequence number from the db using java, depending of the technology you use (which you did not say :-( )
    Timo

  • How shall we do validation for Unique Key and Multiple Primary Key?

    Hi,
    I have table created From EO in which one column is checked as Unique.
    How to do validation for column checked as Unique.
    I know how to do validation for column checked as primary key.
    Below is sample code for primary key validation
    if (getRvSize() != null)
    throw new OAAttrValException(OAException.TYP_ENTITY_OBJECT,
    getEntityDef().getFullName(), // EO name
    getPrimaryKey(), // EO PK
    "RvSize", // Attribute Name
    value, // Attribute value
    "AK", // Message product short name
    "FWK_TBX_T_EMP_ID_NO_UPDATE"); // Message name
    if (value != null)
    OADBTransaction transaction = getOADBTransaction();
    Object[] rvKey = {value};
    EntityDefImpl rvDefinition = xxczVAGCSRVSizingEOImpl.getDefinitionObject();
    xxczVAGCSRVSizingEOImpl rv =
    (xxczVAGCSRVSizingEOImpl)rvDefinition.findByPrimaryKey(transaction, new Key(rvKey));
    if (rv != null)
    throw new OAAttrValException(OAException.TYP_ENTITY_OBJECT,
    getEntityDef().getFullName(), // EO name
    getPrimaryKey(), // EO PK
    "RvSize", // Attribute Name
    value, // Attribute value
    "AK", // Message product short name
    "FWK_TBX_T_EMP_ID_UNIQUE"); // Message name
    What changes need to be done for above code in order to do the validation for Unique Key.
    I have one more Question
    How shall we do the Validation for Multiple Primary Key in a table?
    - Mithun

    1. If you just validate on one attribute like your unique key, then put your logic in the set<Your AttributeName) method
    2. If you want to do the cross validation ( like validating multiple attributes) then put your logic in the validateEntrity Method
    How to do that?
    1. Create a Validation View object.
    2. Associate your VVO to the VAM
    3. Create entity expert.
    4. Have method in entity expert for your validation (you would be calling AM and then VO execute the query and do the validation.
    5. You would be calling the Entity experty method from your EO either setMethods or validateEntity.
    I have given just the high level points.
    Hope this helps.
    Thanks,
    RK

  • How to create a unique key using two or more attributes?

    how to create a unique key using two or more attributes ?

    The following example illustrate how to create a unique key using two or more attributes/fields
    Scenario: Implementing Unique Key on ManagerID & Location ID in DepartmentEO(Department Table)
    Step#1: Open the Desired Entity Object “DepartmentEO”. Go to Overview tab & Click “General” Finger tab.
    Step#2: Expand “Alternate Keys” section & click “+”.
    Step#3: In the Pop-up wizard, Enter a name for alternate Key “Unique_Manager_X_Location”.
    Step#4: Select the desired attributes/fields from available list & Shuffle to right side.
    Step#5: Now go to “Business Rules” finger tab.
    Step#6: Select “Entity Validators” in the list & click “+” to add a new entity level validation rule.
    Step#7: In the Pop-up, Select “Rule Type” as Unique Key
    Step#8: In the “Rule Definition” tab select the key “Unique_Manager_X_Location”created.
    Step#9: Now go to “Failure Handling” tab, and click the Magnifier Icon .
    Step#10: If the key is not already created then in the “Select Text Resource” Popup, Using the functional design document, Enter display value, Key and Description. And click “Save & Select” Button.
    Step#11: Now Click “OK”.

  • Please, how descativo a team of my account? and try Ctr + Shift + D, give the key, but do not descativa!

    please, how descativo a team of my account?
    and try Ctr + Shift + D, give the key, but do not descativa!

    - How did you dlete stuff from the iPod? If you have a 1G or 2G iPod and deleted the stuff by going to Settings>Genera.>Reset>Erase aall contents and settings without being connected to a power source, the battery dies before he erase was comleted since it can take hour.
    - In any event try the following:
    - Connect to a chaging sour for three hours.
    - Reset the iPod and then connect to the computer and try to restore va iTunes.
    Reset iPod touch:  Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - Next try placing the iPod in recovery moe and then try to restore. For recovery mode:
    iPhone and iPod touch: Unable to update or restore
    - Last try DFU made and restore.
    How to put iPod touch / iPhone into DFU mode « Karthik's scribblings

  • How can I run a check for a record across other records in the same dataset based on unique key constraint?

    Dear community,
    I have a flat data set which I run through a lookup and return. I want to check if at least one of the records matching a unique key constraint had a successful return without merging all the records. Can some one point me in the right direction?
    Thanks!
    Marc

    Hi,
    Sounds like a job for the Lookup Check processor!
    As with all check processors, it adds a flag attribute (with a Y/N value) that denotes if the lookup was successful or not, as well as filtering records based on this at output.
    Lookup Check does the same as Lookup and Return but does not return the record(s) looked up.
    Also note that Lookup and Return does not actually merge records, but it does pull back the return data (which you can then split if you want a record for each).
    Regards,
    Mike

  • How to Get the Unique Key results from OWB Tables after Profile

    Hi,
    We are using OWB 10gR2(Paris) Beta Version.
    In this version the new feature is introduced is Data Profiling.
    We are using this feature to analylize the data in terms of stanadards.
    We have done profiling for our tables and we are able to see the results for each table in OWB Profile Results Canvas. In this window one Unique Key tab is there to see the Unique results.
    Now my question is where these results will be stored in standard tables of OWB. I want to know those exact standard tables to extract thoes Unique results in to my reports.
    After profiling we are generating HTML-DB reports to view all these profile results. But we are not able to find the Uique Key tables where these results are stored.
    So pls can anybody provide help on this to get these tables...
    Thanks in advance...,
    Ramesh P.

    You can use DatabaseMetaData#getPrimaryKeys.

  • Rich/Narendran - uh oh!! Does the shared buffer require unique key per id??

    Rich/Narendran -
    Something just occurred to me:
    Does "shared buffer" mean that more than one user can be sharing the same buffer, or is the buffer unique to each user session and is merely "shared" between work processes?
    If multiple users are sharing the same "shared buffer", then I can assign a unique key when I export the data in the first exit.
    But short of using a custom z table, how can I figure out what this key is in the second exit?  I can't "save" the key anywhere, because that's the problem in the first place ...
    I'm hoping that you'll tell me that the "shared buffer" is shared between different work processes for the same user, and not among different users as well !!
    Thanks for whatever you can tell me about this.
    djh

    Hi Naren -
    I've worked on DBMS's in the past where you could pick up a user's thread # in addition to his or her ID - if SAP had anything like that then that would do the job.  Maybe there's a "hidden" sy-something that actually gives you the unique thread ID ... ????
    djh

Maybe you are looking for

  • Why we use Cluster Tables in SAP Hr

    hai friends, i am new to  ABAP-HR and SAP HR, Actually i am core abaper ( working on SD, MM and Fi Modules ) , can any one explain me why and what is the use of Cluster tables in SAP HR, why we use in SAP HR function Module ? Thnx in advance Vijaya

  • Deleting Songs from Nano 7 - Problems!

    What should be a simple matter is made so complex by Apple that it is pure torture.  Why is it so complicated to delete songs from Nano 7? I've tried the "uncheck the boxes" and re-sync nonsense.  Yes, it got rid of some songs -- but it ADDED songs I

  • Sims 3 on iMac Late 2012

    I am having issues with sims 3. I currently have all the expansion packs up to Seasons and I am having freezing and crashing issues... Any tips on fixes? I have uninstalled and reinstalled twice already. Help please

  • Overlapping with html component

    Hi, Html component overlaps dropdown menu bar i.e when pdf is opened with in html componenet I have a problem with html component in flex... I have 12 drop down menus on top of the page... On click of item in dropdown the corressponding file opens in

  • Target group from filter criteria of an attribute list.

    I have created an Attribute list in the T-code CRMD_MKTDS and a filter criteria for this attribute list. Now, I would like to use this filter criteria to create a Target Group. So, is there any Function Module, standard Report program or methods of a