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

Sy-subrc and debugging

matteo_montalto
Contributor
0 Likes
3,063

Hi all, please forgive the (probably) nooby question, some stuffs aren't so clear to me and maybe you can help.

I'm trying to debug a function that generates an error msg. I tried to debug a bit and located the point in which the error message is generated. I've seen that the error message is caused by a sy-subrc value NE 0 after a function call. Well, then the problem is that something goes wrong in that function.

Looking at the call, I've seen that the named exceptions are:

EXCEPTIONS
   error_message = 01
   OTHER = 02.

The exact sy-subrc at the end of that call is 01, but can't locate what goes wrong. I expected to find something like a RAISE statement, but it isn't present. If I consider that function as a "black box", then I see that after its execution the sy-subrc value is 01 (and an error message is generated in the code that follows). If I check in depth the fuction, I see that:

- no raise exceptions are found.

- there are some calls to other functions and also some performs, and loops on tables...

Then the question is: how can I see (debugging a run) where exactly that sy-subrc is set to 01? Or in other words, what is responsable for a sy-subrc change in return for a call function?

This seems a quite complex scenario (the code is quite tricky), but maybe there's some trick in debug I don't know, or something to look for that can help me.

Thanks in advance.

7 REPLIES 7
Read only

Former Member
0 Likes
2,081

hi..

try puttingt a watch point on sy-subrc ???

regards

vivek

Read only

Former Member
0 Likes
2,081

Hello,

The function module is in itself generating the error (i.e. some conditions in the function module are not satisfying and thats the reason the SY-SUBRC is coming as 1). There will be no RAISE EXCEPTION in this case.

My suggestion to you is check the function module in detail (in debug mode) and try to find which of the conditions, select statements, read statements, etc. are failing. There is no other option. you will have to debug and check.

Thanks & Regards,

Kunal

Read only

former_member404244
Active Contributor
0 Likes
2,081

Hi,

Defintely there should be one RAISE statement...Did u check whther the function is calling some other function...Try to search with command RAISE in the main program of the FM..also u can check with ERROR_MESSAGE.

Regards,

Nagaraj

Read only

Former Member
0 Likes
2,081

Hi,

May i know the FM you are debugging . To check myself .

Somewhere a Raise should be there which makes the sy-subrc to 1.

Rhea.

Read only

0 Likes
2,081

The function name is MS_SERVICE_PACKAGE. Is located on a SRM machine.

Read only

0 Likes
2,081

Hi,

see this in line 17 in include LMLSPF2M.

*IF SY-SUBRC EQ 0.

  • RAISE FATAL_ERROR.

*ENDIF.

May the subrc ur looking is coming from other FMs Exceptions which are called in the MS_SERVICE_PACKAGE FM.

Rhea.

Read only

0 Likes
2,081

Hi,

the below are the exceptions are there in the main program ->

RAISE NO_SERVICES_FOUND.

RAISE SERVICE_NOT_EXIST.

RAISE SERVICE_NOT_ALLOW.

RAISE SERVICE_NOT_ALLOW.

RAISE SERVICE_NOT_ALLOW.

RAISE PO_NOT_EXIST.

RAISE PACKNO_NOT_EXIST.

RAISE PACKNO_NOT_EXIST.

RAISE NO_SERVICES_FOUND.

RAISE NOT_FOUND.

RAISE NOT_FOUND.

RAISE SERVICE_NOT_EXIST.

RAISE PACKAGE_NOT_EXIST.

RAISE no_service_data.

RAISE no_tax_changes.

If u check in the source code u will find 'RAISE EXCEPTION..

Regards,

Nagaraj