cancel
Showing results for 
Search instead for 
Did you mean: 

How to Call BAPI inside loop in BODS?

Former Member
0 Kudos

Hi,

I Calling a BAPI from BODS and it has  field customer as import table(not parameter). I have list of customer in a table and I would like to call BAPI once for each customer. How can I do that? IF looping is an option then how?

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member211387
Contributor
0 Kudos

You can loop it but it is best to call the BAPI in one go if the table contains the list of entries you need. This way the system will balance the calls made to the SAP system and traffic associated. Looping is also possible.

In the Example provided by Akhilesh, assign the customer number to a separate parameter (create new variable: call it $G_CustID ) and initialise it after increment in the script using sql function retrieving the data from your customer table. In order to get one customer ID per call, you may need a running rownum that you can refer to using the $G_S variable after each increment. 

This $G_CustID can then be referred to in the BAPI call in the loop to restrict one BAPI call per customer at a time.

kind regards

Raghu

akhileshkiran
Contributor
0 Kudos

Hi ,

You can use while_loop to perform this task. Hope the below example will help you out.

Example: Using the While Loop.

JOB:

Creating the initial variables and passing the values for loop iteration.

Passing the values in the loop.

Printing the increment value. Here you can use the Data Flow instead of the print script.

Incrementing the value of the start variable.

Output:

Regards,

Akhilesh Kiran.