cancel
Showing results for 
Search instead for 
Did you mean: 

CL_BSP_MESSAGE

Former Member
0 Kudos

Hi Experts,

I want to throw the Error Message using Method <b>add_message</b> from the <b>CL_BSP_MESSAGE</b> class.

I called the method. But it didn't work.

Any body please give me the idea or Give any document for this class CL_BSP_MESSAGE.

Thanks in Advance,

Points Assured.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Take a look at <a href="http://help.sap.com/saphelp_nw04/helpdata/en/2a/31b97835a111d5992100508b6b8b11/frameset.htm">this</a> link.

regards,

Dirk.

Answers (1)

Answers (1)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

CL_BSP_MESSAGE is just a mechanism for queuing of messages and an easy way of sending these message from a controller (or model) into the view. It isn't actually responsible for the output of the messages however.

For that you have to design a mechanism to output the messages. The messages object will automatically be available from within the view via the page object. You can use the messages to check the status and indirectly change the output rendering:

if page->messages->assert( 'VALID_TABLE' ) <> 0.
  "do something.
endif.

You can also use the phtmlb:messageBar element to easily output the error message:

<phtmlb:messageBar id = "VALID_TABLE"
                                type = "ERROR"
                                connectedControlId = "DDStructure"
                                text = "<%= page->message->assert_message( 'VALID_TABLE' ). %>"

Former Member
0 Kudos

Hi Thomas,

Thanks for your valuable reply.

But I got the error when I write this code in controller class.

if page->messages->assert( 'VALID_TABLE' ) <> 0.

endif.

Error is,

<b>Invalid logical expression: A field, a function, or "(" was expected

instead of "PAGE->MESSAGES->ASSERT("</b>

How can I rectify this.

Thanks.

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

The sample code that provided comes from a view. Within the view you must access the messages via the page object. Within the controller, you wouldn't have a page object; nor would you need it to access the messages object. messages is already a public attribute of the controller class.