05-01-2009 8:16 PM
I am trying to insert a new HRP1001 Cost Center record in a program and have been trying to use the above Function Modules. The problem I am having is that when they encounter a CONFIG problem, like the Cost Center is not open for posting, instead of coming back with a Return-Code other than 0 they are giving me the message in real time and actually starting the Transaction (PO02) in the first case and exiting the program in the 2nd case. Neither is an acceptable solution. I want it to just let me know it didn't work and keep going. Is this the way these are supposed to work?
05-01-2009 10:10 PM
When you are calling your FM give an extra exception parameter ERROR_MESSAGE i.e. = 9.
Now when some message of type I,S, W will be raised it will automatically be skipped. Messages E, A will trigger that error so you can react accordingly outside FM. Message X will dump the systme out.
This way you can handle old function modules which don't use exceptions or simply call some message inside their body. This is a preety handful way to handle such situations.
As for calling tcode PO02 I am not sure about that. If the processing requires that you will likely be branched to this tcode anyway.
Regards
Marcin
05-01-2009 10:10 PM
When you are calling your FM give an extra exception parameter ERROR_MESSAGE i.e. = 9.
Now when some message of type I,S, W will be raised it will automatically be skipped. Messages E, A will trigger that error so you can react accordingly outside FM. Message X will dump the systme out.
This way you can handle old function modules which don't use exceptions or simply call some message inside their body. This is a preety handful way to handle such situations.
As for calling tcode PO02 I am not sure about that. If the processing requires that you will likely be branched to this tcode anyway.
Regards
Marcin