Handling The Action of Multiple Submit Buttons on SAP Interactive Adobe Form
It is a common requirement to provide multiple submit buttons on an interactive adobe form for different operations. An adobe form can be integrated in ABAP and WebDynpro ABAP,WebDynpro Java applications. It is very easy to achieve this requirement in ABAP. When we want to integrate this adobe form in a webdynpro ABAP component, we need to use the InteractiveForm UI element. But handling the action of multiple submit buttons is tricky because the InteractiveForm UI element has only one event called “OnSubmit”. We have to handle the action of multiple buttons in this single event. To distinguish the action, we need to know the id or name of button on which action is taken which is tricky.
Requirement:
I am taking a simple requirement to accept input from the interactive adobe form which is integrated in a webdynpro application and to post that data into a Ztable. Here I have different operations like adding single/multiple record(s) into the table, updating single/multiple existing record(s) and deleting single/multiple record(s) from the table.
Note: Submit buttons (Create, Update, Delete) are created from WebDynproActiveX section.
Solution: 1. Create an attribute of type ‘char’ in the controller context node bonded with the data source of InteractiveForm UI element.
Ex: Button_name type char10.
2. Create a text field in the adobe form and make invisible. Bind the hidden field with ‘Button_name’ (additional attribute created earlier).
3. In the script editor for the buttons, write java script for storing button name in the hidden input field(before actual action, set the rawValue for hidden field(in the click event),before the standard code as shown in the below image).
Do similar for the Update(rawValue -> ‘UPDATE’) and Delete(rawValue -> ‘DELETE’) buttons.
4. Create an event handler method in the view controller and assign to the OnSubmit event of InteractiveForm.
5. In the event handler method, maintain your logic to distinguish the action of buttons as shown below. Read the context attribute Button_name. Based on the value in the attribute ‘Button_name’, code your operations as shown in the image below.
So, for achieving this requirement (having multiple submit buttons on the adobe form which is integrated in webdynpro application) there may be different ways but this is a better way to follow as explained above.
Need Help:
In case you need assistance on SAP Support Services, please contact us. Please send us your questions, comments or assistance request and our team would be glad to assist you.
By Sreedhar Babu (on behalf of SAP Consulting Team)