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

raise exception

Former Member
0 Likes
845

hi,

1) when control come to RAISE NOT_FOUND where NOT_FOUND in the exceptions tab in function module, what does the system do? show short text in exceptions tab as message? what does the RAISE keyword do here?

FUNCTION-POOL CSTR.

FUNCTION STRING_SPLIT.

...

IF STRING NA DELIMITER.

RAISE NOT_FOUND.

ENDIF.

...

ENDFUNCTION.

2) in the caller program, if assign 7 to NOT_FOUND under exception, which means sy-subrc = 7, right?

PROGRAM EXAMPLE.

...

CALL FUNCTION 'STRING_SPLIT'

  • ...

EXCEPTIONS

NOT_FOUND = 7.

IF SY-SUBRC = 7.

WRITE / 'There is a problem.'.

ELSE.

...

ENDIF.

thanks

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
755

hi,

chk out the <b>Exceptions</b> tab in the function module , To the Left of <b>source Code</b> tab,

What ever you write there for that Exception , it will display that error

4 REPLIES 4
Read only

Former Member
0 Likes
756

hi,

chk out the <b>Exceptions</b> tab in the function module , To the Left of <b>source Code</b> tab,

What ever you write there for that Exception , it will display that error

Read only

h_senden2
Active Contributor
0 Likes
755

Yep, you're right.

In the function module, after a RAISE-EXCEPTION the function will be left with SY-SUBRC = 7 (in your case). This sy-subrc can be used by the calling program.

regards,

Hans

Please reward all helpful answers !!!!!

Read only

Former Member
0 Likes
755

Hi,

1. In the FM, when its RAISE NOT_FOUND...NOT_FOUND would be assinged some number say 7. So the program which has called this FM, will receive a sy-subrc as 7 when the exception NOT_FOUND is raised.

2. Yes you are correct.

Best regards,

Prashant

Read only

Former Member
0 Likes
755

not_found is ur user defined exception inorder to trigger that exception u user the raise key word in func module..

when a no is assigned to it we can call it by that no and specify the message u need to print..

ur code works

regards..