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 module error message.

Former Member
0 Likes
1,580

Call Function ‘Z_function’.

Imports

Exports

EXCEPTIONS

no_entry_found = 1

OTHERS = 2

IF sy-subrc = 0.

  • MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

  • WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

Suppose

if sy-subrc = 1.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

Giving me popup and is troubling.

Could you please tell me if I comment below

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4....

and proceed will it effect me in case of sy-subrc <> 0.

Thank you

5 REPLIES 5
Read only

Former Member
0 Likes
703

No it will not affect in any way. You can put a generric error sayign that

If sy-subrc NE 0.

Write : 'ERROR'.

endif.

- Guru

Reward points for helpful answers

Read only

Former Member
0 Likes
703

Hi !

If you'll comment the MEESAGE-Line the sy-subrc <> 0 will not have any efect to your program. But are you sure you want that... ?!?

If you want to be sure not hat have any bad effects in later following lines if sy-subrc is still <> 0 set the SY-SUBRC = 0 after the call function.

Regards

Rainer

Some points would be nice if that helped.

Read only

Former Member
0 Likes
703

Hi,

Just goto the function module and see what kind of error message it is displaying if sy-subrc = 1.

if its information message popping up than you can comment..not an issue

but in case of warning or error message it will effect.

Regards,

pankaj singh

<i><b>**** reward if helpful</b></i>

Read only

Former Member
0 Likes
703

Hello Sam,

There is no issue if u comment. I beleive it is for handling more specific error and sending out proper msg. Ignoring it in that case detecting an error will be a problem.

Read only

Former Member
0 Likes
703

Hi Sam,

Yes you can. But some times the programs emphasises specific program errors.

For e.g.

Use the following code for function module for GENEREIC case.

In this case you can remove total piece of code suggested by you. and replace the following code.

If sy-subrc ne 0.
Messae 'Error in function module' Type 'E'.
Endif.

Use the following code for function module for SPECIFIC case.

case sy-subrc.
when '1'.
   Message 'No_entry found' type 'E'.
when '2'.
   Message 'Undetermined error in Function module. Please contact system administrator' Type 'E".
Endcase.

Regards

Bhupal Reddy