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

hi

Former Member
0 Likes
363

1) how to handle exceptions i function modules?

2) how to edit a field value in grid list after diplaying it?

Thanks and regards.

RAVI.

3 REPLIES 3
Read only

Former Member
0 Likes
336

Hi Ravi,

You can use the EXCEPTIONS option to handle the exceptions of the function module. If an exception e1, e2 … is raised while the function module is running, the system terminates the function module and does not pass any values from the function module to the program, except those that were passed by reference. If e1, e2 … is specified after the option EXCEPTION, the calling program handles the exception by assigning the value r1, r2 … to sy-subrc. You must specify r1, r2 … as a numeric literal.

If you specify of ERROR_MESSAGE in the EXCEPTION list you can influence the message handling of function modules. Normally, you should only call messages in function modules using the MESSAGE....RAISINGstatement. With ERROR_MESSAGE you can force the system to treat messages that are called without the RAISING option in a function module as follows:

· Messages of classes S, I, and W are ignored (but written to the log in a background job).

· Messages of classes E and A stop the function module as if the exception ERROR_MESSAGE had occurred (sy-subrc is set to rE).

If you specify OTHERS after EXCEPTIONS, the system assigns a single return code to all other exceptions that you have not specified explicitly in the list.

You can use the same number r1, r2 … for several exceptions.

Sample

You need to handle sy-subrc after calling the FM

if sy-subrc = 1.

message e001(yy) with 'Exception1'.

elseif sy-subrc = 2.

message e001(yy) with 'Exception2'.

elseif........

endif.

Just double click e001 to create message

thanks,

reawrd If Helpful.

Read only

Former Member
0 Likes
336

Hi,

1.

You can use the Exceptions to handle the errors

There are two ABAP statements for raising exceptions. They can only be used in function modules:

RAISE <except>.

and

MESSAGE..... RAISING <except>.

The effect of these statements depends on whether the calling program handles the exception or not. If the name <except> of the exception or OTHERS occurs in the EXCEPTIONS addition of the CALL FUNCTION statement, the exception is handled by the calling program.

If the calling program does not handle the exception

The RAISE statement terminates the program and switches to debugging mode.

The MESSAGE ..... RAISING statement display the specified message. How the processing continues depends on the message type.

If the calling program handles the exception, both statements return control to the program. No values are transferred. The MESSAGE ..... RAISING statement does not display a message. Instead, it fills the system fields SY-MSGID, SY-MSGTY, SY-MSGNO, and SY-MSGV1 to SY-MSGV4.

2.

you need to place a pushbutton on application toolbar and on clicking that the cell should become editable

chk this blog

/people/community.user/blog/2007/01/10/displaychange-mode-of-editable-fields-in-alv-using-function-modules-but-not-custom-containers

Regards,

omkar.

Read only

Former Member
0 Likes
336

2) how to edit a field value in grid list after diplaying it?

try to make fieldcat like this:

fc_flat-fieldname = 'ZZSTATUS'.

fc_flat-tabname = 'LIST'.

fc_flat-seltext_m = 'STATUS'.

fc_flat-edit = 'X'.

fc_flat-ref_tabname = 'MSEG'.

Regards,

Himanshu