cancel
Showing results for 
Search instead for 
Did you mean: 

Clear the webdynpro error messages in Dictionary serach help window

Former Member
0 Kudos

Hi ,

I have a search help attached to one of the table column in table control. In the On Enter event of search help i am trowing some error messages. I am using Dictionary standard search help....

On enter event is working fine. My issue is when some error messages are thrown in the webdynpro view those messages are also displaying in the search help window. Whatever may be the message is showing in the webdynpro view at runtime all those messages are getting displayed when i open a searchhelp in the table control.

How can i clear those messages ? When its standard searchhelp where can i write the code to clear the webdynpro meesages.

Could anybody suggest me on this....?

Thanks & Regards

Sireesha...

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi Sireesha,

The above is solved? I am also getting same kind of error.If it is solved.Could you please suggest solution.

Thanks and Regards,

Uma

anand_nidamanuru
Active Participant
0 Kudos

Hi Sireesha,

As far as I know there is no direct way to track the event of F4 window opened, so that we can clear the messages...

Below is one solution.

WD Standard fires an event when ever a window is opened in the application.

The event that is fired is CL_WDR_WINDOW->IF_WD_WINDOW~WINDOW_OPENED

This is an instance event. Please follow the below steps to handle this event

1) Store the message manager reference in a class as a Static variable

2) Create a Event handler for all instances (A Static event handler will suffice)

3) Give importing parameter Sender (it will be automatically identified by the class builder and the corresponding CL_WDR_WINDOW reference will be populated into this at runtime)

4) Now use the below code to clear the messages


  DATA lcl_window_ref TYPE REF TO cl_wdr_internal_window.

  TRY.
      lcl_window_ref ?= sender.
   CATCH cx_sy_move_cast_error.
      RETURN.
  ENDTRY.

  IF lcl_window_ref->is_value_help = abap_true.

    CALL METHOD gr_wd_msg_mgr->clear_messages
      EXPORTING
        including_permanent_msg = abap_true.
  ENDIF.

below is how u can set the handler

Assuming handler method is clear_msgs_on_f4wd_window_open

   SET HANDLER clear_msgs_on_f4wd_window_open FOR ALL INSTANCES. 

Please let me know if you need more help

Thanks,

Anand

Former Member
0 Kudos

Hi anand,

Thanks for your reply. This is what exactly i am facing...

I have some doubts in your code.

1. I am trying to create event handler but i cann create any parameters inside the event handler. Automatically WDEVENT gets created. Where do i create sender here ? what would be the type of sender ?

2. In which event i should call SET HANDLER ? is it in srh help event only?

Regards

Sireesha.

anand_nidamanuru
Active Participant
0 Kudos

Hi Sirisha,

It is the class event handler and not WD Event handler that you have to create.

You need to create a Public Static method as event handler in any class that your application uses. In the definition of this event handler you can pass the sender as importing parameter (I think you have to use "LIKE" instead of "TYPE" and do not give any actual type. Just leave it as blanks.)

Assuming the class name is CL_My_App_util, the event handler name is CLEAR_MSGS_ON_F4.

In the WDDOINIT of your WD Component controller,

1) Store the message manager in the above class, by calling some init method

2) Use the set handler statement

SET HANDLER CL_MY_APP_UTIL=>CLEAR_MSGS_ON_F4 FOR ALL INSTANCES

From now on when any popup window is launched (including F4, OVS etc), the control comes automatically to your Event handler method CL_MY_APP_UTIL=>CLEAR_MSGS_ON_F4.

Check if it is F4 and clear the messages.

Thanks,

Anand

Former Member
0 Kudos

Anand,

I created event handler in the methods tab of the class. and created import parameter as below..

sender importing like

1. Here i am getting error "Type does not exist" .... . associated type i have given blank.

2. Along with the code what you have given i wrote the following code before to your code in the method

  • 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.

Wd_this is unknown....its not defined by DATA statement...

Could you check it pls....

I have some other idea instead of going for creating classess....

Can we check whether any window is opened or not in the F4 event itself ? if its F4 can we clear the messages .

Regards

Sireesha.

anand_nidamanuru
Active Participant
0 Kudos

Hi Sireesha,

For creating the importing parameter please follow the below steps

1) Create the event handler first without any parameters

2) Once created, change the definition again, now in the parameters, just type the name as Sender and hit enter. This will take care of creating the import parameter.

* 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.


Wd_this is unknown....its not defined by DATA statement...

wd_this works only in weddynpro. You need to retrieve the message manager by above code in one of the WD methods (you can use WDDOINIT method of component controller).

Once retrieved, store the message manager reference in the class that you just created the event handler for.

Now in the event handler paste the code that I have given above...

Can we check whether any window is opened or not in the F4 event itself ? if its F4 can we clear the messages .

yes it is possible, if you store the Message manager globally and call it from the Search help exit.

Thanks,

Anand

Former Member
0 Kudos

Hi Anand,

1. I am able to create import parameter for event handler method...but in the definition of the method...i am getting the error "Formal parameter SENDER" does not exist...

Below is my code...

*******************************************************

public section.

class-events ZWINDOW_OPEN .

class-methods ZCLEAR_MSG

for event ZWINDOW_OPEN of ZTEST_MSG

importing

!SENDER.

*****************************************************

2. In the WDINIT method of controller i am gettign the reference for message manager. How this value can be stored in class. I mean how to get this reference in event handler....? how can we call INIT method of controller in the class?

Please suggest me on this....

Thanks

Sireesha.

Former Member
0 Kudos

have u resolved this error?

i hope?

pls tell me about the formal parameter which u have used in the code above as modified by Anand

Thanks & Regards,

Manu

former_member206441
Contributor
0 Kudos

Hi

[this thread|; may help you.

Regards

Arun.P

Former Member
0 Kudos

Hi Arun/Amiti,

Thanks for your replies.

My doubt is in which event should i clear the webdynpro messages ? I tried in all the events like afteraction, beforeaction ,init etc.,

Its not working....

In the search help window i should not get error messages whatever is there in webdynpro view....

for example ... i have 2 rows in table control...in first row i have entered invalid data then it should throw error messages. upto this part is fine. When i open srh help in second row its showing earler messages. I dont want to diaply any error messages in srhhelp window.

How can i achieve this....? any ideas pls suggest me...

Regards

Sireesha

former_member206441
Contributor
0 Kudos

Hi

In the second row search help event, clear the message by using the code which has been given by Amit

and then call the message which you want to show.

Regards

Arun.P

Former Member
0 Kudos

I have only one event for all the rows. If this is the case i need to define n number of events for n number of rows.

My issue is not with the code , its with the event...which event makes only standard search help messages gets clear...?

I tried in srh help event of table control first to clear the messages and then at the end of the code displaying my error messages. But its not even displaying error messages in this case.

Could any body add some points on this pls....

Regards

Sireesha.

former_member206441
Contributor
0 Kudos

HI

So you are using a single event to show message of 'n' no.of rows am i right?

then first of all clear messages using Amit code and then show the message.

Regards

Arun.P

Former Member
0 Kudos

hi ,

to clear ur message s u can use the method clear_messages( )


DATA: l_current_controller TYPE REF TO if_wd_controller,
        l_message_manager    TYPE REF TO if_wd_message_manager.
 
  l_current_controller ?= wd_this->wd_get_api( ).
 
  CALL METHOD l_current_controller->get_message_manager
    RECEIVING
      message_manager = l_message_manager.
 
  l_message_manager->clear_messages( ).

regards,

amit