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: 

not stopping the further process when I generate the error message from class CL_ERROR_MSG

Former Member
0 Kudos


Hi Experts,

I am working on User Exit. this is related to SD module. This user exit is checking the batch characteristics whenever we are saving the sales order.

In above exit, I am using the standard class CL_ERROR_MSG for generating the error messages.

By using method 'SET'  of class CL_ERROR_MSG, I am creating the error messages.

By using method 'SHOW' of class CL_ERROR_MSG, I am showing all the error messages in a dialog.

Upto this it is working fine. But I can able to save the sales order even though I received the error messages. This will not happen for my requirement.

generally, whenevr we receive the error messages, the system should stop the further process of any transaction.

But this error messages are not stopping the saving of a sales order.

my requirement is How can we stop the saving of a sales order after generating the error messages from the above class.

Thanks

Nagireddy Alavala

10 REPLIES 10

Former Member
0 Kudos

Hi,

Create exceptions in the error method ...

Thanks,

Vijay SR

0 Kudos

Thanks Vijay.

I did not get you clearly. Could you please elaborate.

we are getting the error messages in a dialog. up to this ok. But system could not stop the further processing.

How can we stop the further process.

Thanks

Nagireddy Alavala.

0 Kudos

Hi Nagireddy,

After the error message is shown, write 'Exit' statement. Thatway, the rest of ABAP logic will not be processed, I guess in your case the code for saving is getting processed even after the error.

If 'Error' ( based on your logic)

Exit.

Else.

Let the program execute the rest of the logic.

Endif.

Hope this helps.

Thanks

Naveen Pulluri

0 Kudos

Hi,

I hope you are passing 'E' in the TYP parameter in the SET method.

What User exit you are using by the way?

R

0 Kudos

Thanks Naveen.

After that error code, I don't have any code. How can i use the exit.

Exit: User_exit_save_document_prepare.

I am using this exit for validating the batch characteristics before saving the sales order.

For this, I have created a include, in that include I am checking the each characteristic of batch. At the end of include program, What evr error I am receiving, I am listing all the errors and showing in a dialog box using the above class.

When I change the sales order and give the incorrect batch, after clicking on the save button, system  will call this include and check the batch characteristics and if errors found, it list all errors

and showing in a pop up. I am receiving the popup with list of error. But When I click on the Tick(ENTER) mark on the pop up the system is saving the sales order. But in my case it shouln't save the sales order.

How Can I stop the the saving of a sales order.

0 Kudos

Hi Rudra Roy,

Yes. I am passing the 'E' in the TYP parameter in the SET method.

User_exit_save_document_prepare.

0 Kudos

Hi again,

METHOD SHOW will only work if you have set only one message. For Multiple messages it display as a list but actually loose the flavor of true 'E' type message and stops the procesing.

So Either use one message or call RESET Method before calling any SET Method

or raise the error as Message EXXX(Message Class) with,,,, as suggested.

R

Former Member
0 Kudos

Use "EXIT" statement in Source Code, this stop further processing . If its in loop use continue.

0 Kudos

Hi Bhusan,

Even though I am using the Exit Statemnt in the include....It is not working.

Where I need to use this exit.....within in the include or outside the include (After this include in the User exit)

Former Member
0 Kudos

Hi

But why are you using class CL_ERROR_MSG?

If you want to stop the proccess you need to trigger a message type E, so if you want to use that class you should use method  SHOW with COUNT 1

Max