cancel
Showing results for 
Search instead for 
Did you mean: 

Add validations -ABAP WD application

Former Member
0 Kudos

Hi,

I am getting user input via ls_data_selections.

DATA lo_nd_data_selections TYPE REF TO if_wd_context_node.

DATA lo_el_data_selections TYPE REF TO if_wd_context_element.

DATA ls_data_selections TYPE wd_this->element_data_selections.

  • navigate from <CONTEXT> to <DATA_SELECTIONS> via lead selection

lo_nd_data_selections = wd_context->get_child_node( name = wd_this->wdctx_data_selections ).

  • get element via lead selection

lo_el_data_selections = lo_nd_data_selections->get_element( ).

  • get all declared attributes

lo_el_data_selections->get_static_attributes(

IMPORTING

static_attributes = ls_data_selections ).

SELECT * FROM proj INTO CORRESPONDING FIELDS OF TABLE it_proj

WHERE pspid = ls_data_selections.

if user enters a wrong slection this table will not have any entries .I want to add a message at selection screen saying wrong job number.

How do we do that?

rgds

Vara

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Vara,

First of all,You need to use UI component message area that you can place on the top of the VIEW

like any other webDynpro UI Element in design mode. Next you need to create instance of the message manager.

"get message manager 
DATA: l_current_controller TYPE REF TO if_wd_controller,
l_message_manager TYPE REF TO if_wd_message_manager.

DATA: ls_msg type STRING.

l_current_controller ?= wd_this->wd_get_api( ).


CALL METHOD l_current_controller->get_message_manager
RECEIVING
message_manager = l_message_manager.

" existing code
DATA lo_nd_data_selections TYPE REF TO if_wd_context_node.
DATA lo_el_data_selections TYPE REF TO if_wd_context_element.
DATA ls_data_selections TYPE wd_this->element_data_selections.

navigate from <CONTEXT> to <DATA_SELECTIONS> via lead selection 
lo_nd_data_selections = wd_context->get_child_node( name = wd_this->wdctx_data_selections ).


"get element via lead selection 
lo_el_data_selections = lo_nd_data_selections->get_element( ).


"get all declared attributes 
lo_el_data_selections->get_static_attributes(
IMPORTING
static_attributes = ls_data_selections ).

SELECT * FROM proj INTO CORRESPONDING FIELDS OF TABLE it_proj
WHERE pspid = ls_data_selections.

if it_proj is initial.

ls_msg = 'You entered a wrong job number'.


"report error message 
CALL METHOD lo_message_manager->report_error_message
EXPORTING
message_text = ls_msg.

endif.

Greetings

Prashant

Former Member
0 Kudos

Thank you Prashant.

It worked!

rgds

Vara

Answers (0)