Hello RS,
I believe you already know how to define Action Profile and Action definition.
Afterwards, you need to implement a Z method/class to close preceding complaint and assign the method to corresponding Action Definition.
You can refer to Method COMPLETE_DOCUMENT and create your own implementation. Of course you need to write your own logic and code. See my screenshot for reference. Hope this helps.
Regards,
Webster