cancel
Showing results for 
Search instead for 
Did you mean: 

Problem in creating Error/information/success messages WDA

Former Member
0 Kudos

Hi friends,

How can we show the error messages on WDA?

I mean, if for example.. i have a product field on screen, and user enters it.. if it is wrong product.. i want to show an error message..

also some error messages which my Function modules returns to me..

How can we show them?

could you pls let me know.. thanks in advance,

Niraja

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Showing the error message is very simple in WD ABAP.

just click on the Code Wizard (ctrl-F7 ) and select Generate Message.

now when you press F4 in the methods u will get all the method names which u can use.

For the error message u can choose "REPORT_ERROR_MESSAGE" method.

If u does not want to hard code the message then u can create your own messages in SE91.

And then use "RAISE_T100_ERROR" method.

get back to me if any problem.

Thanks.

Former Member
0 Kudos

PG,

I did this way what u told.. 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

report message

CALL METHOD l_message_manager->REPORT_T100_MESSAGE

EXPORTING

MSGID = 'E1'

MSGNO = '360'

MSGTY = 'S'

P1 = ' -> REPORT_T100_MESSAGE'.

But initially i dont show any error messages, but when i have error messages showing up at the top of my WDA using above method, my complete wda is going out of alignment. I have transparent containers, between tables.. that transparent containers height is getting increased...

can you tell me is there a way out where its not going mis aligned.

kindlreply

Niraja

Former Member
0 Kudos

Hi friends,

i m using CALL METHOD l_message_manager->REPORT_T100_MESSAGE to display all error messages and it working fine showing up on top.

But when i have error messages showing up, my other ui elements are going crazy.

i have tables..

when error messges are coming,, i m getting gaps between tables..

is there anyway to figure this out friends..

i have 3 tables .. on my layout.

kindly respond,.

thanks in advance,

niraja

Former Member
0 Kudos

Is this problem coming with only one error message or it's coming when more than one (like more than the size of message area) are coming?

Former Member
0 Kudos

If its single message on the top, the gap is lesser, the gap is incrreasing basedon the number of messages on the above.

could you pls get something ont his kindlky.

niraja

uday_gubbala2
Active Contributor
0 Kudos

Hi Niraja,

You can try proceed in this way. Create a TransparentContainer at the area where you want your messages to be displayed. Specify fixed width & height for this TransparentContainer. Now embed the MessageArea ui element inside this TransparentContainer so it would also inherit the same properties as the TransparentContainer. Now if the number of messages increases the TransparentContainer would get a scrollbar & they would get displayed within the fixed area specified by you. You wouldn't be having the problem of them eating up too much of your screen space.

Regards,

Uday

Former Member
0 Kudos

Uday,

what is the code i have to write to pass the messages to message area, how to pass them?

i have internal table, with message type, id, no, text..

can u pls explain.

thanks again,

Niraja

uday_gubbala2
Active Contributor
0 Kudos

Hi Niraja,

You don't have to do anything in order to have the messages displayed in the MessageArea. You just have to use any of the WDA techniques to report a message & they would all automatically get displayed in this MessageArea. So you dont have to worry about it. And 1 more thing which I had forgot in my earlier post is to set the scrollingMode property of the TransparentContainer to "Auto" so that you will have the scrollbars appear within the container depending up on the number of messages that are getting displayed. If you ommit setting this property you will find no difference & all the messages would get displayed like how they were getting earlier & eat up your screen space.

Regards,

Uday

uday_gubbala2
Active Contributor
0 Kudos

Hi Niraja,

Since you are saying that you have an internal table, with message type, id, no & text then you can go for the message reporting using REPORT_T100_MESSAGE.

* 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_t100_message
  EXPORTING
    msgid                    = " your message class name
    msgno                   = " your message number within the message class
    msgty                    = " The type of message error/warning
*    p1                       =  
*    p2                       =
*    p3                       =
*    p4                       =  .

You can use the P1, P2,.. P4 for passing any values using placeholders to the message.

Regards,

Uday

Former Member
0 Kudos

Uday,

right now im using CALL METHOD lo_message_manager->report_t100_message

,

and im getting that issue.

can u pls reply back..

thanks niraja

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Niraja,

WDA have a very friendly enviroment for displaying error messages.

Here you can use a UI element called message area to sho the error messages or u can use existing message classes to create error messages.

Now lets consider you want to use option 1 i.e message area then following code shoul be used where ever you want(the only consition is thta you need to include message area elemnt in your view)

  • get message manager

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

  • report message

CALL METHOD l_message_manager->REPORT_ATTRIBUTE_ERROR_MESSAGE

EXPORTING

MESSAGE_TEXT = 'Please enter from city'

ELEMENT = Elem_Flights

ATTRIBUTE_NAME = 'CITYFROM'.

Now lets consider you want to go for second option i.e error message by using T100 MESSAGE.(you must be knwing how to use se93 tcode)

  • get message manager

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

  • report message

CALL METHOD l_message_manager->REPORT_T100_MESSAGE

EXPORTING

MSGID = 'E1'

MSGNO = '360'

MSGTY = 'S'

P1 = ' -> REPORT_T100_MESSAGE'.

So the only difference between two processes is that in case two u dont have message area element in the view.

if you can any doubt feel free to ask.

regards

PG

Former Member
0 Kudos

Hi Niraja,

U can use the UI Element 'MessageArea' on the view to display the Error/Warning messages.

Check the example : WDR_TEST_MESSAGE_AREA

Ranganathan.

Former Member
0 Kudos

If you want to display the messages on top of yoru screen always, then you don't need to create the UI element message area. But if you want display the messages in some speicific part of your view, then you need 'message area' UI element.

Ok for displaying the message call this method

CALL METHOD l_message_manager->report_t100_message
EXPORTING
msgid = ls_errores-id
msgno = ls_errores-number
msgty = ls_errores-type
p1 = ls_errores-message_v1
p2 = ls_errores-message_v2
p3 = ls_errores-message_v3
p4 = ls_errores-message_v4
view = 'ID_BODY'.

Here you need to pass message class, message number and message type (E,S,W etc..)

Hope it works.