Thursday 1 July 2010

Infopackage dynamic selection routine

This will explain , how to give dynamic selection for periodic loading using infopackages.
After creating an infopackage go to "Data Selection" tab. Give Type - 6 Abap Routine for the required selection criteria. Here I am loading the data with selection "Previous Month" (0calmonth).

Give a description and click enter. It will move to the Scheduler routine screen.


Enter the code as below (highlighted).

*$*$ begin of routine - insert your code only below this line *-*
data: l_idx like sy-tabix.
read table l_t_range with key
fieldname = 'CALMONTH'.
l_idx = sy-tabix.
*....
l_t_range-low = sy-datum(6) - 1.
l_t_range-high = sy-datum(6) - 1.
modify l_t_range index l_idx.

p_subrc = 0.

*$*$ end of routine - insert your code only before this line *-*

Save this.

This will make the month range to previous month . "l_t_range" table is of type structure RSSDLRANGE (contains Sign, Option, Low, High). We need to populate these fields to pass range dynamically.