Skip to Content
author's profile photo Former Member
Former Member

Input field should be Mandatory Filed

Hi Experts,

I am creating 3 inpufileds and one button in a row dynamically, But I want to make one Input filed ( gv_desc) as mandatory. how can I make the Input field as mandatory. Below is the code which I used.

lr_container ?= view->get_element( 'TC_HEALTH_TEXT' ).

lr_container->SET_VISIBLE( '02' ).

gv_id = ls_add-add_att.

  • Delete Button

gv_id = gv_id + 1.

CONCATENATE 'CHAR' gv_id INTO gv_char.

lr_button = cl_wd_button=>new_button( ).

lr_button->SET_VISIBLE( '02' ).

  • For Grid

lr_grid = cl_wd_grid_data=>new_grid_data( lr_button ).

CALL METHOD lr_grid->set_padding_left

EXPORTING

value = '01'.

  • value = '182'.

CALL METHOD lr_container->add_child

EXPORTING

the_child = lr_button.

lr_button->set_text( 'Delete').

lr_button->set_width( '65' ).

lr_button->set_on_action( 'DELETE_H').

lr_button->set_tooltip( 'Delete Current Department Objective').

  • Complete By Field

gv_id = gv_id + 1.

CONCATENATE 'CHAR' gv_id INTO gv_char.

if wd_comp_controller->GV_NUM = '00'.

wd_comp_controller->GV_NUM = '01'.

endif.

CONCATENATE 'ZHGOALS' wd_comp_controller->GV_NUM '.ZCOMPLETE' into gv_complete.

CONCATENATE 'ZHGOALS' wd_comp_controller->GV_NUM '.ZDESC' into gv_desc.

CONCATENATE 'ZHGOALS' wd_comp_controller->GV_NUM '.ZBSC_CODE' into gv_bsc_code.

wd_comp_controller->GV_NUM = wd_comp_controller->GV_NUM + 1.

CALL METHOD lr_grid->set_padding_left

EXPORTING

value = '95'.

CALL METHOD cl_wd_input_field=>new_input_field

EXPORTING

bind_value = gv_complete

id = gv_char "'CHAR3'

width = '68'

RECEIVING

control = lr_input.

gv_id = gv_id + 1.

CONCATENATE 'CHAR' gv_id INTO gv_char.

  • For Grid

lr_grid = cl_wd_grid_data=>new_grid_data( lr_input ).

lr_input->set_layout_data( lr_grid ).

CALL METHOD lr_container->add_child

EXPORTING

the_child = lr_input.

  • To Create Description field

CALL METHOD lr_grid->set_padding_left

EXPORTING

value = '30'.

CALL METHOD cl_wd_input_field=>new_input_field

EXPORTING

bind_value = gv_desc

id = gv_char "'CHAR2'

width = '700'

RECEIVING

control = lr_input.

  • For Grid

lr_grid = cl_wd_grid_data=>new_grid_data( lr_input ).

lr_input->set_layout_data( lr_grid ).

CALL METHOD lr_container->add_child

EXPORTING

the_child = lr_input.

  • To Ceate BSC Code

CALL METHOD lr_grid->set_padding_left

EXPORTING

value = '70'.

gv_id = gv_id + 1.

CONCATENATE 'CHAR' gv_id INTO gv_char.

CALL METHOD cl_wd_input_field=>new_input_field

EXPORTING

bind_value = gv_bsc_code

id = gv_char "'CHAR1'

width = '25'

  • READ_ONLY = 'X'

RECEIVING

control = lr_input.

  • For Grid

lr_grid = cl_wd_grid_data=>new_grid_data( lr_input ).

lr_input->set_layout_data( lr_grid ).

CALL METHOD lr_container->add_child

EXPORTING

the_child = lr_input.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Aug 19, 2011 at 08:03 AM

    input field class has a method set_state. Using this method set the state as required.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      HI Bhaskaran,

      Issue solved... I forgot to add code in method .. WDDOBEFOREACTION()

      I have added below code and its working now.

      Thanks for your reply

      data: lt_msg TYPE cl_wd_dynamic_tool=>t_check_result_message_tab,

      lo_view_controller TYPE REF TO if_wd_view_controller.

      DATA: text_error TYPE string.

      DATA lr_message_manager TYPE REF TO if_wd_message_manager.

      DATA lr_api_controller TYPE REF TO if_wd_controller.

      lr_api_controller ?= wd_this->wd_get_api( ).

      lr_message_manager = lr_api_controller->get_message_manager( ).

      lo_view_controller ?= wd_this->wd_get_api( ).

      cl_wd_dynamic_tool=>check_mandatory_attr_on_view(

      EXPORTING

      view_controller = lo_view_controller

      display_messages = abap_true "Set this true to display the message in message area

      IMPORTING

      messages = lt_msg ).

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.