Change mandatory attribute in Entity Service

I have an Entity Service E with attributes A and B as mandatory attributes. I changed attribute B and made it non-mandatory and deployed. But the backend table in the database doesn't change and it still has B as NOT NULL attribute. Any attempt to create a new value results in an error from database saying cannot assign NULL to NOT NULL attribute.
Don't want to change the database manually. Is there any way to make the change in the database without dropping the column or the table?

Hi Vivek,
1st Take a Value_Node(say “CustomerDetails”) in the WebDynpro context with the attributes(Say “CustNumber”,” CustName”and “CustType”)  that your Caf_Entity_Service Say “Customer” with attributes “CustNo”,”CustName” and “CustType”)  have .Then Bind the Value_Node into the View(By using “Apply Template” =>”Table”=>Choose the Value_Node then Next Choose ”Input Field” Editor).
Now Inside the Action of the “NewLine” Button put use This.
wdThis.wdGet<Name Of Your Component>Controller().createCustomerDetails();
Now Take an button say “SAVE” and inside the action of “SAVE” button use this Code.
wdContext.nodeACustomer().invalidate();
for(int i = 0;i<wdContext.nodeCustomerDetails().size();i++)
String cnum =  wdContext.nodeCustomerDetails().getCustomerDetailsElementAt(i).getCustNumber();
String cname = wdContext.nodeCustomerDetails().getCustomerDetailsElementAt(i).getCustName();
String ctype = wdContext.nodeCustomerDetails().getCustomerDetailsElementAt(i).getCustType();
try
ACustomer custM = CustomerServiceProxy.create(); //create a new dummy record in caf model with local guid  
custM.setCustNo(cnum);
custM.setCustName(cname);
custM.setCustType(ctype);
custM.getAspect().sendChanges();//populate the dummy record with custom fields and with valid system fields also.
IServiceFacade serviceFacadeProdConf = CAFServiceFactory.getServiceFacade(<Your Caf Model Name>Definition.class)
serviceFacadeProdConf.save();
catch(Exception e)
wdComponentAPI.getMessageManager().reportException("CAN'T CREATE NEW RECORD WITH CUSTOMER ID : "+cnum ,false);
}// end of for loop
Regards,
Mithu

Similar Messages

  • How to create index attributes in CAF Entity Service

    When one creates an entity service with external persistency (local persistency on the persistency tab is unchecked) you have to create at least one "key" attribute. However, how do you create "index" attributes to improve performance. Currently, if you add custom key you must select "key" checkbox in attribute wizard when creating an attribute and this key field must be unique. This is not what I am looking for. I'd like to create a few custom keys that the contents allow duplicate.

    Hi Tom,
    This is a very valuable question. Yes, you can add an index for specific fields to the generated database table. You can do in the NWDS, navigate to the dictionnary view and open the corresponding database table. Now you can add an index and assign database field(s) to this index.
    However: you must be aware that, if the entity is changed (i.e. new parameters are added), the database table is re-generated and the indices are lost.
    Regards,
      Jan

  • Problems updating Entity services or application services

    Hello all,
    I'm working with SAP Netweaver Developer Studio creating a new CAF application.
    First all, I import the SAP Entreprise Service, then I model the entity service, I expose my application Service as a Web Service and finally I deploy it and test it.
    However, when I try to edit my entity service (for instance, including a new attribute) or application service (for instance, changing the bussiness logic code) and I redeploy it, the Web Service Navigator doesn't update the changes.
    So, sadly I must start again configuring the entity and application service.
    Any idea??
    Thanks,

    everytime you change the signature (structure of input/output) of the entity or application service, the change is not automatically propagated to the web service definition. you have to delete manually the web service configuration for the entity or application service or recreate it. you can call it a bug or a feature. it's up to you.

  • How to change the attribute name for a relation

    When the Data Modeler engineers a logical model into a relational model it create table columns for the relations. The names of the generated columns are listed in the attributes list in the properties dialog of the relation. The actual name of the attribute gets calculated by the attribute name of the entity which is part of the relation. This is okay, if there is only one relation between two entities. But when there are two relations between two entities the second attribute gets a stupid number suffix. This makes it impossible to give the attribute a useful semantic meaning.
    When I engineer the model into a relational model I can change the column name in the relational model. Changing the column name in the relational model is not perfect but it would be okay for me, if it would not be overwritten during the next engineering run.
    So I have two questions:
    How can I change the attribute name in the attributes section of the properties dialog of a relation? See here for screen shot:
    http://public.ceving.de/2012050300/relationattribute.png
    And if it is not possible:
    How can I preserve any changes on column names in the relational model during a re-engineering run?
    Edited by: 931739 on 03.05.2012 08:07

    Hi,
    I've logged an Enhancement request on this.
    I don't believe it's possible to change it from the Entity or Relationship dialog, as it's not updatable in these dialogs.
    What you can do is change it in the Relational Model, and then reverse engineer the change back to the Logical Model.
    David

  • Error while "Project Code Generation" in Entity service

    Hi SDN's,
    I have created an entity service which is the help documentaion of NWDS. After completion of all steps while generating project code i am getting an error called "AbstractStringBuffer not reachable"
    Can any body help me in solving this issue.
    Thanks in advance

    Hi Raju,
    it seems like you have a version problem, try to use jdk 1.4 or higher and try.
    Or go to
    Prefrences --> Java --> Installed JRE's here change the Jdk to the latest,compatable version
    Sometimes reinstallation also solves such problems.
    Award pts if help full
    Cheers
    Souza

  • Problem in data source mapping - CAF entity service.

    Hi,
    I created an external service for the bapi given below.
    It has 2 tables as input parameters.
    In entity service I created attributes(for input parameters) for table1 and table2. but in data source i couldn't map more than one attribute to the MATNRSELECTION and PLANTSELECTION.The attributes of the bapi are under the same collection.
    I'm using NWDS version 7.0.06.
    BAPI_MATERIAL_GETLIST (To List all Materials for a Particular Plant)
    Input Parameters:
    Table1: MATNRSELECTION
    MATNRSELECTION-SIGN
    MATNRSELECTION-OPTION
    MATNRSELECTION-MATNR_LOW
    Table 2: PLANTSELECTION
    PLANTSELECTION-SIGN
    PLANTSELECTION-OPTION
    PLANTSELECTION-PLANT_LOW
    Regards,
    Shobhendra

    in your entity if you did create 2 attributes for one material number and one for plant, you can map them to the corresponding MATNRSELECTION-MATNR_LOW and PLANTSELECTION-PLANT_LOW.
    For the sign and option, you should uncheck the IsNull parameter in the "Entity to External Operation parameters" mapping window of the Datasource Tab of your entity. And you should set default values like sign = I and option = EQ or something like that.
    But if you want to pass a list of material numbers or plants, I do have a recollection from last year experiments of some limitation using collections as input parameters. maybe somebody else had better success with that

  • Entity Services: readByCustomKeys operation mapped to External Service

    Hello *,
    in my CAF application I'd like to read a product from SAP PLM. Within my Entity Service materialNumber is my custom key and therefore a corresponding operation exists: readByCustomKeys.
    I map this operation to my External Service (Web service provided by XI).
    As I can't test this operation directly with the Service Browser (deosn't appear there), I wrap  my Entity Service with an Application Service where I use the readByCustomKeys operation from Entity Service.
    Now when I test the Application Service operation I get the following error message in Service Browser:
    ERROR. Invalid type value :
    In XI I can see that there was no error and I got well defined XML data as response. So the problem must occur anywhere in the mapping back from External Service data to Entity Service attributes.
    Wrong data type mapping can be excluded as I already tested this possibility.
    Does anyone know what could be the reason?
    Thanks for your answers and best regards
    Joschi

    Hello Joachim,
    I dont have a lot of experience with readByCustomKeys (one experience which failed) but uou can also use read itself. If you have defined materialNumber as a key in your entity service, then this field can be used in read operations as well (I have a lot of positve experiences with this approach). You will find materialNumber while mapping read with your external service and you need not map the key field generated by Entity Service.
    For testing entity services, we have had several positive experiences with the config browser, specially for a findBy, read and even update operation. It was very easy to have a prototype UI to check the entity services.
    I know this isnt the answer to your question, but just sharing my experiences.
    All the best!!!
    Regards,
    Parag.

  • How to use a structure in CAF entity service

    Hi All
    I want to use a structure as datatype of a complex attribute in a CAF entity service. I tried to use a dictionary structure created in the dictionary part
    of the CAF project and added it to the public part of this DC.But I can't find it in the list of data structures while trying to mention datatype for a complex attribute in an entity service. Can any body suggest how to do it.
    Cheers
    Sudip

    Hello Sudip,
    You can create a complex structure by doing the following:
    1.  From the Attributes Tab, right click on your Entity and select "Create Attribute"
    -  Enter an attribute name and description
    -  select "Complex Attribute" checkbox
    -  select "Finish"
    2.  Right click on the newly created complex attribute and select "Create Sub Attribute".  Do this for each attribute in your structure.
    This complex structure can now be used in your CAF application and also CAF UI patterns.
    Creating complex attributes from the data dictionary is only usually used for creating enumeration types.  When doing this, you have to use the CAF enumeration editor to populate the values.  The "How to guide" that Jan refers to describes this.
    Regards,
    Austin.

  • CAF DB Update for CAF Entity Service from Web Dynpro

    Hi all,
    I have created an entity service in CAF called “Contacts’ which contains the following attributes.
    phoneNo
    cellNo
    emailID.
    Another entity service called "Person" is created. This contains the following attributes.
    personId
    personName
    personAddr
    contactsRef. (Cardinality -> 0..n , Relational Type -> Composition)
    That means Contacts entity service is used within Person entity service. Now it is working fine within CAF service browser. Now the Web Dynpro DC of CAF application is used within another custom Web Dynpro DC project. I want to store data from Web Dynpro.
    Within the context of component controller of  Web Dynpro the structure is like
    APerson
         |_ personId
         |_ personName
         |_ personAddr
         |_ contactsRef       
                    |_ phoneNo (Under contactsRef)
                    |_ cellNo (Under contactsRef)
                    |_ emailID (Under contactsRef)
    So I have written the following code within web dynpro custom method.
    APerson person = PersonServiceProxy.create();
    java.util.List ls = new ArrayList();
    for(int i=0; i<4;i++)
    AContacts contact = ContactsServiceProxy.create();
    contact.setCellNo("9092130156");
    contact.setEmailID("[email protected]");
    contact.setPhoneNo("432258");
    contact.getAspect().sendChanges();
    ls.add(contact);
    person.setRelatedModelObjects("contactsRef",ls);
    person.setPersonID("9999");
    person.setPersonName("xyz");
    person.setPersonAddr("ABC, KOL");
    wdContext.nodeAPerson().bind(person);
    person.getAspect().sendChanges();
    CAFServiceFactory.getServiceFacade(idendityDefinition.class);
    After saving the data from Web Dynpro I am trying to test it from CAF service browser. But I am getting only the parent row. I mean only the value of personId, personName and personAddr fields which I have stored from Web Dynpro. But no value is coming within the table for Contacts entity service for composition relation.
    Could anybody help me how can I solve my problem?
    Thanks & Regards
    Chandan
    Message was edited by:
            Chandan Jash

    Hi Chandan,
    Can you do person.getRelatedModelObjects() and get the contact object, to check whether it is null, also check in the CAF DB whether the data you entered is present.
      I am not sure the code is actually adding the contact model object to person.
    Go thru this SDN Blog on usage of the CMI API's, there is a link for CMI documentation in it which might help you get the right code for adding the contact object.
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/cef4f43e-0d01-0010-db84-ede25c874115.
    award points if  info is helpful
    Regards,
    Anish

  • Problem when creating CAF Entity Service finder Methods

    Guys,
    Can any one please suggest me appropriatly to the below problem.
    I am using NWDS 7.06. I have no problem when creating CAF project, Application Service and Entity Service even.
    But in the Entity Service:
    1. Add a string or longtext attribute.
    2. try to create a custom finder method in operations tab, during that operation i am  not finding the attribute which i have created in step1.
    That means i am not able to create the my own finder methods with parameters.
    I was able to do that in some version long ago but i have forgotten that NWDS version.
    summary of Problem Is: " Cannot create custom methods with custom parameters in Entity Service"
    Can you please suggest me the right version or a solution to this problem on urgent basis please.
    I promise you that i will give you full points to you who ever gives me the right solution.
    Please mail your suggestions to [email protected]

    Guys,
    I have solved the problem successfully. Thanks for your attention.

  • Problem while creating Complex Attirbutes of Entity Service in CAF Applicat

    I am Creating one CAF Application.
    while creating Entity Service i have Used one Complex Attribute. but in Application Services Implementation part when am assigning value to this Complex Attribute.it gives error that no method exist.
    Kindly provide some information on how to use Complex Attributes while creating Entity Service.
    Can i use NWDS2.0.11 for CAF Application?

    Guys,
    I have solved the problem successfully. Thanks for your attention.

  • Java DC calling Operation on Entity Service

    I have three entities (Entity Services) and one Application Service.
    Application Service needs a operation to pull data from each entity based on the input parameter (name, type String).
    The operation, builds an object with attributes from all three entities, and returns that newly created object.
    I have a Java DC, that's going call this operation on the Application Service.
    Question: How Java DC would know the object type of the object returned by the operatio on the custom operation on the Application Service?
    Is it possible to do something like this or is there a better way to do this?
    BTW, This Java DC is being used as Callable Object in GP.
    Can I create a Service Endpoint for the Application Service and build the Callable Object directly against the Application Service. Then how to invoke method on the Application Service? How to handle the Object returned by the Application Service method?

    At first, I'd say you shouldn't be needed a java dc with gp interface if you have a CAF application service.
    GP has a CO for CAF application service you can use out of the box to reference a method of an application service you've deployed on your server. Pretty straight forward. No need of endpoint if service is deployed locally.
    That is assuming you don't have any particular requirements I'm not aware of here.

  • Custom tag SetProperty: Mandatory attribute property missing

    Ok, first some code. Here's the contents of my displayCollection.tag:
    <%@ tag body-content="scriptless" import="com.serco.inquire.*" %>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <%@ attribute name="mgr" required="true" %>
    <jsp:useBean id="irc" scope="session" class="com.serco.inquire.irCollection">
      <jsp:setProperty name="mgrid" value="${mgr}" />
    </jsp:useBean>
    ${irc.mgrid}Here's the JSP I'm calling it from (myq.jsp):
    <%@page language="java" import="java.util.*,com.serco.inquire.*" %>
    <%@ taglib prefix="inq" tagdir="/WEB-INF/tags" %>
    <inq:displayCollection mgr="Chris Novish" />Here's the java class for irCollection (used in the tag file):
    package com.serco.inquire;
    import java.sql.*;
    import java.util.*;
    public class irCollection {
         public String mgrid;
         public irCollection() {
              super();
         public void setMgrid(String datum) {
              this.mgrid = datum;
         public String getMgrid() {
              return this.mgrid;
    }And finally, here's the error I get when i try to run myq.jsp:
    org.apache.jasper.JasperException: /WEB-INF/tags/displayCollection.tag(7,2) SetProperty: Mandatory attribute property missing     org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:41)
         org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
         org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:198)
         org.apache.jasper.compiler.JspUtil.checkAttributes(JspUtil.java:174)
         org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:595)
         org.apache.jasper.compiler.Node$SetProperty.accept(Node.java:1150)
         org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2376)
         org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2428)
         org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:647)
         org.apache.jasper.compiler.Node$UseBean.accept(Node.java:1182)
         org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2376)
         org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2428)
         org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2434)
         org.apache.jasper.compiler.Node$Root.accept(Node.java:475)
         org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2376)
         org.apache.jasper.compiler.Validator.validateExDirectives(Validator.java:1789)
         org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:216)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:372)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:352)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:339)
         org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:594)
         org.apache.jasper.servlet.JspServletWrapper.loadTagFile(JspServletWrapper.java:231)
         org.apache.jasper.compiler.TagFileProcessor.loadTagFile(TagFileProcessor.java:577)
         org.apache.jasper.compiler.TagFileProcessor.access$000(TagFileProcessor.java:48)
         org.apache.jasper.compiler.TagFileProcessor$TagFileLoaderVisitor.visit(TagFileProcessor.java:642)
         org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1539)
         org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2376)
         org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2428)
         org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2434)
         org.apache.jasper.compiler.Node$Root.accept(Node.java:475)
         org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2376)
         org.apache.jasper.compiler.TagFileProcessor.loadTagFiles(TagFileProcessor.java:660)
         org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:228)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:372)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:352)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:339)
         org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:594)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:344)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:391)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:722)>
    as far as I can tell, the attribute mgr is set in myq.jsp when it invokes displayCollection.tag, and displayCOllection.tag's only attribute (required) is mgr. so uhm... what do I misunderstand?

    Nick,
    Thanks for your help.
    But I also face another problem that is
    "unable to load class com.jguru.FormBean" when I tried to call another jsp.
    Here are my code :
    package com.jguru;
    public class FormBean {
    private String LName;
    private String FName;
    private String Passwd;
    private String Tel;
    private String Title;
    private String Dept;
    private String Email;
    private String Accesstype;
    public FormBean() {
    LName="";
    FName="";
    Passwd="";
    Tel="";
    Title="";
    Dept="";
    Email="";
    Accesstype="";
    public String getLName() {
    return LName;
    public String getFName() {
    return FName;
    public String getPasswd() {
    return Passwd;
    public String getTel() {
    return Tel;
    public String getTitle() {
    return Title;
    public String getDept() {
    return Dept;
    public String getEmail() {
    return Email;
    public String getAccesstype() {
    return Accesstype;
    public void setLName(String x) {
    LName = x;
    public void setFName(String x) {
    FName = x;
    public void setPasswd(String x) {
    Passwd = x;
    public void setTel(String x) {
    Tel = x;
    public void setTitle(String x) {
    Title = x;
    public void setDept(String x) {
    Dept = x;
    public void setEmail(String x) {
    Email = x;
    public void setAccesstype(String x) {
    Accesstype = x;
    Thanks.

  • Getting mandatory attribute validation error when the value is defaulted through customization

    Hi
    I am getting Mandatory attribute validation error when we default the value through customization.
    In the UI we have attribute called Last Name which is mandatory at EO level. Customer wanted to default Last name to some value, through page composer it is defaulted to some text and saved.
    When ever we open the page the the same value is defaulted as Last Name and appearing in the UI. But when we submit the page, EO level validation is failing. hence we are getting last name is missing.
    When i debug the code last name attribute value for EO is blank.
    In the UI the attribute last name is associated with bindings  --> #{bindings.lastname.inputvalue}
    The validation is failing if we remove the default binding associated with inputtext box.
    Can some body help what can be reason and is there any solution?
    Thanks,
    Praveen

    version 12.1.2
    I am struggling with same situation, I can't set the default value at business component because, the default value comes from a REST service at run time. In page A,  I have a field F1 that contains value from REST service. Page B has a database bound field F2, whose default value should come from F1 in Page A when a user navigates from Page A to Page B. If I set the value of F2 to be the value of F1, then it displays the value in the UI, but nothing gets submitted to EO and fails at commit.
    To make things difficult, here is my situation: Page A lives in bounded taskflow TF1, and Page B lives in bounded taskflow TF2. So I have created an input parameter P1 in TF 2, which carries over the value of F1 in Page A to Page B. When I am in Page B, I can successfully see the value of the taskflow input parameter P1. So, how do I  programmatically set the value of field F2 with the value of input parameter P1?
    I tried setting the F2.inputValue  in a method call M1 in  taskflow TF2 prior to Page B, but I get null pointer exception as it can't see field F2 yet.
    It seems like a simple thing to do, but I have spent a lot of time trying to make it work without any success.
    I would greatly appreciate any guidance.

  • How to ge the value for attribute for terminal services attribute in Active Directory from userParameters attribute

    I am using dirsync to get  the attributes value that have changed in Active Directory(changelog).
    The following link explains how the dirsync is used to get attribute values :
    'http://blogs.technet.com/b/isrpfeplat/archive/2010/09/20/using-the-dirsync-control.aspx'
    I am changing the attribute Local path under Remote Desktop Services Profile of a user. I have ran a client which uses dirsync to get the changed objects in AD.
    In the client the attribute that is changed is `userParameters` and the value is in encrypted form. 
        CtxCfgPresent                                   P☺CtxCfgPresent???? ☻☺CtxWFProfi
        lePath?↑→☺CtxWFHomeDir?????????????"☻☺CtxWFHomeDirDrive?☺CtxShadow????☺CtxMaxDis
        connectionTime????☺CtxMaxConnectionTime????☺CtxMaxIdleTime???? ☻☺CtxWorkDirector
        y?☺CtxCfgFlags1????"☻☺CtxInitialProgram?
    Is there a way to get  the actual value form the userParameters.

    Hi,
    What about other changed attributes? Are other attributes retrieved by DirSync control turn to be encrypted form?
    Best Regards,
    Amy
    Please remember to mark the replies as answers if they help and un-mark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact [email protected]

Maybe you are looking for

  • Sales Opportunities and Follow Up Activities

    Hi Experts. We have a customer who uses Sales Opportunities and Activities extensively. What they are finding is that when they create a follow up Activity from an Activity linked to a Sales Opportunity, the fields Source Object Type and Source Objec

  • Help with copying files into the the Start Menu

    I am trying to copy my application which tracks system usage, such as reboots, temps, etc, I want it when it first runs, to copy it self into the the programs folder and the start up folder. However I get the error ""FileCopy: destination file is unw

  • How to get a Class object with a generic type of list

    Hi, I want to get an instance of a class which is of type List<ABC>. How can I get that ? What I tried was Class c = List<ABC>.class , bu this is not compiling. I can get new ArrayList<ABC>().getClass() , but the type of that class would be Class<? e

  • 11.1.1.3 installation problem

    Hi, I have installed shared services ,essbase and planning in my local machineand is having OS is XP. my problem is once i started the istallation it went 99% completed status after that it was strucked ,i have tried somany times i am facing the same

  • Why don't Apple security updates show up in my Macbook Pro app store

    Running Mounbtain Lion 10.8.4 on MacBook Pro late 2008. Lately the Mac system and security updates don't show up, for example this latest 10.8.5 and security update 2013-0004.  I also believe that other updates may not be showing up, but I only get s