Inserting a record in backend using syncbo

Hi,
I have a header table and item table like,
EmpHdr-- fields 1) empno
                        2)ename
EmpItem--fields 1) empno
                        2)designation
how can I insert a record in the tables using syncbo.Can any body provide me the detail code.I am new to MI.Please help me.
MerepMeta.xml
<?xml version="1.0" encoding="utf-8"?><MeRepApplication schemaVersion="1.1" id="ZNEWEMPMCD" version="1.0"><Property name="CLIENT.BUILDNUMBER"></Property><Property name="C_APPLRESOLVE"></Property><Property name="DATA_VISIBLE_SHARED">X</Property><Property name="E_APPLRESOLVE"></Property><Property name="HOMEPAGE.INVISIBLE"></Property><Property name="INITVALUE"></Property><Property name="RUNTIME">JSP</Property><Property name="TYPE">APPLICATION</Property>
<SyncBO id="ZNEWEMP" version="3" type="twoWay" allowCreate="true" allowModify="true" allowDelete="true" reqDirectSync="true" downloadOrder="1">
<TopStructure name="TOP">
<Field name="SYNC_KEY" type="N" length="10" decimalLength="0" signed="false" isKey="true" isIndex="true"><Input type="create">false</Input><Input type="modify">false</Input></Field>
<Field name="ZEMPID" type="C" length="10" decimalLength="0" signed="false" isKey="false" isIndex="false"/>
<Field name="ZEMPNAME" type="C" length="20" decimalLength="0" signed="false" isKey="false" isIndex="false"/>
<ChildStructure name="010">
<Field name="SYNC_KEY" type="N" length="10" decimalLength="0" signed="false" isKey="true" isIndex="true"><Input type="create">false</Input><Input type="modify">false</Input></Field>
<Field name="ZEMPID" type="C" length="10" decimalLength="0" signed="false" isKey="false" isIndex="false"/>
<Field name="ZDESIG" type="C" length="15" decimalLength="0" signed="false" isKey="false" isIndex="false"/>
</ChildStructure>
</TopStructure></SyncBO></MeRepApplication>
Regards,
Srikanth Reddy.T
Edited by: Srikanth Thatipally on Oct 21, 2008 8:22 AM

Hello,
Please refer to the API:
https://admin.sdn.sap.com/irj/sdn/go/portal/prtroot/com.sap.km.cm.docs/library/mobile/mobile-infrastructure/mobile%20development%20kit%202.5/content/javadoc/overview-summary.html
Look into the smartcyn package. You will want to create an instance f your sync bo and add rows into it. The API is pretty straightforward.
You can also use mCAF that is shipped with MAM/MAU/DSD/etc that hides the technicalities from you.
Thank you,
Julien.
http://www.msc-mobile.com

Similar Messages

  • Inserting a record in database using Java

    Hello All,
    i have connected a Java Application to the SAP BO Database using DI API and would like to insert a record in the demo database without using an SQL Query "Insert into table1...." but using the following snippet though i dont know if am using the right classes :
                                    ICompany company = conn.getCompany();
                                     IItems items = SBOCOMUtil.newItems(company);
                        items.setItemCode("124");
                        items.setItemName("VXC");
                        items.setItemsGroupCode(1);
                        items.setItemType(0);
                        items.add();
    What i am trying to do here is insert a new record but i dont know where i should mention the table name for e.g. there is table called OITM in the demo database from BO where i would like to create a new Item.
    Could anyone help me here.
    Regards,
    Amit Hingher

    Hi Amit,
    You don't need to reference the destination tables as there is a class for each data object in the DI API and the data tables associated with the object are hardcoded in the class.
    The Items class is the correct one for adding item master data (ie data in OITM, OITW etc).
    I'm not very familiar with these Java objects but I think the add method should return an integer value (as it does with the COM objects used by .NET). If the return value is zero then the add was successful. If the add failed then you'll get a non-zero value which is the SBO error code.
    Kind Regards,
    Owen

  • Unable to insert the record to table using pre-insert & pre-update trigger

    Hi All,
    I have tried to insert and update the backend table using the pre-update and pre-insert triggers. But its not working for me. Please find below the code which i have used in the triggers.
    Pre-insert trigger:
    DECLARE
    v_cust_num_cnt NUMBER;
    BEGIN
              SELECT      COUNT(customer_number)
              INTO      v_cust_num_cnt
              FROM cmw_bc_mobile_number
              WHERE substr(customer_number,1,15)=substr(:BLOCKNAME.CUSTOMER_NUMBER,1,15);
              IF      v_cust_num_cnt = 0 THEN
                        INSERT INTO cmw_bc_mobile_number (CUSTOMER_NUMBER
                                                                                                   ,MOBILE_NUMBER
    ,CREATION_DATE
    VALUES
    (substr(:BLOCKNAME.CUSTOMER_NUMBER,1,15)
    ,:BLOCKNAME.MOBILE_NUMBER
    ,SYSDATE
    COMMIT;                                                                                                    
    END IF;          
    END;
    PRE_UPDATE TRIGGER:
    BEGIN
              IF :SYSTEM.RECORD_STATUS = 'CHANGED' THEN
              UPDATE apps.cmw_bc_mobile_number
         SET mobile_number = :BLOCKNAME.MOBILE_NUMBER,
         creation_date = SYSDATE
              WHERE customer_number=substr(:BLOCKNAME.CUSTOMER_NUMBER,1,15);
              COMMIT;
         END IF;
    EXCEPTION
              WHEN OTHERS THEN
                   NULL;     
    END;
    Please let someone assist in gettting it resolved.
    Regards,
    Raj.

    Just use MESSAGE (we don't know what fnd_message is, that is some custom code):
    message('v_cust_num_cnt='||v_cust_num_cnt);
    IF v_cust_num_cnt = 0 THEN
      message('Now inserting...');
      INSERT INTO cmw_bc_mobile_number (CUSTOMER_NUMBER... 
    else
      message('Nothing to insert');
    end if;

  • Insert multiple records into Oracle using Java

    Hi,
    Has anyone tried to insert multiple records into an Oracle table from Java? I have my data in a Java collection.Can I send a Java Collection to an Oracle Package as a PL/SQL Table Type? My problem is I dont want to instantiate a CallableStatement object everytime I do an insert. Instead I want to do that only once and then insert multiple records in one operation.
    Any suggestions will be appreciated,
    Thanks,
    Alex

    Hi Mensa,
    I went thru the code example in your book in chapter 8 (downloaded it from OTN). It looks like the java code for "public class myPLSQLIndexTab" might be a java stored procedure stored in the oracle database?
    Pardon my ignorance because I've never worked on java code in the oracle database itself but how would I call such a program outside the oracle database? For example say I have a batch job that downloads data from a webservice and that batch job is written in java and its sitting on a batch server somewhere on the network. But the java program that inserts data into the database is sitting in the oracle database (also somewhere in the same network). How can the java code sitting on the batch server talk to the java code sitting on the oracle server? Is it the same as calling a pl/sql package using CallableStatement?
    Thanks
    Alex

  • Meeting trouble when inserting a record into dababase using JDBC.

    Hi, everyone!
    If I want to insert a record in a table of a database, but I
    do not know whether there is already a primary key existing in
    the database (I mean the value of the record which I want to insert
    conflicting, i.e. duplicating, with one of the value of primary
    key in the database). So, I have two solutions:
    1. check whether there is already a primary key which confilcting
    with the value I want to insert, if not, insert into database.
    2. do not do any check before and insert the record directly, and catch
    SQLException.
    But they both have shortcomings. Solution 1 will lost time (must checking first)
    and solution 2 will throw a SQLException, and from the Exception, I do not know
    how can I infer it is a primary key conflicting exception.
    (I do not know how to distinguish it from other type of SQLException, for example,
    database name error exception or SQL statement syntax error).
    I do not know whether I have made myself understood.
    Who have better solutions?
    Thanks in advance,
    George

    If I use solution 2, can I get some information from
    SQLException? For example, can the exception tell me
    whether it is a duplicated primary key error or SQL
    statememt syntax error? You don't have to look at the error text. You should
    look at the error code. But keep in mind that
    it is vendor specific. A duplicate key error in Oracle
    has different error code then in SQL Server.Sounds good in theory, in practice it leaves a lot to be desired. First one still has to figure out which codes are problematic, and there is still no guarantee that they won't change. Moreover you might find that the code is used for different types of errors, and that won't work.
    >
    May you can have a look at the sqlstate, this should
    be the same across different DB's as it is defined int
    he SQL92 standard, but I wouldn't bet on it...
    I would bet - against it.

  • Insertion of Record using GRID

    Hello Sir,
    This is Debasish here.Using Flex Grid I want to insert a
    record in backend resource i.e. database.So how I can create a
    blank editable row in flex grid.
    Please provide me support.

    hi
    When you're workin with Master-Detail make sure that you're selecting right controls from the "Data Control Palette". Drop the Constructors from "data control palette" on your JSF JSP Form. Then use the persistEntity method drop it on the same form and a dialog box wil open, in this select the value as that collection's RESULT,
    For the detail table drop the detail table constructor on the form and also the dropdown list box on the primary key of the master table and then use persistEntity.
    for furthur reference on CREATING I/P FORMS USING CONSTRUCTORS REFER.. jdeveloper documentation section 10.7.1
    When you're working with Master-Detail make sure your detail table is properly linked using Foreign Key. and in the create table template make sure you choose onDelete CASCADE option. This will help you to delete all child records automatically when the master record is deleted.
    BEST OF LUCK
    Ravi Trivedi
    Message was edited by:
    Trivedi
    Message was edited by:
    Trivedi

  • Inserting and Updating records in ORACLE using WebDynpro Java

    Hi All
    I got connected to oracle backend (using my previous thread), but now i want to insert and update the records
    i have created views  for insert and update,
    Thanks in advance
    Sushma

    Hi shusma..
    chk this link..
    <b><u>Creating Connection</u></b>
    package com.sap.xirig;
    import javax.naming.*;
    import javax.sql.*;
    import java.sql.*;
    public class DBLookup {
    String Conn_Status = "Not Connected";
    String Language_Desc = "Empty";
    String Language_Cd = "Empty";
    Connection conn;
    Context ctx;
    DataSource ds;
    //Constructor for the DBLookup object
    public DBLookup {
    try {
    ctx = new InitialContext();
    if (ctx == null) {
    throw new Exception("Boom - No Context");
    // If JDBC 2.0 connection is used please create the DataSource object as below
    // ds = (DataSource) ctx.lookup("jdbc/ORACLEDATASOURCE");
    // If JDBC 1.0 connection is used please create the DataSource object as below
    // ds = (DataSource) ctx.lookup("jdbc/notx/ORACLEDATASOURCE");
    if (ds == null) {
    throw new Exception("Boom - No dataSource");
    catch (Exception e) {
    e.printStackTrace();
    public String getLanguageDesc(String v_str) {
    Statement stmt = null;
    ResultSet rst = null;
    try {
    if (ds != null) {
    conn = ds.getConnection();
    Conn_Status = "Could not get connection to
    datasource";
    if (conn != null) {
    Conn_Status = "Got Connection " +
    conn.toString();
    stmt = conn.createStatement();
    rst = stmt.executeQuery("SELECT
    LANGUAGE_DESC FROM LANGUAGETRANSLATION WHERE LANGUAGE_CD='" + v_str +
    if (rst.next()) {
    Language_Desc = rst.getString(1);
    conn.close();
    catch (Exception e) {
    e.printStackTrace();
    finally {
    if (rst != null) {
    try {
    rst.close();
    catch (Exception e) {
    e.printStackTrace();
    if (stmt != null) {
    try {
    stmt.close();
    catch (Exception e) {
    e.printStackTrace();
    if (conn != null) {
    try {
    conn.close();
    catch (Exception e) {
    e.printStackTrace();
    return Language_Desc;
    http://e-docs.bea.com/wls/docs81/oracle/API_joci.html
    Hope this will help u..
    URs GS

  • Can you use ESB to insert multiple records into a Database

    We have an XML file that has a Parent/Child relationship.
    In situation 1 we have a single parent record in the xml file. We can insert the record into the database successfully.
    In situation 2 we have a parent and a an associated child record. By using a filter expression to identify the existence of the child record we can route to the first DB Adapter to insert the parent then to the second DB Adapter to insert the child.
    Is this final scenario logical and also possible.
    Situation 3 we have multiple child records associated to a single parent. So we would first insert the parent record then insert all the child records.
    Thanks

    I use PL/SQL for this if you are using Oracle.
    Have a look at this post, it is for AQ but the concept can be used for PL/SQL
    Re: Can I pass a pl/sql table as a parameter from a database adaptor
    I will send you an example
    cheers
    James

  • Insert Multiple records using Database adapter with Stored procedure func

    Hi All,
    I want to insert multiple records on a database using a stored procedure. I wanted to insert those records using a Database Adapter and the Database adapter should be invoked by a Mediator.
    Can somebody suggest me with ideas whether it can be acheived with OOB capabtilities in SOA suite or not?
    Thanks for your help in advance.
    Thanks,
    Shiv

    The use case you want to achieve is feature supported by the DBAdapter and it is possible to invoke the same from mediator.
    Please have a look at the oracle documentation and you should be able to get the necessary information.
    The below links should help you as well:
    http://download.oracle.com/docs/cd/E15523_01/integration.1111/e10231/adptr_db.htm
    http://blogs.oracle.com/ajaysharma/2011/03/using_file_adapter_database_adapter_and_mediator_component_in_soa_11g.html
    There are some video tutorials as well :)
    http://www.youtube.com/watch?v=dFldS-fDx70 This should also help
    Thanks,
    Patrick

  • Abort inserting a record in a table using a trigger

    Hi there,
    Is there any way to abort inserting a record in a table using a trigger?
    For full details, I have the following table ("myTable"):
    BSC INTEGER NOT NULL,
    BTS VARCHAR2(20) NOT NULL,
    INFO1 INTEGER,
    INFO2 INTEGER
    myTable_PK = PRIMARY KEY (BSC,BTS)
    I have also a stored procedure that imports a data from text file and inserts them to the specified table (using UTL_FILE package). The stored procedure works great.
    But the thing that in the text file itselft it might be (due to third-parity report generation bug) that the primary key will be violated or the BSC/BTS field has null value. In such case I just want to ignore the insertion statement using a trigger.
    Thanks

    Ok Jens, could you tell me what exception could I use?
    Below a protion of my StoredProcedure.
    CREATE OR REPLACE PROCEDURE update_myTable() IS
    FHANDLE UTL_FILE.FILE_TYPE;
    BSC INTEGER;
    BTS VARCHAR2(20);
    INFO1 INTEGER;
    INFO2 INTEGER;
    BEGIN
    FHANDLE := UTL_FILE.FOPEN('LOG_FILE_DIR',FILENAME,'R',4000);
    LOOP
    UTL_FILE.GET_LINE(FHANDLE,STR);
    -- Process the line STR and generates BSC, BTS, INFO1, and INFO2 values
    EXECUTE IMMEDIATE 'INSERT INTO myTable VALUES(:1,:2,:3,:4)' USING BSC,BTS,INFO1,INFO2;
    END LOOP;
    EXCEPTION WHEN NO_DATA_FOUND THEN UTL_FILE.FCLOSE(FHANDLE);
    END UPDATE_R205BTS;
    Remember that I am already using an exception with NO_DATA_FOUND to indicate the end of file then closing it.
    Thanks for your reply

  • Insertion a record in a table having columns of different charsets using OLEDB

    My development environment -
    Database -> Microsoft SQL Server
    2008 R2
    OS -> Windows Server
    2008 R2
    Database Charset -> Chinese_PRC_CI_AS (Windows
    936)
    Operating System Charset -> Chinese
    Below table is having varchar fields with different charsets.
    create
    table dbo.tcolcs1 (
        c1 int
    not
    null
    primary
    key,
        c2 varchar(30)
    collate SQL_Latin1_General_Cp1_CI_AS ,
        c3 varchar(30)
    collate Chinese_PRC_CI_AS
    I want to insert below record using OLEDB APIs provided by Microsoft. Just for information, character '0x00C4' does not
    belong to Windows 936 codepage.
    insert
    into dbo.tcolcs1
    values (10,
    NCHAR(0x00C4), NCHAR(0x4EBC))
    Code snippet -
    DBPARAMBINDINFO bind_info
    memset(&bind_info,
    0, sizeof(DBPARAMBINDINFO));
    bind_info.pwszDataSourceType = L"DBTYPE_VARCHAR";
    bind_info.wType = DBTYPE_STR;
    I have bound the varchar field with DBTYPE_STR. I can see that my code is not inserting Latin1 character (0x00C4) correctly
    into the table. The code always inserts a blank character into Latin1 column (c2) and 0x4EBC into Chinese column (c3).
    Later, I changed the binding from DBTYPE_STR to DBTYPE_BYTES as below -
    bind_info.pwszDataSourceType = L"DBTYPE_BINARY";
    bind_info.ulParamSize =
    0;              
    bind_info.wType = DBTYPE_BYTES;
    With the above change, I observed that OLEDB is converting hex value to string. It is inserting 0x00C4 as 'C4' and 0x4EBC
    as '4EBC'. I also tried with adding 'AutoTranslate=no' in driver connection string, but it did not help. How can I insert above record with OLEDB in the above table ?
    Thanks in advance.

    Did you try making fields as unicode?
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • How to insert the records using sql query

    hi,
    i insert the record uisng sql query and DOTNET programme successfully and increase the doc num .ubut when i try to  add record using SAP B1 the old Doc no show.It means its not consider the docnums which are not inserted by sql query.
    how can i solve this problem?
    Regards,
    M.Thippa Reddy

    You are not support use Insert / Update / Delete on SAP Databases directly.
    SAP will not support any database, which is inconsistent, due to SQL-Queries, which modify datasets or the datastructure of the SAP Business One Database. This includes any update-, delete- or drop-statements executed via SQL-Server Tools or via the the query interface of SAP Business One
    Check SAP Note: 896891 Support Scope for SAP Business One - DB Integrity
    [https://websmp130.sap-ag.de/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/smb_searchnotes/display.htm?note_langu=E&note_numm=896891]

  • How to update and insert the records without using Table_comparison and Map_operation?

    How to update and insert the records without using Table_comparison and Map_operation?

    Use either join or MERGE see this Inserting, Updating, and Deleting Data by Using MERGE

  • As i am fresher Please share the doc of ECMA script using java script in SharePoint 2013 also how we can insert,update,delete records in list using ECMA script.

    As i am fresher Please share the doc of ECMA script using java script in SharePoint 2013 step by step also how we can insert,update,delete records in list using ECMA script.
    Thanks and Regards, Rangnath Mali

    Hi,
    According to your post, my understanding is that you want to use JavaScript to work with SharePoint list.
    To create list items, we can create a ListItemCreationInformation object, set its properties, and pass it as parameter to the addItem(parameters) function
    of the List object.
    To set list item properties, we can use a column indexer to make an assignment, and call the update() function so that changes will take effect when you callexecuteQueryAsync(succeededCallback,
    failedCallback). 
    And to delete a list item, call the deleteObject() function on the object. 
    There is an MSDN article about the details steps of this topic, you can have a look at it.
    How to: Create, Update, and Delete List Items Using JavaScript
    Thanks & Regards,
    Jason
    Jason Guo
    TechNet Community Support

  • Procedure to insert same record for 30 times in a table using for loop

    Hi,
    I need to insert a record in a table which has to be iterated using for loop

    I think you are in the wrong forum. You can do that like this:
    CREATE TABLE my_table (my_column NUMBER);
    BEGIN
       FOR i IN 1 .. 30
       LOOP
          INSERT INTO my_table
                      (my_column
               VALUES (i
       END LOOP;
    END;
    /Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.apress.com/9781430235125
    http://apex.oracle.com/pls/apex/f?p=31517:1
    http://www.amazon.de/Oracle-APEX-XE-Praxis/dp/3826655494
    -------------------------------------------------------------------

Maybe you are looking for

  • Very dim screen on MacBook Pro - how to prove it?

    I bought an MBP about 4 weeks ago (just before the new rev came out, so this one does not have LED backlight) and have mostly been using it connected to a 23" cinema display. When I was using the built-in screen the other day I realised it was very d

  • Debit & credit line item clearing in F-53

    Dear All, Am in the process of developing payment advice for my client, one of his requirement is while making payment against vendor in F-53, he selecting debit (KG) and credit (KR) line items against the vendor and he paying for the remaining amoun

  • NW2004s: Homogeneous systemcopy ABAP + JAVA

    When doing a combined ABAP + Java systemcopy via R3load procedure, the "old" configurations in the propertysheets on the filesystem may get lost. What is the general procedure here to find out, what needs to be manually adapted after a systemcopy? I

  • Jerky videos with 30 fps not ideal for Europe with 25 fps?

    When I edit a video (720p 30fps) from my compact camera, Sony WX1, on the iMovie, the rendered video seems to be jerky. (especially if I follow a subject with the camera) When I edit a video (1080i 50fps) from my Sony Video camera, the edited video l

  • How do I upgrade my iPad online?

    iPad