The Problem Statement
Having problems calling a BAPI which takes a Table as an input parameter because you are unsure how to add multiple rows to the table ? Here’s how to do the same…
I’ll use BAPI_PRODORDCONF_CREATE_TT as an example and demonstrate how to insert multiple rows in the TIMETICKETS table. Approach1. Create a Local Parameter say, BapiTimeTickets, of type XML with the structure corresponding to a row of the table TIMETICKETS. It will look something like this : 2. Create another Local Parameter say, BapiRequestInputXML, of type XML corresponding to the Input/Table Structure of the BAPI but with the table TIMETICKETS having no rows. 3. Use a repeater on the XML xPath from which you want to create multiple rows. Assign values to the attributes of the BapiTimeTickets so that this represents one row to be added to the TIMETICKETS table. Assign the row to TIMETICKETS and do an Append XML. 4. Lastly assign the variable BapiRequestInputXML to the input of the JCO action Block calling the BAPI.
A sligtly alternative approach
Instead of having a separate variable called BapiRequestInputXML, it is also possible to append the rows directly to the input structure of the BAPI, but in this case you’ll need to do a Remove XML assignment to remove the row that exists by default in the structure.