We’ve already seen a blog on handling structure and table using Bapi’s in webdynpro by Perumal Kanthan
I’ve come across another problem when I wanted to send multiple rows from a table to a bapi
Let’s take a purchase requisition creation as an example.
I used BAPI called Bapi_Requisition_Create_Input.
This handles data for creation of new purchase requisition. Now if I have to pass multiple element from a table in webdynpro to table Requisitin_Items in the above BAPI which is nothing but a structure following steps have to be followed
- Creating corresponding Value node in Custom controller
After creating corresponding node in custom controller do context mapping from view context to custom controller context
After importing structures to the model in webdynpro and mapping it to the corresponding field in the table of webdynpro screen, we should go through this code in on clicking of an event or triggering of a button event
Where Bapiebanc is the class corresponding to Requisitin_Items table in webdynpro generated during model creation for Bapi_Requisition_Create_Input
After that we will be dynamically setting values in Bapiebanc class from ValueNode Object by getter and setter methods.
As we have multiple rows in our table so we have to take size of the node to pass all the elements to bapi.
For this we would use a loop to node size, in our case this is TableNode which holds all the elements which have to pass to the corresponding table of the bapi Bapi_Requisition_Item.
Here after putting loop we set all the elements and then after that we add items to the node of the Requisition_Items by using addRequisitin_Items method by passing the object of “Bapiebanc” class “re” by getting values from the TableNode “tn” which holds elements have to be passed to the table.
.addRequisition_Items(re);//multiple element binding to the object
<u>Use of add<node name>(node object) method over bind(node object) method</u>