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

Transaction programming - Making screen fields 'output only'

Former Member
0 Likes
524

Hi all,

I have a problem concerning a screen - it is so that the screen is used by several transactions - Create 'plan', Display 'plan' and Change 'plan'.

When it's called from the 'Display' transaction I want the screen to be output-only. So I wrote something like this:

MODULE modify_screen OUTPUT.

if sy-tcode = 'ZAF03'.

loop at screen.

if screen-name cp 'I_AFPL*'.

screen-input = '0'.

modify screen.

endif.

endloop.

endif.

ENDMODULE.

The problem is that this screen contains a tabstrip control. The subscreens on the pages of the tabstrip control contain table controls, and the table controls refer to some internal tables in the program.

All the fields which I want to make 'output only' are fields of internal tables beginning with 'I_AFPL' that's why the condition...

This works very well for the fields on the main screen, but not for the fields of the table controls on the tabstrip control... and I'm calling that module from the main screen and also from the subscreens of the 'pages' of the tabstrip control. In the debugger I see that the input is set to 0 but when the screen 'comes on screen' I can still do input in those fields...

Can anyone tell me what I'm doing wrong?

Thanks,

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
482

Hi Ashish,

for table control to disable a column we use the cols property in the screen'..the tablecontrol-cols is set to zero to inactivate a column

Now assume the name of your table control is ZTABLECONT..double click on the screen painter on the table control..these 2 names must be the same....

if you need to disable columns of table control as a part of user action..like say click of a button..it can be entered in PAI by checking the sy-ucomm

data declaration:

data : cols like line of ZTABLECONT-cols.

Case sy-ucomm.

when 'PUSH'.

loop at ZTABLECONT-cols into cols.

if cols-screen-input = '1'.

cols-screen-input = '0'.

endif.

modify ZTABLECONT-cols from cols index sy-tabix.

endloop.

endcase.

This will disable all the columns

for a particular column do the following

For this imagine you have 5 columns

in the below code

index = 1 => column 1

index = 2 => column 2

index = 3 => column 3

index = 4 => column 4

index = 5 => column 5

in the below code , only column2 will be disabled....

so whicever column you want to disable ..just give the index

for multiple disabling..just write the code accordingly

LOOP AT ZTABLECONT-cols INTO cols WHERE index = 2.

IF cols-screen-input = '1'.

cols-screen-input = '0'.

ENDIF.

MODIFY ZTABLECONT-cols FROM cols INDEX sy-tabix.

ENDLOOP.

Pls check and revert....

Regards

Byju

3 REPLIES 3
Read only

Former Member
0 Likes
482

In the PBO routine you should have code that looks like this


PROCESS BEFORE OUTPUT.
*&spwizard: pbo flow logic for tablecontrol 'TBLCLT_MAIN'
  module TBLCLT_MAIN_change_tc_attr.
*&spwizard: module TBLCLT_MAIN_change_col_attr.
  loop at   IT_WK
       into WK_REC
       with control TBLCLT_MAIN
       cursor TBLCLT_MAIN-current_line.
*&spwizard:   module TBLCLT_MAIN_change_field_attr     "  your table cell attributes can be set here
  endloop.

Edited by: Paul Chapman on Apr 24, 2008 7:59 PM

Read only

Former Member
0 Likes
482

Hello.

Did you call the MODULE in the LOOP of the table control?

Otherwise it didn't work!

There is another possiblity to do this. This is described also in the

documentation for TableControls.

(Have a look at Fields of CXTAB*)

Example Program for Table Control from SAP: RSDEMO02

Regards

Read only

Former Member
0 Likes
483

Hi Ashish,

for table control to disable a column we use the cols property in the screen'..the tablecontrol-cols is set to zero to inactivate a column

Now assume the name of your table control is ZTABLECONT..double click on the screen painter on the table control..these 2 names must be the same....

if you need to disable columns of table control as a part of user action..like say click of a button..it can be entered in PAI by checking the sy-ucomm

data declaration:

data : cols like line of ZTABLECONT-cols.

Case sy-ucomm.

when 'PUSH'.

loop at ZTABLECONT-cols into cols.

if cols-screen-input = '1'.

cols-screen-input = '0'.

endif.

modify ZTABLECONT-cols from cols index sy-tabix.

endloop.

endcase.

This will disable all the columns

for a particular column do the following

For this imagine you have 5 columns

in the below code

index = 1 => column 1

index = 2 => column 2

index = 3 => column 3

index = 4 => column 4

index = 5 => column 5

in the below code , only column2 will be disabled....

so whicever column you want to disable ..just give the index

for multiple disabling..just write the code accordingly

LOOP AT ZTABLECONT-cols INTO cols WHERE index = 2.

IF cols-screen-input = '1'.

cols-screen-input = '0'.

ENDIF.

MODIFY ZTABLECONT-cols FROM cols INDEX sy-tabix.

ENDLOOP.

Pls check and revert....

Regards

Byju