How to call another section repeatly and pass in new data selection each time?

Andrew2009

Well Known Member
I have an existing custom UBE and it has one section called A. It uses the below commands in its Initialize Section because there are additional data selection that users will enter when they run this UBE and it does all the work in the Do Section


Set Selection Append Flag( <Yes>)

Set User Selection(BC Date - For G/L (and Voucher) - Julian (F0911)(DGJ), <Less Than or Equal To>, PO Ending GL Date, <And>)

Set User Selection(BC Date - For G/L (and Voucher) - Julian (F0911)(DGJ), <Greater Than or Equal To>, PO Beginning GL Date, <And>)


Everything is fine. Now my new requirement is I have a As Of Date, let's say 12/31/2014. I need to go back 13 months so I need to call section A 13 times and pass in a beginning date and ending date values for 13 months like the below


12/1/2014, 12/31/2014 //December

11/1/2014, 11/30/2014 //November

10/1/2014, 10/31/2014 //October

...Go back all the way to Dec 2013

12/1/2013, 12/31/2013


I'm thinking of making section A a conditional section and create a new section called Main Driver and in a while loop, figure out the ending and beginning dates and call section A 13 times and pass in these 2 date values. It's not working so far.


Do you know the best way to do this?


Thanks
 
Last edited:
Not sure why what you described wouldn't work - maybe expand on exactly what isn't working. Make sure to clear the previously set selection on every iteration. Maybe use ER variables in place of your PO variables in your Set User Selection statements.

For things like this, the debug log is your friend. You can grab the SQL that is being generated and usually it will point out the problem pretty quickly.
 
Back
Top