tstefanov

Blog of Tzanko Stefanov

Embedding Views From Other Components


Some might say that this is quite trivial, but the other day I witnessed a somewhat tricky to spot error related to reusing views. A colleagues of mine was integrating a UI component into CRM quotation page. My colleague had created a reusable custom UI component with an assignment block (view). At first all appeared to be going smoothly.  My colleague was able to show the custom view on the quotation OVP. But upon further analysis, it became apparent that something was wrong:

  • The custom window controller was never created – hence important logic in method do_init_context was never executed
  • When trying to access the custom component controller from the custom views,  ME->COMP_CONTROLLER did not refer to the component controller of the custom UI component but to the component controller of the embedding component (component BT115QH_SLSQ) .

Our assumption was that something went wrong when creating the component usage to the custom UI Component but we did not find anything suspicious there. Then I looked carefully at what was added to the quotation OVP in the runtime repository. The custom view was there but it’s name appeared a bit strange. It did not contain the name of the component usage.

View added without a component usage

View added without a component usage

It became clear that the embedded view had been added directly to the OVP instead of using the created component usage. This of course explained why one would not get the component and window controllers of the custom UI component. They were simply never instantiated. The view was instantiated as an independent UI element.

How one shall not add views

How one shall not add views

I removed the view and added it through the existing component usage.

How to embed views

How to embed views

Next we cleaned the configuration and added the new view to the OVP layout. As expected the controllers of the custom UI component got instantiated and their functionality became available to our embedded view.

Proper Embedding

Proper Embedding

Although by all means the above information is not revolutionary it might help you avoid the same mistake. However, it also shows that you can reuse standalone/independent views without a component usage.

Generic Retrieval of Object Type and Key When Embedding a Component


It is sometimes the case that one needs to get the notion of its ‘surroundings’ when coding reusable UI Components. A view that needs to be reused/embedded in other CRM applications is a perfect example. Such views can implement logic that depends on the context in which they are executed. For example, call one FM when being displayed in an Account and a different FM when rendered in BP Contact. This requires code that determines the “surroundings” dynamically at runtime.  Fortunately there is a fairly straightforward solution.

Each CRM application shall have an associated UI object type. The latter identifies the application semantically. Remember that the same UI components can represent different things. So the UI object types help to specify what does a UI component represent at a given point in time.

BSP_DLC_OBJ_TYPE

BSP_DLC_OBJ_TYPE screenshot

The database table BSP_DLC_OBJ_TYPE  contains the UI Object type definitions. If you take a look there you will see that an UI Object type is mapped to a BOL and BOR objects .

The customers can define their new UI Object types in BSPC_DLC_OBJ_TYP. To view the SAP entries you can use transaction BSP_DLC_SDESIGN (SAP). Customers can maintain their definitions via in IMG under  UI Framework –> UI Framework Definition –> Define UI Object Types .

 

Due to the many to many nature of the relationships in these tables one cannot rely solely on them to map UI object types to BOL and BOR objects. Therefore, there is a service that does the mapping during runtime by evaluating the attributes of the relevant BOL object. The ABAP class name of this service is CL_CRM_UI_OBJECT_MAPPING_SRV. Internally it relies on mapper classes that carry out the actual conversion. These mapper classes implement interface IF_CRM_UI_OBJ_MAPPER.

CRMS_UI_OBJ_MAP  screenshot

CRMS_UI_OBJ_MAP screenshot

 

What mapper class to use for which BOL object is specified in table CRMS_UI_OBJ_MAP . You can use transaction CRMC_UI_OBJ_MAPPING instead of browsing this table in the DDIC (will also show the associated Design Layer objects). For customer settings use transaction  CRMS_UI_OBJ_MAP (Customer) or IMG path  UI Framework –> Technical Role Definition -> Define Object Mapping (Customer)

 

 

 

 

 

But how to use all these in an embeddable UI component? It is actually quite simple.  First you need to get an instance of the mapping service and then execute one of its methods. You have methods for obtaining the UI object types based on a BOL entity, getting the BOR type or the other way around – get the UI object type from a BOR/BOL objects. Here is an example that retrieves the BOR object from a  BOL:

* Local data declarations

  DATA: lv_ui_type TYPE bsp_dlc_object_type,

                lh_map_srv TYPE REF TO cl_crm_ui_object_mapping_srv.

* Get BOR object data

  lh_map_srv = cl_crm_ui_object_mapping_srv=>get_instance( ).

  CHECK lh_map_srv IS BOUND.

  lv_ui_type = lh_map_srv->determine_ui_object_of_entity( bol_entity ).

  CHECK lv_ui_type IS NOT INITIAL.

  pes_borident = lh_map_srv->get_bor_from_entity( iv_ui_object_type = lv_ui_type  

                                                                                                             iv_entity         = bol_entity ).

What is important is to note that the BOL object used must be the one used in CRMS_UI_OBJ_MAP. These are root entities and are often referred to as “main” BOL entities.  This term is somewhat loosely used. In the context of UI components, this is the BOL entity returned by IF_BSP_WD_HISTORY_STATE_DESCR~GET_MAIN_ENTITY of the OVP or the Window controller classes.  That should be a straightforward task to get 🙂

Using Web Client UI in ECC 6.0 EhP4 and Higher


The other day I was asked if one can use the Web Client UI on an ERP (ECC) 6 system. The answer is ‘yes, given that you have the right enhancement pack’. The matter is briefly discussed  in chapter 1 of our Web Client UI book (http://www.sap-press.com/h3192). I must admit that the information in the book is not enough to get someone started with coding Web Client UI applications in ERP.  The overall statement goes along the lines that ECC 6.0 EHP4 includes already the WEBCUIF framework. However, the framework is hidden from the developers/users. The relevant customizing in SPRO is simply missing. A customer would have to know the names of the maintenance views, tables, transactions, etc.

As of ECC 6.0 EhP5, a customer can also maintain the Web Client UI customizing via SPRO. As far as I can remember this customizing can be found in under the SPRO path for FI-CA. However, the relevant FI-CA switch has to be activated. So again, although present, the Web Client UI is not that visible to the developers.

Please note that one has the complete Web Client UI framework across the entire SAP Business Suite 7.01 and higher. Needless to say, the the fact that it is sometimes hidden, proves it a bit difficult to use the Web Client UI in systems like ERP 6.0 EhP4. If you are lucky and have EhP5 than all you need to do is activate the switch (if you know about it of course).

In this blog, I will try to get you started with Web Client UI development in Business Suite 7 EhP4. The first challenge that you will be facing is that you do not have the GenIL Model Editor. The same is true even for those having CRM 7.0 as the editor was introduced in EhP1. In the book, we decided to stick with the model editor as there are different ways in which one can manually implement the GenIL model definition. A good read is the blog of Harel Gilor, “Create your own BOL Obect”, http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/19914. We are referring to that blog on page 130 of our book. So we thought that one can relatively easy learn how to manually maintain the GenIL model, but very few knew of the existence of the GenIL model editor. In addition, we needed it to demonstrate the GenIL handler concept.

Now back to ECC: let’s say that you have read the blog of Harel (or the rest of the available materials on SDN) and implemented your model. Now you are ready to register your GenIL components and component sets. What is easily available in CRM’s SPRO under Customer Relationship Management->CRM Cross Application Components->Generic Interaction Layer/Object Layer->Basic Settings is simply missing in ERP EhP4. If you have both systems you can check what is behind the SPRO path and simply run it in ERP.

In this example, the GenIL components are maintained in view cluster (transaction SM34) CRMVC_GIL_APPDEF (refer to the screenshot provided here).

So now you can add your own custom GenIL component and create a component set. We will not do it in this blog (read Harel’s blog or the book). But  let’s pick an existing component and see what we can do with it. The SAMPLE component is the recommended exemplary GenIL component that a Web Client UI developer can always refer to. We can test it in transaction GENIL_BOL_BROWSER. Start that transaction and enter SAMPLE as an application.

Transaction GENIL_BOL_BROWSER

Transaction GENIL_BOL_BROWSER

Once the BOL browser opens the SAMPLE component you could execute the  OrderQuery. In the screenshot I simply set the Description field to ‘*’ and left the rest blank.

Once you have developed and tested your GenIL component, you can start the component workbench via transaction BSP_WD_CMPWB and develop your application.

The information presented here is hardly scratching the surface of what you will need to develop and deploy a complete Web Client UI solution in ECC. So if you are lost and need help finding a transaction code or table name, drop me a comment . And if you are willing to experiment and discover useful things on your own, please do not hesitate to share.

Our book is the N1 best selling book for SAP Press


They say a picture is worth 1000 words. Just look at the left – I have nothing more to add. Except maybe that I feel proud for the guys (Sanjeet, Armand) and myself of course. I already received some positive feedback from people who have started reading it. Hopefully more will come (positive and negative). 

The Book (SAP Web Client)


SAP Web Client Book Cover

It has been on SAP Press’ web site for some time now, but it finally made it into the featured releases section. By ‘it’ I am referring to the book that I co-authored – ‘SAP Web Client: A Comprehensive Guide for Developers’.

About one year ago, together with my friends Armand and Sanjeet, we decided that it is time to put into use our knowledge of what is more commonly known as the CRM Web Client UI framework. We thought that this would provide us with a sense of achievement, while delivering information about a product that is widely used but yet poorly understood. The typical SAP ABAP developers know ABAP WebDynpro and probably BSP Application Programming but they often lack knowledge in the UI framework that powers CRM. Their only source of information was SAP Help and the SDN community. Well, there was also another book called ‘SAP CRM Web Client Customizing and Development’ but we felt that it is not that development oriented. Although I must say it provides quite a comprehensive overview of the framework and its customizing. In the meantime it turned out that our former colleagues Tim and Uwe are working on a similar project together with Michael Füchsle. But SAP Press assured us that there is room for two such books – one for the German and another one for the English speaking audiences. So if you prefer to read in German we encourage you to check ‘SAP Web Client’, again by SAP Press.

Those of you familiar with SAP CRM are very much aware of the Web Client UI. Few years ago the CRM organization figured out that ABAP WebDynpro cannot meet its specific requirement. As time was of an essence, the man in charge of CRM at SAP – Bob Stutz (a person that we all deeply respect) – decided that CRM shall develop its own UI framework. The framework would be based on the BSP technology and use some of the architectural principals of Webdynpro. CRM took an existing framework developed by the Interaction Center (IC) team and assembled development and product management teams. Armand, Sanjeet and I were part of those teams. This is how we got introduced to the framework, contributed to it and ultimately fell in love with it.

So what you will find in this book? I will create a separate SDN blog where I will give an overview of the content, but in the meantime you can check the following SAP Press link:

http://www.sap-press.com/products/SAP-Web-Client%3A-A-Comprehensive-Guide-for-Developers.html

Keep in mind that this is quite a technical book. The topic presentation always revolves around examples. We have tried to stick to one an imaginary use case that we implement via different techniques. As a result, the reader is not distracted by the story and can focus on the implementation task. Sometimes we deviate and present other examples but this is relatively rare.

To summarize, if you want to become a CRM developer or are just curious of this beast called the Web Client UI, go ahead and get this book. If you have questions, doubts or need help please come back to this blog and let us know what is troubling you. Your feedback will be highly appreciated!

 

There is a also a 10% discount coupon if you purchase the book at http://www.sap-press.com: WEBCLIENTILN.

Moved to Munich


It has been 2 weeks since I moved to Munich. I started with OpenText (OT). It is a bit ironic that prior to this engagement I have been living in Canada and working for a German company. Now I am in Germany and working for a Canadian company.

The folks here are not only nice but also very knowledgeable and enthusiastic about what they do. The set up reminds me of the good old days in CRM when development and product management strived to deliver something useful quickly to the market. All in all, I hope I will fit in and become part of that team.

The project that I am involved is about integrating OT’s Enterprise Content Management suite with SAP products (ERP and CRM). After looking into the architecture, I must say it is very similar to what I have integrating SAP’s StreamWork and CRM. This is extremely positive, as it means that two teams/individuals independently came up with the same solution approach.

On the personal side – I sleep on a mattress and hope that my belongings from Canada will arrive soon. But I have an internet connection (thumbs up to Vodafone) and a table with chairs to sit on. The beer is affordable and tastes great!!!