cancel
Showing results for 
Search instead for 
Did you mean: 

CRM_ORDER_STATUS badi

Former Member
0 Kudos

Hi all,

I need your help.

I have searched this forum and found some of the threads about CRM_ORDER_STATUS badi. It will be triggered when we change the status.

But, when I tried to put the break point in CL_EXITHANDLER and changed the status of a service order, it was showing only CRM_WTY_BADI. There was no other badi in debugging.

Can someone explain how to check that CRM_ORDER_STATUS is the correct badi for status changes?

Thank you all!

-Ezhno.

Accepted Solutions (0)

Answers (7)

Answers (7)

SandeshK
Participant
0 Kudos

Hi Maren,

There are different ways a BADI is called by the standard SAP Code. CL_EXITHANDLER may not always tell you which BADI is getting triggered.

- San

mrkarthi
Participant
0 Kudos

Hi Maren,

I would like to add few more lines to Atul's reply.

CRM_ORDER_STATUS BADI will be triggered based on the filter value. If we see the standard implementation CMS_ORDER_STATUS, the filter value is maintained as "E0003CMSCON01". Observing the filter value, it is understood that E0003 is the status and CMSCON01 is the status profile. Once this filter value is achieved, the BADI will be triggered.

I am not sure if any other BADI could be triggered if the status is changed generically in the transaction.

Regards,

Karthi M R.

Former Member
0 Kudos

hi Karthi M R,

if u want to trigger the badi when the status is changed,create action profile(for this use badi exec_method_ppf) for the transaction ,there u can set the status in action profile.

Regards,

Padma.

Former Member
0 Kudos

Sorry, I dint mean to offend.

Closing the thread.

former_member210661
Active Contributor
0 Kudos

Hi Ezhno,

go through this link this is another way to find out the badi..

this might help full to you...

Thanks & Regards,

Srinivas.

Former Member
0 Kudos

Hello Atul,

Thank you for your detailed explanation and  everything is working fine.

But, my question is different. Let me rephrase my question.

Just forget that you and I don't know the CRM_ORDER_STATUS badi.


We would like to find out which badi gets triggered when we change the status. How  should we proceed now?

atulJaiswal
Participant
0 Kudos

Hi Maren,

Well as i mentioned CRM_ORDER_STATUS BAdi will be triggered as soon as you change the status. Since my observation says it does!!!

I think i really do not understand your doubt now. Hope you get your query resolved by some one who understood your doubt better.

On a lighter note: Thanks for realizing me that i don't know what i know about CRM_ORDER_STATUS BAdi ( as per your highlighted and underlined suggestion) I will try to learn more. Thanks! .

Regards,

Atul

Former Member
0 Kudos

Atul,


Thank you for your detailed explanation. And, I have already implemented the same logic you explained.


I am sorry if my question is not clear. I'm not  a native speaker of English.


The actual question is:


If you want to find out which badi gets triggered after clicking the SAVE button, you will put the break point in CL_EXITHANDLER and you can see the ORDER_SAVE badi name in debugging.


In the same way, why BAdi CRM_ORDER_STATUS doesn't get triggered when we change the status (NOT after implementation). Is it just because there is no filter set to the badi?


If so, is there any other way to find out this is the correct badi to work on for status change related logic?


Hope, I made it clear now.   Thank you.

atulJaiswal
Participant
0 Kudos

Hi Maren,

You are right. We use CL_EXITHANDLER  class to verify which all BAdis gets called over the process of transaction.

CRM_ORDER_STATUS is correct BAdi if you want to do validation/logic on/after status change. As I mentioned this BAdi is filter dependent so it will not let you activate its implementation without Filter value.

In your implementation could you see Runtime behaviour as  "Implementation will be called "? If not you must need to activate along with appropriate filter in your BAdi to ensure your implementation gets called.

Might be you used wrong status profile. For your reference i suggest below steps. You can verify for any deviation:

Create a new implementation-> In properties tab click on Insert Icon-> Use F4 help provided there-> A popup screen will appear asking to choose from below options

1. User status in Business transaction

2. System Status

Select first row( your choice)-> User status in Business transaction-> Another screen asking you to select 'Status profile' will appear.( Choose correct status profile -> This is critical)-> choose the status you need required as point of validation.

Save and activate-> In properties tab you will find  Runtime behaviour as  "Implementation will be called ".

Put a breakpoint here before_save and After_save method with your user ID. Re login to web UI.

Create/Edit a service order try to change the status. Badi will be triigered.

For example if you selected 'In process' as a filter value. As soon as you select assign status as 'In process' in your service order breakpoint of both methods will be triggered.

Let me know your findings. I will try to help.

Regards,

Atul

Former Member
0 Kudos

Hello,

Thanks for your replies.

Our functional consultant mentioned the CRM_ORDER_STATUS badi name in the specification.


But, I am just checking why it's not getting triggered when I tried.

In other words, when we click SAVE button, we can see the ORDER_SAVE badi getting triggered.

Then, why not CRM_ORDER_STATUS badi when changing the status?!

Requirement was... we can't change the service order status to CLOSED until all the service items' status is CLOSED.

Thank you.

atulJaiswal
Participant
0 Kudos

Hi Maren,

BAdi CRM_ORDER_STATUS is a filter dependent BAdi and its trigger is dependent on the filter that has been set.

Before_save method lets you to perform validation before the status is being set and depends on your logic you can control the further status to set or prevent. Similarly After_save method lets you to perform validations after the specific status has been set.

Coming back to your question, you must need to see the filter value of your implementation. This could be the reason why you cant see your implementation not getting triggered while debugging. It should trigger once filter value is matched with the status of your service order.

For your requirement if i understand correctly you needed service order status not to be changed before all service item status is 'closed'. You should create an implementation with the filter value ( combination of user status & status profile ). Here in before_save method you can write your logic to check the header status if not 'Closed' raise exception 'NOT_ALLOWED'.

Regards,

Atul

Former Member
0 Kudos

Can change the status using the fm  CRM_ORDER_CHANGE_STATUS

Regards,

Padma.

atulJaiswal
Participant
0 Kudos

Hi Maren,

Could you provide some more inputs about your requirement.

Do you need to do apply your logic as soon as user selects different status ( mostly from dropdown list) or you want your logic when user changes the status and save the transaction?

In case if you need to do your validations/cutom logic at save, better use 'ORDER_SAVE' BAdi implementation.

Let us know you requirement more specifically.

Regards,

Atul