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

exceptions in function module

Former Member
0 Likes
857

hi experts,

I am reading feed code from a table (zfeed).if the feed code is not found in the table i've to do the following

If the feed is not found in this table then we need to error.

If sy-subrc <> 0.

Issue error message “Feed code & is not setp-up in table (ZFEED), processing stopped.

This error message will be added to table (ERROR_COM)

Raise exit_processing.

Endif.

how to add this message in to the structure (ERROR_COM) this structure

ERROR_NUMBER

MSG_CLASS

MSG_TYPE

MSG_TEXT

MSG_VARIABLE1

MSG_VARIABLE2

MSG_VARIABLE3

MSG_VARIABLE4

these are the fields in the structure.

i expect a detailed explanation

thanx,

Prajith

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
810

Whst is the structure of ERROR_COM?

IF it is not yet created, then try this...

First create a msg in a msg class using this text:

"Feed code & is not set-up in table (ZFEED), processing stopped"

Now create the table as below:

ZFEED Number

Msg class

Msg Number

Date (These date n' time to track the things, if u want u can include the user name also)

Time

Now in ur function module populate these things in to table work area error_com and insert error_com.

6 REPLIES 6
Read only

Former Member
0 Likes
810

Just add like this:

lwa_error-level = 1.

lwa_error-severity = 'E'.

lwa_error-langu = sy-langu.

lwa_error-ag = 'FTI_LDB_MESSAGE'.

lwa_error-msgnr = 202.

lwa_error-var1 = i_rfha.

APPEND lwa_error TO e_t_error.

Error number : Number of the mesage

class : msg class

text: Any tectxt to appear along with the msg

Var1..var4 can hold values

Read only

0 Likes
810

Hi Srivijaya,

can i use MESSAGE E007(AT) RAISING NOT_FOUND ?

is it possible to store all the data into the structure? i mean

all the message deatils?

thanx,

Prajith

Read only

0 Likes
810

Hello Prajith ,

You could also raise the error msg using :

MESSAGE ID 'FTI_LDB_MESSAGE' TYPE 'E' NUMBER 313

RAISING no_deal_num (0r)

the way u specified.

But this will not store the details into the structure. Rather it raises a message and exists. As i mentioned before, u have to create a workkarea ot type 'bapierr' or the way u wanted and append it to an internal table. Do u want to exist the pgm after the error occurs or maintain an error log and display in the last ?

Read only

Former Member
0 Likes
810

Try the way below :

If sy-subrc <> 0.

**“Feed code & is not setp-up in table (ZFEED), processing stopped.

lwa-ERROR_NUMBER = 007.

lwa-MSG_CLASS = xyz.

MSG_TYPE = 'E'.

MSG_TEXT = 'Feedcode not in bla bla bla . .'.

MSG_VARIABLE1 = Feedcode.

append lwa to itab_err.

MESSAGE E007(AT) RAISING NOT_FOUND .

Endif

Read only

Former Member
0 Likes
811

Whst is the structure of ERROR_COM?

IF it is not yet created, then try this...

First create a msg in a msg class using this text:

"Feed code & is not set-up in table (ZFEED), processing stopped"

Now create the table as below:

ZFEED Number

Msg class

Msg Number

Date (These date n' time to track the things, if u want u can include the user name also)

Time

Now in ur function module populate these things in to table work area error_com and insert error_com.

Read only

Former Member
0 Likes
810

thanx for your help Sreevijaya and Jyothi