Application Development 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: 

Dynamically make a field read-only in table maintenance "Single Screen"

Former Member
0 Kudos
1,585

Hi All,

I have added a free text field to a Z table (field size is 255 chars), and have generated a maintenance for the same.

I dont want to add this field as a "key" in the table

I want the user to enter text in this field only during a record creation. When the user is trying to view/edit records, i need to make this text field as read-only..

Is this possible to code in "PAI" module of the single screen ??

Thanks in advance,

Regards,

Raviraj

1 ACCEPTED SOLUTION

Former Member
0 Kudos
322

I have done something similar. Use event 01 (Save Data) and set the screen field as display only.

Rob

4 REPLIES 4

Former Member
0 Kudos
323

I have done something similar. Use event 01 (Save Data) and set the screen field as display only.

Rob

0 Kudos
322

Hi Rob,

Thanks for the quick reply.,

I'm not quite sure how to "set screen field to display". I hav'nt worked much on screen programming. is it a SY field that i need to set ?

Thanks,

Raviraj

0 Kudos
322

I'm afraid I misinterpretted my thinking on this one.

I used that event to automatically fill in certain fields, not change the display status. I believe I set the fields to no-display in the screen painter and I don't think this helps you.

You would have to do this somewhere in the PBO, but I'm not sure where. I'll try to get back to you on this.

Rob

0 Kudos
322

Read this for SM30 events:

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/8129f164-0a01-0010-2a8e-87652872...

Try this code inside some of the events forms:


  LOOP AT SCREEN.
    IF screen-name EQ 'TABLE-FIELD'.     " Table field you wish to make read only
      screen-input = 0.                   " 0 disables, 1 enables
      MODIFY SCREEN.
    ENDIF.
  ENDLOOP.

regards