on 11-24-2009 11:59 PM
HI All,
I am new to WDA. I am developing a WDA application, on the first view I have a table and a button to go to the next view.
When the table is empty i need to issue a error message in the message area and the user should not be able to navigate further using the NEXT button.
I want to display this message before the user does some action i.e ( before the button trigger ).
Can some one help me how to achieve this.
Thanks,
Krishna
i need to issue a error message in the message area and the user should not be able to navigate further using the NEXT button.
now if ls_cn_input is INITIAL , u need to generate a error message and disable ur NEXT button
//for generating the error message
// this can be done by code wizard ( cntrl +f7) as well by selecting the radio button generate message and select the
// method *report_error_message*
* DATA lv_message TYPE string .
** get message manager
* DATA lo_api_controller TYPE REF TO if_wd_controller.
* DATA lo_message_manager TYPE REF TO if_wd_message_manager.
*
* lo_api_controller ?= wd_this->wd_get_api( ).
*
* CALL METHOD lo_api_controller->get_message_manager
* RECEIVING
* message_manager = lo_message_manager .
*
*
*
** report message
* CALL METHOD lo_message_manager->report_error_message
* EXPORTING
* message_text = 'Please enter data before exit .'.
// ur error message
the user should not be able to navigate further using the NEXT button.
// disable the NEXT button
u procced as follows :
1 create a context attribute of type WDY_BOOLEAN
2 bind this with ur button UI
3 nw using set_attribute method , set its value to ' ' ( ie blank)
again this cn be donr thru code wizrd by selecting read context node/attribute
DATA lo_nd_cn_node TYPE REF TO if_wd_context_node.
DATA lo_el_cn_node TYPE REF TO if_wd_context_element.
DATA ls_cn_node TYPE wd_this->element_cn_node .
DATA lv_attr LIKE ls_city-ca_attr.
* navigate from <CONTEXT> to <CN_VISIBLE> via lead selection
lo_nd_node = wd_context->get_child_node( name = wd_this->wdctx_ca_attr).
* get element via lead selection
lo_el_cn_node = lo_nd_cn_node->get_element( ).
* set single attribute
lo_el_cn_node->set_attribute(
EXPORTING
name = `CA_ATTR`
value = ' ' ).
// I have read ca_attr attribute under context node cn_node
// this attribute is binded to button UI
I hope it helps
rgds,
amit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi,
Follow these steps :
1. Get the node data into an internal table using get_Static_attribute_table method.
2. Use if endif condition to check whether internal table is empty.
3. IF table is empty throw an error message.
For throwing error message , you could use Code Wizard (control + F7 ).
Refer this code :
DATA lo_nd_cn_sflight TYPE REF TO if_wd_context_node.
DATA lo_el_cn_sflight TYPE REF TO if_wd_context_element.
DATA lt_cn_sflight TYPE wd_this->elements_cn_sflight.
* navigate from <CONTEXT> to <CN_SFLIGHT> via lead selection
lo_nd_cn_sflight = wd_context->get_child_node( name = wd_this->wdctx_cn_sflight ).
lo_nd_cn_sflight->get_static_attributes_table( IMPORTING table = lt_cn_sflight ) .
lo_el_cn_sflight = lo_nd_cn_sflight->get_element( ).
if lt_cn_sflight is INITIAL.
* get message manager
data lo_api_controller type ref to if_wd_controller.
data lo_message_manager type ref to if_wd_message_manager.
lo_api_controller ?= wd_This->Wd_Get_Api( ).
CALL METHOD lo_api_controller->GET_MESSAGE_MANAGER
RECEIVING
MESSAGE_MANAGER = lo_message_manager.
* report message
CALL METHOD lo_message_manager->REPORT_ATTRIBUTE_ERROR_MESSAGE
EXPORTING
MESSAGE_TEXT = 'Error message'
ELEMENT = lo_el_cn_sflight
ATTRIBUTE_NAME = 'CONNID'
CANCEL_NAVIGATION = 'X'.
endif.
I am looking for some functionality like REPORT_ATTRIBUTE_MESSAGE which will not allow any further actions.
1 first of all raise ur error message using the methods raise_error_message or report_Attribute_error_message as mentioned in the earlier replies
2 to stop further actions , u read the node cn_node which is binded to table UI and check like this :
CHECK ls_cn_node IS NOT INITIAL.
// this will stop further actions
I hope it wud sort ur problem
rgds,
amit
Hi Amit,
Thanks for the details.
As you said I am displaying the error message in the message area and it stays there for some time.
Now i am facing one more problem when is scroll the table i mean the horizontal scroll bar on empty table,
it disappears from the message area.
lv_text_m01 = wd_assist->if_wd_component_assistance~get_text( 'M01' ).
get message manager
DATA lo_api_controller TYPE REF TO if_wd_controller.
DATA lo_message_manager TYPE REF TO if_wd_message_manager.
lo_api_controller ?= wd_this->wd_get_api( ).
CALL METHOD lo_api_controller->get_message_manager
RECEIVING
message_manager = lo_message_manager.
report message
CALL METHOD lo_message_manager->report_error_message
EXPORTING
message_text = lv_text_m01.
Thanks,
Krishna
hi ,
u proceed like this :
When the table is empty
// chaeck whether the table is empty or not by reading the context node which is binded to ur table UI
// this can be done by pressing control + f7 and selecting the radio button read context node/attribute
// ie thru code wizard
DATA : lo_nd_cn_input TYPE REF TO if_wd_context_node ,
lo_el_cn_input TYPE REF TO if_wd_context_element ,
ls_cn_input TYPE wd_this->element_cn_input ,
ls_cn_input1 TYPE wd_this->element_cn_input.
* navigate from <CONTEXT> to <CN_INPUT> via lead selection
lo_nd_cn_input = wd_context->get_child_node(
name = wd_this->wdctx_cn_input ).
* get element via lead selection
lo_el_cn_input = lo_nd_cn_input->get_element( ).
* get all declared attributes
lo_el_cn_input->get_static_attributes(
IMPORTING
static_attributes = ls_cn_input ).
// use IF condition to check if table is empty or not
// I am reading the node cn_input binded to TABLE UI
IF ls_cn_input is INITIAL.
// u need to raise the error message
// diable the NEXT button
ELSE.
// write ur logic to proceed further
rgds,
amit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Krishnakumar,
When the table is empty i need to issue a error message in the message area and the user should not be able to navigate further using the NEXT button
When the table is empty, u can display the message inside the table with the Table UI Attribute and u can disable the NEXT Button by linking it with the context.
Ranganathan.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.