cancel
Showing results for 
Search instead for 
Did you mean: 

How to mapped Gray out field in web dynpro for ABAP.

Former Member
0 Kudos

Hi,

While preparing a WD Application i m using a RFC,which has one input parameter as MODE.

IF MODE = 'DIS' (DIS stands for Display) then all fields of layout in web dynpro should be gray out.

and

IF MODE = 'MOD' (MOD stands for Modification) then all fields of layout in web dynpro should be opened of entering the data.

Can anyone help me to solved this scenario.

Regards,

<b>Seema</b>

Accepted Solutions (1)

Accepted Solutions (1)

IanStubbings
Active Participant
0 Kudos

Hi Seema

I had the same issue a while ago. I ended up with an assistance class with set/get read only methods. I then used the following type code to set the read only property in the WDDOMODIFYVIEW:

DATA: lr_start_date TYPE REF TO cl_wd_input_field,

lr_end_date TYPE REF TO cl_wd_input_field,

lr_pernr TYPE REF TO cl_wd_input_field,

lv_read_only TYPE abap_bool.

lr_start_date ?= view->get_element( 'INP_START_DATE' ).

lr_end_date ?= view->get_element( 'INP_END_DATE' ).

lr_pernr ?= view->get_element( 'INP_PERSON' ).

lv_read_only = wd_assist->get_read_only( ).

IF lv_read_only = abap_true.

lr_end_date->set_read_only( abap_true ).

lr_start_date->set_read_only( abap_true ).

lr_pernr->set_read_only( abap_true ).

ELSE.

lr_end_date->set_read_only( abap_false ).

lr_start_date->set_read_only( abap_false ).

lr_pernr->set_read_only( abap_false ).

ENDIF.

All my business logic is within my assistance class so it makes it easier to maintain.

Regards

Ian

Former Member
0 Kudos

Hi Seema,

As an alternative to Ian's suggestion which works directly with UI elements.

Useful if you have individual field control issues.

If you do not need individual field control. Then consider also

ie Diplay mode = all fields off,

mod = all on.

then

map the read_only property of all UI elements to a single field in the context.

eg create a NODE 'UI_CTRL'.

add an attribute READ_ONLY of type wdy_boolean.

call your function and set this context attribute with ABAP_TRUE or ABAP_FALSE

accordingly.

2 different ways. 1 using the UI element. 1 using the context.

Whatever works for you...

regards

Phil.

Former Member
0 Kudos

Thanks Phil , lan and Frank.

I was doing same procedure mentioned by phil,Bt i was using the attribute of type of boolean.

As mentioned by Phil it should be of type wdy_boolean.

Thanks a lot Phil.

Regards,

Seema.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello seema,

1.call your RFC Module

2. Create a Context node and a field named ENABLED type String in this node.

3. If your RFC returns DIS then clear enabled, if the result is MOD then enabled = 'X'.

4. Write Enabled to the Context.

5. In your View mapp the Context field with the Enabled-Property of your UI-elements.

Regards

Frank