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

catch error come from FM?

Former Member
0 Likes
2,341

hi,

when calling a FM 'L_TO_CREATE_TR', a error 'Storage type xx does not allow negative stock figures' occurs, and the process popup E message text at status line, so the program is stoped !

while i want to process the error in program, how to do to avoid the ECC popup this error text when calling this FM?

Thanks advanced!

1 ACCEPTED SOLUTION
Read only

RaymondGiuseppi
Active Contributor
1,624

In you call function EXCEPTION add the following

<i><b>ERROR_MESSAGE</b>: This exception instructs the system to ignore S messages, I messages and W messages until return from the function module (although they still appear in the log during background processing). When an E message or an A message occurs, the called function module terminates, as if the exception <b>ERROR_MESSAGE</b> has been triggered.

</i>

(...)
 EXCEPTIONS
   FOREIGN_LOCK                         = 1
   QM_RELEVANT                          = 2
   TR_COMPLETED                         = 3
   XFELD_WRONG                          = 4
   LDEST_WRONG                          = 5
   DRUKZ_WRONG                          = 6
   TR_WRONG                             = 7
   SQUIT_FORBIDDEN                      = 8
   NO_TO_CREATED                        = 9
   UPDATE_WITHOUT_COMMIT                = 10
   NO_AUTHORITY                         = 11
   PREALLOCATED_STOCK                   = 12
   PARTIAL_TRANSFER_REQ_FORBIDDEN       = 13
   ERROR_MESSAGE                        = 14
   OTHERS                               = 15.

You message will trigger the ERROR_MESSAGE exception and SY-SUBRC = 14.

Regards

hi,

when calling a FM 'L_TO_CREATE_TR', a error 'Storage type xx does not allow negative stock figures' occurs, and the process popup E message text at status line, so the program is stoped !

while i want to process the error in program, how to do to avoid the ECC popup this error text when calling this FM?

Thanks advanced!

3 REPLIES 3
Read only

Former Member
0 Likes
1,624

Hi edgar

using sy-subrc, check where the error occurs in you code and then catch that exception using exception handling. Then you wont have this pop up.

Regards

Ravish

Read only

RaymondGiuseppi
Active Contributor
1,625

In you call function EXCEPTION add the following

<i><b>ERROR_MESSAGE</b>: This exception instructs the system to ignore S messages, I messages and W messages until return from the function module (although they still appear in the log during background processing). When an E message or an A message occurs, the called function module terminates, as if the exception <b>ERROR_MESSAGE</b> has been triggered.

</i>

(...)
 EXCEPTIONS
   FOREIGN_LOCK                         = 1
   QM_RELEVANT                          = 2
   TR_COMPLETED                         = 3
   XFELD_WRONG                          = 4
   LDEST_WRONG                          = 5
   DRUKZ_WRONG                          = 6
   TR_WRONG                             = 7
   SQUIT_FORBIDDEN                      = 8
   NO_TO_CREATED                        = 9
   UPDATE_WITHOUT_COMMIT                = 10
   NO_AUTHORITY                         = 11
   PREALLOCATED_STOCK                   = 12
   PARTIAL_TRANSFER_REQ_FORBIDDEN       = 13
   ERROR_MESSAGE                        = 14
   OTHERS                               = 15.

You message will trigger the ERROR_MESSAGE exception and SY-SUBRC = 14.

Regards

Read only

0 Likes
1,476

Thanks Raymond,

It is working. Great information