on 04-22-2014 10:09 AM
Hello CRM Experts,
I am trying to change value of a field - "object_id" of table "CRMD_ORDERADM_H" while creation of a service request. I am doing this by implemeting BADI - CRM_ORDERADM_H_BADI, method - CRM_ORDERADM_H_MERGE. In this method I am creating a new number and updating it in Object_id field of orderadmh table. This badi is getting called on every button click like - NEW, SAVE, even on pressing enter in service request creation page.
But I want to execute the code written in this method only on clicking SAVE button in web ui. But I am not able to find a way to do so.
Please suggest something.
Thanks,
Pooja
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Actually another way of doing this would be to create a new BTE function module instead. You can control the timing so that the function module will only fire once upon save if you configure the correct event timing.
To find out more on how to use this do a search here on CRMV_EVENT or run that transaction code in your system and click on "read this information".
For a bigger hint you would target:
Transaction Category - BUS20001 - or specific category that you need.
Execution TIme - 78 Before Saving
Object - ORDERADM_H
Event - BEFORE_SAVE
Attribute <*>
or perhaps
Execution TIme 88
Object ORDERADM_H
Event - INIT
or even:
Execution time - immediately
Object ORDERADM_H
Event AFTER_Create
In either case the call callback would be of type C call once per transaction
I would do an CRMV_EVENT_TRACE to figure out where to put this, but that's my best ideas.
Take care,
Stephen
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Pooja,
1. Use badi order_save, in method check_before_save implement your logic.
2. Validate if field ZZXXXX (name of your field for new object id) is populated or not. (If you add the field with AET then you can use FM CRM_ORDER_H_READ_OW if you add the field in ORDER_H structure, if you add the field in CUSTOMER_H structure you can use FM CRM_CUSTOMER_H_READ_OW).
3. If field ZZXXXX is not populated then you generate your new number and maintain with FM CRM_ORDER_H_MAINTAIN_OW or CRM_CUSTOMER_H_MAINTAIN_OW
Hope this information helps you.
Regards,
Jorge G.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI Faisal,
Thanks alot for your sugesstion
However, in Badi - CRM_ORDERADM_H_BADI, merge method, there is a chaging parameter of type structure - CRMT_ORDERADM_H_BADI, which contains object id as a field. So we can directly enhance object id value in table orderadmh by passing alpha numeric object id in this changing parameter. This badi is used for processing of orderadm only. That is why I thought of using this badi.
But by using order_save badi, do you have any idea, how can we enhance orderadmh table?
Thanks,
Pooja
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Faisal,
First, the Badi is getting called, then event handler of save button.
Thanks,
Pooja
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Pooja,
If you want it to be triggered only when SAVE button is pressed, write the code in the button event handler instead of BADI. Why do you want to go for BADI in this case?.
Thanks,
Faisal
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Christian and Faisal,
My requirement was to generate an alpha numeric number on creating a service request. But alpha numeric number range is not present in SAP standards. So I implemented badi -CRM_ORDERADM_H_BADI to enhance table crmd_orderadm_h with alpha numeric object id.
So when I click on "New" button (to create a service request), this implementaion is getting called and alpha numeric service request number gets generated which I update in object_id field of orderadmh table. But after this, if I exit or cancel the page, the alpha numeric number that has been created has got wasted. So in order to avoid wasting of numbers, I want to execute the code written in badi implementation only on save action to get surity that the number which is getting generated is getting saved also.
But I am not able to find out a way of doing this. I can not put any check on event handler of save, as all these event handlers are getting called after badi.
I also tried calling badi manually in save method, but by doing this, no alpha numeric number is getting generated, rather standard object id is getting generated.
Please help me if you can.
Thanks,
Pooja
User | Count |
---|---|
5 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.