Skip to Content
avatar image
Former Member

How to Call BAPI inside loop in BODS?

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?

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • Apr 18, 2016 at 10:03 AM

    Hi Former Member,

    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.


    1.png (16.1 kB)
    2.png (4.4 kB)
    3.png (6.2 kB)
    4.png (4.1 kB)
    5.png (3.6 kB)
    6.png (71.7 kB)
    Add comment
    10|10000 characters needed characters exceeded

  • Apr 18, 2016 at 10:51 AM

    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

    Add comment
    10|10000 characters needed characters exceeded