cancel
Showing results for 
Search instead for 
Did you mean: 

How to grayout input fields in fpm guibb ?

0 Kudos

How to grayout input fields in fpm guibb ?

Accepted Solutions (0)

Answers (5)

Answers (5)

nancy_kuchhal_ibm
Discoverer
0 Kudos

The same is achieved by View exit class's method adapt_field_properties.

One can set the read_only property of the field and insert the value in ct_field_properties and set the cv_field_properties_changed as ABAP_TRUE.

Other fields that should be activated are visible, enabled and the name according to one's requirement.

Regards,

Nancy

former_member1193869
Participant
0 Kudos

Hi Debasish,

I'm also working on similar sort of things if you got any solution pls let me know aswell.

Reagrds,

Naveen

former_member196830
Active Participant
0 Kudos

Enhancing the GET_DATA method worked for me just fine. What Abdullah suggested is the solution I put in place.

Regards,

Boris

former_member196830
Active Participant
0 Kudos

For some reason setting the field usage in GET_DATA works, but the GET_DEFINITION doesn't.

When I set up a break-point in GET_DEFINITION it gets there and properly seem to be assigning the read-only attribute, but that does not affect the screen.

Any ideas why?

Thanks,

Boris

0 Kudos

Hi phani ,

Thanks for ur replay but its not grayout the field .there is no effect of this code .can you have any other solution.

J_R
Advisor
Advisor
0 Kudos

Hi Debasish,

if it doesn't help to set the attribute READ_ONLY to 'X' for the feeder field in the field usage table of method GET_DATA then either you have forgotten to set the exporting parameter EV_FIELD_USAGE_CHANGED to 'X' as well in GET_DATA, or the feeder field uses a field reference READ_ONLY_REF which can be defined in the field description table of method GET_DEFINITION. In the latter case you have to change the field value of this reference field in method GET_DATA accordingly.

Best regards,

Jens

Former Member
0 Kudos

Hi DEbasish,

Can you put your code here can see why is it not working.

Thats how it is done in FPM and It works for me .

Also could you please try to make the ev_data_changed = abap_true.

Thanks

Phani

0 Kudos
  * method IF_FPM_GUIBB_LIST~GET_DATA.

   data : f_usage type fpmgb_s_fieldusage.
  data : lt_field_usage type STANDARD TABLE OF fpmgb_s_fieldusage.

  if flag = 'X'.
    return.
  endif.
  flag = 'X'.

  select * from zstudent into table itab.

  ct_data = itab.
  ev_data_changed = 'X'.

  LOOP AT ct_field_usage INTO F_USAGE WHERE NAME = 'ZID'.
    f_usage-name = 'ZID'.
    f_usage-read_only = 'X'.
    f_usage-mandatory = 'X'.
    f_usage-enabled = 'X'.
    MODIFY CT_FIELD_USAGE FROM F_USAGE TRANSPORTING FIXED_VALUES_CHANGED READ_ONLY MANDATORY ENABLED.
    CLEAR F_USAGE .
  ENDLOOP.

  ev_field_usage_changed = 'X'.

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

   method IF_FPM_GUIBB_FORM~GET_DATA.

   DATA : li_makt_line TYPE makt.
   data : f_usage type fpmgb_s_fieldusage.

     li_makt_line = cs_data"cs_data contains the data
  IF li_makt_line-matnr IS NOT INITIAL.
    SELECT SINGLE * FROM makt INTO cs_data WHERE matnr = li_makt_line-matnr .
    ev_data_changed = abap_true.
  ENDIF.

if ct_field_usage is NOT initial.
LOOP AT CT_FIELD_USAGE INTO F_USAGE WHERE name = ' MAKTG '.
     f_usage-name = 'MAKTG'.
     f_usage-read_only = 'X'.
     f_usage-mandatory = 'X'.
     f_usage-enabled = 'X'.
   MODIFY CT_FIELD_USAGE FROM F_USAGE TRANSPORTING FIXED_VALUES_CHANGED READ_ONLY MANDATORY ENABLED.
     CLEAR F_USAGE.
     ENDLOOP.
     ENDIF.
    EV_FIELD_USAGE_CHANGED = abap_true.

===================================

HI PHANI

I ATTACHED THE CODE IF U HAVE ANY ANY SOLUTION REPLAY .

REGARDS

DEBASISH

Former Member
0 Kudos

The code seems about right. Why are you changing the mandatory and enabled fields? Only change the read_only field. I prefer to either use a field-symbol or an index when updating an internal table. Also, why are you checking if ct_field_usage is not initial. You don't really need to since you are looping on that internal table.

Former Member
0 Kudos

Hi Debasish,

LOOP AT CT_FIELD_USAGE INTO F_USAGE WHERE name = ' MAKTG '.

     f_usage-name = 'MAKTG'.

     f_usage-read_only = 'X'.

     f_usage-mandatory = 'X'.

     f_usage-enabled = 'X'.

   MODIFY CT_FIELD_USAGE FROM F_USAGE TRANSPORTING FIXED_VALUES_CHANGED READ_ONLY    

   MANDATORY ENABLED.

     CLEAR F_USAGE.

     ENDLOOP.

Here you have used MODIFY and you have used Transporting and not used NAME in it user that and it should work .

Also Why do you need to use if ct_field_usage is NOT initial condition.

Thanks

Phani

former_member231368
Participant
0 Kudos

Hi Debasish,

I also have same requirement in SAP EHSM to gray out one field based on some condition. Did you achieve this?

Can you please share the solution if it is done.

Thanks in advance.

Yerukala setty

former_member231368
Participant
0 Kudos

Hi Abdullah,

I have the same requirement that a field need to be gray out based on certain condition. Have done through field symbol. But still field is in enable mode.

Can you please check.

Thanks,

yerukala Setty

Former Member
0 Kudos

Hi Debasish,

You can handle it in the GET_DATA of the Feeder class if you want to do it on a condition.

LOOP AT ct_field_usage INTO ls_field_usage WHERE name = 'Name of the field'.

*** You can change

READ_ONLY

MANDATORY

ENABLED

LABEL_TEXT

HELP_TEXT

LINK

VISIBILITY  all these properties for the field and then modify the ct_field_usage****

MODIFY ct_field_usage FROM ls_field_usage TRANSPORTING fixed_values fixed_values_changed mandatory visibility.

       CLEAR ls_field_usage.

endloop.

and then make the ev_field_usage_changed = abap_true .

This is how it is handled.

Thanks

Phani

Former Member
0 Kudos

You can change the input field into text view in your FPM configuration. If you want to change it at runtime, then you need to modify the field to read-only in the GET_DATA method of the feeder class.

0 Kudos

Hi abdullah,

is it necessary to instatiate any std. method of any other std. interface ?

Former Member
0 Kudos

You don't need to instatiate anything; FPM will take care of creating feeder instances. You can either enhance the class to add your code or create a child class that you use in your configuration. As Jens mentions below, you can either enhance the GET_DEFINITION to always make a field read-only or use the GET_DATA to change it to read-only at run-time.

I recommend you go through the FPM Developer Guide document. It is a PDF document available in this website. Just type FPM Development Guide and you will find it.

former_member196830
Active Participant
0 Kudos

Hello Abdullah,

Is there a way to check the CR Status in the GET_DATA method? I can't seem to find the status in the structures. I need to only make the fields read-only for the last status 04 and I don't wnat to use the settings in configuration "Edit Statuses of Change Request Steps". In my case, these steps are used by several different data models, same workflow.

I'm also using it with the Vendor UI, where I have to disable the Editability. There it's controlled with a different mechanism and I'm not sure if that's the best approach for me. Please advise...

Thanks in advance,

Boris

Former Member
0 Kudos

You can use MDG API classes in the feeder class. Here is a new document that should help you (it is mainly for approval but you can use the same technique to read the status): How to Read Approval Info for Master Data by Ca... | SCN