Where to create root BOL in custom component - best practice

Hi Experts,
I have created a BOL class to insert values into a ZTable.
I have created a custom component/views for the BOL. Now how will the create method in the BOL will be called. In which method of the component controller or view controller do I create the BOL root..
I want to use the following code.
CALL METHOD SUPER->WD_CREATE_CONTEXT
DATA:
  lref_substitute           TYPE REF TO if_bol_bo_property_access,
  lv_index                  TYPE i,
  lref_bol_entity           TYPE REF TO cl_crm_bol_entity,
  lrf_cuco                  TYPE REF TO cl_gs_mcat_mcat_impl,
  lref_bol_core             TYPE REF TO cl_crm_bol_core,
  lv_object_name            TYPE crmt_ext_obj_name VALUE cl_crm_catego_genil=>gc_ob_schema,
  lv_create_param               TYPE crmt_name_value_pair_tab,
  lv_number                     TYPE int4 VALUE 1,
  lref_new_substitute       TYPE REF TO if_bol_entity_col,
  lr_tx                     TYPE REF TO if_bol_transaction_context
lref_bol_core = cl_crm_bol_core=>Get_instance( abap_true ).
lv_object_name = 'ZHRUS_D2'.
TRY.
    CALL METHOD lref_bol_core->root_create
      EXPORTING
        iv_object_name  = lv_object_name
        iv_create_param = lv_create_param
        iv_number       = lv_number
      RECEIVING
        rv_result       = lref_new_substitute.
  CATCH cx_crm_unsupported_object .
ENDTRY.
CHECK lref_new_substitute IS BOUND.
lref_substitute ?= lref_new_substitute->get_first( ).
CHECK lref_substitute IS BOUND.
me->typed_context->zhrus->collection_wrapper->clear( ).
me->typed_context->zhrus->collection_wrapper->add( iv_entity = lref_substitute ).
I give the code in various methods and it all works fine. But what is the best way to create the root node.
Regards,
Abdullah Ismail

Hi Abdullah,
I use something like this to create a root entity in the BOL Core. In this case, a standard entity: BTOrder.
*- Data dictionary
DATA lr_core         TYPE REF TO cl_crm_bol_core.
DATA lr_fac          TYPE REF TO cl_crm_bol_entity_factory.
DATA lt_params       TYPE crmt_name_value_pair_tab.
DATA lr_ent          TYPE REF TO cl_crm_bol_entity.
FIELD-SYMBOLS <line> TYPE crmt_name_value_pair.
*- Get the core instance and factory
lr_core = cl_crm_bol_core=>get_instance( ).
lr_fac = lr_core->get_entity_factory( 'BTOrder' ).
*- get supported parameters for this object
lt_params = lr_fac->get_parameter_table( ).
*- Set the process Type
READ TABLE lt_params ASSIGNING <line> WITH KEY name = 'PROCESS_TYPE'.
<line>-value = '0010'.
*- Create the BOL entity, based on parameters
lr_ent = lr_fac->create( lt_params ).
lr_ent = lr_ent->get_related_entity( 'BTOrderHeader' ).
*- Lock order
CHECK lr_ent->lock( ) = abap_true.
It is an alternative way. Check if it helps you creating your Z-Object in the BOL root
Kind regards,
Garcia
Edited by: Bruno Garcia on May 12, 2011 12:15 PM

Similar Messages

  • Transaction to create root object in genil component.

    hi all ,
    may be it seems to be basic question. i am following one tutorial where they are creating one genil component. in order to create root object, they told to run the transaction GENIL_MODEL_EDITOR. but i couldnt find the this transaction in my system. is there any other transaction to create root objects for genil component in CRM. kindly help me.

    Hey praveen,
    If you dont use ehp1, there is no any transaction to create root object. you can fallow this [wiki|http://wiki.sdn.sap.com/wiki/display/CRM/CreateaZBOLObjectPart1] page.
    Regards,
    Zafer,

  • Business component best practices

    I am rewriting an existing PHP application in ADF. Database is large and used in production. Current DB tables do not use many foreign keys. Should I create the custom associations manually in Business Components or create them in the database have BC creation process pick up the association automatically. What's the best practice around this?
    -saidul

    Foreign key are a vital part of the busines logic as they show how entities are wired together. I prefer to have them in the DB as all applications (adf or not) are forced to obey them. This helps to keep the data consistent.
    Now if you are aleady in production, you should first check if you can apply the foreign key constrains without breaking your other running apps.
    If you implement the associations in ADFbc you might hit some data which you can't save as the checks implied by ADFbc can't be met by the data.
    Timo

  • Custom CSS Best Practice?

    I am upgrading a company theme (created in 3.2) to 4.2, so porting old tables, tr, td, custom css etc. into the section and div elements of a copy of Theme 25 of 4.2.
    I have a master theme application and am subscribing to it from each application, and have a custom CSS file (in Shared Components whilst developing then will become external in production for performance reasons) referenced in the page templates.
    My question is, taking the form region as an example, in Theme 25 at the top of the form region definition you have:
    <section class="uRegion #REGION_CSS_CLASSES# clearfix" id="#REGION_STATIC_ID#" #REGION_ATTRIBUTES#>I want to customise the uRegion CSS, so what is the best practice - put a new uRegion definition in the custom CSS file with the new CSS in it, to override the standard uRegion, or change the form template to:
    <section class="ABCuRegion #REGION_CSS_CLASSES# clearfix" id="#REGION_STATIC_ID#" #REGION_ATTRIBUTES#>and put a new definition for ABCuRegion in the custom CSS file? Both work but I wonder what is best. By referencing the company name ABC in the template it is obvious that this has been overridden, but by just overriding the standard uRegion and leaving the template as-is, is that better for forward compatibility? I have also read that some people create a new directory on the server, copy a standard theme into it and change the standard css files after that.
    regards,
    Malcolm.

    MalcA wrote:
    I am upgrading a company theme (created in 3.2) to 4.2, so porting old tables, tr, td, custom css etc. into the section and div elements of a copy of Theme 25 of 4.2.
    I have also read that some people create a new directory on the server, copy a standard theme into it and change the standard css files after that use the copy as the base for a custom theme.That's the recommended approach if you're really creating a custom theme rather than just tweaking things here and there. It follows the principle of separation of concerns in that by retaining the standard <tt>uRegion</tt> class you can change the appearance of the application simply by switching the referenced CSS, rather than having to change template, HTML, and CSS.
    It's also more efficient than having the browser parse and apply multiple levels of override rules, and more likely to allow designers and developers to remain sane as they have fewer strange cascade and specificity bugs to deal with.
    Best practice for serious customization is to leave <tt>/apex/images/...</tt> untouched and create your own CSS/images/JS folder structure elsewhere on the web server. This makes it easier to apply APEX patches and upgrades, and to manage your custom resources.

  • Do We Modify 9AMATNR or Create Z9AMATNR?  What is the Best Practice?

    Years ago, when started up our SAP BW system, we were taught to activate delivered content (like 0MATERIAL) and then MODIFY IT -- there was no reason to copy it to our own "Z" object in order to modify.  Now we are beginning an SAP APO DP project.  Does the same rule hold true?  Do we modify 9AMATNR, or do we copy it to Z9AMATNR and then modify Z9AMATNR?  What is the best practice, and why?  THANK YOU!

    Hi Laurie,
    I have to agree with the rest of the responses - create a "Z" object.  We did something similar with 9ALOCNO - we created a Z9ALOCNO characteristic so that we could create new attributes.
    If you create a Z9AMATNR, you can assign the product (and location) characteristics in the Master Planning Object Structure so that the system knows that your Product characteristic is Z9AMATNR and not 9AMATNR.  This may save you a headache later when you transfer the forecasts to SNP.
    1. use transaction /SAPAPO/MSDP_ADMIN
    2. open up the MPOS in question
    3. menu path Edit -> Assign Product / Location
    4. enter the product and location characteristics
    5. save and exit
    Dan

  • How and where to create SAP Exit or Customer Exit in query variable

    Hi,
    I have to create a date variable in BEx and it should always contain default value as SY-DATUM i.e. current date.
    I dont have 0CalDay in any of my data flow,also I am not supposed to add 0CALDAY.
    If so,where i can write that exit.
    Thanx in advance.

    Actually,what my requirement is...
    I will not filter any characteristic based on this sy-datum instead I will use that variable value in formulae.
    For ex: in my selection,i mention As of date = today's date..then inside the quer designer,a formula will calculate No.of days=As of date-Due date,where "As of Date" is nothing but the date which i have enterd in my selections.
    please let me know any solution

  • SAP Certificate vs Customer Certificate - Best Practice

    Hi All
    We are using an external archive server for archiving data and documents. The communication between SAP and the server is made secure using certificates.
    As per my limited understanding, SAP uses its own certificate for this communication, that is generated in the transaction STRUST. I think it is also possible to use a customer certificate for this communication by importing it in the same transaction.
    We need to determine whether to use the standard SAP certificate or use a custom one in our project. Under which scenarios is it recommended to use a custom certificate? Are there any disadvantages of using the standard SAP certificate?
    Any help is appreciated. Thanks in advance.
    Joy

    Hi,
    If you archive server is inside your corporate network, I don't see why it would be needed to use a custom certificate.
    I don't even know if it is possible because this is the System PSE.
    The SAP system send its STRUST PSE to the archive server at initialization.
    Then each URL generated by the SAP system is signed with the certicate in order for the archive server to know from where the command came.
    I would advice you to keep using the standard System PSE.
    Regards,
    Olivier

  • Creating RFCs which emulate program activity - best practice.

    Hi, First post on the forum so please be kind I'm hoping I've posted in the correct place.
    I'm looking at creating a few RFCs to enable a bit of automation. Theory is that details are passed into the RFC and the function does some magic to update the system, hitting all the BRFs etc. The transaction I'm looking at is ICLCDC02, we're quite a few patches behind so there is a lot of good RFC stuff I just don't have access to.
    My first attempt simply calls the relevant functions detailed in the program and ticks all the boxes but I have concerns. Then I had a look at BDC and found that SHDB couldn't replay some fo the screen selections - just errored out (and that was with a straight record and playback - no modification) so BDC is out for that reason and also some logic would be required so BDC is not really a good candidate IMO. My plan is to stick to calling the relevant functions which I feel may introduce some maintenance overhead.
    Is there any pest practice for situations like this? Is there a way to run the transaction without dialog, call the relevant functions to add records etc accessing the global memory of the transaction then close/save ensuring that all future BRF changes etc get hit? If this is possible then it would greatly reduce/eliminate the maintenance overhead and get rid of my nagging doubt.
    Or is my current approach the correct one?
    Many thanks.

    Hello,
    "This will send work item to user (pr creator) sap inbox which when they double click it will complete the workflow."
    It sounds liek they are sending a workitem where an email would be enough. By completing the workitem they are simply acknowledging that they have received notification of the completion of the PR.
    "Our PR creator will receive notification of the PR approval to theirs outlook mail handled by a program that is scheduled every 5 minutes."
    I hope (and assume) that they only receive the email once.
    I would change the workflow to send an email (SendMail step) to the initiator instead of the workitem. That is normally what happens. Either that or there is no email at all - some businesses only send an email if something goes wrong. Of course, the business has to agree to this change.
    Having that final workitem adds nothing to the process. Replace it with an email.
    regards
    Rick Bakker
    hanabi technology

  • Sharepoint 2013 search component best practice

    hi
    With a big SharePoint 2013 farm:
    2 WFE
    2 App server
    2 Search App server (havent set up these servers yet)
    What would the best way to divide the search componment between the two serarch app servers?
    Crawl component
    Crawls content sources to collect crawled properties and metadata from crawled items and sends this information to the content processing component.
    Content processing component
    Transforms the crawled items and sends them to the index component. This component also maps crawled properties to managed properties.
    Analytics processing component
    Carries out search analytics and usage analytics.
    Index component
    Receives the processed items from the content processing component and writes them to the search index. This component also handles incoming queries, retrieves information from the search index and sends back the
    result set to the query processing component.
    Query processing component
    Analyzes incoming queries. This helps optimize precision, recall and relevance. The queries are sent to the index component, which returns a set of search results for the query.
    Search administration component
    Runs the system processes for search, and adds and initializes new instances of search components.
    If you ignore the need for redunancy (we may add another 2 search app servers for that later).
    brgs
    Bjorn

    Hi Bjorn,
    According to your description, my understanding is that you want to deploy the search components in two search app servers.
    It depends on how many search service applications you need and the size of your environment.
    Here is a link about how to configure topology for one search service application with multiple search components across 2 servers for redundancy and performance:
    http://blogs.msdn.com/b/chandru/archive/2013/02/19/sharepoint-2013-configuring-search-service-application-and-topology-using-powershell.aspx
    You can also run the Query Processing component in web front server and run the other components in the search servers or application servers.
    Please refer to the link below:
    http://blogs.technet.com/b/meamcs/archive/2013/04/09/configuring-sharepoint-2013-search-topology.aspx?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+yahoo%2FZfiM+(Team+blog+of+MCS+%40+Middle+East+and+Africa)
    Best regards.
    Thanks
    Victoria Xia
    TechNet Community Support

  • CTM - Global customizing settings - Best practices

    Colleagues
    We are in the process of optimizing the performance of our CTM engine. We are using SAP recommended standard settings for live cache accesses. Currently we are operating in asynchronous mode with packet size of 1000.
    Here are other settings we have
    Packet size for creating orders = 500
    Packet size for creating pegging relationships = 5000
    Packet sie for order selection = 500
    Please advice if you have experimented with any other settings for improved performance of CTM engine.
    Also, if you can provide any other suggestions that can help in improving performance of CTM, it would be appreciated.
    REgards,
    Pavan

    Hi pavan,
    The setting for creating orders and creating pegging relationships
    is found Ok as per Standard.
    But in our engagement, we used 50 for order selection which gave
    good results.  The value indicates for how many location products a
    liveCache request can be started at one time. The default value is
    50 location products as per SAP recommendation.
    Regards
    R. Senthil Mareeswaran.

  • How/where do I get BPR-content for SAP best practices into solar01/solar02?

    I am looking to use SAP Solution Manager to perform a blueprint & (parts of) a configuration/realization with a number of SAP ERP best practices as the starting point. Unfortunately the BPR-content for my solman seems to be missing as I cannot find any of the processes defined on http://service.sap.com/bestpractices when scoping the blueprint for my project in solar01. We have ST ICO150 loaded, or so I am told.
    Is there additional content out there somewhere so I can add processes/scenarios into solar01 from best practices?

    Hi
    follow this guide
    this is a step by step screenshot guide
    https://websmp110.sap-ag.de/~sapdownload/011000358700002006042008E/HowTo_Impl_Bus_Proc.pdf
    Hope query answered.
    Regards
    Prakhar

  • Help with creating a custom component.

    Hi. I have created a really simple custom component called
    myComp. It is a simple Canvas 100 pixels x 100 pixels with an Image
    control component.
    <mx:Canvas>
    <mx:Image id="image1">
    </mx:Canvas>
    After instantiating the component in Main.mxml eg. var
    pic1:myComp = new myComp(); I am having a problem setting the
    source property of the Image component.
    "image1" is the id of mx:Image in the custom compoenent so I
    tried pic1.image1.source = "assets/ball.jpg" but I get a run time
    error "Error #1009: Cannot access a property or method of a null
    object reference".
    Don't really know what I am doing wrong.
    Any help please!

    In your custom component, try adding a bindable public var
    which contains the path to your image. Also, set the image.source
    to this var.
    In your main app, set the var within the <mx:> tags of
    the custom component. Since it is a public var, it will show up in
    the code hint. You can also now change the image var from the main
    app anytime you like using ActionScript code.

  • Nesting JSF components in a  custom component

    I'm creating a new JSF custom component. my component needs to include an input text and a list box. my question is : how do I add these components to my JSF component ? I want to use to JSF component to render them rather then encoding the HTML myself. how can I do it ?
    I was told I need to use encodeChildren method somehow but I don't know how ?

    I finally found how to set a default skin to a custom component so that users of my component will not have to set again the skinClass value of my component.
    You have to create a defaults.css file at the root of your library and tell the compiler to take it into account.
    The remaining problem is about the compiler. There are some steps before success and they are a bit mysterious/unclear....
    I found 2 or 3 blog articles explaining those steps but the compiler arguments to use are all differents in each article...
    Here are the links I found:
    http://www.unitedmindset.com/jonbcampos/2010/05/12/creating-custom-spark-components/
    http://www.betadesigns.co.uk/Blog/2010/05/14/default-skin-for-custom-flashbuilder-componen ts/
    http://flexdevtips.blogspot.com/2009/06/default-stylesheet-in-swc-flex-library.html
    Following the first article guidelines has been successful for me but I'm not marking this topic as Resolved because I'd like some answers about this whole thing...

  • HtmlCommandLink in a custom component

    Hi everybody,
    seems like I got stuck with this Problem here: I am trying to create HtmlCommandLink within my custom component that points to a method via method binding. My code looks as follows:
    ResponseWriter writer = context.getResponseWriter();
    HtmlForm htmlForm = new HtmlForm();
    htmlForm.encodeBegin(getFacesContext());
    HtmlCommandLink htmlCommandLink = new HtmlCommandLink();
    htmlCommandLink.setParent(htmlForm);
    MethodBinding methodBinding = getFacesContext().getApplication().createMethodBinding("#{TestAction.defaultAction}", null);
    htmlCommandLink.setAction(methodBinding);
    htmlCommandLink.encodeBegin(getFacesContext());
    writer.write("Link");
    htmlCommandLink.encodeEnd(getFacesContext());
    htmlForm.encodeEnd(getFacesContext());
    The Link is created in the page and I can click on it but the method is not invoked. I can invoke it in the code manually which means the reference to the method is working. Am I missing something here?
    Any help appreciated
    Florian

    thanks for your help, and i change the code as :
    @Override
         public void encodeBegin(FacesContext context) throws IOException {
              if (context == null) {
                   throw new NullPointerException();
              ResponseWriter writer = context.getResponseWriter();
              ExpressionFactory expressionFactory = context.getCurrentInstance().getApplication().getExpressionFactory();
              ELContext elContext = context.getCurrentInstance().getELContext();
              MethodExpression actionExpression = expressionFactory.createMethodExpression(elContext,
                        "#{UserManager.actionLoad}",null, new Class[] {ActionEvent.class});
              UIParameter parameter = (UIParameter)context.getCurrentInstance().getApplication().createComponent(UIParameter.COMPONENT_TYPE);
              parameter.setId("addId");
              parameter.setTransient(false);
              parameter.setName("id2");
              parameter.setValue(34);
              HtmlCommandLink link = (HtmlCommandLink) context.getApplication().createComponent(HtmlCommandLink.COMPONENT_TYPE);
              HtmlForm form = new HtmlForm();
              form.setId("pageForm");
              link.setTransient(true);
              link.setValue("Create");
              link.setActionExpression(actionExpression);
              link.getChildren().add(parameter);
              this.getParent().getChildren().add(link);
              form.encodeBegin(context);
              link.encodeBegin(context);
              link.encodeEnd(context);
              form.encodeEnd(context);
    I can click on it but the method is not invoked.
    Any help appreciated.

  • JSF Custom component for table pagination and sorting

    hi
    i want such a custom component that render a table and table has the features of pagination and column sorting.
    any one know from where i can get such a custom component.
    (if this component is available with source then it would be more help full for me)
    thnks & regards,
    Haroon
    Message was edited by:
    HaroonAnwarPADHYAR

    I know two companies that offer JSF component for table pagination and sorting and AJAX based :
    http://www.teamdev.com/quipukit/demo/datatable/DataTable_filteringAndPaging.jsf
    http://java.samples.infragistics.com/NetAdvantage/JSF/2006.1/
    The problem? They are not open source..
    And I am too looking forward on this subject, because I want to develop my own custom component and add some features. If someone has any tips, references or samples of their own, it would be really appreciated.
    Thank you.
    Paul

Maybe you are looking for