cancel
Showing results for 
Search instead for 
Did you mean: 

OCA edit button problem

Former Member
0 Kudos

Hi ,

In my custom search page i have two OCA buttons namely Edit and Delete.....before creating these two buttons my overview page was

in edit mode which i transferred into display mode by redefining the SET_VIEW_GROUP_CONTEXT method in main window.

now the problem is after creating the OCA ,if i click on edit button it is showing in display mode rather than edit mode  .

what can i do to solve this problem.

thank you.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Rohan,

When edit button of OCA is clicked , then you need to lock the entity and set all views as editable.

   WHEN 'EDIT'.
          IF lr_ent->lock( ) EQ abap_true.
            view_group_context->set_view_editable( me ).
            lr_vgc ?= view_group_context->get_parent_vg_context( ).
            lr_vgc ?= lr_vgc->get_dependant_vg_context( lr_ent ).
            lr_vgc->set_all_editable( ).
            lr_cw->find( iv_bo = lr_ent ).
          ENDIF.

After that you can perform navigation , if you need to edit the details in detail .

Regards,

Nithish

Former Member
0 Kudos

Hi Nithish ,

i tried to add you code instead of my code , but i need some inputs on the declared variables,

like lr_ent  and lr_vgc and lr_cw  what these variable represent.

i had declared like this

lv_indexs TYPE i,

lv_column TYPE string.

Former Member
0 Kudos

  lr_ent       TYPE REF TO cl_crm_bol_entity,

  lr_vgc       TYPE REF TO if_bsp_wd_view_group_context,

  lr_cw        TYPE REF TO cl_bsp_wd_collection_wrapper,

Regards,

Nithish

Former Member
0 Kudos

Hi Nithish,

this is my code for OCA EDIT Button.

i used ur code but its not navigating  to overview page.

WHEN 'EDIT'.
      Data:  lr_ent       TYPE REF TO cl_crm_bol_entity,
             lr_vgc       TYPE REF TO if_bsp_wd_view_group_context,
             lr_cw        TYPE REF TO cl_bsp_wd_collection_wrapper.

       IF lr_ent->lock( ) EQ abap_true.
         view_group_context->set_view_editable( me ).
         lr_vgc ?= view_group_context->get_parent_vg_context( ).
         lr_vgc ?= lr_vgc->get_dependant_vg_context( lr_ent ).
         lr_vgc->set_all_editable( ).
         lr_cw->find( iv_bo = lr_ent ).
        me->op_to_overview( ).
       ENDIF.

i have added one more statement to navigate to overview but it is not working.


Former Member
0 Kudos

Hi Rohan,

That code is to make the view editable .

For navigation you need to craete a navigation link between two views and navigate .

Regards,

Nithish

Former Member
0 Kudos

Ya right,

you could see that i have added one additional statement

me->op_to_overview( ).

which actually navigates to Overview page from Resultview page.

thankx

Former Member
0 Kudos

So what is the code in outboound plug method op_to_overview??

here you need to use navigate method

  view_manager->navigate( source_rep_view = me->rep_view

                       outbound_plug   = '<Navigational Link >' ).

Regards,

Nithish

Former Member
0 Kudos

Hi Nithish,

           

         your right i have the same code written in my Outbound Plug.

but still its not working.

regards

Former Member
0 Kudos

Are these two views -source view and destination view are under one window  and are under same component ??

Check the run time repository once .

Regards,

Nithish

Former Member
0 Kudos

The component is same, but these belongs to two different windows which come under same

main window.

ex:

window

     viewset

         result.

     overview.

          detail.

i need to navigate from result to detail. when i click on the Edit button.

thankx.

Former Member
0 Kudos

Can you provide the screenshot of runtime repository of expanded window and viewset nodes ??

Former Member
0 Kudos

Yup. just sent the screen shot of my run time repository.

thankx.

Former Member
0 Kudos

Everything seems to be fine.

Check whether the navigation link name in method op_overview is entered correctly as it is case sensitive. Place a breakpoint and do some debugging from this method.

Regards,

Nithish

Former Member
0 Kudos

But Nithish the code i had written previously before pasting your code was working well (i.e., it was navigating perfectly)

only thing was that the overview page was in display mode rather that in editable mode.

i think there is no any problem in navigation.

thankx.

Former Member
0 Kudos

Can you post the entire code of on click action method and have tried debugging this method and find out whether the overview page entity is getting locked??

Former Member
0 Kudos

Hey Nithish,

My Outbound Plug Method.

METHOD op_to_overview.
   view_manager->navigate(
source_rep_view = rep_view
outbound_plug   = 'TO_OVERVIEW'
data_collection = iv_data_collection ).

ENDMETHOD.

-----------------------------------------------------------------------------------------------------------------------------------------------------

My ON_click event method.

METHOD eh_onoca_click.
   DATA: lv_event TYPE string,
         lv_index TYPE string,
         lv_row_index TYPE i,
         lr_col TYPE REF TO cl_crm_bol_entity.

   SPLIT htmlb_event_ex->event_defined AT '.'
   INTO lv_event lv_index.
   lv_row_index = lv_index.

   CASE lv_event.


     WHEN 'DELETE'.
       CALL METHOD comp_controller->window_manager->create_popup_2_confirm "interface  if_bsp_wd_window_manager
         EXPORTING
           iv_title          = 'Confirmation message'
           iv_text           = 'Are you sure! u want to delete?'
           iv_btncombination = if_bsp_wd_window_manager=>co_btncomb_yesno

         RECEIVING
           rv_result         = m_popup_confirm.

       CALL METHOD m_popup_confirm->set_on_close_event
         EXPORTING
           iv_view       = me
           iv_event_name = 'POPUP_CLSOED'.

       CALL METHOD m_popup_confirm->open.

     WHEN 'EDIT'.
       DATA: lv_indexs TYPE i,
             lv_column TYPE string.
------------------------------------------------------------------------------------------------------------------------------------------------
*      DATA:  lr_ent       TYPE REF TO cl_crm_bol_entity,
*             lr_vgc       TYPE REF TO if_bsp_wd_view_group_context,
*             lr_cw        TYPE REF TO cl_bsp_wd_collection_wrapper.
*
*      IF lr_ent->lock( ) EQ abap_true.
*        view_group_context->set_view_editable( me ).
*        lr_vgc ?= view_group_context->get_parent_vg_context( ).
*        lr_vgc ?= lr_vgc->get_dependant_vg_context( lr_ent ).
*        lr_vgc->set_all_editable( ).
*        lr_cw->find( iv_bo = lr_ent ).
*      ENDIF.
-----------------------------------------------------------------------------------------------------------
       cl_thtmlb_util=>get_event_info(
       EXPORTING
         iv_event = htmlb_event_ex
       IMPORTING
         ev_index = lv_indexs
         ev_column = lv_column ).

       me->typed_context->result->collection_wrapper->find( iv_index = lv_indexs ).
       me->op_to_overview( ).

     WHEN OTHERS.
   ENDCASE.
ENDMETHOD.

thankx.


Former Member
0 Kudos

Method in Main Window ,Which makes the overview page change into Display mode.

method SET_VIEW_GROUP_CONTEXT.
*CALL METHOD SUPER->SET_VIEW_GROUP_CONTEXT
*  EXPORTING
*    IV_PARENT_CONTEXT =
**    iv_first_time     = ABAP_FALSE
*    .
    IF iv_first_time EQ abap_true AND
        me->view_group_context IS NOT BOUND.
     IF iv_parent_context IS INITIAL.
       CREATE OBJECT me->view_group_context
         TYPE cl_bsp_wd_view_group_context.
     ELSE.
       me->view_group_context = iv_parent_context.
     ENDIF.
   ENDIF.
endmethod.

Former Member
0 Kudos

In EDIT case , You need to fetch lr_ent as current entity of collection wrapper.

me->typed_context->result->collection_wrapper->find(iv_index = lv_index).

lr_ent ?= me->typed_context->result->collection_wrapper->get_current( ).

Here lr_ent is result model entity, if its is same as overview page context entity  then proceed with the lock code and navigate.

If the overview page entity is different from the result entity , then first fetch overview main entity using some search object . Then lock the main entity and navigate.

Regards,

Nithsih