cancel
Showing results for 
Search instead for 
Did you mean: 

Editable cell controlled by 2 fields value

Former Member
0 Kudos

Hi all,

I have a requirement where, there is a cell that need to be disabled when any 1 of the 2 field has 'X'.

Simply explain my logic below

If field 2 or field 3 eq X, then field 1 should be disabled. otherwise editable.

Does anyone have an idea on how i can do this? i tried "lr_input->set_read_only_fieldname( value = 'NEW_CLAIMS_MODE' )"

but it only works for one field. My new requirement is i need the Field 1 to be editable only when both Field 2 and Field 3 is blank.

Please advice.

Thank you

-V-

Accepted Solutions (1)

Accepted Solutions (1)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

You can only bind to a single attribute to determine the Read Only mode. Suggestion: create one new attribute dedicated to the read-only status of field #1. Then write logic that tests the values in Field #2 and Field #3 to set the value of this dedicated read-only status attribute field.

Former Member
0 Kudos

Hi Thomas,

Thanks for the speedy reply.

I forgot to mention that this is related to ALV in WD. I'll try to see what you suggested. Meanwhile if there is alternative, please do let me know.

Thank you.

Get back in a min...

Former Member
0 Kudos

HI Thomas it does not work. when one of the check box is set to X all bcomes X.

Any other alternatives?

Former Member
0 Kudos

Hi,

Can you be more clear on your requirement. How many columns are there in ALV. Out of them how many are checkboxes.

What exactly you want to achieve.

Regards,

Lekha.

Former Member
0 Kudos

Alright.

I have Field1 which need to be editable if either one of the other 2 fields(Field2 and FIeld3) has a X in it.

Field1 should be editable if Field2 or Field3 equal to X. In an ALV Table.

I hope you are clear on my requirement.

Thank you very much sir.

Regards,

-V-

Former Member
0 Kudos

Hi,

Now your node (to which the alv is bound) has 3 attributes In addtion to this have READ)ONLY(wdy_boolean) to this node.

Now, In the column settings for this ALV, For Field1(get_column reference) and create a input field and use theSET_READ_ONLY_FIELDNAME( 'READ_ONLY' ) use this code.

Now,

Implement the Onclick event of the ALV.

In this event -

loop at lt_table into ls_table.
if ls_table-field2 eq 'X' or ls_table-field3 eq 'X'.
ls_table-read_only = abap_false.   "editable
else.
ls_table-rad_only = abap_true.  "Noneditable
modify lt_table from ls_table index sy-tabix.
endif.

lr_node->bind_table( lt_table).

endloop.

Initially when you display the table, you can use the same code as above.

Hope this is clear.....

Regards,

Lekha.

Former Member
0 Kudos

Thank you very much Lekha.

Great Adivce.

Regards,

V

Answers (0)