Skip to Content

Assume that we have already created Search View and Result View and these views are included in ViewSet. The Search View is for advance searching and result view the table that displays the result of search.

Now follow the steps:

Step 1: Implement WD_DESTORY method.

            Redefine the method WD_DESTORY method of Search View and write the following code:

              RAISE EVENT history_trigger.

       CALL METHOD SUPER->WD_DESTROY.

          Here history_trigger event is raised which calls the State_Store method.

Step 2: Implement the method STATE_STORE

            Redefine the method STATE_STORE in the Search View and write the following code:

               DATA:
        lr_ent
TYPE REF TO cl_crm_bol_dquery_service.
        lr_ent ?= me
->search->collection_wrapper->get_first( ).
       
IF lr_ent IS BOUND.
           state_container
->add_item( im_name  = ‘SearchView’
                                     im_value
lr_ent ).

        ENDIF.

In add_item method SearchView is the name for identifying the state. In me->search->collection_wrapper, search is the context node that was created using BOL Entity BTQ1Order.


Step 3: Implement the method STATE_RESTORE

            Redefine the method STATE_RESTORE in the Search View and write the following code:

               DATA:

           l_ref_ent TYPE REF TO cl_crm_bol_dquery_service.

           state_container->get_item( EXPORTING im_name  = ‘SearchView’
                                   
IMPORTING ex_value = l_ref_ent
          
EXCEPTIONS OTHERS = 0 ).
          
IF l_ref_ent IS BOUND.
                me
->search->collection_wrapper->add( iv_entity = l_ref_ent
                                                 iv_set_focus
= abap_true ).
          
ENDIF.

To report this post you need to login first.

2 Comments

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

Leave a Reply