Skip to Content
author's profile photo Former Member
Former Member

DDL in Web Dynpro

hi all

Is it possible to write ddl statements of sql in web dynpro.

i wish to create table from dynpro.

bye

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Aug 03, 2005 at 05:01 AM

    Hi,

    you should not use DDL or DML directly from WebDynpro ever, as the WD framework is meant only for User Interface creation. You should envelope your Business Processing logic in some EJB or normal Java helper classes and call the same from WD classes. If you use a core java helper class you can execute its method from WD. From a core java class you can create a table like below

    String url = "jdbc:mySubprotocol:myDataSource";

    Connection con;

    String createString;

    createString = "create table COFFEES " +

    "(COF_NAME VARCHAR(32), " +

    "SUP_ID INTEGER, " +

    "PRICE FLOAT, " +

    "SALES INTEGER, " +

    "TOTAL INTEGER)";

    Statement stmt;

    try {

    Class.forName("myDriver.ClassName");

    } catch(java.lang.ClassNotFoundException e) {

    System.err.print("ClassNotFoundException: ");

    System.err.println(e.getMessage());

    }

    try {

    con = DriverManager.getConnection(url, "myLogin", "myPassword");

    stmt = con.createStatement();

    stmt.executeUpdate(createString);

    stmt.close();

    con.close();

    } catch(SQLException ex) {

    System.err.println("SQLException: " + ex.getMessage());

    }

    But please dont use DDL, DML or any business processing in WD code directly.

    Regards,

    Shubhadip

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 03, 2005 at 05:01 AM

    Hi Mitesh,

    Try this link on relational persistance

    http://help.sap.com/saphelp_nw04/helpdata/en/bd/b127af68234e868cfd4e9f440aa0bf/frameset.htm

    Regards,

    Jaydeep

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 03, 2005 at 05:05 AM

    Hi Mitesh,

    Its not possible to use DDL statements in Webdynpro.

    You can only use DML statements in webdynpro or any other J2ee applications.

    Regards,

    Bhavik

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Aug 03, 2005 at 05:38 AM

    Hi Mitesh,

    Adding to Ghosh's comment the best way I suggest you to do is create your table manually using Dictionary for MaxDB or in any other Vendor SQL manually.

    Use the corresponding vendor driver file to connect to the DB.Try DML statement alone from your Webdynpro fo contacting and querying your DB.

    The reason why DDL is not suggested from Webdynpro is that the Webdynpro meta model user interface does not by itself supports effective DDL statement like we normally do in .jsp file. or javafile.

    Hence the performance is also affected if you have DDL in WD.

    Hope it helps.

    Regards,

    Guru

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 03, 2005 at 05:44 AM

    Hi ,

    One more way !!

    1. I have created the tables using the Dictonary project

    in MaxDB

    I have imported the tables as Models in WebDynpro using

    JavaBean importer.

    I wrote a simple generator that will generate a simplebean out the tables in webdympro. (https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/java/simple java bean generator for database.pdf)

    Note : There are some limitations in the tool 😔

    2.Another way is write all your SQL statements in the component/custom controller (JDBC programming) and access those methods from the view .

    Regards, Anilkumar

    Message was edited by: Anilkumar Vippagunta

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.