Application Development 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: 

advise on catch

Former Member
0 Kudos

Could someone please explain the concept or

message e100 raising XXXXX

aand the concept of calling a FM and if an exception is raised catch it . (how do you catch that???)

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi..

An exception arises in a FM when sy-subrc is NE 0.

so after the calling of FM....chk for the condn sy-subrc <> 0.

This will catch ur exception, and the message defined in the FM will be displayed

Uncomment your exception part in the FM and add this


 IF SY-SUBRC NE  0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

where SY-MSGV1 SY-MSGV2 .....depends on the no. of exceptions defined by the FM

Regards

Winnie

Edited by: Winnie Clarence on Oct 7, 2008 12:11 PM

Edited by: Winnie Clarence on Oct 7, 2008 12:15 PM

2 REPLIES 2

Former Member
0 Kudos

Hi..

An exception arises in a FM when sy-subrc is NE 0.

so after the calling of FM....chk for the condn sy-subrc <> 0.

This will catch ur exception, and the message defined in the FM will be displayed

Uncomment your exception part in the FM and add this


 IF SY-SUBRC NE  0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

where SY-MSGV1 SY-MSGV2 .....depends on the no. of exceptions defined by the FM

Regards

Winnie

Edited by: Winnie Clarence on Oct 7, 2008 12:11 PM

Edited by: Winnie Clarence on Oct 7, 2008 12:15 PM

former_member182466
Contributor
0 Kudos

To add a little bit to the previous answer. You will have to add an EXCEPTIONS part to the CALL FUNCTION command to be able to catch the exceptions in your program. You will also have to code the display of the message yourself.

Hope this helps,

Gert.