Function module PTRA_WEB_EXPENSE_REPORT_GET_2 not working when used in loop
I have used a function module PTRA_WEB_EXPENSE_REPORT_GET_2 in a custom fumction module which i am developing fetch the travel expense data . The function module PTRA_WEB_EXPENSE_REPORT_GET_2 returns the travel expense data based on the employee and the trip number. I want to fetch the travel expense data for a given set of employees and trip number and hence i have used this function module inside a loop statement.
The function module returns the travel expense data for the employee and trip in the first loop pass. From the second loop passs it doesn't return the value. I have also checked this in se37 and the same thing happens. Value is returned for the fist employee but for the next employee we have to go to initial screen of se37 and execute the Func. module again.
I debugged this function module and found that the value of the employee and the trip number is stored in the global variable. The value passed for the employee and trip is compared with the correspomding value in the global variable and if they are not same an error message is returned. Since we are using in a loop , each time a different value is passed for the employee and trip and the check fails .
Is there any way to clear the value in the global parameters or is there any other function module which can be used to clear the values of the global variables?