cancel
Showing results for 
Search instead for 
Did you mean: 

Switch UIBB Between Edit and Read Only on Runtime

mariano_gallicchio2
Participant
0 Kudos

Hello Experts.

I have a Initial Screen and OVP Main page with some UIBB of different kind.

I want to ( after check some conditions ) set a UIBB to Display Mode in the event Leave Initial Screen.

I got the applicaction IF_FPM and IF_FPM_OVP references but i don't see a method to change a UIBB to Display Mode

There is a way to do that?

Thanks!

Accepted Solutions (1)

Accepted Solutions (1)

AbhishekSharma
Active Contributor
0 Kudos

Hi Mariano,

To Enable and disable controls you need to set read_only_ref property of Field Description in GET_DEFINATION method of your Feeder class as shown below:


APPEND INITIAL LINE TO et_field_description ASSIGNING <fs_field_description>.

      <fs_field_description>-name = 'COUNTRY'.

      <fs_field_description>-read_only_ref = 'READ_ONLY'.

Then In Get_data method you can set CT_FIELD_USAGE-read_only = abap_true.

LOOP AT ct_field_usage INTO ls_field_usage.

            IF ls_field_usage-name EQ lc_dept_id.

              ls_field_usage-read_only = abap_true.

              MODIFY ct_field_usage FROM ls_field_usage.

            ENDIF.

          ENDLOOP.

          ev_field_usage_changed = abap_true.

If you want to disable table control then you can do that as below:

In GET_DATA method of LIST UIBB there is one Parameter called IO_EXTENDED_CTRL of IF_FPM_LIST_ATS_EXT_CTRL.

You can use

io_extended_ctrl->set_table_enabled( abap_false ). "TO Disable table

io_extended_ctrl->set_table_enabled( abap_true ). "TO Enable table


Please have look to below posts:





Thanks-

Abhishek


mariano_gallicchio2
Participant
0 Kudos

Thanks a lot Abhishek.

I was doing that control for some inputs.

I was wondering if maybe there is something more "global" like when the event "FPM_SAVE" is triggered.

Regards.

Mariano

AbhishekSharma
Active Contributor
0 Kudos

Hi Mariano,

May you please elaborate on "global"...

Although if you want this control to be on standard "FPM_SAVE" event you can Handel this event in GET_DATA and put your code there it will still work.

If you want this control to be on Buttons also (assuming) toolbar buttons, that you can do as follows:

DATA:

      ls_tb_bt  TYPE if_fpm_ovp=>ty_s_toolbar_button,

CALL METHOD mo_ovp->get_toolbar_button

          EXPORTING

            iv_content_area       = iv_content_area

            iv_toolbar_element_id = iv_toolbar_element_id

          IMPORTING

            es_toolbar_button     = ls_tb_bt.

set status of your button

ls_tb_bt-enabled = abap_true/abap_false.

Or set visibility

ls_tb_bt-visibility = if_fpm_constants=>gc_visibility-visible.

Finally update to toolbar

CALL METHOD mo_ovp->change_toolbar_button

          EXPORTING

            iv_content_area   = iv_content_area

            is_toolbar_button = ls_tb_bt.

        RETURN.

Thanks-

Abhishek

mariano_gallicchio2
Participant
0 Kudos

Abhishek,


what i meant with "global" was a method or structure on the FPM that indicates that the UIBB is editable or not.

someting like uibb->set_editable( true ) 


I've changed a little of my logic and solved this issue by:

- Seting default edit mode to R

- and after processing the event leave_initial_screen, if some condition is satisfied, the event FPM_EDIT is raised.

-If the condition is not satisfied the application remains in read only mode.



Thanks again for your help.


Mariano.

AbhishekSharma
Active Contributor
0 Kudos

ohhhhh

I only know this "global" method for table control which I already told you in last reply..

as per my knowledge for controls you need to do individually by setting read_only_ref field.

Thanks-

Abhishek

ulrich_miller
Active Participant
0 Kudos

Hi Mariano,
there is a global handling of edit mode in FPM: Please check the FPM cookbook:

->

-> 3.3.1.2 Edit and Display Mode in OVP

In case that this is not sufficient then go ahead as Abhishek advised. In that case this blog
might be helpful:

https://scn.sap.com/community/web-dynpro-abap/floorplan-manager/blog/2015/05/21/team-fpm--list-ats-u...

Kind regards,
Ulrich

mariano_gallicchio2
Participant
0 Kudos

Thanks a lot Ulrich.

My solution was a combination of both. Using the the parameter described in the textbook to set Read Only Mode.

Regards.

Mariano.

Answers (0)