Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Disabling fields in a view

Former Member
0 Likes
2,211

Hello All,

     I have created a maintenance view in which I need to disable some fields for input based on the other fields in the same row. For eg

               Field1        Field2

Row1          A        (Enabled)

Row2          B        (Disabled)

     For this I thought of creating a PBO module that would loop through the table view but the module is not getting invoked when the view is accessed.

The code at the screen is

PROCESS BEFORE OUTPUT.

   MODULE LISTE_INITIALISIEREN.

   LOOP AT EXTRACT WITH CONTROL

    TCTRL_ZTESV_DE_SUPPRES CURSOR NEXTLINE.

     MODULE LISTE_SHOW_LISTE.

   ENDLOOP.

  MODULE FIELD_DISABLE.

Whilst the MODULE LISTE_SHOW_LISTE is getting invoked the module FIELD_DISABLE isnt.

Also can you guide as to how I may loop through the table control to achieve the intended result as I am new to Dialog Programming.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,797

Hi Nikunj,

Add your MODULE FIELD_DISABLE inside the Loop in PBO.

This will help you to trigger this module for each record present in the internal table.

Inside MODULE FIELD_DISABLE, use LOOP AT SCREEN and based on your conditions, enable or disable your field for editing by changing the parameter as follows.

Validate the field by IF condition using the SCREEN-NAME as mentioned in the screen (the one that you wanna disable) and according to your criteria change

SCREEN-INPUT = 0 (Disable for editing)

SCREEN-INPUT = 1 (Enable for editing)

Do not forget to Modify the screen after changing the screen Parameters.

Regards,

AyyamPerumal


6 REPLIES 6
Read only

Former Member
0 Likes
1,798

Hi Nikunj,

Add your MODULE FIELD_DISABLE inside the Loop in PBO.

This will help you to trigger this module for each record present in the internal table.

Inside MODULE FIELD_DISABLE, use LOOP AT SCREEN and based on your conditions, enable or disable your field for editing by changing the parameter as follows.

Validate the field by IF condition using the SCREEN-NAME as mentioned in the screen (the one that you wanna disable) and according to your criteria change

SCREEN-INPUT = 0 (Disable for editing)

SCREEN-INPUT = 1 (Enable for editing)

Do not forget to Modify the screen after changing the screen Parameters.

Regards,

AyyamPerumal


Read only

0 Likes
1,797

Hello Ayyam,

    Thanks for your reply. I tried as you suggested, keeping the module inside the loop but it is still not getting triggered.

Code at Screen

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

PROCESS BEFORE OUTPUT.

   MODULE LISTE_INITIALISIEREN.

   LOOP AT EXTRACT WITH CONTROL

    TCTRL_ZTESV_DE_SUPPRES CURSOR NEXTLINE.

     MODULE LISTE_SHOW_LISTE.

     MODULE FIELD_DISABLE.

   ENDLOOP.

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

Code at Module(which isn't getting triggered anyway)

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

MODULE FIELD_DISABLE OUTPUT.

   LOOP AT SCREEN.

     if screen-input = 0.

     endif.

   ENDLOOP.

ENDMODULE. 

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


Read only

0 Likes
1,797

Hi Nikunj,

I would suggest you to uncheck the "INPUT FIELD" in the Field Attributes for FIELD2 in the screen.

After this,

Change the MODULE FIELD_DISABLE OUTPUT as follows.

MODULE FIELD_DISABLE OUTPUT.

     IF EXTRACT-FIELD1 = 'A'.

          LOOP AT SCREEN.

               IF SCREEN-NAME = 'FIELD2'.

                    SCREEN-INPUT = 1.

               ENDIF.

               MODIFY SCREEN.

          ENDLOOP.

     ENDIF.

ENDMODULE.

Change the conditions based on your requirement. Just suggested you with your example.

Regards,

AyyamPerumal

Read only

0 Likes
1,797

Hello Ayyam,

     I did something similar to this and it worked. Many thanks for your input.

The earlier issue regarding the module not getting invoked was resolved simply be re-logging in to the box.

Read only

Former Member
0 Likes
1,797

Make use of your VIEW table control structure effectively..

All record to be displayed in your VIEW will be present in the IT GT_DOC.

And for each record in this table Module tc_9000_get_lines get called..where you can change the Column and row attribute using the control structure..tc_9000

You can have a try..could be useful

Regardes

Ansumesh