Friday, 24 May 2013

33.NAVIGATIONAL LINK CREATION.



Creating navigation from one to another view needs understanding of certain methods in the framework. 

There are certain entry and exit points to a view, which are called plugs. 

1.       INBOUND PLUG: this is a method which acts an entry point to the view.
2.       OUTBOUND PLUG: this method acts as a leaving point from the view. 


Let us take two views A and B. if we want to navigate from view A to view B. then we will create a outbound plug in the view A as we are moving away from A and one inbound plug in the view B as we are moving near to B. 

How framework knows the source and target?
Navigational link. 

We define it in the run time repository. This link provides the source and target information to the frame work.

Let us create plugs first. 

Create one outbound plug in the result view as it is a source view. Go to the result view and right click on outbound plug and choose create option. 




Give any valid name. Framework automatically adds prefix ‘op’. we have given ‘TOOVERVIEWPAGE’.

Go to the overview page and create one inbound plug. Use the above method to create inbound plug. 






Creating navigational link:
Go to the run time repository and click on the edit button. Right click on navigation links and choose create. 





In the next dialog box, choose the values as shown below. Give the meaningful name to the link. 





Source is our result view and target is overview page. Choose continue and save the repository. 


As discussed, in order to navigate to the over view page, still little coding effort is required. Go to the event handler (eh_objectid) in the result view. Call the outbound plug in this event handler as shown below.
 





Open the outbound plug method in the result view and add the following code to it. 





We have completed the navigation part. Test the application. Carry the search and click on any hyperlink in the result list. We will be taken to the overview page.  We got following screen. 





Oops, there is no data in the view. 

Yes, we just completed the navigation. We did not feed any data to this view. 

How we will do it?

1.       We will create one new context node in the existing custom controller.
2.       In the event handler that we trigger when user clicks on the hyperlink, we will feed the data to this context node.
3.       We will bind the context node of header view to the context node of custom controller so that data will flow to the header view.

Let us create a context node in custom controller.

11 comments:

  1. Hi all,

    These chapters are really useful. I practiced each and every chapter till now....
    but in this chapter i am getting run time error. I checked each and every step till now very properly but i don't where it is going wrong. It is saying:

    SAP Note

    The following error text was processed in the system:
    Dereferencing of the NULL reference



    Exception Class CX_SY_REF_IS_INITIAL
    Error Name
    Program CL_O2CBMXD6ACIPA0XZM9PGXE4CZW6CP
    Include CL_O2CBMXD6ACIPA0XZM9PGXE4CZW6CM002
    ABAP Class CL_O2CBMXD6ACIPA0XZM9PGXE4CZW6
    Method _ONLAYOUT
    BSP Application YTUTCOMPONENT
    BSP Page HEADER.HTM
    Line 43
    Long text An attempt was made to execute a dynamic method callon an initial(NULL-) object reference. The reference must refer to an object.

    Can any one please help me so that i can proceed with the remaining classes.

    ReplyDelete
    Replies
    1. Hi
      It is because of we are trying to access any method or variable with object reference. but object reference is initial or not bound. I believe that you are using something like this
      controller->view_group_context->xxxxx and here view_group_context might initial. in this case, use the set_view_group_context method and set the view_group_context property so that it will refer to valid object instance. if this is not the case, paste the line 43 code. I will try to help you.

      Delete
    2. Hi Mannala,
      First of all thanks for your reply. But I didn't used anything like view_group_context. What ever it is, I did a small change which makes my code works. In chapter 30 while creating a FORM VIEW you asked us to check Change/Display mode check box, at first i did it in the same way u said which gave me error so I unchecked it. Now the code is working. But again in chapter 45 while reusing a standard component i am getting same sort of error:
      -------------------------------------------------------------------------------------------------
      What happened?
      Calling the BSP page was terminated due to an error:

      SAP Note

      The following error text was processed in the system:
      Dereferencing of the NULL reference



      Exception Class CX_SY_REF_IS_INITIAL
      Error Name
      Program CL_BTPARTNE_PARTNER0_IMPL=====CP
      Include CL_BTPARTNE_PARTNER0_IMPL=====CM003
      ABAP Class CL_BTPARTNE_PARTNER0_IMPL
      Method DO_PREPARE_OUTPUT
      Line 97
      Long text An attempt was made to execute a dynamic method callon an initial(NULL-) object reference. The reference must refer to an object.
      ------------------------------------------------------------------------------------------------

      As i am using standard component i don't know what to do. If you help me in solving this, then it will be great help and i can follow the remaining chapters. If you need any clarification or anything you can directly mail me.

      Mail Id: yaswanth.damarla@gmail.com

      Delete
    3. Hello Yashwanth,

      are you aware , what is the utility of Change/display mode check box in the view type.

      -Abhishek.

      Delete
  2. Hi Mannala,

    I got what you are saying about view_group_context. You explained about that in chapter 46. Sorry for the previous post and thanks for sharing us these chapters. Can you please send me some more material required to study. So that i can get much more grip on CRM.

    Mail id: yaswanth.damarla@gmail.com

    ReplyDelete
  3. Where did you get EH_OBJECTID event handler?

    ReplyDelete
    Replies
    1. Hi,

      In chapter 32 while making object_id as hyperlink, we specified 'objectid' as a value for fp_onclick. Here 'objectid' is hyperlink name that should be triggered when onclick is done. So we need to create an event handler with the same name as 'objectid'.

      Just right click on Event Handler and create with the name 'objectid' it will automatically take the prefix 'EH_ON'.

      Delete
  4. Hello Mannala

    Can you please help me to remove the dump as got by Yashwant

    ReplyDelete
  5. When i test the application after completing 33rd topic i got the result as expected, but there is
    no correct title for the HEADER view. Instead of "Contract header" ( as i set the same title as you when the overview page was configured in topic 31) i got the name of the component and view: //ZBSP_ARO_SE/HEADER so it looks like given/required title name is not taken.

    I tried to set brakpoint in the below method of the Header view:
    IF_BSP_WD_HISTORY_STATE_DESCR~GET_STATE_DESCRIPTION
    but it didn't work. Breakpoint was not even catched.
    Could you please help with that issue ?

    ReplyDelete
  6. HI,

    I have created Event with Object id but still its not opening Overview page. I check all steps done correctly.

    ReplyDelete
  7. HI praveen garu,
    your blog is very helpful for sap crm beginners thanks for your help.
    I got the same error as dereferencing of the null reference. can u explain that little bit briefly.
    thankyou.

    ReplyDelete