Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Protocol Error Msgs

Former Member
0 Likes
1,455

Hello Friends,

I need to protocol error msg during the process of my program.

for example inside a loop I need to verify user input aginst flate-file data.

so I have a form routine which verify date and returns a lv_error_flag = 'x' if error occurd.

now here is my point.

I can take an internal table and can write there statci msg...like

data: lt_error_table type table of ts_error_str .

Data ls_error_table type ts_error_str

ts_error_str-msg = "Erro in date, not give in file"

append ls_error_str to lt_error_str....

....

and in the end of processing, I can display my internal table maybe in ALV or so.

is this the conventional way of doing protocol error msg ? or does sap provides some standard functions ?

please suggest.... a good way to do so.

Thanks.

Edited by: Shah H on Feb 16, 2011 4:35 PM

5 REPLIES 5
Read only

kesavadas_thekkillath
Active Contributor
0 Likes
1,107

Hi,

Instead of this declare the message in se91. Then call it in your program using fm BALW_BAPIRETURN_GET2

or the syntax

MESSAGE ID CL

TYPE 'I'

NUMBER Number

WITH par1

par2

par3

par4

INTO RETURN-Message.

Also try to place statement like below just for the case of where used list from se91. Place this after the message is populated to your internal table.

if 1 = 2.

message e012.

endif.

Read only

0 Likes
1,107

Thanks for your reply.

Do you have any example for me. Or is there any artical/blog describing this all ?

Regards,

Read only

0 Likes
1,107

Hi Shah,

search for SAP Application LOG.

Function modules are available for creation of logs, appending messages, saving log to database. This can be checked by transaction SLG1. SLG0 is used for log objects creation.

Regards,

Clemens

Read only

0 Likes
1,107

Thanks Guy for your kind reply.

I have found something like: 'BAL_LOG_MSG_ADD' to add msgs to log and then reterive it via a handel later on...

But is'nt it more to save log on db ? and not for time being ?

I am only intrested to display error-msg occured in program to user on run-time and not to save them in db.

Please provide me with an example for blog or an artical describing this.

Thanks.,

Read only

0 Likes
1,107

Hi Shah,

everything is possible.

If you don't need the protocol, in database for later evaluation, just do not save it.

Check the available funtions in groups

SBAL

SBAL_CNTL

SBAL_DB

SBAL_DB_CONVERT

SBAL_DB_INTERNAL

SBAL_DETAIL

SBAL_DISPLAY

SBAL_DISPLAY_BASE

SBAL_DISPLAY_MESSAGE

SBAL_PROFILE

SBAL_SERVICE

SBAL_TOOLBOX

SBAL_TXT

You have BAL_DSP_LOG_DISPLAY for display of log.

Regards,

Clemens