Skip to Content

This blog is continuation of my previouw blog “CRM 7.0 How to –5B Create an Overview Page with content” 

So far I have created a read-only view DetailsOV and assigned it to OverviewPage. Now I want to create a second view for editing purpose. The purpose is to navigate from first view (which is read-only) to this second view which will enable the user to change the data.

 

Make sure that the new view is same as the first view (fields and their alignment) with the exception that it will be used only for edit purpose.

 

Follow my Blog CRM 7.0 How to –5A Create a custom component with a simple view to create an empty view called DetailsEF just same as DetailsOV and then assign it to the window.

 

image

 

image

 

Once this is done go back to the view details and edit the DetailsEF.htm file and change the code as shown below

 

 

image

 

 

After activation double click on the view name, the configuration Tab should appear. As this view will be equivalent to the first view, take into consideration to have same fields in this view as well.

 

image

 

In order to add button to the view DetailsOV add an attribute GT_BUTTON to the *.IMPL.

 

image

 

image

 

Redefine the method DO_PREPARE_OUTPUT of the controller.

 

 

image

 

 

Go to the DetailsOV.htm file and add the lines shown below. 

 

 

image

 

 

After this the edit button should appear in the view. Test the application to verify.

 

 

image

 

Next step is to create the Event Handler to respond this button.

 

image

 

Give the same name you have entered in the method DO_PREPARE_OUTPUT of the controller for parameter on-click. This is case sensitive so to avoid any issues, type it in Caps and system will create the event handler with the prefix EH_ON.

 

image

 

image

 

Right click on Outbound plug and create an outbound plug for DetailsOV. Give the name of the target view where the navigation is going to e.g. in this case TODETAILSEF.

 

image

 

Create an inbound plug for the second view DetailsEF. Give the name of the view from where the navigation is coming from e.g. in this case FROMDETAILSOV.

 

image

 

Go to Runtime Repository and switch to edit mode and create navigation from DetailsOV to DetailsEF.

 

image

 

image

 

image

 

In View DetailsOV go to the event handler and call the outbound plug.

 

image

 

In the outbound plug and call the navigation link just created above.

 

image

 

Since the view DetailsEF is not embedded in an overview page the button needs to be added to the main toolbar. To do that, implement a BACK button on the second view by implementing an Interface for the view controller

 

image

 

image

 

Now implement the method GET_BUTTONS

 

image

 

image

 

 

Implement the method GET_NUMBER_OF_VISIBLE__BUTTONS.

 

image

 

Create an event handler for the view DetailsEF make sure that you use the same name used in the GET_BUTTON method. 

 

 

image

 

To enable the navigation back from DetailsEF to DetailsOV create an outbound plug in DetailsEF and inbound plug in DetailsOV.

 

image

 

image

 

Create navigation link to enable the back navigation.

 

image

 

image

 

Call the outbound plug from the Event Handler EH_ONBACK.

 

image

 

From the outbound plug call the Navigation link.

 

image

 

This concludes the navigation from DetailsOV to DetailsEV and viceversa.

 

image

 

 

image

This is what we have achieved so far.

image

In my next Blog I will cover CRM 7.0 How to –5D Custom Controller and Binding of context nodes

To report this post you need to login first.

14 Comments

You must be Logged on to comment or reply to a post.

    1. Vikash Krishna Post author
      Hi Apoorva,

      Very good point. You can copy the DetailsOV. Just right click on the view DetailsOV and select copy and give the name DetailsEF. This will create a view for you but after that you have to change the .htm code and configuration of the view as configuration will not get copied.

      But by doing that you just skipped few steps of the wizard nothing much.

      Thanks,
      Vikash.

      (0) 
      1. chand shaik
        Hi Vikash,
        According this Bolg Hi I have tried to execute navigation between two page.

        In DO_PREPARE_OUTPUT method I have written the code as below

        METHOD DO_PREPARE_OUTPUT.
          DATA: LS_BTTON TYPE CRMT_THTMLB_BUTTON.
          CALL METHOD SUPER->DO_PREPARE_OUTPUT.
          IF GT_BUTTON IS INITIAL.
            LS_BUTTON-TYPE = CL_THMLB_UTIL=>GC_ICON_EDIT.
            LS_BUTTON-ENABLED = ABAP_TRUE.
            LS_BUTTON-ON_CLICK = ‘EDIT’.
            APPEND LS_BUTTON TO GT_BUTTON.
          ENDMETHOD.         

        I am getting below error while checking the code 

        The type “CL_THMLB_UTIL=>GC_ICON_EDIT” is unknown.

        Kindly please help me to move further.

        Thanks
        Basha

        (0) 
        1. Vikash Krishna Post author
          Hi Basha,

          Go to Tr. SE80 and check the package   
          ‘BSP_DYN_CONFIG_TAG_LIB’. In Class Library look for the class ‘CL_THMLB_UTIL’ and in the Attribute look for the attribute GC_ICON_EDIT. If it is not there then search SAP OSS note with the class name. Generally you should not get such errors.

          Thanks,
          Vikash.

          (0) 
  1. Vikash Krishna Post author
    Hi Krishna,

    No you are not missing any thing. I have not made the field editable yet. I’ll be covering the details how to do that in my coming blogs.

    Thanks,
    Vikash.

    (0) 
  2. Jaya Nair
    Hi Vikash,

    Your explanations are very helpful.
    Can you please help me to understand can we  put a button on the Opportunity page. And if yes how should i code for it.
    My requirement is that i want more than one smartform to be printed on the Opporutnity page so the output determination ie., Preview output I assigned one smartform so i need to assign another smartform to.

    Your reply will be of great help.

    (0) 
    1. Vikash Krishna Post author
      Hi Jaya,

      Here is what you should do.

      Enhance your component and check which place you want to put the button. Say you want to put the button on Overview page, then enhance that view and in IMPL class redefine the method

      IF_BSP_WD_TOOLBAR_CALLBACK~GET_BUTTONS and
      IF_BSP_WD_TOOLBAR_CALLBACK~GET_NUMBER_OF_VISIBLE_BUTTONS

      in the first method

      code should be something like this:

            ls_button-text  = ‘XXXXXXXXXX’.
            ls_button-on_click = ‘PRINT_PREVIEW’.                 “#EC NOTEXT
            ls_button-page_id  = me->component_id.
            IF lv_archived = abap_false.
              ls_button-enabled  = abap_true.
            ELSE.
              ls_button-enabled  = abap_true.
            ENDIF.
            ls_button-type     = cl_thtmlb_util=>GC_ICON_PRINT.
            APPEND ls_button TO rt_buttons.
            CLEAR ls_button.

      In second method you change the variable rv_result = number of buttons you want to be visible.

      Then create an event and write your code to priview your smartform.

      Hope this will help.

      Best,
      Vikash.

      (0) 
      1. Jaya Nair
        Thanks Vikash,

        But still a little confusion, where is the relation between the standard print preview button assigned to the action definition. when we create a action defintion with  processing type as smartform print the standard print preview button automatically calls this action defintion.

        My problem is that Now i want my customized button to call another action definition.

        Thanks in advance for your precious time.

        (0) 
  3. chandrakant kulkarni
    Hello Vikash
    When i write the code mentioned by you in the DO_OUTPUT_HANDLE i am getting this error. Please help me
    The field “GT_BUTTON” is unknown, but there is a field with the similar          

    REGARDS
    CHANDRAKANT KULKARNI

    (0) 
  4. Narendra Bachimanchi
    Hi Vikash,

    Thank you very much for your valuable article. I learned a great deal from it. I have couple of questions.

    Why did we implemented the interface for back button in second view. Why can’t we follow the same approach as view1?(I tried it and obviously it didn’t work) You explained that since it is not assigned to an overview page, this approach is followed. Can you explain a bit more.

    (0) 
  5. Puneet Mittal

    Hi Vikash,

    Firstly thank you very much for this good article. I had learned lot of things to this article .

    I was going through this article. I got this error when i click on edit button “

    • The navigation target assignment block ZPM/DetailsEF is not part of the current configuration

      


    Please help me to resolve this error.


    Again i am giving thank you to this valuable article .

    Regards,

    Puneet Mittal

    (0) 

Leave a Reply