Question:
Hello,
I'm developing a BADI action (the normal way through activity transactions etc in SPRO) to call a screen where the user can select multiple service contracts which contents should be copied into one new (including correct document flow). Anyone done it?
It works for one contract (of course, as in standard), but I can't make it work for multiple. I'm using functions CRM_ORDER_MAINTAIN and CRM_ORDER_SAVE right now, how should they be called? Or maybe there is another solution to it? I'm new in developing in the CRM area...
Any help appreciated!
Henrik
Answer:
Hi Henrika
I Need to develop the same tool.
HAve you solved yours?? Can you give us a clue of the solution?
Kind Regards,
Rhus
Answer:
Hello Rhus,
yes it works now. Short description of the solution:
-use method lc_action_execute->get_ref_object to pick up the guid you are creating or changing (ORDERADM_H)
-In my case: I used new own screen for picking products from different existing contracts. Collect them in an internal table.
-call CRM_ORDER_MAINTAIN: I used structures IT_PRODUCT_I, IT_CUSTOMER_I (for my own EEWB fields), CT_ORDERADM_H (initial when calling!), CT_ORDERADM_I, CT_INPUT_FIELDS and CT_DOC_FLOW.
After that I'm leaving the action BADI and get back to std transaction CRMD_ORDER. Now you can see the service contract has one or many product items + document flow filled on header + item level. When pressing save in transaction the service contract is stored on the db.
I hope this helps a little. The key is just to use CRM_ORDER_MAINTAIN in the correct way (to store order data to the buffer, will be visible on screen as well), the rest is taken care of by the transaction itself. Key fields in the structures are for instance ORDERADM_I-HEADER, and REF_GUID/GUID in all structures. In my case I should not use CRM_ORDER_SAVE, that is done in the transaction later.
BR Henrik