cancel
Showing results for 
Search instead for 
Did you mean: 

Disable and enable field at runtime in sap crm 2007

Former Member
0 Kudos

Dear experts!

I created 2 new fields on Opportunity type by EEWB. The first field is checkbox type, is called FIELD1. The second is dropdown list type, is called FIELD2. My problem is: In general, if FIELD1 is not checked, FIELD2 is disalbe. When i checked FIELD1, FIELD2 is enable, enable to choose a value in dropdown list value of FIELD2. But, i don not know how to do it. Can you help me resolve this problem?

Thanks alot!

Longndtb.

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member206299
Contributor
0 Kudos

Hi ,

You have to implement custom Logic here.

First you need to read the value of FIELD1 in the GET_I_FIELD2 Method.

For this you can call the GET_PROPERTY Method for the atrribute FIELD1 in the GET_I_FIELD2.

Checking whether the value is initial or not in the GET_I_FIELD2

we can change the rv_disabled eq abap_true / abap_false this makes the field disabled or enabled.

Make sure that in the layout FIELD1 comes before the FIELD2.

Regards,

Sijo

Former Member
0 Kudos

Thanks Amar Nath and sijokjohn85 for your answer!

But maybe i have not described clearly to you understand, so your solution has not resolved my problem. I will describe more detail as following:

- I create 2 transaction type ZOP01 and ZOP02 are BUS200111 object type. And using EEWB to generate 2 fields type input field are ZZFN01 and ZZFN02 on those transaction type. Because 2 Trans type are common component BT111H_OPPT, so 2 fields ZZFN01 and ZZFN02 will display on Web UI together when i create either of 2 trans type. Problem is if i create new opportunity type ZOP01, only ZZFN01 is enable, ZZFN02 is disable. and if i create new opportunity type ZOP02, only ZZFN02 is enable, ZZFN01 is disable. Your solution to resolve this problem. But, i done it, and my thread do not question about this.

- My problem is: I create 2 field are ZZFN01 and ZZFN02 on transaction type ZOP01. ZZFN01 is checkbox type, ZZFN02 is dropdown box. (i do not question: How to make ZZFN01 is check box and ZZFN02 is dropdown box, i done it). I want that: when ZZFN01 is not checked, ZZFN02 is disable and when i checked the ZZFN01 then, ZZFN02 goes from disable to enable, immediately? I create method GET_I_ZZFN02, in this method, i put some code lines to check ZZFN01 and return to PA_RETURN_ZZFN01. if (PA_RETURN_ZZFN01 = ' ', then make ZZFN02 is disable. If (PA_RETURN_ZZFN01 = 'X', then make ZZFN02 is enable). when i create new opportunity type ZOP01, the ZZFN01 is not checked, so ZZFN02 is disable, of course. Next, i check ZZFN01, how to method GET_I_ZZFN02 recheck the ZZFN01 to make ZZFN02 is enable? This is my problem, and i question about this! So, can you help me?

Thanks for your concern!

Longndtb.

amarnath_kathi
Active Contributor
0 Kudos

Generate GET_P_ZZFN01 method for Field ZZFN01. Whenever the checkbox is changed here in this method set a flag like PA_RETURN_ZZFN01 = 'X' and call SET_ZZFN02 method and reset it.

CarstenKasper
Active Contributor
0 Kudos

Hi,

I believe the only part that is missing from your code is to add these lines to the GET_P_ZZFN01 method on the context node:


  CASE iv_property.
    WHEN if_bsp_wd_model_setter_getter~FP_SERVER_EVENT or if_bsp_wd_model_setter_getter~FP_ONCLICK.
      rv_value = abap_true
  ENDCASE.

These should trigger a roundtrip whenever the user checks or unchecks the field ZZFN01. This will lead to the GET_I_ZZFN02 method to be processed again.

cheers Carsten

Former Member
0 Kudos

Thanks Carsten Kasper!

I inserted your code lines in GET_P_FIELD01, and process in GET_I_FIELD02, result is as my expectation!

Thanks again!

Longndtb.

amarnath_kathi
Active Contributor
0 Kudos

There are many threads with similar requirement in the forum. Run a search, you would get them. One thread I can recollect right away is [this|;. try it out.

Former Member
0 Kudos

Dear Amar Nath an everyone!

Before i created this new thread, i searched in this catagory, but i did not find, or i can applied those solution for my problem. And, your thread you has recollected for me, i can not use for my problem too. Can you or can any one help me?

Thanks very much!

Longndtb.

amarnath_kathi
Active Contributor
0 Kudos

Which component and view are you working on? Are the 2 fields in the same view?

Former Member
0 Kudos

Dear Amar Nath!

I create 2 new fields on component BTCUSTOMER_H, in the same view BTCUSTOMER_H/CustomerH, in the same context node BTadminH. And component BTCUSTOMER_H displays on WEB UI as an assignment block of component BT111H_OPPT. I created GET_I_FIELD2 for FIELD2 and i can make it disable when i do not check on the FIELD1. But after that when i checked the FIELD1, the FIELD2 is still disable.

amarnath_kathi
Active Contributor
0 Kudos

The approach would be to set a flag in the GET_P_FIELD1 when the checkbox is checked. In this method, the standard code may be something on these lines


CASE iv_property.
    WHEN if_bsp_wd_model_setter_getter=>fp_fieldtype.
      rv_value = cl_bsp_dlc_view_descriptor=>field_type_checkbox.
  ENDCASE.

Now put a breakpoint here and see how rv_value changes, you can set your flag accordingly. Check for this flag in GET_I_FIELD2 and accordingly set RV_DISABLED = 'TRUE' or 'FALSE'.