Showing results for 
Search instead for 
Did you mean: 

Principal question: MVC

Former Member
0 Kudos

Hi all,

I have some problems understanding the logic behind SAP's MVC-pattern - the tutorials are not very useful for they omit the interesting and difficult parts. But perhaps I'm simply thinking in the wrong direction so anybody who puts me on the right track is welcomed!

Here is one thing I really don't get - either I'm mistaken or SAP is:

Why is the member ERROR of class CL_BSP_MODEL protected? In my view that doesn't make sense, ERROR should either be a parameter for any set-get-method (not my preferred solution) or it should be public (read-only). How in the current framework is a controller supposed to send a meaningful message to the user when a set-method of a model failed? (I know, there is a quite stupid message saying, that there an error occured while transferrring data to the model)

Another thing that is not strictly MVC-related: why does CL_BSP_MESSAGE not use the "normal" SAP-message-format? Why can't I save any further information (long text infos) in it?

Ok, enough for now, I would also like to discuss appropriate patterns for BSP-transaction-programming, but I keep that for later...

best regards,


Accepted Solutions (0)

Answers (1)

Answers (1)

Active Contributor
0 Kudos

Stephan, below the answer from our MVC expert. She requested that I append it.

bye, brian


Hi Stephan,

The error list is intended to be called for each attribute. The idea was to display the error message near the corresponding input field. So you can ask the model whether a special attribute is valid or not, and you will receive the message, if there is one.

But there are some possibilities to get the message list:

1. The message list is returned to the caller of model->if_bsp_model~instantiate. This method is called by the default implementation of cl_bsp_controller2->do_handle_data. If you want to get the whole message list, you may reimplement this method and include the source code of cl_bsp_controller2->fill_model_data.

2. The other possibility is to write a method in your model class. This class has access to the error attribute, and may handle it to any caller.

You may add additional text to each message item (parameter: dummy ). This is just saved as it is, and is returned with get_message method.

regards, R.

Former Member
0 Kudos

Hi Brian, hi "R.",

thanks for your answer.

> The idea was to display the error message near the corresponding input field.

I see. The problem is, that when you edit some "real" data, you may not have enough space for an extra messages near by every input field. Another thing is that R/3-users are very used to the cooncept of having a central message bar showing all errors and giving more in-depth information on request.

We actually solved the problem by using our own BSP-framework (including message handling) by writing our own model- and controller-class which inherit from the SAP classes, kind of following your second suggestion.

Perhaps this is a nice example where different back grounds lead to different object-models!

Best regards,