on 2024 Sep 20 9:52 AM
Hi everyone,
I’m encountering an issue where I need to pass a message from the cx_sql_exception class to the frontend. I’m using the get_text() method to retrieve the message and then passing it through the new_message_with_text() method via the Reported parameter. However, the message gets cut off after 50 characters.
I understand that I could create a message in a message class with four variables (&1&2&3&4), which would give me 200 characters, but I don’t think this is an ideal solution.
Is there a more effective way to send free text messages longer than 50 (or 200) characters to the frontend? Any insights would be greatly appreciated!
For example, the error message I receive is:
A database error occurred. The error message in the database was: "invalid column name: SYSTEM_USER: line 1 col 44 (at pos 43)".
Here’s a snippet of the code I’m using:
TRY.
...
CATCH cx_sql_exception INTO DATA(lx_sql_exception).
APPEND VALUE #(
...
%msg = me->new_message_with_text(
severity = if_abap_behv_message=>severity-error
text = lx_sql_exception->get_text()
)
) TO reported-zentity.
...
ENDTRY.
Thanks a lot!
Request clarification before answering.
ok then just for some clarification or explanation if you are not so familiar with the RAP-Framework:
Here is a good explanation from @dhegde :
In general, you need to fill "reported" structure with messages. Local Handler Classes of BIL class are inherited from `cl_abap_behavior_handler` which in turn is inherited from `cl_abap_behv`. This class provides two methods to prepare "%msg" instance of 'reported'
So because i don't have message id, message number etc., i have to use the other method which allows me to raise a message with whatever text i want.
Now i understand that maybe free text could be misunderstood but i obviously use the system message which you can see in the code i provided, but it gets cut off after 50 characters.
And nothing is wrong with message classes if a had one i could use but to my knowledge the exception class doesn't deliever a reference to one:
So please tell me the correct message class i can reference to use the new_message( ) method or another method to raise a message longer than 50 chars. Thank you guys.
I hope this clears up some confusion. 🙂
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
-
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 9 | |
| 6 | |
| 5 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.