How to insert data in database table

Hi experts,
               How to insert data into database table using internal table from function module.

Hi,
As per my understanding are you looking for the complete API feature of data insertion into the database using the Locking Mechanism? If yes, then you need to create a Lock Object using the Primary keys of the Primary Table and Secondary Tables. You need to call the lock object first and then you need to make the entry into the table. This principle is based on  'All or None Concept'.
For the insert Statement Key word you can have a look at the following link:
http://help.sap.com/abapdocu/en/ABAPINSERT_SOURCE.htm
Hope this helps.
Thanks,
Samantak.

Similar Messages

  • Its very urgent:how to insert data into database tables

    Hi All,
    I am very new to oaf.
    I have one requirement data insert into database tables.
    here createPG having data that data insert into one custom table.
    but i dont know how to insert data into database tables.
    i wrote the code in am,co as follows.
    in am i wrote the code:
    public void NewoperationManagerLogic()
    ManagerCustomTableVOImpl vo1=getManagerCustomTableVO1();
    OADBTransaction oadbt=getOADBTransaction();
    if(!vo1.isPreparedForExecution())
    vo1.executeQuery();
    Row row=vo1.createRow();
    vo1.insertRow(row);
    in createPG processrequest co:
    public void processRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processRequest(pageContext, webBean);
    ManagerInformationAMImpl am=(ManagerInformationAMImpl)pageContext.getApplicationModule(webBean);
    am.NewoperationManagerLogic();
    process form request:
    public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processFormRequest(pageContext, webBean);
    if(pageContext.getParameter("Submit")!=null)
    ManagerInformationAMImpl am=(ManagerInformationAMImpl)pageContext.getApplicationModule(webBean);
    am.getOADBTransaction().commit();
    please help with an example(sample code).
    its very urgent.
    thanks in advance
    Seshu
    Edited by: its urgent on Dec 25, 2011 9:31 PM

    Hi ,
    1.)You must have to create a EO based on custom table and then VO based on this EO eventually to save the values in DB
    2.) the row.setNewRowState(Row.STATUS_INITIALIZED); is used to set the the status of row as inialized ,this is must required.
    3.) When u will create the VO based on EO the viewattributes will be created in VO which will be assigned to the fields to take care the db handling .
    You must go thtough the lab excercise shipped with you Jdeveloper ,there is a example of Create Employee page ,that will solve your number of doubts.
    Thanks
    Pratap

  • How to insert date into database table

    Hi,
    i used date navigator in htmlb. i want toupdate date into the database table ystudetn_inf. and also please tell me how to insert that date into table.give me small example in stepby step.

    Hi,
      I am sure you have used htmlb:dateNavigator as follows
    <htmlb:dateNavigator id             = "myDateNavigator"
                               monthsPerRow    = "1"
                               onNavigate      = "myOnNavigate"
                               onDayClick      = "myOnDayClick"
                               onWeekClick     = "myOnWeekClick"
                               onMonthClick    = "myOnMonthClick">
          </htmlb:dateNavigator>
    Trap the onDayClick event in oninputprocessing
    date_event ?= cl_htmlb_manager=>get_data(
                                        request = runtime->server->request
                                             name     = 'inputField'
                                             id       = 'mydate'  ).
    date = datenavigator_event->day.
    and use date value to update your table.
    If found helpfull rewards points.
    Regards,
    Albert

  • How to insert data into database table from a servlet? Help please.

    From a servlet I want to insert a message with some servlet parameters into an oracle database table by writing 'insert into tablename'. How shall I write the sql statement?

    simple suppose u wanned to insert user name and password into table user_info then this is a simple example .....
    Best Regds
    bondzoro
    [email protected]
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    public class tester extends HttpServlet {
    Connection con = null;
    public void init(ServletConfig sc){
    super.int(sc);
    Class.forName("oracle.jdbc.driver.OracleDriver");
    public void service(HttpServletRequest req,HttpServletResponse res) throws ServletException,IOE
    try {
    con=DriverManager.getConnection("jdbc:oracle:thin:@database_URL:1521:ORA8","username","pa
    String user = req.getParameter("username");
    String pass = req.getParameter("pass");
    PreparedStatement pst = con.prepareStatement("insert into user_info values(?,?)");
    pst.setString(1,user);
    pst.setString(2,pass);
    pst.executeQuery();
    pst.close();
    con.close();
    }catch(Exception _e){
    _e.printStackTrace(System.err);
    ~

  • How to insert data into two tables linke with foreign key..

    I have two tables
    1)EMP(emp_ID,username,emp_type_code)
    emp_ID is primary key, emp_type_code is a foreign key references emptype table.
    2)emptype(emp_type_code,emp_type_descripton)
    emp_type_code is primary key
    Could anyone help me ..how to insert data into EMP table. How to insert data into two tables linke with foreign key..

    CREATE TABLE "CATDB"."DWDIMUSER"
    "USER_ID" NUMBER(10,0) NOT NULL ENABLE,
    "SPECIALTY_ID" NUMBER(10,0),
    "FULLNAME" VARCHAR2(20 BYTE),
    "FNAME" VARCHAR2(20 BYTE),
    "LNAME" VARCHAR2(20 BYTE),
    "USER_SUBTYPE" VARCHAR2(20 BYTE),
    CONSTRAINT "DIMUSER_PK" PRIMARY KEY ("USER_ID") USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "CATDB" ENABLE,
    CONSTRAINT "DIMUSER_DIMSPECIALTY_FK" FOREIGN KEY ("SPECIALTY_ID") REFERENCES "CATDB"."DWDIMSPECIALTY" ("SPECIALTY_ID") DISABLE
    CREATE TABLE "CATDB"."DIMSPECIALTY"
    "SPECIALTY_ID" NUMBER(10,0) NOT NULL ENABLE,
    "SPECIALTY_NAME" VARCHAR2(100 BYTE),
    CONSTRAINT "DIMSPECIALTY_PK" PRIMARY KEY ("SPECIALTY_ID") USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "CATDB" ENABLE
    INSERT INTO DIMUSER (FullName, FNAME, LNAME, USER_TYPE, USER_SUBTYPE)
    SELECT DISTINCT
    Engineer AS FullName,
    regexp_substr(Engineer , '[^,| ]+', 1, 1) as FName,
    regexp_substr(Engineer , '[^,| ]+', 1, 2) as LName ,
    'Engineer'
    FROM EMPLOYEELOOKUP;
    INSERT INTO DIMSPECIALTY (SPECIALTY_NAME)
    SELECT DISTINCT SPECIALITY
    FROM EMPLOYEELOOKUP;
    COMMIT;
    CREATE TABLE employeelookup ...IS A TABLE THAT HAS ALL THE DATA NEDED TO BE FILLED IN BOTHE TABLES...
    CREATE TABLE "CATDB"."EMPLOYEELOOKUP"
    "EMPLOYEELOOKUP_ID" NUMBER(10,0) NOT NULL ENABLE,
    "ENGINEER" VARCHAR2(25 BYTE),
    "SPECIALTY" VARCHAR2(20 BYTE),
    CONSTRAINT "DIMSPECIALTY_PK" PRIMARY KEY ("EMPLOYEELOOKUP_ID") USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "CATDB" ENABLE
    DATA IN EMPLOYEELOOKUP
    Engineer, Specialty,
    John, Dow, Electronis,
    Dow, Jons, Technician
    Stan Smithers Sales
    Mark, Richards Marketing
    Jenny, Lane Marketing
    John, Lee Sales
    I NEED TO LOAD THE FOREIGN KEY IN DIMUSER FROM THE DIMSPECIALTY TABLE?
    BY USING THE LOOKUP TABLE TO MARCH THE NAMES UNDER THE Engineer COLUMN, SPECIALTY COLUMNE DISTICTIVLY BY JOINING THE DIMSPECILTY TO RISTIVE THE PRIMARY KEY AND FILL IT IN THE DIMUSER TABLE AS A FOREIGNE KEY.

  • How to insert data into a table from an xml document

    using the XmlSql Utility, how do I insert data into a table from an xml document, using the sqlplus prompt.
    if i use the xmlgen.insertXML(....)
    requires a CLOB file, which i dont have, only the xml doc.
    Cant i insert directly from the doc to the table?
    the xmlgen examples I have seen first convert a table to a CLOB xmlString and then insert it into another table.
    Isnt there any other way?

    Your question is little perplexing.
    If you're using XML SQL Utility from
    the commandline, just use putXML.
    java OracleXML putXML
    null

  • How to insert data into two tables at once using XSJS

    Hello Experts,
    My requirement is to insert data into two tables at once. I have a XS JS app and want to update these tables via xsjs. How can I do this ?
    Is there any mechanism like sql 'transactions' also in Hana ? If yes, how can I call it via xsjs ? If not, what are the ways to populate two different tables at once.
    Please advice. Any help is really appreciated.
    Thanks !

    There is nothing special about inserting into two tables at once in XSJS. Just issue two separate SQL Statements.  Don't execute the COMMIT until after both commands.  That way they are all one transaction.

  • How to insert date into a table by selecting form sysdate

    Hi
    My Table format is like this
    SQL>desc log;
    Name Null? Type
    EMP_ID VARCHAR2(30)
    LOGIN DATE
    LOGOUT DATE
    now when ever an employee logs in i w'd like to insert date into the table.
    i put up the following query
    SQL> insert into log(emp_id,login)
    2 values
    3 ('Ed_01',
    4 select
    5 sysdate
    6 from dual
    7 );
    select
    ERROR at line 4:
    ORA-00936: missing expression
    I got the above error how can i rectify that plz suggest me very urgently as i have to submit my project very early to my boss.

    try this :
    insert into log(emp_id,login) values ('Ed_01', sysdate);

  • How to insert data into a table only when data has changed its value (when compared to the previous inserted value)

    I wish to insert data into a table only when the value of the inserted data has changed. Thus, in a time series, if the value of the data at time, t-1, is 206 then if the data to be inserted at time t is 206, then it is skipped (not entered).
    If the value of the data at time t+1 is 206, it is skipped also; until the value changes, so if the value at t+1 was 205, then that would be inserted, and if at time t+2 the data is 206, it would be inserted too.
    What is the best way to do it without increasing overheads?

    This view works:
    SELECT
    i.IDNO,i.[Date],i.[Level]
    FROM
    mytable i
    INNER
    JOIN mytable
    d
    ON
    d.IDNO
    = i.IDNO-1
    WHERE
    i.[Level]
    <> d.[Level]
    on this mytable below.  A trigger could be quite useful here although I am cautious using them. However I wish to avoid the overhead by not having a temp table (which could be sizable).  mytable below
    should give 3 lines. The IDNO is an identity column.
    IDNO
    Item
    Date
    Level
    1
    X24
    12/23/13 10:41
    22996
    2
    X24
    12/23/13 10:41
    22996
    3
    X24
    12/23/13 9:21
    23256
    4
    X24
    12/23/13 9:21
    23256
    5
    X24
    12/23/13 9:22
    23256
    6
    X24
    12/23/13 9:22
    23256
    7
    X24
    12/23/13 9:22
    22916

  • How to insert data from a table to database

    Hi all,
    My problem statement is that:
    I have jsp page, which has a table with some columns editable for inserting data. I am using MySql database.
    Now when I insert the data in the table and click submit button , the data entered must get stored in the database.
    If its a single data I can do it , but how to do for mulitple rows or columns.
    Please suggest me a solution
    Regards,
    Suraj

    i did one program similar to this requirement. when the rows and columns are fixed then what is the problem.
    use java script and capture all the values into an array and pass this to servlet and there call a method which will set
    the bean objects. or else no need to pick the array directly pass all the parameters and set the beans by retrieving these
    parameters(request.getParameter()).
    Diablo

  • How to Insert Data in Database using BCS with out External List

    Hi,
    How to Insert,Update and Delete User Interface  data using business connectivity service with out External List.Please suggest me solution.
    Regards,
    khadar

    Once you've configured the external content type, you can interact with it using the BDC Object Models available to you.  You can use server side or client side and interact with the database without an external list.
    Check these links:
    Server side:
    http://msdn.microsoft.com/en-us/library/office/ff464357(v=office.14).aspx#sectionSection3
    Client Side: http://msdn.microsoft.com/library/jj164116.aspx
    Brandon Atkinson
    Blog: http://sharepointbrandon.com

  • How to insert Date into Database from workbench.

    Hi
    I have requirement where  I need to  insert the currentDate and Time to the database.   Here I am using  as
    At SQL Statement Info Editor ,have like these :
    Type     value
    Date     parse-dateTime(current-dateTime())
    At DB I have Datatype  as DateTime( Using MySQL). Here i am getting error like :
    Caused by: com.adobe.idp.dsc.jdbc.exception.JDBCIllegalParameterException: Type mismatch is found when preparing SQL statement. Expecting type 'date', but got type 'String'.
    Could  any one tell me where I can find  detailed log say hibernate type... where exatly we are  getting error.(Expect jboss's server log).
    Please tell how to  insert the date into the DB ASAP.
    Thanks
    Praveen

    Thanks for   all replies.
    Eventually I  got  the solution  the post
    From the Form (Using DatePicker) , we will get the DateTime  datatype to the Workbench. All  we need to  do is assign the  same to DateTime variable in the workbench and inserting the data to the DB.
    It works.
    Thanks
    Praveen.

  • How to insert data into database. Please help me(Struggling Very much)

    Hi i am having a jsp page which contains some textfields and one button. I have a database table and i have added to my page. The first column of Database table is ID which is of NUMERIC type and it has been set into primary key. And rest of fields are CHAR type. I am using SQL Server 2000. I have to enter the data into text fields and when i submit the add button it must add to the database table. But i am getting error like
    Exception Details: java.lang.IllegalArgumentException SRNI.TABLE1.NAME
    Please i am trying this one from two months. but it is not getting. I have tried alot by studying all tutorials in Java Studio Creator. I have posted many times but i have followed everyones suggestion. Please give me some instances of writing code to the corresponding requirements i have mentioned above.Please explain step by step including simple one also.
    Thanking You in Advance.

    Hi Srinivasan,
    Please check out the Database projects available at:
    http://blogs.sun.com/sakthi/entry/flavors_of_crud_tutorial_projects
    These have been exercised using this tutorial against different databases:
    http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/inserts_updates_deletes.html
    HTH,
    Sakthi

  • Inserting data in database table

    Hi Everybody,
                  Could any one help me out on this,
    I have 2 tables ztab and ztab1 ,What i need to do is i need to check each coloum entry of table ztab against there check table if it eixst i need to insert that record  in table ztab1 if not then i have to send a message .
    From My knowledge Insert Command Does not perform the Checks agains the Check table.
    I Would like to use CHECK statemet if any one has any Idea on using CHECK or other then Check  Statement PlZ do share .
    Regards,
    Aima

    If you are using ABAP to update your table then there is no other way to validate from all 5 -6 check tables and you will have to select from all.
    Statement "CHECK" will not serve your purpose as you have to give an error message if check fails or insert if check passes , so you can only use READ table with IF SY-SUBRC condition .
    Even if you dont check the check tables you can insert
    entries into ZTAB but then the referential integrity is violated .
    Check tables entries are validated when user makes an entry in screen , like when you create a purchase order you cannot enter a non existing material , so I am not sure if you can have user extry on screen . If yes and there is a foreign key defined on table field, it will automatically validate and give error on screen.
    Cheers.
    ( Dont forget to reward if answers were helpful ).

  • How to insert Data in a table from iFS.

    Hi,
    We have an application that communicates with the customer through iFS. I am asked to add a new functionality to that application that will populate a
    table in the database with customer id, customer inserted file name and internal file name after rename. I would
    really appreciate any input on how can I achieve this
    from our Custom Application using iFS.
    Is it possible to achieve this through LibrarySession API or I have to write a separate JDBC application which will be called from our current application to do the task.
    Thanks,
    SA

    Your question is little perplexing.
    If you're using XML SQL Utility from
    the commandline, just use putXML.
    java OracleXML putXML
    null

Maybe you are looking for

  • App.open not responding if called from inside onclick()

    Hi all. Working on a script for InDesign CC 2014 I found this problem : if I call app.open() from inside button.onclick() it stops and nothing happens. Since I'm a beginner with Javascript I'm probably doing something wrong, but I can not figure out

  • Display queue context doesn't corresponde to elements in output

    Hi people, just a suggestion from you because I don't know any more where to see. I realized a mapping in which I have to manipulate the contextes for an element. It's happen that watching the context by the Display Queue the number of contextes in o

  • How can I show the chart in forms?

    Dear all: I want to create a line chart. I use the chart wizard and it is successful to create the chart. But, it can't show the chart when I run the form. How can I show the chart in form6i? Besides, I see a document that refer to 'OG.pll'. I can't

  • DNG Profile Editor can't read ColorChecker shot on slide film

    I use my DSLR (Olympus E-5, 50mm macro) to digitize old Kodachrome and Ektachrome slides.  As it happens, I have reference shots of a Macbeth Color Checker I shot back then.  I thought I would be able to create custom DNG profiles to get accurate dig

  • Install EAS Console Client in Windows 7

    Hello, I have EPM 11.1.1.3 and I have difficulties installing EAS Console Client in my PC (Windows 7-32 bit). In other PC (same characteristics than mine), it installed with no problems. So I don't know why I can't do it in mine. I'll be grateful if