cancel
Showing results for 
Search instead for 
Did you mean: 

how to set focus and mark red on certain select option field

Former Member
0 Kudos

hi experts

I embedded a select_option view in my application and tried to use IF_WD_SELECT_OPTIONS->request_focus to set focus on a certain select option field if the logical check failed, and also hope the low field of the select option can be marked red....but things does not happen that way....

could anyone kindly tell me how to implement that requirement?

tkx and regards

sun

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Sun,

In order to see the select option highlighted in red color, please set the select option as mandatory using the I_OBLIGATORY parameter in the ADD_SELECTION_FIELD method as shown below:

DATA lt_data type range table of <your column>.

IF_WD_SELECT_OPTIONS->ADD_SELECTION_FIELD EXPORTING I_ID ='<YOUR FIELD>'
I_OBLIGATORY = ABAP_TRUE
IT_RESULT = lt_data.

Please revert back in case of issues.

Regards,

Sumit

Edited by: Sumit Oberoi on Jan 27, 2011 12:06 AM

Former Member
0 Kudos

hi Sumit

thanks for ur reply.

but I just can not following ur instruction, b'coz those fields are not mandatory, and the check is not about mandatory check, it is logical check.....

gill367
Active Contributor
0 Kudos

What is the problem you are facing in this ?

Requesting focus is easy.

just call the method request focus and pass the id of the parameter whose lower value field you want to focus.

as shown below.

code you might have written in wddoinit

DATA: LT_RANGE_TABLE TYPE REF TO DATA,
        RT_RANGE_TABLE TYPE REF TO DATA,
        READ_ONLY TYPE ABAP_BOOL,
        TYPENAME TYPE STRING.

    DATA: LR_COMPONENTCONTROLLER TYPE REF TO IG_COMPONENTCONTROLLER,
        L_REF_CMP_USAGE TYPE REF TO IF_WD_COMPONENT_USAGE.

*   * create the used component
  L_REF_CMP_USAGE = WD_THIS->WD_CPUSE_SELECT_OPTIONS( ).
  IF L_REF_CMP_USAGE->HAS_ACTIVE_COMPONENT( ) IS INITIAL.
    L_REF_CMP_USAGE->CREATE_COMPONENT( ).
  ENDIF.

    WD_THIS->M_WD_SELECT_OPTIONS = WD_THIS->WD_CPIFC_SELECT_OPTIONS( ).
    WD_THIS->M_HANDLER = WD_THIS->M_WD_SELECT_OPTIONS->INIT_SELECTION_SCREEN( ).

 LT_RANGE_TABLE = WD_THIS->M_HANDLER->CREATE_RANGE_TABLE( I_TYPENAME = 'ZDEALERID' ).
* * add a new field to the selection
  WD_THIS->M_HANDLER->ADD_SELECTION_FIELD( I_ID = 'ID'
  IT_RESULT = LT_RANGE_TABLE I_READ_ONLY = READ_ONLY ).

code for focusing a field.

wd_this->m_handler->request_focus( i_id = 'ID' ).

you must have declared attributes m_handler and m_wd_select_options type reffering to IF_WD_SELECT_OPTIONS and

IWCI_WDR_SELECT_OPTIONS respectively.

and regarding that red color i am not sure it is possible without using message manager.

thanks

sarbjeet

Former Member
0 Kudos

Hi,

Have you implemented the ON_CHECK /ON_EXECUTE /ON_ENTERmethods of select options, Try to code it there and throw the error..using message manager..

Need to test it from my end too....Just try it out...

Regards,

Lekha.

Former Member
0 Kudos

hi Lekha

I did not implement the check with the event ON_CHECK /ON_EXECUTE, but do it in the wdbeforaction, and my question is not hwo to throw error, but how to set focus on the low field of a select option....

many thanks