cancel
Showing results for 
Search instead for 
Did you mean: 

[ALV] Check for required input fields

guillaume-hrc
Active Contributor
0 Kudos

Hi,

You can specify an inputField cell editor for an ALV column. Doing so would add the little red star in the column header.

But, how to check whether the input field has been filled by the user or not??

In custom dynpro, when you put some required inputFields, you can check with this code:

{code:ABAP}CALL METHOD cl_wd_dynamic_tool=>check_mandatory_attr_on_view EXPORTING view_controller = lo_api_controller. "Export current view API{code}

What about in ALV?

Do I have to do it "manually"??

Thanks in advance.

Best regards,

Guillaume

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

red star on cloumn is not possible but you can use icon on column header or instead of method CALL l_wd_dynamic_tool=>check_mandatory_attr_on_view

you can use

      msg-msgno = '007'.
  

     CALL METHOD lo_message_manager->report_attribute_t100_message
      EXPORTING
        msg            = msg
        element        = <if_wd_context_element>

        attribute_name = 'attribute name' .

guillaume-hrc
Active Contributor
0 Kudos

Hi,

On my system, the code :

lo_input_field->set_state( value = cl_wd_abstract_input_field=>e_state-required )

does set the red star on column header.

I really would like to use cl_wd_dynamic_tool=>check_mandatory_attr_on_view !!

But this takes a IF_WD_VIEW_CONTROLLER as input parameter and I have none to pass because it has to be the view of the embedded ALV.

Giving the current view (taken from WDDOMODIFYVIEW for instance) is unsuccessful.

Thanks for your insights.

Best regards,

Guillaume

amy_king
Active Contributor
0 Kudos

Hi Guillaume,

CL_WD_DYNAMIC_TOOL has another method, CHECK_MANDATORY_ATTRIBUTES, which you can also use to check mandatory fields. With this method however, you pass in an explicit list of fields that are considered required.

data lv_error            type wdy_boolean.

data ls_attribute       type cl_wd_dynamic_tool=>t_check_mandattr_struct.

data lt_attribute_list type cl_wd_dynamic_tool=>t_check_mandattr_tab.

ls_attribute-attribute_name = 'ATTRIBUTE_1'.

ls_attribute-element_index  = index.

append ls_attribute to lt_attribute_list.

ls_attribute-attribute_name = 'ATTRIBUTE_2'.

ls_attribute-element_index  = index.

append ls_attribute to lt_attribute_list.

lv_error = cl_wd_dynamic_tool=>check_mandatory_attributes(

     attribute_list           = lt_attribute_list

     display_messages = abap_false

     context_root           = wd_context

   ).

Cheers,

Amy

Answers (1)

Answers (1)

guillaume-hrc
Active Contributor
0 Kudos

Hi,

It works OK!

Did you set the display message to abap_false on purpose?

Indeed, when I click on the link (javascript:sapUrMapi_triggerFocus("WD0202", true)) provided in the Message Area, I get a Javascript error.

Thanks in advance.

Best regards,

Guillaume

guillaume-hrc
Active Contributor
0 Kudos

Hi,

Still get the Javascript error. (at 2 different customer locations)

Am I the only one??

Best regards,

Guillaume

guillaume-hrc
Active Contributor
0 Kudos

Hi,

Just found out this OSS Note 1579580 !!

Best regards,

Guillaume