Application Development 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: 

How to Handle Error thrown from Conversion routine

avinashd_m
Participant

Hi All,

I have program which uses conversion routine 'CONVERSION_EXIT_ABPSN_INPUT, which converts WBS Element from external format to internal format like PS-012456-11 to PS01245611.

So my problem occurs when i am passing invalid WBS Element PS-BAS-UBHNX to conversion routine, it gives me an error as follows :

Whenever i get this error from conversion routine, my program terminates without further execution. so any one help me here on how to avoid program termination and continue execution of the program on getting the error.

Note : This standard conversion routine doesn't have any exception maintained.

Thanks in advance,

Avinash

1 ACCEPTED SOLUTION

Sandra_Rossi
Active Contributor
0 Kudos

If the conversion routine sends an error message, you may only handle it according to the context where it happens -> first read https://help.sap.com/http.svc/rc/abapdocu_752_index_htm/7.52/en-US/index.htm?file=abenabap_message_e..., then read the section corresponding to your context, cf https://help.sap.com/http.svc/rc/abapdocu_752_index_htm/7.52/en-US/index.htm?file=abenabap_messages_....

In your case, my opinion is that the conversion routine is called outside the PAI, so you might intercept it by wrapping your code into a function module, and handle the classic exception ERROR_MESSAGE (https://help.sap.com/http.svc/rc/abapdocu_752_index_htm/7.52/en-US/abapcall_function_parameter.htm#!...).

4 REPLIES 4

srikanthnalluri
Active Participant
0 Kudos

Hi Avinash, You may have to get the coding mask, and if the WBS element doesn't follow the coding mask don't even pass it to Conversion FM. Please check the Note - 421212.

ilachaudhary297
Participant
0 Kudos

Hi Avinash,

If the function module is not returning any value that means the value given as input is not correct. Though the FM is not giving exception for this scenario when used in program but its not ending up in dump also. You can put a IS INITIAL check on the importing WBS element to further stop the processing.

Thanks

Sandra_Rossi
Active Contributor
0 Kudos

If the conversion routine sends an error message, you may only handle it according to the context where it happens -> first read https://help.sap.com/http.svc/rc/abapdocu_752_index_htm/7.52/en-US/index.htm?file=abenabap_message_e..., then read the section corresponding to your context, cf https://help.sap.com/http.svc/rc/abapdocu_752_index_htm/7.52/en-US/index.htm?file=abenabap_messages_....

In your case, my opinion is that the conversion routine is called outside the PAI, so you might intercept it by wrapping your code into a function module, and handle the classic exception ERROR_MESSAGE (https://help.sap.com/http.svc/rc/abapdocu_752_index_htm/7.52/en-US/abapcall_function_parameter.htm#!...).

Thanks for the answer,

The classical exception Error_message is worked for me.

With addition of ERROR_MESSAGE = 1, to the conversion routine while calling it, allowed me to avoid termination of the program and there by to show proper error message.