Skip to Content

View is switch not in edit mode

Hi,

I added a new assigmentblock (for this I created a view in BT111H_OPPT). The view displays values from a dependent BOL.

So far so good, but if I switch to edit mode - only my view elements will not switch to edit mode.

I see "<%= controller->view_group_context->is_view_in_display_mode( controller ) %>" this in my view - which will call

method IF_BSP_WD_VIEW_GROUP_CONTEXT~IS_VIEW_IN_DISPLAY_MODE. In the method the statement ME->GLOBAL_EDIT is every time not X - so the view do not switch to edit mode - can anyone help to solve this problem.

Thank you in advance

Paul

Add a comment
10|10000 characters needed characters exceeded

Related questions

6 Answers

  • Best Answer
    Posted on Sep 26, 2011 at 09:23 AM

    Hi,

    checked, is not empty:

    lv_collection - ENTITY_LIST [1x2(12)]Standard Table

    Greetings

    Paul

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi, I think the edit button is in the top assignment block only.. so it is switching the top view in edit mode when u click edit.

      So you have to add some addition code so that it opens ur view in edit mode when u click edit.

      Put this code in your view in the do_prepare_output. if btadminh is not there in ur view, get it from comp controller or custom controller. it will open ur view in edit mode.

      DATA: lr_ent TYPE REF TO cl_crm_bol_entity.

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

      if lr_ent IS BOUND.

      IF lr_ent->IS_LOCKED( ) = abap_true.

      CALL METHOD me->view_group_context->set_view_editable

      EXPORTING

      iv_view_controller = me.

      ENDIF.

      endif.

  • author's profile photo Former Member
    Former Member
    Posted on Sep 24, 2011 at 07:35 AM

    you have said that your bol entity used in the custom view is a dependent bol to the other bol used in the overview page. if you want to open it in edit mode do these steps.

    1. lets say ur view has context node C1 and it is having the base entity as ent1. The ent1 is standard entity and has a relation with the BTAdminh.

    2. Go to the create context node method of your view. go to the create_c1 method. inside the method, you must have created the relation between the btadminh and your ent1. But the relation should be defined in the on_new_focus method of the ent1 class and that method should be called inside the create_c1 method. so directly creating the relation in the create_c1 method won't work because when you open the page in edit mode, it does not call the create_c1 method again. So if you have put the relation there in the on_new_focus method it would be called when u open it in edit mode.

    Check the standard applications how the on_new_focus is called and how the method is defined and how the coding is done inside on_new_focus. also you should also create the parent context node in your view if you have not. also the parent should have the data binding with comp controlller or custom controller. The create_context method should have call like ,

    create_btadminh( ).

    create_ent1( ).

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 24, 2011 at 05:37 PM

    Thank you for you fast reply - I tried it today -but as expected I have a few problems (sorry, but I'm new on WebUI development).

    My situation now:

    in Customizing

    ZP1 is the dependent object and Z1 is the Acces Object

    ZP1 has Source Object BTADMINH

    Z1 has Source Object ZP1

    Context Nodes

    BTADMINH - mapped to standard custom controller

    Z1 - mapped to standard same custom controller (added node this in controller by enhancement)

    ZP1 - mapped to standard same custom controller (added node this in controller by enhancement)

    context nodes structure

    BTADMINH

    BTADMINH ->ZP1

    ZP1->Z1

    Methods

    CREATE_CONTEXT_NODES

    CREATE_BTADMINH( ). - not changed used the generated implementation


    CREATE_ZSPORDSET( ). - not changed used the generated implementation


    in this method there is already the ZSPORDSET->on_new_focus( focus_bo = entity ). implemented

    CREATE_ZSPORD( ). - not changed used the generated implementation

    in this method there is already the ZSPORD->on_new_focus( focus_bo = entity ). implemented

    But nothing happens 😔

    Do you have an idea what I making wrong? Sorry for that question - (because your answer was great - but I think I 'm not able to transfer to my coding.

    Thanks in advance

    Paul

    Edited by: paul meiner on Sep 24, 2011 10:29 PM

    Edited by: paul meiner on Sep 24, 2011 10:30 PM

    Edited by: paul meiner on Sep 24, 2011 10:30 PM

    Edited by: paul meiner on Sep 24, 2011 10:31 PM

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Ok. I think the issue lies in the on_new_focus methods only..

      the standard code will use the create_related_entity in those methods.. Try these steps first..

      1. Put a break point inside the method ZSPORDSET->on_new_focus( focus_bo = entity ).

      2. now when u click edit button, the debugger should stop in that point.(need to check in edit mode, display mode debugging not required )

      3. Inside the method ZSPORDSET->on_new_focus( focus_bo = entity ), standard code has used get_related_entity method using the focus_bo. Check what entity that method is returning... I think in ur case it is not returning any entity there. If its correct, that is the reason ur view is not in edit mode.(if the collection is blank then also follow step5)

      4. If its returning an entity, send the code in there and I can check and let u know..

      5. if it is not returning, we have to modify the code a bit.. I can send u the code on monday as i dont have the system now.. but the code u have to write should do like this..

      a. if the collection is blank or if get_related_entity is not returning any entity, you have to create the ZSPORDSET entity in that method.. before creation, you have to check if the focus_bo(in this case it is btadminh) is in edit mode..(some method is there to check .... changeable,etc..monday i can give u the method name).. so if both conditions are true use the create_related_entity method to create ur zspordset entity and add it to the context node collection (i think that code is already added by standard).

      after saving the code, log off from webui and login again and check the code in debug.. if in edit mode it is creating the entity in case no entity found, then your view fields should be in edit mode...be careful that in display mode it should not call the create_related_entity method.

      Same approach should be followed for the other context node...

      Let me know if its working or not..

  • Posted on Sep 25, 2011 at 06:45 PM

    Hi,

    thank you again 😊 - my problem seems to be, that the application only starts the method CREATE_ZSPORDSET if I open the opportunity. Than the application stop at the breakpoint. If I switch to edit mode, the application do not stop. But I set a breakpoint to the main view - this view also stops only one time.

    Do you have an idea?

    Thanks in advance

    Paul

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      hi,

      when u switch to edit mode, the CREATE_ZSPORDSET wont be called again, but the method on_new_focus will be called that time.so put breakpoint inside that method and check.....

      let me know if it calls the on_new_focus when u switching to edit mode....

  • Posted on Sep 26, 2011 at 06:58 AM

    Hi,

    thank you for your fast reply - an yes you are right - the method was called 4 times. From this point :

    method ON_FOCUS_CHANGED .
raise event NEW_FOCUS exporting FOCUS_BO = FOCUS_BO.

    Checked the code of method ON_NEW_FOCUS - and found nothing. This means the:

    entity ?= focus_bo. -> cast works

    lv_collection = entity->get_related_entities(iv_relation_name = 'ZSPExternalCaseSet' ). -returns class

    me->set_collection( lv_collection ). - works as well

    but read mode still doesn't work

    Greetings Paul

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      can you please check if there is any entities in the lv_collection ... ??

      put a break point in the statement .. me->set_collection( lv_collection ). and manually check if there is any entity inside the lv_collection

  • Posted on Sep 26, 2011 at 10:02 AM

    Great - many thanks - it works - thank you for your great support.

    Paul

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.