cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamically making read only for a field in get_data(CL_EHHSS_INC_BINFA_UI_FRM)

former_member583823
Participant
0 Kudos

Hi Experts,

I am making read only for a field based on condition in get_data method of class CL_EHHSS_INC_BINFA_UI_FRM.

But it is not working. Pls find the code for the same.

LOOP AT CT_FIELD_USAGE INTO lw_field WHERE NAME = 'OC_INC_TYPE'.

   lw_field-read_only = ABAP_TRUE.

   MODIFY ct_field_usage FROM lw_field TRANSPORTING read_only.

   ev_field_usage_changed = 'X'.

ENDLOOP.


Pls help me what is wrong in this coding.


Regards,

Reny Richard

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Reny,

Within your feeder class, update the reference fields in CS_DATA or CT_DATA within the
GET_DATA() method. You can find the names of the fields by looking at table
CT_FIELD_DESCRIPTION which gets returned from GET_DEFINITION().

Thanks and Regards,

Gangesh.

Answers (1)

Answers (1)

harsha_jalakam
Active Contributor
0 Kudos

Hi Richard,

Please check if   this loop is executing for the correct desired event(say on click or from the start ). & the field name specified is correct or not through debugging. And check by placing the parameter ev_field_usage_changed = 'X'. after the loop statement.

Below is a sample code for making the field read only.

field-SYMBOLS: <fs_field> like line of CT_FIELD_USAGE.
   loop at CT_FIELD_USAGE ASSIGNING <FS_FIELD>.

     case <FS_FIELD>-NAME.

     when 'OC_INC_TYPE'. " name of the field
         <FS_FIELD>-READ_ONLY = 'X'.                " ' ' for editable

     ENDCASE.


CV_FIELD_USAGE_CHANGED = abap_true.



Regards,

Harsha

former_member583823
Participant
0 Kudos

Hi Harsha,

Code for read only is working in correct condition and also i have placed CV_FIELD_USAGE_CHANGED = abap_true. outside the loop.

But it is not working. In debug the value is getting changed till end, but not appearing in the screen.

Regards,

Reny Richard

former_member583823
Participant
0 Kudos

Hi Harsha,

In the same place visibility is working fine but read only, mandatory and enable is not working.

Regards,

Reny Richard

harsha_jalakam
Active Contributor
0 Kudos

Hi Richard,

Can you please share the entire code , in the method?

Regards,

Harsha