Method in AM impl

Dear All,
in oracle docs, i see 2 ways to work with tables (insert or update & delete and select as well), let us speak about insert one.
- there is one way to work with EOs like this
EntityDefImpl productDef = ProductsBaseImpl.getDefinitionObject();
  return (ProductsBaseImpl) productDef.createInstance2(getDBTransaction(), null);
- and another known way to make the same process using VO in update mode
what is the difference, better and why sometimes we work with EO in AM impl however we see VOs directly in AM ?
i use jdev12c ADF - BC/ JSF
thanks

createInstance2(...) is the deep down creation of an entity object. It lets you create an EO without a VO so it's more like an EJB. IF you create an EO this way the EO will not be directly visible in any VO based on EO without refreshing the VO. Check http://www.packtpub.com/library/oracle-application-development-framework-real-world-developers-guide/ch03lvl1sec27
for more info.
If you use ADFbc then you should create the new row (EO) via the VO as this pushes the EO into the visible area of the VO and then EO cache. Then the new row is visible for your session until you commit it to the DB which makes it visible for all other session too.
Timo

Similar Messages

  • How to call a method in IMPL class from one context node

    Hi, I´ve been only study the posibility to access a method in the IMPL class  from one context node class...CN## without using events, is there a way to call it ??? I don´t have it as requierement just learning thanks !.

    Hi,
    Try this by following this you can get the custom controller instacne in the view context nodes, for your requirement you can keep the view implementation class instance instead of cuco..
    To get the custom controller instance in Context node getter/setter method:
    1. Declare Cuco instance reference variable in ctxt class..
    2. Set this cuco ref. in the Create context node method of ctxt class:
    try.
    gr_cucoadminh ?= owner->get_custom_controller( 'ICCMP_BTSHEAD/cucoadminh' ). "#EC NOTEXT
    catch cx_root.
    endtry.
    you can avoid this step as this is not needed in case of view isntance
    3. Assign this instance to the respective context node Create method using:
    BTStatusH->gr_cuco ?= gr_cucoadminh.  " here assign the view implementation ref. " me" instead of gr_cucoadminh
    Here gr_cuco is the ref. variable of custom controller in the respective context node for eg. BtstatusH
    Sample implementation of this can be found in
    ICCMP_BTSHEAD/BTSHeader ->context node BTACTIVITYH-> attr ->GR_CUCO(instance of cuco)
    Cheers,
    Sumit Mittal

  • How to give a message in the UI page if there is an error in AppImpl method

    How to give an error message in the jsf page if the AppImpl method fails ?
    Use case : I have a create form and a submit button which binds with a client interface method in Application Impl class. If the method fails due to some exception , how can I notify the users with proper error message ?
    Thanks
    Suneesh

    Hi,
    As the previous reply (casting the result) is the best solution here (separating model and view logic) but sometimes we do a shortcut.
    may be it is not the best approach but it comes handy most of the time, this approach is also error-proven. we used it more than 2 years in large applications.
    add the following code whenever you want to add message in UI be aware that we have add it in a jar and add that library to the model projects
    FacesContext ctx = getFacesContext();
    FacesMessage fm = new FacesMessage(FacesMessage.SEVERITY_ERROR, msg, "");
    ctx.addMessage(null, fm);
    you just need to add jsf library to the model applications and replace msg with your message.
    regarding throw jboException, it seems good most of the time but sometimes when you are in middle of the transaction it somehow ruin the flow of the transactions.
    Regards.

  • View not copied or enhanced with wizard Error while creating Event Handler method in Z Component

    Hello Friends,
    In one Z Component (Custom Component), in one of the views, while creating event handler, it gave me error message that view not copied or enhanced with wizard.
    I am aware that in Standard Component, if we want to create the event handler method then we need to first Enhance the Component and then we need to enhance the view.
    But, in the Z Component (Custom Component), how to create event handler method in one of the views as while creating event handler method i am getting view not copied or enhanced with wizard error.

    Hi,
    Add a method in views impl class with naming convention eh_on__* with htmt and html_ex parameters.  I dont have have the system right now. Please check any existing event import export parameters.
    Check out do handle event method in the same class.
    Redefine that method.  Call that event method in this handle method. See existing code for reference.
    Attach that event to the button on click event in .htm page.
    Regards,
    Bhushan

  • Implementation of static methods in Custom Controls

    I'm using Custom Java Controls to implement business objects in a workshop web application.
    I've designed a number of static methods into the object model for logically static operations (i.e. operations related to the Business object but not requiring an instance).
    Since workshop generates the control interface as a java interface, it is not possible to declare static methods on the control interface. I have tested implementing the interface as an abstract class and setting @editor-info:code-gen control-interface="false" on the control. This seems to work, but then we lose code generation.
    Other options include:
    - Put the static method on the Impl and call directly (don't like this, breaks encapsulation)
    - Make it non-static (don't like this, prevents compiler checks for refs to non-static members)
    Has anyone found an elegant way to do this in workshop without losing code gen features? Any ideas welcome...
    TIA
    Jim

    Please guys someone tell me the answer for this question. I guess its a valid question, though I feel that the answer to this question must be quiet easy since somewhere the methods must have been getting implemented.
    Please let me know who does that and how and when!!!
    Hoping for an explanation to this now

  • Gettting the session value in doDML() of Impl.java

    I'm using ADF BC, struts, JSP.
    I have the logged in user in my session variable and I want to store that in the database in the timestampfields.
    I am 'overriding' doDML' method in my Impl.java. In the 'insert' operation, I want to get the session value. How do you do that. I tried setCreatedBy(session.getAttribute("user")), but it says HttpSession object/class not found.
    How do you get the session value in your Impl.java.
    Thanks.

    Hi,
    You don't need to add any library or overwrite prepareSession() method. You may add values to BC session in any time and in any method in business components e.g in Application Module:
    private void addToMySession(Integer currUser){
    Hashtable userdata = getDBTransaction().getSession().getUserData();
    if (userdata == null) {
    userdata = new Hashtable();
    userdata.put("CurrentUser", currUser);
    Then you may get this value in any businnes component e.g. in EO:
    protected void doDML(int operation, TransactionEvent e) {
    if (operation == DML_INSERT) {
    Hashtable userdata = getDBTransaction().getSession().getUserData();
    Integer currUser = userdata.get("CurrentUser");
    setUserId(currUser);
    super.doDML(operation, e);
    I hope that explained clearly :) and it helps.
    Regards
    Kuba

  • Amimpl class method

    hi experts,
    am using jdev 11.1.15.0
    generalledgerAMImpl holds this
       public String checkLoginCredentials1(String p_user,String p_pwd)
        System.out.println(p_user + " " + p_pwd);
        ApplUsersVOImpl  vo = (ApplUsersVOImpl)this.getApplUsers1();
        vo.setNamedWhereClauseParam("p_user",p_user.toUpperCase());
        vo.setNamedWhereClauseParam("p_pwd",p_pwd.toUpperCase());
        vo.executeQuery();
        int rowCount=vo.getEstimatedRangePageCount();
        System.out.println("rowCount="+rowCount);
        if(rowCount==0)
    //   throw new JboException("Password doesn't match '" +p_pwd+    "'");
           throw new JboException("Username or Password is Incorrect");
           return "Welcome"+ "  " + p_user.toUpperCase();
        } and this method exposed to ui. as button. it make match with db and if correct redirect if not throw error.
    ok fine. above all of the things are fine.
    is there any possiblity to call this method any viewrow impl or eoimpl
    how can call this method. ?
    y means. am calling means i need the return value.
    so only am asking ?
    important note: checkLoginCredentials1(String p_user,String p_pwd) in this method,
    1. String p_user,
    2. String p_pwd value passed @ time only. rest of the time cant get thiss.
    i hope u all understud? is there any link regards this? pls post here.
    Edited by: Erp on Oct 10, 2011 3:51 AM

    no luck. Dimitris Stassi... is there any 1?
    as earlier as i said
    generalledgerAMImpl hold this
        public String checkLoginCredentials1(String p_user,String p_pwd)
        System.out.println(p_user + " " + p_pwd);
        ApplUsersVOImpl  vo = (ApplUsersVOImpl)this.getApplUsers1();
        vo.setNamedWhereClauseParam("p_user",p_user.toUpperCase());
        vo.setNamedWhereClauseParam("p_pwd",p_pwd.toUpperCase());
        vo.executeQuery();
        int rowCount=vo.getEstimatedRangePageCount();
        System.out.println("rowCount="+rowCount);
        if(rowCount==0)
          throw new JboException("Username or Password is Incorrect");
           return "Welcome"+ "  " + p_user.toUpperCase();
          public String testing()
        { return "String value"; };
        Dimitris Stassi... told me do like this. Yes you can call this through View Object Java class
    public void sampleTest(){
    SampleAppModuleImpl apModule=(SampleAppModuleImpl)this.getApplicationModule(); // this is how you will get your AM instance
    apModule.callAMethod();
    }     but ..
    GlAccountClassesVOImpl hold this.
    public void test() { 
    generalledgerAMImpl apModule=(generalledgerAMImpl)this.getApplicationModule();
    apModule.checkLoginCredentials1(p_user,p_pwd);
    //above statement show some error. error is p_user,p_pwd varialbe not found. as earlier as i said. i cant assign the value. @ run time it will pass  the value from jsp page to generalledgerAMImpl > checkLoginCredentials1.so how?  solve this problem.
    apModule.testing(); // ur point is correct here. || because here no parm passing
    Edited by: Erp on Oct 11, 2011 3:43 AM

  • Business Partner Role Specific Field View in WebClient

    Hello to everyone,
    I have a question that really needs a answer.  We are upgrading from SAP CRM v4 to SAP CRM v7.0 and as such we have a number of custom Business Partner Roles within the Person BP Type.  Against these custom roles we have developed custom field and tabs in order to separate the content within the BP Role further.
    After rolling off an implementation of SAP CRM v6.0 [2007], the following seems apparent:
    - Assignment of Roles is done via an assignment block in the Customer Maintenance view.
    - You can create Business Partners in different roles initially.
    - You cannot maintain Business Partner details in specific roles
    However, you cannot display the role specific fields as you can in the WinClient.  As an example, a Citizen Role BP will have different fields to that of a Teacher, but these roles could be assigned to one Business Partner.
    There does not seem to be any guidance as to how this is managed in the WebClient and as it seems a fundamental part fo the SAP CRM offering, you would have thought that this questions has been asked, but I have found no answers.
    I really hope anyone can help and appreciate any time and effort put into solving my question.
    Many Thanks,
    MatFlat.

    Hi MatFlat,
    Yes, your observation is right - in the Web UI, fiel grouping is not implemented for roles. This is because the role concept is quite different between SAP Gui and Web UI.
    In SAP gui, (CRM 4.0) roles had a functional meaning as well as a UI control. However, the concept was changed with Web UI. Now, roles have only a functional meaning, and no effect on the UI at all.
    If you want to implement role based field grouping in Web UI, you need to define your own methods in the implementation class.
    E.g : you can write code to influence the field properties based on the roles. I guess you can redefine the DO_PREPARE_OUTPUT  methods of the impl class.
    In order to get info about which roles the BP is maintained , you can use FM BUPA_ROLES_GET_2.
    Hope this helps you.
    Cheers,
    Rishu.

  • Adding new view to viewset (BP_DATA to ICCMP_BP_DETAIL)

    Hello Experts !
    We are on CRM 7.0. I want to add the window IDNumber of component BP_DATA in the component ICCMP_BP_DETAIL.
    What are the steps to follow?
    I created an "usage" of the component BP_DATA in the component ICCMP_BP_DETAIL. I added the interface view BP_DATA/IdNumberWindow to the usage.
    I also created a new view area ('ZIdNumberData') in the viewset ICCMP_BP_DETAIL/BuPaCreateVS. Then, I assign the view of my usage BP_DATA to this new view area.
    I enhance the BuPaCreateVS.htm by adding a new line to the code like this:
       <thtmlb:gridCell columnIndex = "1"
                       rowIndex    = "3" >
        <bsp:call comp_id = "<%= controller->GET_VIEWAREA_CONTENT_ID( 'ZIdNumberData' ) %>"
                  url     = "<%= controller->GET_VIEWAREA_CONTENT_URL( 'ZIdNumberData' ) %>" />
      </thtmlb:gridCell>
    But when I enter the webui it's giving me a DUMP in the view BP_DATA/AccountIDNumberList, the method DO_PREPARE_OUTPUT, because the following reference is initial:
    ME->VIEW_GROUP_CONTEXT
    The reference ME has the following value:
    Does anybody has any suggestions ?
    Thank you in advance
    M.

    Hi,
          Some components are meant to be used with a main component. The view group context is inherited hierarchically from parent components. Coming to your problem, assuming that the BP_DATA/AccountIDNumberList view is already enhanced, redefine the method set_view_group_context method im the IMPL class.
    Put in code, something like this..
    method SET_VIEW_GROUP_CONTEXT.
      IF iv_parent_context IS BOUND.
        CALL METHOD super->set_view_group_context
          EXPORTING
            iv_parent_context = iv_parent_context
            iv_first_time     = iv_first_time.
      ELSE.
        CREATE OBJECT me->view_group_context
            TYPE cl_bsp_wd_view_group_context.
      ENDIF.
    endmethod.
    This will clear up the immediate issue, but you will likely face more.
    Regards,
    Arun Prakash

  • Data validation at the UI level

    Hi
    I have a requirement like i need to validate the input data at the UI level.
    If the data is valid ,only then it should be allowed to be saved.
    If someone knows how to do the same.
    I have seen a method DO_VALIDATE_INPUT method in View controller (IMPL) class.No clue on how it is being used.
    Regards
    Leon

    Hi Leon,
    Are you talking about the Webclient as UI or something else??
    There are 2 options:
    1) You use the Get and Set methods of your context node attributes (The ...CN01 etc classes) (to be found under your IMPL class --> attributes TYPED_CONTEXT(...CTXT class) and in there you should have some ...CN01, CN02, etc. classes. Here are all the GET and SET methods. (you could also go via the views' attributes, this is the shortest way).
    Within the Get (put the value in the model) and Set (get the value from the model)methods you could do some checks and show an error.
    2) Use the Do_handle_data method of your IMPL class. Once data is entered in the screen, this method is always called when another action is performed (pressing a button). Here you can easily check the content of fields.
    3) Use the Do_handle_event method of your IMPL class. This method is called when there is an event that is being triggered (save button is pressed). You can redefine this method and before really saving the data you can perform your checks.
    Hope this helps.
    Kind regards,
    Micha

  • ADF: How to find out which query has taken what time?

    Hi,
    I have an ADF application which has many SQL queried running on each button click/page load, so how to find out which query is taking what amount of time? So that i can identify the long running queries and modify them to improve the application performance.
    Thanks in advance.

    Hi,
    As suggested by Timo,you need to start tracing on oracle.jbo package for getting the SQL queries.But I think the second option suggested by him would be better.You will have to override executeQueryForCollection method in VO Impl class .Pseudo code would be
    @Override
    Take start time
    super.executeQueryForCollection
    Take end time

  • How to populate a table in a custom view

    I created a custom table view.
    In the view I replaced u201C//Contracts/Tableu201D with "<%= controller->gt_contracts %>"
    I populate gt_contracts  in DO_PREPARE_OUTPUT and it works (i.e. the table in the view is populated). However, this is not the proper way as for example the button to download to Excel does not show up, even if the property is set to TRUE.
    So how do I fill the table having u201C//Contracts/Tableu201D  . I think I should use BUILD_TABLE( ) or not ?
    Thank you,
    Mihai

    Hi Mihai,
    You can populate data in DO_INIT_CONTEXT method of ur impl class in your Z component.
    data:
    lv_struct_ref type ref to YOUR_STRUCTURE,
    lv_value_node type ref to cl_bsp_wd_value_node,
    lv_bo_coll type ref to if_bol_bo_col.
    Data: current type ref to if_bol_bo_property_access.
    data: dref type ref to data.
    data: lv_guid_h type crmt_object_guid.
    data: lt_attr type table of YOUR_STRUCTURE.
    data: ls_attr type YOUR_STRUCTURE.
    data: lr_entity type ref to cl_crm_bol_entity.
    create object lv_bo_coll type cl_crm_bol_bo_col.
    lt_attr is ur internal table.
    Loop at lt_attr into ls_attr.
      create data lv_struct_ref.
      create object lv_value_node
           exporting
                iv_data_ref = lv_struct_ref.
    call method lv_value_node->if_bol_bo_property_access~set_property
    exporting
    iv_attr_name = 'YOURFIELDNAME1'
    iv_value = ls_attr-firstname.
    call method lv_value_node->if_bol_bo_property_access~set_property
    exporting
    iv_attr_name = ' YOURFIELDNAME2'
    iv_value = ls_attr-lastname.
    lv_bo_coll->add( lv_value_node ).
    typed_context->YOURCONTEXTNODE->set_collection( lv_bo_coll ).
    endloop.
    Regards,
    Raghu

  • How to populate a table in the html page from the java script

    Hi all,
    I have doubt in populating a table in the html page. my application is as follows
    I have a html page in which i have a combo box and a table following the combo box.
    i have to populate the table depending on the item selected in the combo box.
    for this i am using javascript to get the value of combo box onClick
    then i have to call some function thru jsp to get the data and then i have to populate the table with thst into from java script
    how can i do this, i.e populating html table from java script
    Thanks in advance
    satya

    Hi Mihai,
    You can populate data in DO_INIT_CONTEXT method of ur impl class in your Z component.
    data:
    lv_struct_ref type ref to YOUR_STRUCTURE,
    lv_value_node type ref to cl_bsp_wd_value_node,
    lv_bo_coll type ref to if_bol_bo_col.
    Data: current type ref to if_bol_bo_property_access.
    data: dref type ref to data.
    data: lv_guid_h type crmt_object_guid.
    data: lt_attr type table of YOUR_STRUCTURE.
    data: ls_attr type YOUR_STRUCTURE.
    data: lr_entity type ref to cl_crm_bol_entity.
    create object lv_bo_coll type cl_crm_bol_bo_col.
    lt_attr is ur internal table.
    Loop at lt_attr into ls_attr.
      create data lv_struct_ref.
      create object lv_value_node
           exporting
                iv_data_ref = lv_struct_ref.
    call method lv_value_node->if_bol_bo_property_access~set_property
    exporting
    iv_attr_name = 'YOURFIELDNAME1'
    iv_value = ls_attr-firstname.
    call method lv_value_node->if_bol_bo_property_access~set_property
    exporting
    iv_attr_name = ' YOURFIELDNAME2'
    iv_value = ls_attr-lastname.
    lv_bo_coll->add( lv_value_node ).
    typed_context->YOURCONTEXTNODE->set_collection( lv_bo_coll ).
    endloop.
    Regards,
    Raghu

  • Solved: ADF BC and primary keys - how to implement without using triggers

    Using the following OBE as an example:
    http://www.oracle.com/technology/obe/obe9051jdev/ADFWorkshop/BuildingADFApplicationsWorkshop.htm
    There is just one view that has CustomerId defined as a primary key, where the value for the primary key comes from the customer_seq sequence.
    How do you create the model using ADF BC entity to create an entity object that has a primary key that needs to be populated by a sequence table when inserted WITHOUT using a trigger?
    Basically I want to just use ADF BC instead of toplink in the OBE. We do not use triggers to insert primary keys, so this example is a good match for what I need.
    Can someone help me out. How do I adjust the model to use just ADF BC - how do I define the entity object to use a sequence. Do I just override the create method in the impl? Is it that simple? Or is there a way to do this point and click in the entity tool.
    Thanks!

    I'm not the dba (or one of several) - so don't shoot the messenger... the dba's do not like to use triggers in the code. I have been told that this has caused too many problems in application development.
    I don't ask why, just deal with the fallout.
    I did try using the following code in a create method:
    protected void create(AttributeList attributeList)
    super.create(attributeList);
    SequenceImpl s = new SequenceImpl("customers_seq", getDBTransaction());
    // this.setCustId(s.getSequenceNumber());
    this.createPrimaryKey(s.getSequenceNumber());
    When I run the test program for the module, I get a new entry with the id empty and greyed out. I was hoping that this would be filled in on the actual insert, but no joy. As soon as I try to commit, I get an error:
    (oracle.jbo.AttrValException) JBO-27014: Attribute CustId in CustomersWSView is required)
    So what needs to be done?
    Message was edited by:
    klee

  • Can we show blank lines for transient VO?

    I'm a newbie.. Using JDev 11.1.1.2.0.
    I have a requirement like this (simplified): On first page show an editable table with 2 columns: part no and date, and 10 blank rows. On hitting submit, it should go to a second page which has the part number, date, and price (from database API).
    I went thru storefrontdemo example and I see they have used a transient VO for the cart. So I created a transient VO with 3 attributes - part number, date and price. Also created an AM method in the Impl class to get the price for a part/date combination.
    Few questions:
    1. How can I show the first page with blank rows? When i drag and drop the VO from data control palette as an editable table, I get no rows.
    2. Is it wise to invoke the AM method for each row and populate the price on the transient VO attribute? Will the transient VO values display on the second page, assuming both the first and second pages are in a task flow?
    Thanks in advance!
    Kalp
    Edited by: user514831 on Jan 17, 2011 1:56 PM

    Answering my own question - I just added a CreateInsert operation from data control palette and rewired the "Method" to a custom bean that does something like:
    Row row = vo.createRow();
    vo.insertRow(row);

Maybe you are looking for

  • Adding variable in onApplicationStart

    Hi, When we add a new variable in Application.cfc under the method onApplicationStart the variable doesn't seem to be visible until we restart the application. But as I am a beginner I am not sure what Restarting an Application means? Would restartin

  • Copy  purchase info record

    Hellow! I am looking for a way to copy  purchase info record from one vendor to the other. Vender has changed the company but all prices and material  numbers are the same. Is it possible  to copy  info record without devepoping Z report? Andrey Gars

  • Customized Account Assignment Category In SRM 4.0

    Hi All, We are using SRM 4.0 & SAP R/3 4.6c in classic scenario. we need to map account assignment category (Balance Sheet) in SRM which is having fields Profit Center (mandatory), G/L account (optional) & partner (optional). I want map this account

  • Subtypes of infotype 0105

    Hi group At our site I find that they have set up both subtype 0012 and 0030 for private email-address. They are both translated to "Private email" in our language. 0012 is used the most and is described in our user documentation. But I see that subt

  • SAP Demo Portal

    I'm looking for a SAP demo portal - the one with rilke e (mss) and jordan m (ESS) for illustrative purposes - need to illustrate the vision of an hr portal to my squad. can't access it via http://idesportals.wdf.sap.corp:1080/ - the port is not open