2023 Sep 21 1:38 PM
I have 2 custom fields in aufk table which I want to update with values after the user clicks on save in IW31 tcode. I want to find a user exit that can process after saving the order so that I can have the order details in the logic to update my values. EXIT_SAPLCOIH_009 is not apt for this as it does not have final order header. It has only buffer order data.
If there is any BAdI for the same also it would be great!
Thanks for your help
EDIT: I have tried WORKORDER_UPDATE BADI and its methods as well.
2023 Sep 21 1:52 PM
Please check Enhancement spot WORKORDER_UPDATE with BAdI interface IF_EX_WORKORDER_UPDATE
2023 Sep 21 1:56 PM
Hi,
Thanks for your suggestion. I had checked WORKORDER_UPDATE but has only importing parameters for the AT_SAVE method. Please correct me if I am wrong. I would be needing an exporting or changing parameter to update aufk custom fields right?
2023 Sep 21 1:59 PM
Yes I tried that. But I thought I would need an exporting or changing parameter for my requirement. Would I be able to just update aufk without that?
2023 Sep 21 2:03 PM
Check Enhancement IWO10018 if your fields were appended in structure CI_AUFK (you may be required to use a dummy dynpro)
2023 Sep 21 2:07 PM
Thanks for your suggestion. I had checked IWO10018. But it won't get triggered after saving the order in IW31 I guess.
2023 Sep 21 2:38 PM
Problem is that the usual BAdI, WORKORDER_UPDATE, doesn't allow to change data (methods such AT_SAVE and BEFORE_UPDATE pass only read only parameters.
2023 Sep 22 6:58 AM
The fields are updated by a logic does not need user input. And when the user creates the order, it fetches the previous order details for the custom fields and updates it at the time of save. I wont be able to use IWO10018 as the order gets released and printed by a batch job and it won't trigger the user exit in that case.
2023 Sep 22 8:33 AM
As the previous order is already in the database and the new one is not yet, you can already load the data from the last order into the suggested customer exit, select the creation date (descending) or the maximum key value (subquery)
NB: You could also display those fields in the customer-exit in read-only mode.?
2023 Sep 22 10:39 AM
Yes I can do that as well. But I won't be able to use the suggested customer exit as it does not get triggered at save. I want it to trigger at save so that it works when the processes are carried out by a batch job. That's why I am searching for an exit that let's be update the values at save.
2023 Sep 21 6:25 PM
If provided customer exits and BAdIs are not enough you can try to use implicit enhancement at the end of form USER_EXITS_SAVE in include LCOIHF05. Just be cautious to only adjust your custom fields and it shouldn't influence standard processing.
2023 Sep 22 6:59 AM
2023 Sep 22 7:55 AM
This form also has only buffer order details and not order header.
2023 Sep 22 8:13 AM
It's normal for document creation that number is not yet assigned and changed later on. You can just try to adjust your fields and see if they are saved in most cases it should work. If not then you need to debug it and find other spot after it's called. However this place is pretty safe because user-exits are called here.
2023 Sep 22 9:58 AM
But based on the current order number and current erdat only my logic to populate the custom fields is coded. So I would need access to the current order number to execute the update of the custom fields. Any idea where I would be able to get the order header after save?
2023 Sep 22 8:03 PM
I don't have option to debug the process from code it looks like either some ehnacement point or badi in CO_ZV_ORDER_POST FM should work. For example EAM_MRS_ORDER_POST badi method POST_BEFORE_COMMIT. However you need to debug it and check by yourself, it can also depend on your system version what you can do there. Good luck!
2023 Sep 22 7:29 AM
Please have a look at this blog:
https://blogs.sap.com/2014/04/20/iwo10018-user-fields-in-maintenance-order/
2023 Sep 22 7:31 AM
The user exits mentioned in this blog don't trigger on clicking save in IW31. So I could not use those.
2023 Sep 22 8:16 AM
Can you use EXIT_SAPLCOIH_019 (include ZXWOCU16)?
aufk-zzfield = 'Test'.
MOVE-CORRESPONDING aufk TO coci_aufk_exp.
2023 Sep 22 8:36 AM
No, it doesn't trigger on save right, so when I am executing through a batch job this code won't get executed. That's why I have to search for after save events
2023 Sep 22 8:56 AM
2023 Sep 22 10:35 AM
2023 Nov 03 12:12 PM
Thanks for all the replies. I had used the below statement in EXIT_SAPLCOIH_009 to update the caufvd_imp structure even before I had order number of the current order getting created. This perform effectively lets you to update the fields of aufk even if you have only the buffer order number.
PERFORM caufv_upd(saplcobh) USING caufvd_imp.