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

Capture errors in standard Function Module

aidan_mulcahy
Active Participant
0 Likes
2,384

Hi,

I am using WS_DELIVERY_UPDATE, but question relevant for any similar FM really.

Sometimes, this FM will fail deep inside its code and outputs a hard 'E'rror and kills the process.

Previously, for other FM's, I have used:

call function '...'

IMPORTING...

EXPORTING...

EXCEPTIONS

OTHERS = 99.

to capture these errors. But WS_DELIVERY_UPDATE does not have any EXCEPTIONS (just a PROT table).

Any way of catching the errors so I can log the data in a better way in my own code rather than just crashing out?

Thanks.

1 ACCEPTED SOLUTION
Read only

arseni_gallardo
Active Participant
0 Likes
1,557

Use:

  EXCEPTIONS

      error_message = 1.

It is documented,

4 REPLIES 4
Read only

arseni_gallardo
Active Participant
0 Likes
1,558

Use:

  EXCEPTIONS

      error_message = 1.

It is documented,

Read only

0 Likes
1,557

Bahh!!!

Thanks Arseni. Where was it documented? Couldn't find it.

I've always used OTHERS = 99 and that normally works.

ERROR_MESSAGE = 1 worked perfectly.

Thanks again.

Read only

0 Likes
1,557

Take a look here http://help.sap.com/saphelp_nw04/helpdata/en/9f/db98ef35c111d1829f0000e829fbfe/frameset.htm

Calling Function Modules in ABAP

To call a function module, use the CALL FUNCTION statement:

CALL FUNCTION <module>
     [EXPORTING  f1 = a 1.... f n = a n]
     [IMPORTING  f1 = a 1.... f n = a n]
     [CHANGING   f1 = a 1.... f n = a n]
     [TABLES     f1 = a 1.... f n = a n]
     [EXCEPTIONS e1 = r 1.... e n = r n [ERROR_MESSAGE = r E]
                                     [OTHERS = ro]].

Read only

former_member213851
Active Contributor
0 Likes
1,557

Hi ,

You can create Z FM 'ZWS_DELIVERY_UPDATE' by copying existing WS_DELIVERY_UPDATE nad then inside Exceptions tab you can add your own Exceptions via SE37.