cancel
Showing results for 
Search instead for 
Did you mean: 

Regarding input check and ui elemnts

Former Member
0 Kudos

Hi Gurus,

I have two queries:

1.)

I have implemented the following code to check whether mandatory fields are filled

but it is not returning any message if the select options are blank.

I have made obligatory = X and

used the following code:

data: lt_msg TYPE cl_wd_dynamic_tool=>t_check_result_message_tab,

lo_view_controller TYPE REF TO if_wd_view_controller,

lo_message_manager type ref to if_wd_message_manager.

lo_view_controller ?= wd_this->wd_get_api( ).

lo_message_manager = lo_view_controller->get_message_manager( ).

cl_wd_dynamic_tool=>check_mandatory_attr_on_view(

EXPORTING

view_controller = lo_view_controller

display_messages = abap_true

IMPORTING

messages = lt_msg ).

2.) I have created transparent container:

the layout is FlowLayout and data is Matrix head data.

The elements under this are supposed to come one below the other.

For eg:

Group1:

element1

element2

element3

but it is comming on beside the another in the layout like this:

element1,element2,elemenet3 in the Layout.

can anyone please advise on this..?

Best Regards,

Navin fernandes

Accepted Solutions (1)

Accepted Solutions (1)

cain_sun
Participant
0 Kudos

Hi Navin,

The Implementation class CL_WD_SELECT_OPTIONS of Interface IF_WD_SELECT_OPTIONS will check the mandatory fields or select options automatically in its method CHECK_AND_TRANSPORT_FIELD (). This method will be called in IF_WD_SELECT_OPTIONS~GET_VALUE_OF_PARAMETER_FIELD(), that is, the method is used to retrieve the value of your added fields.

But there is bug here, it only checks the <field symbol> is bound or not. Once the field is not bound, the message of TEXT-005 in the class will be reported. But if the <fs> is bound but with no value, such as initial SPACE. It will also think it is inputted and does not report any error.

In this case, I think you have to report the error message after the GET_PARAMETER_FIELD().

Regards,

Cain Sun

Answers (3)

Answers (3)

Former Member
0 Kudos

Yes, the cl_wd_dynamic_tool=>check_mandatory_attr_on_view does not work as intended - not sure why. It may be something to do with the fact that the selection screen WDA is typically embedded in the Window therefore the mandatory check is only executed after the View is processed - maybe...?

I used this alternative in the view method on click of a button on the View.

data: lv_error type i.

CALL METHOD wd_this->m_handler->check_selection_screen

IMPORTING

e_num_error_msgs = lv_error_count.

if lv_eror_count > 0.

exit. "Do not proceed with the rest of the button event processing.

endif.

anand_nidamanuru
Active Participant
0 Kudos

Hmmm, yes you are correct.

Seems like there is no way we can get the view controller from the Select options component.

let me do some research and see how the obligatory parameter works.

Thanks,

Anand

anand_nidamanuru
Active Participant
0 Kudos

Hi Navin,

Please find my suggestions below

1) There are some constraints while working with mandatory attributes in WD

First of all, please let us know how you are making the obligatory = X? is it using the Configuration?

Once you have done that, there are two mandatory things that needs to be taken care while calling the method

cl_wd_dynamic_tool=>check_mandatory_attr_on_view(

<ul>

<li> View controller

<li> Context lead selection

</ul>

The view controller should be of the view that the selection option is, so it should be of WDR_SELECT_OPTIONS and not your WD Component where you embedded the selection options...

I am not sure how Selection option internally manages context. So We can not control the lead selection..

We can give it a try. Just pass the controller of selection option component usage instead of passing your WD Component View

*****

***Change the below statement to pass the controller of select options

lo_view_controller ?= wd_this->wd_get_api( ).

****

*****

If this works, then its great, else we will have to do manual checking instead of using standard method...

2) Please make the immediate container of the elements as Matrix layout instead of Flow layout.

Once done, mark all the elements as Matrix head data. That will fix your issue.

Thanks,

Anand

Former Member
0 Kudos

Hi anand,

I have made it mandatory like this:

WD_THIS->M_HANDLER->ADD_SELECTION_FIELD( I_ID = 'VBELN_VA'

I_WITHIN_BLOCK = 'BLOCKA'

IT_RESULT = LT_RANGE_TABLE

I_OBLIGATORY = 'X'

i_read_only = read_only

I_VALUE_HELP_ID = 'ZSEARCH_VBELN'

I_VALUE_HELP_TYPE = IF_WD_VALUE_HELP_HANDLER=>CO_PREFIX_SEARCHHELP ).

Best Regards,

Navin Fernandes.

anand_nidamanuru
Active Participant
0 Kudos

Hi Navin,

Then I am not sure if select options directly takes care of mandatory check or we have to use this Mandatory check attribute method...

Are you getting the mandatory indicator (the red * mark), if yes try passing the View controller of the WDR_SELECT_OPTIONS component usage.

Thanks,

Anand

Former Member
0 Kudos

Hi anand,

I am getting the mandatory * red mark for the element of select option..

How to use controller of select option.. it does not have method wd_get_api.. can u elaborate on the same..!

Best Regards,

navin fernandes.

anand_nidamanuru
Active Participant
0 Kudos

Hi Navin,

We just checked in our application. The obligatory parameter is enough for the mandatory parameter check to be in place.

We dont have to call the check_mandatory_attribute method to find the errors.

The WDR_SELECT_OPTIONS component automatically takes care of this.

It is working in our appliacation.

Thanks,

Anand

Former Member
0 Kudos

Hi anand,

I checked the below code:

WD_THIS->M_HANDLER->ADD_SELECTION_FIELD( I_ID = 'VBELN_VA'

I_WITHIN_BLOCK = 'BLOCKA'

IT_RESULT = LT_RANGE_TABLE

I_OBLIGATORY = 'X'

i_read_only = read_only

I_VALUE_HELP_ID = 'ZSEARCH_VBELN'

I_VALUE_HELP_TYPE = IF_WD_VALUE_HELP_HANDLER=>CO_PREFIX_SEARCHHELP ).

Since my f4 is not thru standard help but zsearch help,

the obligatory parameter does not work as per standard functionality...

How can i take care of this..Thats my question..?

Ne advice..?

Best Regards,

Navin fernandes.

Former Member
0 Kudos

Hi,

you can check if the select-option field is initial or not using the following approach....

DATA rt_kostl TYPE REF TO data.

FIELD-SYMBOLS: <fs_skostl> TYPE table.

DATA sel_opt TYPE selopt.

*GET_SELECTION_FIELD

rt_kostl = lo_componentcontroller->m_handler->get_range_table_of_sel_field(

i_id = 'SKOSTL' ).

ASSIGN rt_kostl->* TO <fs_skostl>.

*need this looping to see if it the cost center is empty or not...

LOOP AT <fs_skostl> INTO sel_opt.

EXIT.

ENDLOOP.

IF sel_opt-low IS INITIAL.

    • get message manager

    • report message

CALL METHOD lo_message_manager->report_error_message

EXPORTING

message_text = 'Please fill in the cost center'.

else.

  • here fire the plug to go to next view or do whatever you want to do

endif.

Thanks....

AS..

Note: m_handler is an attribute at my componentcontroller leverl of following type:

M_HANDLER type ref to IF_WD_SELECT_OPTIONS

Former Member
0 Kudos

Hi Are,

I used the same approach..since standard was not responding properly.

Thank You..

Do u know why it does not respond properly when i attach search help externally..

Best Regards,

Navin Fernandes.

Former Member
0 Kudos

Thank You everyone..!