How to get the PRIMARY KEY of a table at runtime ???

Hi everybody,
My requirement is to update a z-table at runtime according to the data given ata runtime. So the main difficulties for me is that whenever I tried to update the table based on the data given in UI many rows are getting updated as these fields are not unique. So I think if I can get the PRIMARY KEY along with these given fields then I can update only one row at a time.
So Can anyone suggest me how to get PRIMARY KEY of a table based on the data in UI..??
Any suggestions will be appreciated..
Thanks,
Sekhar

U will get primary keys of transparent tables using FM "REUSE_FIELDCALATLOG_MERGE".
pass tyour table name and u will get fieldcatalog filled. In tht their is a field called "KEY" if it has 'X' then tht field is a primary key of transparent tables & if it has "space" then it is not a primary key...
Or else you can try with 'DDIF_TABT_GET'
Or try this code
PARAMETERS: p_table TYPE tabname OBLIGATORY.
DATA: go_strucdescr   TYPE REF TO cl_abap_structdescr,
      gt_tab_fields   TYPE ddfields.
FIELD-SYMBOLS: <gwa_tab_field> TYPE dfies.
TRY .
*   Get the details of the DDIC table
    go_strucdescr ?= cl_abap_elemdescr=>describe_by_name( p_table ).
  CATCH cx_sy_move_cast_error .
    MESSAGE 'Error while casting' TYPE 'S'. RETURN.
ENDTRY.
* Check if input is a DDIC table
CHECK go_strucdescr->is_ddic_type( ) = 'X'.
* Get the details of the table fields
gt_tab_fields = go_strucdescr->get_ddic_field_list( ).
* Display the Key fields of the table
LOOP AT gt_tab_fields ASSIGNING <gwa_tab_field> WHERE keyflag = 'X'.
  WRITE: / <gwa_tab_field>-fieldname.
ENDLOOP.

Similar Messages

  • How to get the Primary key from  Synonym

    Hi ,
    I want to get the Primary Keys for my tables . I used
    java.sql.DatabaseMetaData databasemetadata = connection.getMetaData();
        ResultSet rs = databasemetadata.getTables(null, null, "%", null);
    rs.next();
        System.out.println(" TABLE_CAT "+ rs.getString(1));
        System.out.println(" TABLE_SCHEM  "+rs.getString(2));
        System.out.println(" TABLE_NAME "+rs.getString(3));
        System.out.println(" TABLE_TYPE  "+rs.getString(4));
        System.out.println(" REMARKS "+rs.getString(5)); gives :
    TABLE_CAT null
    TABLE_SCHEM PROGRESS
    TABLE_NAME ApplicConv
    TABLE_TYPE SYNONYM
    REMARKS null
    Now if I use :
      rs = databasemetadata.getPrimaryKeys(null,"PROGRESS","Applicconv");
      System.out.println("Is result set Non empty "+rs.next()); gives :
    Is ResultSet non empty false .
    Can you tell me why this result is empty? Is it because of my table is a Synonym?
    If it is Synonym how to get the primary key ?

    You can use DatabaseMetaData#getPrimaryKeys.

  • How to get the primary key names right for child tables?

    I have a logical model with a parent table and two child tables. The engineering strategy is "table per child". The parent has an primary key attribute. This is a screen shot:
    https://lh5.googleusercontent.com/-iKMtA3Say5c/UIkG1iktgEI/AAAAAAAAAtc/mrwFeHm4gi4/s800/child_pk_log.png
    When I engineer the model I get two primary keys with the same name name, which is the name of the parent:
    https://lh3.googleusercontent.com/-N88a9VwoPKw/UIkG1spbXpI/AAAAAAAAAtY/eonf8WdUZ6I/s800/child_pk_rel.png
    The correct names would be CHILD1_PK and CHILD2_PK. I can change the relational model by applying the naming rules but the next engineering will trash the names again.
    How can I fix this?

    Hi,
    the problem with PK name is fixed in Data Modeler 3.2.
    You can change PK name in relational model it won't be changed on next engineering
    Philip

  • How I get the primary key in a interactive report?

    hi,I'm a noob of apex.
    I want to get a Interactive report's primary key or rownum,and I try to use the f01...but it doesn't work.
    how can I do this.
    zl

    Have a look at: Re: To reference Interactive Report filtered rows in PL/SQL

  • How to get the primary key generated by an Insert?

    My classpath is correct. So does anybody knows
    Why the following lines of code do not work?
    I get this message error.
    The line incorrect is line "6".
    Exception in thread "main" java.lang.AbstractMethodError:
    com.microsoft.jdbc.sqlserver.SQLSe
    rverConnection.prepareStatement(Ljava/lang/String;I)
    Ljava/sql/PreparedStatement;
    1. String strSql;
    2. PreparedStatement stmt;
    3.
    4. strSql = "insert into MYTABLE (MYFIELD) values ('SOMESTRINGVALUE')";
    5.
    6. stmt = myConnection.prepareStatement
    7. (strSql,Statement.RETURN_GENERATED_KEYS);
    8.
    9. stmt.executeUpdate();
    10. stmt.close();
    I try to use the method
    "ResultSet getGeneratedKeys()"
    from the class Statement but without effect since the program can�t proceed from line '6'.

    Hi,
    1. String strSql;
    2. PreparedStatement stmt;3.
    4. strSql = "insert into MYTABLE (MYFIELD) values ('SOMESTRINGVALUE')";5.
    6. stmt = myConnection.prepareStatement
    7. (strSql,Statement.RETURN_GENERATED_KEYS);8.
    9. stmt.executeUpdate();
    10. stmt.close();Can your go and look Ur code @4,
    4. strSql = "insert into MYTABLE (MYFIELD) values (?)";and then before @9,
    stmt.setString(1,SOMESTRINGVALUE);
    Raju

  • Get the primary key

    Hello,
    I would like to get the primary key of a MS Access table, but the DatabaseMetaData.getPrimaryKeys(...) doesn't work. An exception is thrown.
    Anybody knows how to get the primary key of a MS Access table?
    Thanks
    Arno

    Which code threw which exception?
    Searching this forum for
    Access primary
    could help, too.

  • Getting the primary key from order form

    Does anyone know how to get the primary key (DocEntry) off of the order form for an existing order?  I don't really want to use the DocNum field since it is not the primary key and theoretically two different orders could have the same DocNum.  Thanks in advance for your help.

    Hi Joe,
    DocEntry and DocNum values are unique, so you cannot have in db 2 orders with the same DocNum. It's possible, that DocEntry and DocNum values can vary.
    If you know the DocNum value (f.e. from Order's Form), you can simple use RecordSet object:
    Dim sQuery as String
    Dim oOrder as SAPbobsCOM.Documents
    Dim oRecordSet As SAPbobsCOM.Recordset
    Set oOrder = oCompany.GetBusinessObject(oOrders)
    Set oRecordSet = oCompany.GetBusinessObject(BoRecordset)
    sQuery = "Select DocEntry From ORDR Where DocNum = '" & DocNumber & "'"
    oRecordSet.doQuery sQuery
    If oRecordSet.RecordCount > 0 Then
      oOrder.GetByKey(oRecordSet.Fields(0).Value)
    End If
    And this should work.
    Regards
    Libor.

  • How can I obtain the primary key of a table for an entity relation?

    hello everybody
    I am doing a consultation to a table in my data base, good this table has alone two fields, the first one is the code or pk and the second one is the description, to be presisos they are names of city and code.
    From the beginning!!: This method this one in another class that is a Dialog that is going to call to the class SelecPlace ();
      SelecPlace sl = new SelecPlace();
    public void capturarLugar(){  //  Simple void method in the mentioned class
            String place = txtProcedencia.getText() ;  //  a JTextField
            sl.executeStatement(place) ;                  
        }ok, now we see part of the code of the class SelectPlace
    public class SelecPlace extends AbstractTableModel{
        Connection con = null;
        Statement sentencia = null ;
        ResultSet rs = null;
        ResultSetMetaData rsmd = null ;
        String[] nameColum = {} ;
        Vector datos = new Vector() ;
        public SelecPlace() { }
        public void executeStatement(String query){
          try{
             con = DBManager.getConnection() ;
             sentencia = con.createStatement(rs.TYPE_SCROLL_INSENSITIVE,
                                                                          rs.CONCUR_UPDATABLE) ;
             String sql = "select * from Place where descripcion like %"+query+"%'";
              rs = sentencia.executeQuery(sql) ;
              rsmd = rs.getMetaData();
              int nroColumnas = rsmd.getColumnCount() ;
              nameColum = new String[nroColumnas] ;
              //obtengo los nombres de columnas en cache
               for(int colum = 0; colum < nroColumnas; columna++){
                    nameColum[colum] = rsmd.getColumnLabel(columna + 1) ;
               datos = new Vector();
                while(rs.next()){
                    Vector newRow = new Vector();
                    for(int i = 0; i < getColumnCount(); i++){
                    newRow.addElement(rs.getObject("place_ID"));
                    newRow.addElement(rs.getObject("description"));
                    datos.addElement(nuevaFila);
                fireTableChanged(null);
            }catch(SQLException e){
                System.err.println(e);
                e.printStackTrace(System.err);
                System.out.println("error in statement");
            }catch(ClassNotFoundException cnfe){
                System.err.println(cnfe);
        }Ok, this code me works and I obtain in this case the field description of the table Place
    Now my question is, how can I obtain the primary field of my table?
    I need this value of this field that in the base of information in a bigint, and to take it to the first class before mentioned, for that I am working with a data base related

    Certain duffymo and everyone!!, good I give you my scheme:
    And generalizing my question, I want to obtain the value of the primary key of a table in the database, I obtain more values of the same row, but I need the primary key, and you see one with the primary key I want to turn a Long and it to insert with code java in foreign clave in another table of the database
    Good of this form I believe that it would not be breaking the integrity relacional of the tables

  • I create a mobile game. How to get the signing key?

    I create a mobile game. How to get the signing key? Is the certificate is payable? Sorry if the topic is in the wrong section.

    You need to be an iOS/Mac OS X developer.
    https://developer.apple.com/devcenter/

  • How to get the Reports of Change Tracking Table in MDM?

    Hi!
    Please tell me how to get the reports of Change Tracking Table in MDM which is a System table, directly from MDM without using any interface.
    Thanks in advance for the reply.
    With Best Regards
    Devendra Pandey

    Hi Devendra,
    MDM can track changes on tables and fields. <u>The level of change tracking, and which tables/fields to track, are configurable in the MDM Console</u>. MDM opens a new database on the same database engine as the MDM repository and writes all change records to this database.
    For information of various steps you can visit
    <a href="http://help.sap.com/saphelp_mdm550/helpdata/en/45/c7b20339ee570ae10000000a114a6b/content.htm">this URL</a>
    Regards,
    Krutarth

  • How to get the list of top 10 tables grown last week or last few days

    Hi All,
    Please let me know, how to get the list of top 10 tables grown last week or last few days
    Thanks

    Please let me know, how to get the list of top 10 tables grown last week or last few days1.Oracle Version and OS info please ... ALWAYS
    2.Do you have licensing options (Tuning and/or Diagnostics Pack) ?
    3.Have you ran AWR/Statspack in last week or last few days
    1.Because Oracle do not store auto tack the history of tables growth. See below link where one user has showed the possible way of manual track of table(s) growth :
    Re: oracle tables growth
    2.MOS Note for How To Get Table Growth History Information? [ID 1395195.1]
    3.If you are in 10g than EM of 10g has something called Segmnet Statistics which can show you the growth of your table.
    4.Other clue :
    SQL> select * from table (dbms_space.object_growth_trend('SCOTT','EMP','TABLE'));
    TIMEPOINT                                                                   SPACE_USAGE SPACE_ALLOC QUALITY
    17-SEP-12 11.06.20.228000 AM                                                       1593       65536 GOOD5.A good script by Mice Ault for historical growth of segments within AWR:
    http://www.dba-oracle.com/t_table_growth_reports.htm
    Regards
    Girish Sharma

  • If I have an EntityBean that mappes to two tables within one database, when I create that EJB, whoes reponsibilty to generate the primary key in database table? The RDBMS or EJB?

    If I have an EntityBean that mappes to two tables within one database, when I create
    that EJB, whoes reponsibilty to generate the primary key in database table? The
    RDBMS or EJB?
    Thanks,
    JW

    Refer to http://e-docs.bea.com/wls/docs81/faq/ejb.html/#257430
    "Jingwei Zhang" <[email protected]> wrote:
    >
    If I have an EntityBean that mappes to two tables within one database,
    when I create
    that EJB, whoes reponsibilty to generate the primary key in database
    table? The
    RDBMS or EJB?
    Thanks,
    JW

  • Am not getting the primary key of the enity but the value 0 for first eleme

    Hi everyone , I have used the primary key of an entity to create a selectonechoice in my page. But when I select from the combo box am gettting the value of the first element as 0 second as 1....
    How to I get the value of the primary key itself...
    Thanks you for your kind cooperation .
    Regards
    Lutchumaya

    Hi,
    0 is the index of the value in the selectOne Choice
    See
    http://groundside.com/blog/DuncanMills.php?title=adf_the_list_binding_value_problem&more=1&c=1&tb=1&pb=1
    for how to retrieve the actual value
    Frank

  • How to get the UDDI Key to publish a service provider system in SR?

    Hi,
    I am following instruction in appendix 1 & 2 of the white paper at https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/1079b1af-dcb7-2b10-9ebb-eafcaa3cbbea?overridelayout=true
    trying to publish a service provider system into the service registry. One thing not clear to me is how to get the uddikey as needed in step 6 in appendix 1.
    My service registry is in a PI 7.1 SP4 system. I followed the instruction in appendix 2 but there is no uddi key displayed in the General tab. Please help.
    Regards,
    Jiannan
    Paragraph extracted from the whitepaper:
    There may be cases in which the NWA logical settings do not match the Services Repository
    settings when Visual Composer is trying to locate the enterprise services. Such cases can occur
    when there is no SLD ID definition of the physical system in the Services Repository.
    Currently, Visual Composer cannot search for services on a physical system with an empty SLD ID
    (which is not a valid one).
    To obtain this capability, the following steps should be performed to generate the necessary data
    for each system with a non-valid SLD ID, so that Visual Composer can search for services over it.
    1.Log on to http://<serverName>:<serverPort>/WSNavigator.
    2.Select the Services Registry radio button.
    3.In the Find field, enter sr and choose Go.
    4.Select the ServicesRegistrySi line and choose Next.
    5.Under the Operation Name, search for the publishPhysicalSystems operation, select it and choose Next.
    6.Fill the service information parameters with the following (see Appendix 2 for details on how to get this information) :
      6.1.Click the + icon in the physical system[].
      6.2.Deselect the Classifications checkbox.
      6.3.Click the + icon in the classificationReferenceGroups[].
      6.4.Click the + icon in the classificationReferences[].
      6.5.Deselect the classificationSystemKey checkbox.
      6.6.Deselect the uddiKey checkbox and enter the value <localUddiKey>.
      6.7.Deselect the value checkbox and enter the value <localSystemHostName>.
      6.8.Deselect the host checkbox and enter the value <localHostName>.
      6.9.Deselect the physicalSystemKey checkbox.
      6.10.Deselect the logical key checkbox and enter the value <System name>.<SystemHome>.<host name>.
      6.11.Deselect the systemName checkbox and enter the value <system name>.
      6.12.Deselect the type checkbox and enter the value 2.

    Hi Jiannan,
    No worries, you can go to UDDI client from the main page of PI  i.e. http://<serverName>:<serverPort>/
    And you use the search function for  the TModel for your Physical System. Search parameters can use the % wildcard.
    Hit the search and you find the UDDI Key for the Physical System.
    Cheers.
    Hemant Chahal

  • How to generate the primary key item automatically in form region?.

    Hi,
    The primary key item is generated automatically in report region.I already give the pl/sql function for generating of primary key.but I want to generate the primary key value automatically in form region only?.how to do this?.Pls help me..
    Thanks and Regards.

    One of the guidelines when selecting column for a primary key is:
    Choose a column whose data values are never changed. A primary key value is only used to identify a row in the table, and its data should never be used for any other purpose. Therefore, primary key values should rarely or never be changed.
    Cheers!

Maybe you are looking for

  • ECC 6 SR3 upgrade I am getting following error at  RSVBCHCK

    2EETQ241 Errors found in logfiles - accumulated in file "PSVBCHCK.ELG" 1EETQ203 Upgrade phase "JOB_RSVBCHCK_D" aborted with errors 1 ETH010XRSVBCHCK: Check of open update requests 2EETG050 Update records still exist - Please process. There is no SM13

  • Problem in ESS Build when creating the project "Import can't be resolved"

    Hi All, we are using ESS and MSS 600 for ERP 2005 and EP 7.0. Once the cms INBOX components are imported to Development, I have started my development. In the Build process, when I am trying to create the Project for ess/us/bank inactive DC, It says:

  • Officejet pro 8500 a909n Unable to locate - The printer is not connected

    Something, unknown to me, must have recently changed with my printer and or my iMac and MacBook Pro.  I was suddenly unable to print.  When I attempt to print I get this icon on the dock: I then click on the icon and this is the window that is displa

  • Can this be done using WLS 8.1 LDAP?

    I am trying to configure WLS 8.1 to use LDAP for authentication/authorization. I have the basics working so now I am trying to move to the next hurdle. We are building a single webapp that will serve several different companies. The main difference w

  • Variable selection issue

    can someone plzzz help me regarding the following issue..........   how to limit set of master data values in variable selection during query execution? cheers   hari.