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.

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 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.

  • 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.

  • How to pass the primary key from a report to multiple forms

    I am trying to build an application that tracks a person's training records. I have a report and 3 forms (all tabbed). From the report I can click the edit link to modify a person. Is there a way I can pass the primary key of the person (from the report) to the other forms? Hope what I'm trying to do is clear.
    Thanks.

    Hi,
    You can specify items from other pages also.
    Did you use that popup to pick item ?
    Did you noticed that it filter by page where your link point. You can remove filter from popup and then select other items.
    Or just manually type your item names
    Br, Jari
    Edited by: jarola on Nov 11, 2009 1:08 AM

  • 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 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

  • Can't get the applet control from a form page

    Hi,
    I need to get the applet control in a browser which has loaded an oracle form component.
    When i use jinitiator, i get the control as sun.plugin.ocx.ActiveXAppletViewer., but when i use jre for running the oracle forms, i am not able to get the applet class. I observed with the control hierarchy with Monkey, the java accessibility tool, but I coudn't find any applet class.
    Kindly help.
    Thanks & Regards
    Sunil

    Hi,
    Sorry for the incompleteness in the post.
    1. What is the complete Forms version you are using? Do not reply with something like 6i, 9i, 10g, etc. These are product names and not versions.
    10g Release2
    2. What is the client platform (operating system) and version?
    Windows XP Professional Version 2002, Service Pack 3
    3. Which browser and version are you using?
    IE version 6.0.2900.5512.xpsp_sp3_gdr.090804-1435
    4. Which JInit and Sun JRE version are you using?
    JInit-JInitiator 1.3.1.22, Sun JRE- 1.6.0_17
    5. Are you seeing this problem with Developer Suite or Application Server or both?
    I am working on Developer suite.
    6. Provide the complete contents of the Java Console after the failure occurs.
    My issue is that I am not able to identify the applet class.I am not getting any crash as such.
    7. Does the person running the form have Windows Administrator or Power User permissions?
    Windows Administrator
    Let me elaborate the query again.
    I need to get the applet object of the page that loads the form. To get the applet class, I have written a listener class and print the name of the classes that get created. This way, I identified that the class sun.plugin.ocx.ActiveXAppletViewer, is the applet created in the IE when the form is loaded using JInit.
    Also, I can see the same applet class in the monkey tool once the page is loaded.
    HOWEVER, when I use SUN JRE to load the form, the action listener class doesn't identify any applet class. The monkey tool also fails to show any. The class I get in this scenario is sun.plugin2.main.client.PluginEmbeddedFrame.
    I assume that there should be some applet class present to load the form irrespective of whether it uses JInit or Sun JRE.
    Kindly correct me if I am wrong.
    The console log is as follows
    Java Plug-in 1.6.0_17
    Using JRE version 1.6.0_17-b04 Java HotSpot(TM) Client VM
    User home directory = C:\Documents and Settings\sunil
    c: clear console window
    f: finalize objects on finalization queue
    g: garbage collect
    h: display this help message
    l: dump classloader list
    m: print memory usage
    o: trigger logging
    q: hide console
    r: reload policy configuration
    s: dump system and deployment properties
    t: dump thread list
    v: dump thread stack
    x: clear classloader cache
    0-5: set trace level to <n>
    com.sun.deploy.util.ConsoleWindow
    javax.swing.JRootPane
    javax.swing.JPanel
    javax.swing.JLayeredPane
    javax.swing.JPanel
    javax.swing.JScrollPane
    javax.swing.JViewport
    javax.swing.JTextArea
    javax.swing.JScrollPane$ScrollBar
    com.sun.java.swing.plaf.windows.WindowsScrollBarUI$WindowsArrowButton
    com.sun.java.swing.plaf.windows.WindowsScrollBarUI$WindowsArrowButton
    javax.swing.JScrollPane$ScrollBar
    com.sun.java.swing.plaf.windows.WindowsScrollBarUI$WindowsArrowButton
    com.sun.java.swing.plaf.windows.WindowsScrollBarUI$WindowsArrowButton
    javax.swing.JPanel
    javax.swing.JButton
    javax.swing.JLabel
    javax.swing.JButton
    javax.swing.JLabel
    javax.swing.JButton
    sun.plugin2.main.client.PluginEmbeddedFrame
    Reading certificates from 137405 http://164.67.34.102:8889/forms/java/frmall.jar | C:\Documents and Settings\sunil\Application Data\Sun\Java\Deployment\cache\6.0\36\1a4500a4-49be8669.idx
    oracle.forms.engine.Main
    Loaded image: http://164.67.34.102:8889/forms/formsdemo/images/iorganizer.gif
    Reading certificates from 11 http://164.67.34.102:8889/forms/formsdemo/jars/iorganizer.jar | C:\Documents and Settings\sunil\Application Data\Sun\Java\Deployment\cache\6.0\23\b018557-49b3d76d.idx
    oracle.forms.engine.Splashscreen
    Loaded image: http://164.67.34.102:8889/forms/formsdemo/images/bannerlogo.gif
    Loaded image: http://164.67.34.102:8889/forms/formsdemo/images/white.gif
    oracle.ewt.event.tracking.GlassMouseGrabProvider$Proxy
    oracle.forms.ui.mdi.MDIContainer
    oracle.ewt.lwAWT.LWComponent
    oracle.ewt.lwAWT.LWComponent
    oracle.ewt.imageCanvas.ImageCanvas
    oracle.ewt.EwtComponent
    oracle.ewt.scrolling.scrollBox.ScrollBox
    oracle.ewt.scrolling.scrollBox.ScrollBox$1
    oracle.forms.ui.FormDesktopContainer
    oracle.ewt.scrolling.scrollBox.EwtLWScrollbar
    oracle.ewt.scrolling.scrollBox.EwtLWScrollbar
    oracle.ewt.lwAWT.LWComponent
    proxyHost=null
    proxyPort=0
    connectMode=HTTP, native.
    Forms Applet version is : 10.1.2.0
    oracle.ewt.lwAWT.lwMenu.LWMenuBar
    oracle.ewt.lwAWT.LWComponent
    oracle.ewt.lwAWT.lwMenu.LWMenu
    Loaded image: jar:http://164.67.34.102:8889/forms/java/frmall.jar!/oracle/forms/icons/frame.gif
    oracle.ewt.event.tracking.GlassMouseGrabProvider$Proxy
    oracle.ewt.button.ContinuousButton
    oracle.ewt.button.ContinuousButton
    oracle.ewt.button.ContinuousButton
    oracle.ewt.button.ContinuousButton
    oracle.ewt.event.tracking.GlassMouseGrabProvider$Proxy
    Reading certificates from 137405 http://164.67.34.102:8889/forms/java/frmall.jar | C:\Documents and Settings\sunil\Application Data\Sun\Java\Deployment\cache\6.0\36\1a4500a4-49be8669.idx
    I hope my query is clear now.
    Thanks & Regards
    Sunil

  • 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

  • Getting the data back from pdf form.

    Hi all,
    I am generating a pdf form an ABAP program using the function module- FP_FUNCTION_MODULE_NAME.
    The form is getting generated properly.Some of the fields in thid form is editable.
    I want to get this values back to the ABAP program for further processing.
    Please let me know how this can be done.
    Regards,
    Rupesh R Nair.

    Hi,
    Have you choose your scenario for updating value according to the value set in the PDF forms ( Download, mail ... )
    If you want user send the forms by back mail or by download it thru an abap program let me know.
    Best regards

  • How to find out the primary key of oracle apps tables

    Hii,,
    My Question is How to find the primary key in the apps table...Is there any Query or other way to find out???
    for eg.
    I want to find out the primary key of the AP_INVOICES_ALL table...just tell me how can i get the primary key of this table.
    I am currently using toad for the query..
    Please guide me...

    you can define the primary key when you create table
    or add the primary key after the table creation by 'ALTER TABLE ... ADD constraint pk_nme primary key (col1, col2)';
    you could use below sql to check the detail of primary key:
    1) check out the table definition directly:
    select dbms_metadata.get_ddl('TABLE','EMP') FROM DUAL;
    2) check out the columns of primary key:
    select * from user_constraints where constraint_type='P' AND table_NAME='EMP';
    select * from user_cons_columns where CONSTRAINT_NAME='PK_EMP';And BTW, it is madam, not sir. :)
    Edited by: PhoenixBai on Dec 17, 2010 1:07 PM

  • Knowing the primary key columns of the given table

    Hi,
    How can I get the primary key columns of the given table?
    Regards,
    Sachin R.K.

    You can find the constraint_name from all_constraints/user_constraints for constraint_type = 'P' (which is the primary key constraint).
    And then see which columns are in for the constriant_name
    in all_cons_columns/user_cons_columns view.
    Below is the example
    select acc.column_name from
    all_cons_columns acc, all_constraints ac
    where acc.constraint_name = ac.constraint_name
    and acc.table_name = 'DEPT' AND acc.owner = 'SCOTT'
    and ac.constraint_type = 'P'
    Hope this helps
    Srinivasa Medam

  • Retrieving auto inc primary key from entity bean (MySQL DB)

    Hello,
    I searched the forum intensively, but did not find an answer for the following problem.
    I've set up an MySQL database "Location" with two fields (ID, Description), ID is my primary key and I've added the AUTO_INCREMENT flag to this field. This works fine, i can add a row in the table with my entity bean "Location" from my session bean :
    Location l = new Location();
    l.setDescription("at home");
    em.persist(l);
    and even when I ask this location back from the DB, there is no problem :
    Location l = em.find(Location.class,1);
    return l.getDescription();
    The rows in the table increment nicely. The problem however is, that you don't allways know the ID. So I would like to do the following from my session bean:
    Location l = new Location();
    l.setDescription("at home");
    em.persist(l);
    int id = l.getId();
    the getID method allways returns a null object. The row is added in the DB, but the auto incremented ID is not returned to the entity bean!
    I know I could solve this by generating the ID's myself, but one of the strengths of autoincrement should be not to have to do this, no?
    If anyone has a clue how to solve this issue, I would very much appreciate it !
    Michiel
    Edited by: Michiel82 on Dec 6, 2007 6:01 AM

    No reactions so far ... this is a work-around for the issue :
    I've created an additional table sequence with two fields: gen_key and gen_value. Then, in my Location entity bean I can add the following:
    @TableGenerator(
    name="locationGen",
    table="sequence",
    pkColumnName="gen_key",
    valueColumnName="gen_value",
    pkColumnValue="location",
    allocationSize=1
    @Id
    @GeneratedValue(strategy=GenerationType.TABLE,generator="locationGen")
    @Column(name = "id", nullable=false)
    private Short id;
    This generates the primary key in the bussiness logic, but I would like to get the autogenerated key from my MySQL database (see previous post). Is this perhaps not supported by EJB3.0?
    Michiel

  • Primary key from Synonmn

    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[b] primary key ?

    does your database documentation provide any hints?
    or your jdbc driver?

Maybe you are looking for