cancel
Showing results for 
Search instead for 
Did you mean: 

Enable the fields in Webdynpro abap

former_member219737
Participant
0 Kudos

Hi Experts,

After the SAVE action is performed in the Screen, I need to Enable the field , when there is no values in the Days Column ...

Can u suggest an idea on this ...

I have listed the Screen shot for reference .,..

Regards,

Karthik S

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

i would suggest:

- read your column in the action of the save button, if it is inital

- if initial enable the field.

     you can do this by binding the attribute enable to a boolean in the context and change value of this boolean in the context or change it direct in the attributes of the UI element.

regards

Alex

former_member219737
Participant
0 Kudos

Hi Alex,

Thanks for your reply .

Can i know the steps to achieve the same ...

Regards,

Karthik S

Former Member
0 Kudos

Hi Karthik,

when you click the save Button, the action assigned to this button is executed. In this coding you have to check if your column is filled.

If the column is not filled change attributes of the ui filed to enable it.

Sorry, maybe you cann specify the problem? Is it the coding in the action to check if column is initial or is it changing of the attributes?

Please check the document provided by Rama, it gives you a goof example on what to do.

regards

Alex

former_member219737
Participant
0 Kudos

Hi Alex,

Thanks for your reply .

I have used the below sort of code inside the loop Statement of SAVE method ..Still, I could able to see the field in disable mode but not in Enable mode ...

        IF lv_attr_name = 'DAY1' OR lv_attr_name = 'DAY2' OR lv_attr_name = 'DAY3' OR lv_attr_name = 'DAY4' OR
         lv_attr_name = 'DAY5' OR lv_attr_name = 'DAY6' OR lv_attr_name = 'DAY7' .

        lo_el_timesheet->set_attribute_property(
        EXPORTING
          attribute_name = lv_attr_name
          property       = if_wd_context_element=>e_property-enabled
          value          = abap_true  ).
      ELSE.
        lo_el_timesheet->set_attribute_property(
EXPORTING
  attribute_name = lv_attr_name
  property       = if_wd_context_element=>e_property-read_only
  value          = abap_false  ).
      ENDIF.

Can u suggest an idea on it .

Regards,

Karthik s

Answers (2)

Answers (2)

Gowtham
Contributor
0 Kudos

Hi Karthik,

Create one new attribute to control the read only(with type wdy_boolean) and bind it with the required field's read only property , post save action you can call one more method there check the initiality of the required fields , if those are initial make the fields are editable.

- Gowtham.

former_member219737
Participant
0 Kudos

Hi Gautam,

Thanks for your reply .

I have tried using READ_ONLY property...Still its making it has greyed out one.

I have made Link to Action to the field. Is it possible to make it enabled after the action the SAVE button .

Can i know the snippet of code to achiev it .

Regards,

Karthik S

Gowtham
Contributor
0 Kudos

Hi Karthik,

i have created a table and a button in the screen , inside the table's node have created one more attribute called 'R1(type wdy_boolean)' to control the read only property and binded the same R1 with all table fields read only property.

and in the submit button click i am calling this code to enable the fields:

  DATA lo_nd_vbap TYPE REF TO if_wd_context_node.

  DATA lo_el_vbap TYPE REF TO if_wd_context_element.

  DATA ls_vbap    TYPE wd_this->element_vbap.

  DATA lt_vbap    TYPE wd_this->elements_vbap.

  lo_nd_vbap = wd_context->get_child_node( name = wd_this->wdctx_vbap ).

  lo_el_vbap = lo_nd_vbap->get_element(  ).

  lo_nd_vbap->get_static_attributes_table(

  IMPORTING

  table = lt_vbap ).

  CLEAR ls_vbap.

  LOOP AT lt_vbap INTO ls_vbap.

    MOVE ' ' TO ls_vbap-r1.

    MODIFY lt_vbap

      FROM ls_vbap

     TRANSPORTING r1.

ENDLOOP.

  lo_nd_vbap->bind_table( lt_vbap ).\

and this will enable the read only input fields into editable fields.

- Gowtham

former_member219737
Participant
0 Kudos

Hi Gautham,

I have tried the same but i could not able to see the fields of a table as Enabled one .

Can u suggest idea on the same ..

I have listed the screen shot for reference ...

Code :

    CLEAR ls_timesheet_1 .
  LOOP AT lt_timesheet_1 INTO ls_timesheet_1 .

   if ls_timesheet_1-day1 is initial or ls_timesheet_1-day2 is initial or ls_timesheet_1-day3 is initial or
      ls_timesheet_1-day4 is initial or ls_timesheet_1-day5 is initial or ls_timesheet_1-day6 is initial or
      ls_timesheet_1-day7 is initial .

      MOVE space TO ls_timesheet_1-read_day1 .

   endif .


    MODIFY lt_timesheet_1 FROM ls_timesheet_1 TRANSPORTING read_day1 .

  ENDLOOP.

  lo_nd_timesheet_1->bind_table( lt_timesheet_1 ).

layout :

Regards,

Karthik S

Gowtham
Contributor
0 Kudos

Hi Karthik,

Can you please check the cell variant which is created inside the table cell , if that is not required you can remove that and check.

- Gowtham

former_member219737
Participant
0 Kudos

Hi Gautham,

Its working fine...but y it is not happening with Cell Variant Stuff...

Is there any other Option to achieve it ...

Regards,

KArthik S

ramakrishnappa
Active Contributor
0 Kudos

Hi Karthik,

You need to use the READ ONLY property of context attributes in your case.

If there is empty value, set the value read_only to FALSE.

Please refer my document below , Hope it suits your requirement

In the above document, i used lock and unlock buttons, you can use logic of unlock for SAVE action as your requirement.

Regards,

Rama