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

Function modules

madan_ullasa
Contributor
0 Likes
768

Hi frnds,

im creating a function module. in this FM im using another FM. How do i catch the exceptions in the FM im creating, when the called FM returns an exception.

points assured to all replies..

madan.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
749

hi madan,

check out this link.

<a href="/people/durairaj.athavanraja/blog/2005/04/03/execute-bw-query-using-abap-part-i:///people/durairaj.athavanraja/blog/2005/04/03/execute-bw-query-using-abap-part-i

regs,

jaga

7 REPLIES 7
Read only

abdul_hakim
Active Contributor
0 Likes
749

Hi,

Check the return code after you have called the inner FM and react accordingly.

REgards,

Abdul

Read only

Former Member
0 Likes
750

hi madan,

check out this link.

<a href="/people/durairaj.athavanraja/blog/2005/04/03/execute-bw-query-using-abap-part-i:///people/durairaj.athavanraja/blog/2005/04/03/execute-bw-query-using-abap-part-i

regs,

jaga

Read only

Former Member
0 Likes
749

When the inner function module returns an exception, it is possible to catch that exception there itself, provided u shud have defined exceptions for that inner func. module. There are lotz of func. modules like that.. for example check out HR_READ_INFOTYPE

Regards,

Rajeev

Read only

Former Member
0 Likes
749

Hi Madan,

It is as same as you handle exception in Report.

CALL FUNCTION 'ZTEST'

EXPORTING

NAME = 'TEST'

IMPORTING

NAME1 = V_NAME

EXCEPTIONS

NO_DATA_FOUND = 1

UNDEFINED = 2.

Regards,

Sudhakar.

Read only

Former Member
0 Likes
749

Hi

check this link

<a href="http://help.sap.com/saphelp_erp2005/helpdata/en/9e/d58167116711d5b2f40050dadfb92b/frameset.htm">Exceptions in Function Modules and Methods</a>

hope it solves your problem

Regards

Amit

Read only

Former Member
0 Likes
749
CALL FUNCTION 'TEST'
*    ... 
     EXCEPTIONS 
          NOT_FOUND = 7.
if sy-subrc = 1.
  raise exception1.
else.
  raise exception2.
endif.
Read only

jayanthi_jayaraman
Active Contributor
0 Likes
749

Hi,

You have to check the sy-subrc value after the FM is called.

Then based on sy-subrc value it return,you can design your code.