Unable to fetch database table from webdynpro application

Hello,
I have a Webdynpro application trying to fetch data from the database table. I have used the following code to get the connection to the database and execute the sql statement.
          InitialContext dbInitContext = new InitialContext();
          Properties sysProperties = System.getProperties();
          String sysname = sysProperties.getProperty("SAPSYSTEMNAME");
          String dbName = "jdbc/" + "SAP" + sysname + "DB";
          DataSource dataSource = (DataSource) dbInitContext.lookup(dbName);
          Connection conn = dataSource.getConnection();
          String SelectStmt = "Select * from INV_CUSTOMER";
          PreparedStatement stmt = conn.prepareStatement(SelectStmt);
          ResultSet resultSet = stmt.executeQuery();
I logged into the database using user superdba in sqlcli, and created the table "INV_CUSTOMER". I am trying to run this application in my sneak preview java installation which comes with maxdb 7.6. But when I run the app, it always throws up the error:
The SQL statement "SELECT * FROM "INV_CUSTOMER"" contains the semantics error[s]: - 1:15 - the table or view >>INV_CUSTOMER<< does not exist
I am new to this concept, so any help would be appreciated.
Thanks,
Ajay

>
Ajay Singh wrote:
> Hi Isaias,
>
> I created a dictionary project with the same structure, and used it in my app. Right now, everytime I run my app, the old data I entered is lost. I need to store data in the table, and reuse those records the next time I run the app. How do I do this?
> Another question I have is, I have created Database Tables inside Local Dictionary of my dictionary project. Does this create a table in the actual database?
> Forgive me, but I am new to this topic.
>
> Thanks,
> Ajay
Hi,
It seems to me like there is more than one issue here. Let me try and help you out with some details.
1.) If you have created the Dictionary project and the code in your original post is not giving you problems then it's good. However, the problem of the data disappearing from your Java Dictionary seems little bit wierd. You need to ensure that you are not running any "delete" command and ensure that the select statement (of it has and conditions) is correct.
2.) As far as where the tables actually reside: When you create the Dictionary tables in a Dictionary Project-  this will actually create a script that will be run on the server that has an installed database (like Oracle, MSSQL Server or MaxDB, UDB). This means that the dictionary tables are just an abstraction of actual database tables.
In order to ensure that you are not deleting the data - debug your Web Dynpro Application or EJB so that you can go through it step by step and see whether all the database statements are correct. Sometimes you may not get an SQL error due to a NullPointer in the dynamic queries as well - so keep a check on that as well.
If you require a more detailed solution - please give us a small piece of code that we can analyse.
Hope that helps.
Thanks.,
p256960.

Similar Messages

  • How to query a sql database table from webdynpro?

    Hi All,
    Can someone tell me the steps involved in accessing a sql server database table and retrieving the record set from a webdynpro application.
    Thanks in advance.
    Best regards,
    Divya

    Hello Divya,
    I would recommend you to read "Java Persistence" section in Development manual describing various options for database integration http://help.sap.com/saphelp_nw04/helpdata/en/61/fdbc3d16f39e33e10000000a11405a/frameset.htm
    Tutorials
    http://help.sap.com/saphelp_nw04/helpdata/en/46/ddc4705e911f43a611840d8decb5f6/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/91/9c2226df76f64fa7783dcaa4534395/frameset.htm
    Web serices
    http://help.sap.com/saphelp_nw04/helpdata/en/d6/f9bc3d52f39d33e10000000a11405a/frameset.htm
    EJB
    http://help.sap.com/saphelp_nw04/helpdata/en/19/f9bc3d8af79633e10000000a11405a/frameset.htm
    Best regards, Maksim Rashchynski.

  • Can we access PI tables from WebDynpro Java via PI 7.1?

    Hi Experts
    Is it possible to fetch PI Tables (to display monitoring and alerts as dashboard on portal) from Java Stack. I got some javadocs API SAP Netweaver for PI 7.1 but i don't know how far it can help me in solving my purpose of fetching and displaying the PI monitoring data on Portal.
    https://www.sdn.sap.com/irj/sdn/javadocs
    Please advise if J2EE access to PI Tables is possible or RFC is the suggested solution to fetch PI Monitoring data.
    Thanks
    Neha

    Hi Neha,
    You can access PI tables from Webdynpro Java application using RFC or Webservices. Create RFC or Webservices which will fetch data from the PI tables.Create the required JCO's and the Webdynpro java application which uses the Adaptive RFC model or Adaptive Webservice Model to connect to the ECC system.
    I found a document that speaks about fetching data from SXMB_MONI Standard Table https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/b050ff4f-84c3-2b10-3d99-8f9c44f57a17
    Hope this is useful.
    Regards,
    Seema Rane.

  • Modify database table from internal table

    Hi All,
    I need to update database table from internal table which is having around 30000 records.
    I am using MODIFY tabname FROM TABLE int_tabname...
    Using this statement, I can modify the databse records very well. But user has some additional requirement.
    He wants that the table should be modified from the internal table and after modification we should have the erroneous records to be displayed if any.
    e.g. if 1500 records out of 30000 are erroneous then only 28500 records should be updated and 1500 records should be displayed as erroneous records so that the user can correct them and use them again for executing the program.
    Is there any FM which imports the database table name and internal table, modifies the database and exports an internal tanle with erroneous records?
    Any help will be appriciated,
    Regards,
    Neha

    Hi
    modifying datbase table useing internal table
    <b>advises</b> before updating this datbase table plz lock that table to avoid incosistency
    write the logic for modifying
    Modify the database table as per new dunning procedure
      MODIFY fkkvkp FROM TABLE lt_fkkvkp   .
    and finally unlock the table
    <b>example</b>
    *To lock table for further operations
      constants: lc_tabname TYPE  rstable-tabname  VALUE 'FKKVKP'  . "FKKVKP
      CALL FUNCTION 'ENQUEUE_E_TABLE'
        EXPORTING
          tabname        = lc_tabname
        EXCEPTIONS
          foreign_lock   = 1
          system_failure = 2
          OTHERS         = 3.
      IF sy-subrc EQ 0.
      To fetch all the contract accounts for customers of the segment
      Households/SME.
        PERFORM fetch_contract_accounts using lc_tabname .
      ENDIF.                    " IF sy-subrc EQ 0.
    *wrote the logic
    Modify the database table as per new dunning procedure from internal table
      MODIFY fkkvkp FROM TABLE lt_fkkvkp   .
    *unlock the tbale
      CALL FUNCTION 'DEQUEUE_E_TABLE'
       EXPORTING
         TABNAME   =  uc_tabname .
    <b>Reward if usefull</b>

  • Generate database tables from Business Components

    Is it possible to generate the database tables from a set of existing business components?
    This would be a handy feature to have, similar with JPA tables generation based on Entity Beans.
    Thanks
    Florin Marcus

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Dmitri:
    Dear Laura,
    I mean first variant where the database would be the same:
    scott/tiger@database1
    foo/bar@database1
    Of course I understand that we must register every user in database by "CREATE USER XXX" and it is unacceptable for Internet. But it may be very convenient for an Intranet because we can build access restriction based on set of views without any changes in applications.
    Best wishes,
    Dmitri.<HR></BLOCKQUOTE>
    null

  • HI,Can anybody pls explain me, while extracting database table from sap-r/3

    HI,Can anybody pls explain me, while extracting database table from sap-r/3 to sap-bw using GENERIC DATA SOURCE it will ask us Name of the APPLICATION COMPONENT what does it means?

    Application Component is a collcetion of tightly coupled S/W component. You can think of it is like folder, where all the related S/W will be put in. Like MM will have all the DS related to MM.
    Thanks..
    Shambhu

  • How to Import/Export database tables from one server to other in oracle8i

    Hello friend,
    Please can any one tell me how to import/export groups of database tables from one server with oracle to another using VB.net. It would be nice if some one can provide some code of it.
    I am a software developer and I am in middle of a large project development, in which I need to export a large oracle database from one server to another efficiently.
    Its very urgent so please someone help me.

    At command prompt (source db)
    set ORACLE_SID=db_name
    exp system/password@db_name full=y buffer=104857600 file=(c:\file1.dmp, c:\file2.dmp....) log=c:\exp.log filesize=2000M
    Then ftp the export dump files (in binary) to the other server or copy to target server over the network.
    At command prompt (target db)
    set ORACLE_SID=db_name
    imp system/password@db_name full=y ignore=y buffer=104857600 file=(c:\file1.dmp, c:\file2.dmp....) log=c:\imp.log filesize=2000M
    If the path names of the datafiles are going to be different in the target server (as compared to the source), then precreate the tablespaces before import. Set buffer value accordingly.
    Message was edited by:
    FeNiCrC_Neil

  • Access UME from Webdynpro Application

    Access UME from Webdynpro Application u2013 display the user attributes from Webdynpro iview
    How to go for this...??
    Edited by: saurav mago on Sep 1, 2008 6:45 PM

    Hello Saurav,
    Try this:
    import com.sap.security.api.IUser;
    import com.sap.security.api.IUserAccount;
    import com.sap.security.api.UMException;
    import com.sap.tc.webdynpro.services.sal.um.api.IWDClientUser;
    import com.sap.tc.webdynpro.services.sal.um.api.WDClientUser;
    import com.sap.tc.webdynpro.services.sal.um.api.WDUMException;
    try {
         IWDClientUser wdClientUser = WDClientUser.getCurrentUser();
         IUser sapUser = wdClientUser.getSAPUser();
         if (sapUser != null) {
              java.util.Iterator parentGroups = sapUser.getParentGroups(false);
              while (parentGroups.hasNext()) {
                   String parentGroupName = (String) parentGroups.next();
                   if (parentGroupName.equals("GRUP.R3_ROLE_DS.Z:EP_XPTO123")) {
                        return true;
    catch (WDUMException e) {
         e.printStackTrace();
    OBS.: sapUser can be used to access a lot of info regarding the user.
    OBS.: you need to add a reference to "com.sap.security.api.sda", that is in the default SC SAP_JEE, if I well remember.
    Regards,
    Douglas Frankenberger

  • How to update database table from Internal Table

    hi experts,
        Can anyone please assist me in inserting records to a database table from an Internal Table
    whose structures are identical.
    Thanks in Advance,
    Sudhaa............

    Hi Sudha,
    Here are some example of update and insert:
    UPDATE SFLIGHT SET PLANETYPE = 'A310'
    PRICE = PRICE - '100.00'
    WHERE CARRID = 'LH' AND CONNID = '0402'.
    This example overwrites the contents of the PLANETYPE column with A310 and decreases the value of the PRICE column by 100 for each entry in SFLIGHT where CARRID contains u2018LHu2019 and CONNID contains u2018402u2019.
    TABLES SPFLI.
    DATA WA TYPE SPFLI.
    MOVE 'AA' TO WA-CARRID.
    MOVE '0064' TO WA-CONNID.
    MOVE 'WASHINGTON' TO WA-CITYFROM.
    UPDATE SPFLI FROM WA.
    MOVE 'LH' TO SPFLI-CARRID.
    MOVE '0017' TO SPFLI-CONNID.
    MOVE 'BERLIN' TO SPFLI-CITYFROM.
    UPDATE SPFLI.
    CARRID and CONNID are the primary key fields of table SPFLI. All fields of those lines where the primary key fields are "AA" and "0064", or "LH" and "0017", are replaced by the values in the corresponding fields of the work area WA or the table work area SPFLI.
    DATA: ITAB TYPE HASHED TABLE OF SPFLI
    WITH UNIQUE KEY CARRID CONNID,
    WA LIKE LINE OF ITAB.
    WA-CARRID = 'UA'. WA-CONNID = '0011'. WA-CITYFROM = ...
    INSERT WA INTO TABLE ITAB.
    WA-CARRID = 'LH'. WA-CONNID = '1245'. WA-CITYFROM = ...
    INSERT WA INTO TABLE ITAB.
    WA-CARRID = 'AA'. WA-CONNID = '4574'. WA-CITYFROM = ...
    INSERT WA INTO TABLE ITAB.
    UPDATE SPFLI FROM TABLE ITAB.
    This example fills a hashed table ITAB and then overwrites the lines in SPFLI that have the same primary key (CARRID and CONNID) as a line in the internal table.
    Insert statement :
    TABLES SPFLI.
    DATA WA TYPE SPFLI.
    WA-CARRID = 'LH'.
    WA-CITYFROM = 'WASHINGTON'.
    INSERT INTO SPFLI VALUES WA.
    WA-CARRID = 'UA'.
    WA-CITYFROM = 'LONDON'.
    INSERT SPFLI FROM WA.
    SPFLI-CARRID = 'LH'.
    SPFLI-CITYFROM = 'BERLIN'.
    INSERT SPFLI.
    If the database table does not already contain a line with the same primary key as specified in the work area, the operation is completed successfully and SY-SUBRC is set to 0. Otherwise, the line is not inserted, and SY-SUBRC is set to 4.
    Regards,
    Premraj kaushik

  • Create database tables from an xsd

    Is it possible to generate database table from a given xsd using toplink ?
    I want to use these tables to persist java objects obtained by unmarshalling the xml (corresponding to this xsd).
    Thanks in advance,
    Mahima

    Hello Mahima,
    Although you could use TopLink to generate a database schema from an XSD using a combination of wizards available in the TopLink Workbench, the resulting database schema would probably not be an optimal design. If you're interested we can talk about how to use this approach as a guide.
    Is your main use case the generation of a database schema or the actual movement of database data to/from XML?
    Using a combination of TopLink's object-relational and object-XML support to move data between XML and a relational database is a valid pattern. Refer to the discussion thread below for some approaches at setting up the metadata.
    TopLink-JAXB : Creating and Mapping tables from Toplink-JAXB POJOs.
    -Blaise

  • Is it possible to copy tables from another application or excel into forms

    I wasnt to insert tables from another application or excel into forms. currently it copies over the information from the table but doesnt keep it in a table format? Is it possible to do this?

    Dear try67
    I just forwarded him to a page (by Adobe Expert) where I had hoped this will help him.
    It could also be your side.
    I don't think that it took a comment from another. Unless it is a personal good advice. I just wanted to help and free of charge
    Sometimes we overlook a detail by quick reading. Is this never happened to you ?

  • Updating database table from an internal table

    Hi All,
    I am updating a database table from an internal table.
    I am changing the non-key fields in that table.
    when I check sy-subrc = 4.
    Record already exists, because I am changing non-key fields of the
    database table.
    Is there any addition like to accept the duplicate keys with update.
    Alternatively, I have used Modify, It is adding new record,
    Again, I have search the old record and use Delete on the database table.
    Thanks & Regards,
    Kalyan Chandramouli
    SAP ABAP Consultant

    Hi,
    You are right, the field which I am trying to change is a part of primary key.
    Because, sy-subrc = 4. says,
    No line with specified primary key exits in the database table.
    I have a Z-tabel, with Kunnr Vkorg Matnr Bzirk Bztxt Split_percentage
    In this table primary key consists of KunnrVkorgMatnr+Bzirk.
    I am able to change the Split_percentage using UPDATE.
    Now, my client want to change Bzirk, Bztxt also in the table.
    How can I Go.
    Thanks & Regards,
    Kalyan Chandramouli
    SAP ABAP Consultant

  • Updating database table from internal table

    I am updating the database table from internal table for this is have used the following syntax
    Update kna1 from table itab.
    And it is giving error message as the work are itab is not long enough.
    Please help me.

    Hi,
       Refer this code
    *&      Form  SUB_READ_UPDATE_BSEG
          text
    FORM sub_read_update_bseg.
      IF NOT it_final[] IS INITIAL.
        LOOP AT it_final INTO wa_final.
          UPDATE bseg SET zuonr = wa_final-ccnum
                      WHERE bukrs EQ wa_final-bukrs
                      AND   belnr EQ wa_final-vbeln
                      AND   rfzei EQ wa_final-rfzei
                      AND   saknr NE ' '.
        ENDLOOP.
    *--Message data updated successfully
        MESSAGE i888 WITH text-002.
        LEAVE LIST-PROCESSING.
      ELSE.
    *--Message No data found
        MESSAGE i888 WITH text-003.
        LEAVE LIST-PROCESSING.
      ENDIF.
    ENDFORM.                    " SUB_READ_UPDATE_BSEG
    Regards,
    PRashant

  • Access SAP database table from different SAP server

    Hi,
    May i know is that possible to access the SAP database table from server A to server B without write a program on server A? Is it possible for direct access the SAP database table.
    Best regards,
    Gan

    Hello,
    you could use the RFC-Modules RFC_READ_TABLE or RFC_GET_TABLE_ENTRIES on server A.
    Precondition: you need a RFC-Destination from B to A.
    And a little drawback: you get only the first 512 byte of each table entry.
    Regards Wolfgang

  • Loading  a database table from a UNIX file

    hi,
    Need A program to load a database table from a UNIX file
    thnks.

    HI,
    report zmjud001 no standard page heading.
    tables: z_mver.
    parameters: test(60) lower case default '/dir/judit.txt'.
    data: begin of unix_intab occurs 100,
    field(53),
    end of unix_intab.
    data: msg(60).
    ***open the unix file
    open dataset test for input in text mode message msg.
    if sy-subrc <> 0.
    write: / msg.
    exit.
    endif.
    ***load the unix file into an internal table
    do.
    read dataset test into unix_intab.
    if sy-subrc ne 0.
    exit.
    else.
    append unix_intab.
    endif.
    enddo.
    close dataset test.
    ***to process the data. load the database table
    loop at unix_intab.
    z_mver-mandt = sy-mandt.
    z_mver-matnr = unix_intab-field(10).
    translate z_mver-matnr to upper case.
    z_mver-werks = unix_intab-field+10(4).
    translate z_mver-werks to upper case.
    z_mver-gjahr = sy-datum(4).
    z_mver-perkz = 'M'.
    z_mver-mgv01 = unix_intab-field+14(13).
    z_mver-mgv02 = unix_intab-field+27(13).
    z_mver-mgv03 = unix_intab-field+40(13).
    to check the data on the screen (this is just for checking purpose)
    write: / z_mver-mandt, z_mver-matnr, z_mver-werks, z_mver-gjahr,
    z_mver-perkz, z_mver-mgv01,
    z_mver-mgv02, z_mver-mgv03.
    insert z_mver client specified.
    *if the data already had been in table z_mver then sy-subrc will not be
    *equal with zero. (this can be *interesting for you - (this list is
    *not necessary but it maybe useful for you)
    if sy-subrc ne 0.
    write:/ z_mver-matnr, z_mver-werks.
    endif.
    endloop.
    1. This solution is recommended only if the database table is NOT a standard SAP database table .
    Cheers,
    Chandra Sekhar.

Maybe you are looking for

  • Z2 Problems

    Hi Sony, I just want to share my problems on my Xperia Z2. First is the sd card error message always pops up "unexpected removal of sd card". Second is when Im using the SBH52 headset for text to speech like for email and facebook notifications, the

  • Csv file uploading for database table creation

    Hi there, I'm in the process of making an application that will be able to upload a csv file and create a table based on the same file. As of now, I have managed to make my application upload a csv file into the database. My problem now is to transfe

  • There are unesscessary gaps in my menus. How do I get rid of them?

    Huge gaps are appearing in my menus. I have no idea how they got there. In addition, screengrab doesn't work and I can't configure adblocker, the icon is gone.

  • Tiger Compatability with Final Cut Express

    Will Final Cut Express 2.0.3 work with Tiger 10.4.4

  • Question about DPI & IE7

    RE: IE7 on WinXP In IE7, take a look at www.nypost.com (specifically the masthead and the nav bar) with a DPI of 96DPI. Everything looks fine. Now look at it with 120DPI. AHHHHHHH. How, as web designer, do I handle this?!? The NAV bar is suddenly too