How to create a new record using ODataModel?

Hi,
I am new to UI5 and so ODataModel. I have tied one table to an ODataModel.
How would I send request to a server so that I will have a new entry created at server end?
I googled this and I tried following:
1. Called createEntry method on ODataModel as follows:
sap.ui.getCore().byId("maintainRolesTable").getModel().createEntry("DERMASSIGNMENTSet",{
"DeUser":"C5192081",
"SeqNo":"X",
"Childbp":"C5192081",
"ChildbpName":"",
"Id":"2",
"RelationType":"",
"Parentbp":"I0656568",
"ParentbpName":""
2. I called then submitChanges method on the model as follows:
sap.ui.getCore().byId("maintainRolesTable").getModel().submitChanges();
This is giving error as follows:
POST https://lsftdc00.wdf.sap.corp:1443/sap/opu/odata/sap/ZSECENTRAL_SRV/DERMASSIGNMENTSet 403 (Forbidden) datajs.js:17
2014-06-05 16:53:32 The following problem occurred: HTTP request failed403,Forbidden,CSRF token validation failed -
When I try to use ajax call instead of these methods, I get error as follows:
var obj={
  "Childbp": "C5192081",
  "ChildbpName": "Supriya Kale",
  "DeUser": "C5192081",
  "Id": "8",
  "Parentbp": "I0656568",
  "ParentbpName": "",
  "RelationType": "RESOURCE MANAGER",
  "SeqNo": "1",
             "metadata":{
                 "id":"https://lsftdc00.wdf.sap.corp:1443/sap/opu/odata/sap/ZSECENTRAL_SRV/DERMASSIGNMENTSet(DeUser='C5192081',SeqNo='x')",
                 "uri":"https://lsftdc00.wdf.sap.corp:1443/sap/opu/odata/sap/ZSECENTRAL_SRV/DERMASSIGNMENTSet(DeUser='C5192081',SeqNo='x')",
                 "type":"ZSECENTRAL_SRV.DERMASSIGNMENT"
  $.ajax({
  type: "PUT",
  dataType: "json",
  url: "https://lsftdc00.wdf.sap.corp:1443/sap/opu/odata/sap/ZSECENTRAL_SRV/DERMASSIGNMENTSet",
  data: JSON.stringify(obj)
  }).success(function( msg ) {
  alert('HI read operation complete....................................');
  }).error(function(msg){
  alert("error occurred");
I get following error:
PUT https://lsftdc00.wdf.sap.corp:1443/sap/opu/odata/sap/ZSECENTRAL_SRV/DERMASSIGNMENTSet 403 (Forbidden)
Can anyone tell me if I am going wrong in calling methods? Help would be appreciated.
Thanks,
Supriya Kale

Hi Supriya,
you can take a look at this blog. Building a CRUD Application with SAPUI5 Using Odata Model
Scroll down to Create Operation.
There you can see that the author is also first fetching CSRF and the calling CREATE operation.
For simple example see correct answer in this thread.
HTTP request failed403,Forbidden,CSRF token validation failed
Best regards,
Peter

Similar Messages

  • How to create a new record using a custom method?

    Hi I want to create Jdev 11 a new record using the contructor following in the footsteps of http://www.oracle.com/webapps/online-help/jdeveloper/10.1.3/state/content/navId.4/navSetId._/vtAnchor.CACCIJAG/vtTopicFile.adfdevguide%7Cweb_adv~htm/.
    My problem is the following.
    Messages for this page are listed below.
    Error
    JBO-29000: Unexpected exception caught: javax.ejb.EJBException, msg=java.lang.IllegalArgumentException: Object: null is not a known entity type.; nested exception is: java.lang.IllegalArgumentException: Object: null is not a known entity type.
    Error
    java.lang.IllegalArgumentException: Object: null is not a known entity type.; nested exception is: java.lang.IllegalArgumentException: Object: null is not a known entity type.
    Error
    Object: null is not a known entity type.
    Someone can help me?
    Cristian.

    Hello Frank, this tutorial make it and was successful but, what I am trying to do is add a new record in the table departments. The steps undertaken are suguientes
    drag over page the contructor department, with a submit, this will drag on the button, the method presistencia, set binding action with "$ (bindings.Departments.result)", and when running the application gives me the error
    Nov 2, 2007 10:06:22 PM oracle.adf.controller.faces.lifecycle.FacesPageLifecycle addMessage
    WARNING: ADFc: JBO-29000: Unexpected exception caught: javax.ejb.EJBException, msg=java.lang.IllegalArgumentException: Object: null is not a known entity type.; nested exception is: java.lang.IllegalArgumentException: Object: null is not a known entity type.
    oracle.jbo.JboException: JBO-29000: Unexpected exception caught: javax.ejb.EJBException, msg=java.lang.IllegalArgumentException: Object: null is not a known entity type.; nested exception is: java.lang.IllegalArgumentException: Object: null is not a known entity type.
    I need to know if what I am doing is right, because I followed the steps of the tutorials and it is not functioning the insertion of a new record.
    Thank you thank you.

  • How to create a new material using a BAPI?

    Dear friends,
    How to create a new material using a BAPI? I mean without knowing the material no., how to just create a new one using function modules(BAPI)?
    Thanks a lot!

    Dear,
    New material can be created by using a BAPI_MATERIAL_SAVEDATA.
    More over their are lots of threads available on SDN on the question you raised so kindly search the SDN before posting any thread .
    Cheers
    fareed

  • How to create a new component using SPICE?

    People, I don't know how to create a new component using SPICE.
    I know that it's possible to create a new component and use a SPICE code, but I don't know how to do this very well, and I need the TI ISO124 (Isolation Amplifier), and I have no idea on how to do that. Can somebody help me? I need to develop a layout.
    Thank you!!

    Hi,
    Here is a tutorial that explains in details how to create your own component in Multisim using a SPICE model.
    Hope you find it helpful,
    Mahmoud W
    National Instruments

  • Crystal Reports XI - How  to create a new field using a formula field

    I'm quite new to CR, but have been learning quickly!
    I would like to know how to automatically create a new record/field based on another field in that row...
    I have a report showing the following data:
    Run Code     Start KM    Stop KM    Status 
    H2                 100            150           Partial
    H2                 150             155          Partial
    H2                 155             160          Partial
    S3                 120             150       Completed
    The status is generated by comparing the 'Start KM' and 'Stop KM' against fields in another table called 'Start Odo' and 'Stop Odo'
    In this example...
    H2 has 'Start Odo' and 'Stop Odo' values of 90 to 160, therefore there is still 90-100 to check.  The 'Start KM' and 'Stop KM'  is equal to the 'start Odo' and 'stop Odo' for S3, therefore it shows completed.
    My question is how do you create a formula field, which will add an entire row...displaying the values 90-100.
    I've been trying to use a conditional check in the 'Start KM' column, that sees if status is equal to partial than if start km is greater than start odo (Which is the reference km) then display the value of start odo in the new row. I'm stuck at how to create a new row.
    I want the final result to look like this...
    Run Code     Start KM    Stop KM    Status 
    H2                  90              100         Partial
    H2                 100             150          Partial
    H2                 150             155          Partial
    H2                 155             160          Partial
    S3                 120             150       Completed
    Any suggestions would be more than appreciated

    Hi Adi
    Looking at your examples it seems that you want to add a row to the existing recordset (rows fetched from the database).
    If it is the case (even if based on a formula) then you can not do it within crystal. Crystal is designed to display data and ideally it should not generate the new data.
    However, as per your requirement you can try to add this logic at database end. May be a command object within Crystal Reports can help you.
    Let me know if you do not understand anything.
    Regards
    Nikhil

  • How to create a new plugin using Adobe InDesign CS5?

    How to create our own plugin using Adobe InDesign CS5?is there any documents available for this?

    Sure. (Didn't Google find anything?)
    http://www.adobe.com/devnet/indesign/sdk.html
    But you don't "use" InDesign to write plugins. You need a C++ compiler and a lot of programming knowledge and experience with C++. If this means nothing to you, don't look any further -- it's way too complicated to "go and get started" at random. Adobe's documentation is not intended for learners, starters, and people who shrink back at the thought of having to read multiple help documents that are each a couple of megabytes large.
    Using the SDK is so complicated there's even a part of the forum dedicated to it, aptly (and obviously) called InDesign SDK. If you browse the messages in there, you can get an idea of the most common pitfalls and problems.
    If the above scares you off, well, that was fully intentional (sorry, but it is). It's by far easier to write scripts. Scripts have several advantages over plugins:
    1. They are platform independent (Javascripts are; AppleScript is just for Macs and Visual Basic is just for Windows). Plugins are exclusively platform dependent. To write the same plugin for both Windows and for Mac, you have to know all the pitfalls of changing code from one platform to another, and you need a complete working compiler and development system for both platforms.
    2. They are version independent. Simple scripts work on a fairly great range of InDesign versions -- some of my own scripts date back to CS, and are totally or virtually unchanged. It's even possible to force "too old" scripts to work with newer versions.
    3. Scripts can do most of the things a plugin can do. The main difference used to be that plugins allow you to write a fully integrated look-and-feel part of InDesign, but with the advance of ScriptUI and event handlers and menu customization, you come quite far. Only for highly specialized functions you still need a real plugin (custom item integration, custom spell and hyphenation modules, stuff like that).
    4. The scripting community is very active -- it also has a forum of its own, called (well, obviously) InDesign Scripting -- and are a friendly lot, always ready to help. (Unless you whine about how to do every little thing. (That is, I can't stand that personally. Others may not mind.))
    5. Scripting is easy. ... not really, but it is fairly easy, and compared to writing a custom plugin in C++, it's a breeze, a walk in the park, and a summer stroll all rolled into one.

  • How to create a new record in crm?

    Hi,
    Have any one tried creating a new crm record using the function crm_order_maintain?
    I noticed that there is a ref_guid in each of the table structures in the exporting parameters. Is it a standard ref_guid for all creation objects?
    Thanks in advance,
    Jen

    In CRM every object contains a 32 bit guid which is always unique and is generated by the system.You need not to give this guid while creating an object.
    Here is a sample code for creation of a quotation:
    DATA:
        t_object_to_save    TYPE crmt_object_guid_tab,
        t_saved_objects     TYPE crmt_return_objects,
        t_objects_not_saved TYPE crmt_object_guid_tab,
        t_new_orders        TYPE crmt_orderadm_h_comt,
        s_new_order         TYPE crmt_orderadm_h_comt,
        t_input_field       TYPE crmt_input_field_tab,
        s_input_field       TYPE crmt_input_field,
        s_fieldname         TYPE CRMT_INPUT_FIELD_NAMES.
    s_new_order-handle = 1.
    s_new_order-mode = 'A'.
    s_new_order-process_type = 'QUOT'.
    s_input_field-ref_handle  = 1.
    s_input_field-ref_kind    = 'A'.
    s_input_field-objectname  = 'ORDERADM_H'.
    s_input_field-logical_key = space.
    CLEAR s_fieldname.
    s_fieldname-fieldname = 'MODE'.
    APPEND s_fieldname TO s_input_field-field_names.
    s_fieldname-fieldname = 'PROCESS_TYPE'.
    APPEND s_fieldname TO s_input_field-field_names.
    INSERT s_input_field INTO TABLE t_input_fields.
    INSERT s_new_order INTO TABLE t_new_orders.
    CALL FUNCTION 'CRM_ORDER_MAINTAIN'
      CHANGING
        ct_orderadm_h     = t_new_orders
        ct_input_fields   = t_input_fields
      EXCEPTIONS
        error_occurred    = 1
        document_locked   = 2
        no_change_allowed = 3
        no_authority      = 4
        OTHERS            = 5.
    if sy-subrc ne 0.
    clear s_new_order.
    read table t_new_orders
    into s_new_order
    INDEX 1.
    if sy-subrc ne 0.
    l_object_to_save = s_new_order-guid.
    INSERT l_object_to_save INTO TABLE t_objects_to_save.
    CALL FUNCTION 'CRM_ORDER_SAVE'
      EXPORTING
        it_objects_to_save   = t_objects_to_save
      IMPORTING
        et_saved_objects     = t_saved_objects
        et_exception         = t_exceptions
        et_objects_not_saved = t_objects_not_saved
      EXCEPTIONS
        document_not_saved   = 1
         OTHERS               = 2.
    if sy-subrc eq 0.
    call function 'BAPI_TRANSACTION_COMMIT'.
    endif.
    endif.
    <b>REWARD FULL POINTS.</b>
    cheers,
    ashish.

  • How to create a new DataBase using Oracle 10g Express Edition???

    Hello, I am new to Oracle, I am used to Microsoft SQL Server (Enterprise Manager).
    Here in Oracle I do not get how do I create a DataBase, and then create tables on it.
    could anyone please explain to me how to do it?

    A SQL Server database is roughly equivalent to an Oracle schema.
    You should rarely need to create a new database. If you do need to create a database, get a 'for fee' edition of Oracle and use the dbca tool (Database Configuration Assistant) to do that. In fact, you are only allowed to have one XE database on the machine.
    However, you can create as many schemas in an existing Oracle database as you need. (One schema, owned by userid SYS, is roughly equal to your 'master catalog'.)
    You can create other schemas simply by
    1) creating a userid that will own the schema (one designated for maintenance of the schema);
    2) grant that userid appropriate privileges, such as 'CREATE TABLE', 'CREATE VIEW' as shown in the SQL Reference manual under the GRANT section;
    3) provide that userid with a quota in one or more tablespaces (see the CREATE USER command in the SQL Reference manual);
    4) create the objects, such as tabels, views, sequences, stored procs and functions, etc. (as in the SQL Reference manual);
    5) create the users who will access the objects, and grant them the CREATE SESSION capability (as in the SQL Reference manual);
    6) grant access (select, update, execute, etc.) on the schema objects to these users (as in the SQL Reference manual);
    7) if desired, create synonyms on the schema objects so the users do not need to use fully qualified syntax such as "SELECT col FROM schema.table;" (as in the SQL Reference manual).
    In case you are interested in looking at the SQL Reference manual, it can be found at http://www.oracle.com/pls/db102/portal.portal_db?selected=1 ;-)

  • How to creat a new record in the Db table

    Dear all,
    I am trying to update a DB table and i want to create new records in this table every time the user changes something on the screen,
    I want to append the DB table and not update it how should  i go about this???
    Regards,
    Vijay.
    PS:

    Hi
    User INSERT statement for the same...
    Please read the help...
    Cheers,
    Hakim

  • How to create a new database using Enterprise manager?

    hi all,
    thank you for all your support. i want to create a new database . I tried following these steps
    i am using Oracle 9i and windows XP
    1, opened the enterprise manager by clicking from programs
    2,selected launch standalone Application
    3, from the tree i expanded the network node and expanded the databases node ,now i can see the globaldatabase i created during installation . i can login that database using systems and manager (username & password )
    4, clicked the new database icon from the window , a small window with node named database appeared
    5 , I tried to expand that by clicking on the database node ,but it pops up a new window showing no active session selected
    I would be grateful if anyone can suggest a solution for this
    thanks & regards

    Hi,
    How can i access DBCA
    start ---> run ---> DBCA <<hit enter>>
    or
    start ---> program ---> oracle home ---> configuration tools ---> database configuration assistant.Regards
    Mohammed Taj
    http://dbataj.blogspot.com

  • How to create a new report using MS Word add-ins?

    Hi, I am a newbie. I am using BI Publisher 10.1.3.4 and l want to create a simple report using BI Publisher from MS Word add-ins. I don't have a default template. What are the steps to create a new report from scratch. I want to create a simple report for one table contains 4 columns & 2 rows data, and then save the report under my folder.
    I am in an urgent need to learn this, any suggestions are highly appreciated.
    Thanks all.

    Thx Everyone, I figured that out. It's simple and clear to me.

  • How to create a new customer using XD02?

    Hi ,
    My requirement is to create a new customer in XD02 when I change the customer name or address of existing customer and not to update the original customer.
     ex.)  1. change the information of customer code 'F001'  in XD02.
              2. save 'F001'  not changing its information.
              3. create 'F002'  reflecting the updated information.
    I know normally, the existing customer is updated when we change its customer name or address in XD02, but I heard BTE may meet my requirement.
    Could you tell me how to realize it or possible BTE?
    Regards,
    Miyako
    Edited by: kuwahara miyako on Nov 20, 2008 10:22 AM

    Hello Karthik,
    Thanks for you reply.
    I am a SAP developer.
    I need to create a new Exit in my program which can be enhanced later by customer.
    Customer could then enhance it with CMOD
    But I can not find the 'create' function in SMOD.
    Do you have some advice? Thanks!

  • How to create a new app using existing Dev & Dist certificates

    Okay, I have already created one app that has been approved by Apple. Now we're ready to create a second app and we're trying to create the .p12 certificates using the existing Apple Dev and Dist Certificates. For some reason we can not get the .p12 certificates for the new app to link up with the existing Apple Dev and Dist certificates. I don't understand what I'm missing. Any help would be appreciated. Thanks!

    You must have 2 folders with the following :
    Dev:
    aps developer identify.CER
    CertificateSigningRequest.certSigningReq
    Certificats.P12 (already created for your previous app)
    Certificats Push Dev.P12
    Mobile Provision
    Distri
    aps prodution identify.CER
    CertificateSigningRequest.certSigningReq
    Certificats distri.P12 (already created for your previous app)
    Certificats Push Prod/distri.P12
    Mobile Provision
    Try, you will know quickly if you havent do it well

  • How to create / edit a website using SharePoint Designer 2013

    How to EDIT a website created by Frontpage using SharePoint Designer 2013 ?
    How to CREATE a new website using SharePoint Designer 2013 ?

    You can edit any sharepoint site using designer not any other site.
    To create a new website using designer follow below:
    To create a new site, click the File tab, choose Sites, and perform one of the following:
    Click New Blank Web Site to create a blank, empty SharePoint site.
    Click Add Subsite to My Site to create a new site under your My Site.
    Under Site Templates select a template to create a new site based on a SharePoint template.
    http://office.microsoft.com/en-in/sharepoint-designer-help/get-started-with-sharepoint-designer-2010-HA010370548.aspx#BMopensites

  • Need help to create a new record in mdm using java webdynpro

    hi all,
    I have to develop an application to create a new record in mdm by using java WebDynpro  . Please help me what is the process that i have to follow to do this and provide me if you have any step by step guidance for this.
    thanks & regards,
    Mahi.

    Hi,
    The below link will help u to make the application in JAVA webdynpro
    The article has code to for creating records.
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/803e9e80-21f4-2a10-8cbf-bcf6a8060be3
    Hope this may help u .
    Rgds
    Ankit

Maybe you are looking for

  • How can I (re)activate my iPhone 4 from overseas?

    Ok, this is a strange one.  I'm from the US and have had my iPhone 4 AT&T) since it was released (mid 2010). No problems. I'm overseas (Taiwan) for vacation and about one week into my trip I finally get good WiFi and so I check my e-mail, vpn to home

  • Windows EventViewer Errors and Warnings

    I am new to this company and have been asked to work initially to assist our Application Group with their concerns over some applications suffering performance problems.   I interviewed the Group Supervisor and he has indicated that he would like me

  • T60 w/ Docking Station DVI - HDMI 1080p problems.

    Hi, Im currently running vista 32bit on a T60 with a docking station trying to externally display to a 1920x1080 LCD via the DVI port on the back of the docking station to the HDMI port on the LCD (Samsung N series 40"). The problem im having is when

  • Adding Wireless Profile XML In TS or Command Line in SCCM

       I have exported my wireless profile to an XML file and have created a package and tried from the command line in TS but keep getting errors (0x00000001 or 0x80004005). The command line I've been using is netsh wlan add profile filename="<Profilena

  • Order acknowledgement

    Hi, Is there any way to tick order acknowledgement check box in ITEM DETAIL , CONFIRMATION tab automatically? If PO has 200 line item then it will be a  time consuming job to do this item by item. Thanks Ankur