Pages

Tuesday 24 April 2012

HOW TO ENHANCE UI COMPONENT


Enhancing the UI COMPONENT :


1. Go to Transaction BSP_WD_CMPWB and specify the UI component that you want to ENHANCE.

2. Click on Display. This will open the following screen and Click on ENHANCE COMPONENT.





3. In next dialog , give ENHANCEMENT SET NAME and click on right mark.




(please read ENHANCEMENT CONCEPT post to know how to create enhancement set)


4. In next dialog, give application name.




5. it will ask for creating new BSP application. Click ok. Then it will ask for repository storage location as REPOSITORY.XML. choose right mark.


6. Store it either in local package($TMP) or choose another package to transport(according to requirements).


7. We have successfully enhanced the UI component. Once it is done, we can see enhancement name in the heading.




8.If we observe, in the left side panel all views are grayed out, which means, these views can be enhanced. Right click on any view, you can see ENHANCE VIEW option in the context menu.





9. Lets continue enhancing the view also , to know more details. Remember, every time we enhance any view, WEBUI frame work will derive new Z (customer ) classes for view controllers and contexts.


10. I chose AccountRelationshipsOV view to ENHANCE. Before enhancing kindly observe the view controller class name in the below screen shot.





11. We can notice its name started with CL. Once you enhance this, controller name will start with letter Z.


12. Choose any view and right click on it and choose Enhance. In next dialog, it will show one class whose name starts with Z.




13. Choose OK. Some times, it happens that this particular view has already been enhanced in some other enhancement set. In this case, you may receive a message saying that this class already exists. kindly choose some other name for class by changing the class name like ZL_BP_DATA_ACCOUNTRELATIO_IMP1. I got the same message as I already enhanced this view in some other Enhancement set. So I changed the name as mentioned above.







14. Next , it will derive a new z class for CONTEXT also. choose ok. If class is already there, then do it like the step 13. Save both objects ( two new classes , one for view and another one for context) in LOCAL PACKAGE else in Transportable package.


15. We have successfully enhanced view also. kindly check the color of the view that has been enhanced. You can find it in black color not in grey color. Open any UI component which is not enhanced, you can find all views in black color. Once UI Component enhanced, views will be grayed out and ready for enhancement. Once you enhanced the views also, they again come in black color.


16. Deriving new Z classes is nothing but replacing the controllers. Go to transaction SE80 (object repository ) and open the  newly created BSP APPLICATION. In this case it will ZBP_DATA.

17. Kindly check the below screen shot. We can find all enhanced objects in this component here. Since we enhanced one view, we can see that view details here.







18. You can find the controllers which have been replaced in the transaction SM34. Go to this transaction and type value BSPWDVC_CMP_EXT and click on display. select enhancement set that you have used to enhance the component and click on ENHANCEMENT DEFINITION.

19. It will show all components that have been enhanced under this enhancement set.




20. Select the component that you have just enhanced and click on CONTROLLER SUBSTITUTES. Below screen will appear. Kindly look at it we can find the controller substitutions. As I enhanced AccountRelationshipsOV view. You can see this entry here.






In next post, I will introduce basic concepts in the CRM WEBCLIENT.

Thanks for reading my article. If you find it useful. Kindly tell about it to Your Friend also.





Saturday 21 April 2012

ENHANCEMENT SET CONCEPT


ENHANCEMENT SET:

sap provides a concept to enhance SAP standard UI components with out modifying the standard SAP UI COMPONENTS. All modifications that are carried by customer will be stored in the container called, ENHANCEMENT SET.

It is a common requirement for a WEBUI developer to add extra functionality ( creating context nodes, adding new event handlers and creating new inbound and outbound plugs for navigation ....etc) to the SAP STANDARD UI COMPONENT.

Lets have a look at the main transactions and tables which are necessary in this concept. 

Transactions : BSP_WD_CMPWB (component workbench )
                          SM34 (View cluster maintenance)
                          SM30 (View Maintenance )


Tables/View:  BSPWDVC_CMP_EXT  (View Cluster)
                        BSPWDV_EHSET_ASG  (view to maintain data).


BSP_WD_CMPWB ( business server pages - web dynpro - component workbench). This is the transaction to use to create or enhance any component. kindly look at the screen shot below.




There are two ways to create enhancement set.

1. We can directly create enhancement set by clicking on NEW button as highlighted in the above screen shot.

a. click on NEW button, enter new enhancement set name and description in dialog screen it appears.




b. click on right mark and store it in $TMP (Temporary) Package or Transport it(According to requirements).  Enhancement Set Created.

Lets Look at second way.

2. This is something like doing it manual.

   a . Go to SM34 transaction and give view cluster name BSPWDVC_CMP_EXT and click on Maintain button.










  b. Click on New Entries and Enter Enhancement set name and description and press save.


Enhancement set created.


Now, you may create multiple enhancement sets. However, WEBCLIENT framework, at a time can use only one ENHANCEMENT set. When you open component work bench transaction, active enhancement set will be preset in the ENHANCEMENT SET field. This value is client specific. You can change active enhancement in the table BSPWD_EHSET_ASGN.


Go to Transaction SM30 and enter value BSPWDV_EHSET_ASG and click on maintain . You can see,  for each client, there will be one enhancement set assigned.
I am assigning my newly created enhancement set for my client.



Now , when ever I open component workbench, this enhancement set will be preset in the ENHANCEMENT SET field.


Ok. We have created enhancement sets. What if some wants to load particular enhancement dynamically ?


Well, we have a answer for that. In this kind of situations we need to create a new implementation for the BADI (business add in ) COMPONENT_LOADING. In this BADI we need to change the code in the method IF_BSP_WD_CMP_LOADING_BADI~GET_ACTIVE_ENHANCEMENT_SET. 

Kindly look at the default implementation of this method in the below screen shot. They are reading client specific enhancement set from the table BSPWD_EHSET_ASGN.


We need to create new implementation for this BADI to write our own logic to load the enhancement set.

I will put another paper on How create new implementations for BADIS.

Lets learn how to enhance a component in next post.