InfoPackage ABAP Routine for Date Range - Only Start Date Extracted

I am using an ABAP Routine in an InfoPackage to select data for a 2 year period.  The routine converts SY-DATUM into the Current Fiscal Year and Period, and then calculates the Starting and Ending Fiscal Year / Period of a 24 month period.  The Start and End values are passed to the InfoPackage as l_t_range-low and l_t_range-high.
The Source and Target are both Basic Infocubes.
The InfoPackage executes successfully, and the Selection values on the Header tab of the monitor reflect a 24 month period.  Unfortunately, on closer review of the data in the cube, only data for the first month appears to have been loaded.  I’m guessing that the extract was only performed with the From value, even though a To value was also provided.
I created a simple Infopackage and manually input the selection parameter values just to be sure I wasn’t overlooking something. The InfoPackage performed as expected, loading more data which spanned the selection time period.
I can provide the code if it helps, but the fact that the monitor reflects a Start and End value suggests that the problem is with the InfoPackage, not the ABAP routine.
Has anybody ever experienced this before ?  Any ideas would be greatly appreciated ?
Thanks,
Lyle

We can write ABAP routine in Infopackage with a range of values (From & To). Make sure you fill all the following information while building the final range information as below,
   l_s_range-sign    = 'I'.
   l_s_range-option  = 'BT'.
   l_s_range-low     = lowvalue.
   l_s_range-high    = highvalue.
  MODIFY l_t_range FROM l_s_range INDEX l_idx.
As you can see the key is passing the "BT" information for capturing range.
Hope it helps..
thanks
Kumar

Similar Messages

  • Abap Routine for Date selection in Infopackage

    Hi
    I have to write an abap routine for date selections in the infopackage,
    There are two date begda and enda.
    Do i code for BEGDA and fill in the begin date using routine and use another routine to fill the ENDA.
    JPJP

    Hi JP,
      If you have two info objects BEGDA and ENDA in the Info package for selection
      then you will have to write seperate routine for each of them.
      If you want to give single value for each date field then update only the field l_t_range- low otherwise if you want to give range then you can update the internal table fields l_t_range-low and l_t_range-high .
    Regards,
    Prakash

  • ABAP routine for loading data of current month in InfoPackage

    Hello experts,
    I want to load data of current month. Therefore I implemented the following ABAP-Routine for field 0CALDAY in the InfoPackage's data selection:
    data: lv_datum_l like sy-datum,
             lv_datum_h like sy-datum. 
      concatenate sy-datum(6) '01' into lv_datum_l.
      call function 'RP_LAST_DAY_OF_MONTHS'
      exporting
      day_in = sy-datum
      importing
      last_day_of_month = lv_datum_h.
      l_t_range-sign = 'I'.
      l_t_range-option = 'BT'.
      l_t_range-low = lv_datum_l.
      l_t_range-high = lv_datum_h.
    But function 'RP_LAST_DAY_OF_MONTHS' cannot be found!
    Any other suggestions for getting last day of current month?
    regards
    hiza

    Hi,
    Add this code. When u complete execution of this code, ZDATE will have ur month end date.
    data : zdate_c(2) type c,
           zyear_c(4) type c,
           zmonth_c(2) type c.
    data :  zdate like sy-datum.
    data :  zday(2) type n.
    zdate = sy-datum
          zyear_c = zdate(4).
          zmonth_c = zdate+4(2).
          zdate_c = '01'.
          concatenate zyear_c zmonth_c zdate_c into zdate.
          CALL FUNCTION 'FIMA_END_OF_MONTH_DETERMINE'
          EXPORTING
            I_DATE         = zdate
          IMPORTING
            E_DAYS_OF_MONTH = NO_OF_DAYS.
          zday = NO_OF_DAYS.
          concatenate zyear_c zmonth_c zday into zdate.

  • ABAP Routine  for 0FISCPER  slect options in InfoPackage

    Hi,
    I am trying to write an ABAP Routine for 0FISCPER as select options (range) dynamically.
    Ex:
    0FISCPER selection for this year as 001.2008 to 012.2008
    0FISCPER selection for next year as 001.2009 to 012.2009.
    Now  we are changing InfoPackage every year manually, so I need to write a routine for 0FISCPER in InfoPackage to handle dynamically every year
    Thanks,
    SK.

    Hi
    write an ABAP routine to get that value..But are you getting any planned data(why you want till end of the year...till infopackage runs is o.k i think, if you don't have planned data)...Any way you can check the below code, which can be useful...
    You can see the below code at->your infopackage selections>Ty-->choose variable type as 6 and enter any ABAP routine name( to create) and then there is a button on the application tool bar called 'routine info'..this give you the following information...
    Definition
    You can define complex selections for InfoPackages and control the automatic deletion of requests from InfoCubes in the scheduler, by using routines.
    Routines are processing blocks in ABAP programs that consist of a pre-defined data declaration section and an ABAP subroutine (form routine). In the subroutine you can use all of the ABAP programming functions.
    You can use the following routines for making selections in InfoPackages:
    1. Selection routines for fields, on the Data Selection tab page
    2. Selection routines for file names, on the External Data tab page
    3. Selection Routines for selecting the from and to dates for time-dependent data, on tab page Update
    4. Selection routines for determining old requests to be deleted after successfully loading a new request, on the Data Target tab page
    Program frame:
    After you have called up the Editor for routine maintenance, you get the following program frame:
    1. Selection routines for fields, on tab page Data Selection:
    program conversion_routine.
    '$*$ begin of global - insert your declaration only below this line -
    TABLES: ...
    DATA:   ...
    $$ end of global - insert your declaration only before this line    -
    FORM COMPUTE_<Fieldname>
      tables l_t_range structure rssdlrange
      changing p_subrc like sy-subrc.
    $$ begin of routine - insert your code only below this line       -
      data: l_idx like sy-tabix.
            read table l_t_range with key
                 fieldname = <Fieldname>.
            l_idx = sy-tabix.
            modify l_t_range index l_idx.
            p_subrc = 0.
    $$ end of routine - insert your code only before this line       -
    ENDFORM.
    2. Selection routines for file names, on tabstrip External Data:
    FORM compute_flat_file_filename
         changing p_filename like rsldpsel-filename
              p_subrc like sy-subrc.
    $$ begin of routine - insert your code only below this line-
              p_filename =
              p_subrc = 0.
    $$ end of routine - insert your code only before this line-
    ENDFORM.
    3. Selection routines for selecting the from and to date for time-dependent data, on tabstrip Update:
    form compute_time_dependent_dates
         changing p_datefrom type d
                  p_dateto   type d
               p_subrc like sy-subrc.
    $$ begin of routine - insert your code only below this line-
              p_datefrom =
              p_dateto   =
              p_subrc = 0.
    $$ end of routine - insert your code only before this line-
    ENDFORM.
    4. Routines for determining the old requests to be deleted after successfully loading a new request, on tab page Data Targets:
    form compute_<InfoCube-Name>
      tables l_t_request_to_delete structure rsreqdelstruc
      using l_request like rsreqdone-rnr
      changing p_subrc like sy-subrc.
    *Insert Source Code to decide if requests should be deleted.
    *All Requests in table l_t_request_to_delete will be deleted
    *from Infocube <InfoCube-Name>.
    *Add new requests if you want to delete more (from this cube).
    *Remove requests you did not want to be deleted.
    $$ begin of routine - insert your code only below this line-
         loop at l_t_request_to_delete.
         endloop.
         clear p_subrc.
    $$ end of routine - insert your code only before this line-
    ENDFORM.
    Note:
    Those fields flagged with <...> are dependent on the selection fields and are filled automatically by the system when you call up the Editor.
    Procedure
    Make the following entries:
    1. Between $$ begin of global ... and $$ end of global ... you can define data declarations. These are the declaration sections for the local data in the routine. This data is only visible in the routines.
    2. The subroutines begin with FORM and end with ENDFORM.
    The subroutines for the particular routines are:
    Selection routines for fields on tab page Data Selection: FORM COMPUTE_<Field name>
    Selection routines for file names on tab page External Data : FORM compute_flat_file_filename
    Selection routines for selecting the from and to dates for time-dependent data on tab page Update: FORM compute_time_dependent_dates
    Routines for determining old requests to be deleted after successfully loading a new request on tab page Data Target: FORM COMPUTE_<InfoCube-Name>
    The subprograms have the following parameters:
    Subprogram FORM COMPUTE_<Field name>:
    l_t_range
    In the table l_t_range the routines for all selection fields that are filled, or have a routine, are made available.
    The routines are executed in the scheduler last of all and therefore, you can change all the selections that you have carried out previously.
    p_subrc
    Using the variable p_subrc you can report errors to the scheduler. p_subrc <> 0 signals an error and means the data request is terminated.
    Subprogram FORM compute_flat_file_filename:
    p_filename:
    You give the name of the file that is to be loaded in parameter p_filename.
    This is useful if your file name contains date dependencies that should be determined by sy-datum and calculated during runtime.
    p_subrc
    You can inform the scheduler of an error with variable p_subrc. p_subrc <> 0 signals an error and means that the data request is terminated.
    Subprogram FORM compute_time_dependent_dates:
    p_datefrom and p_dateto
    Fill these parameters with the from and to dates for time-dependent master data and texts.
    p_subrc
    You can inform the scheduler about an error using variable >LS>p_subrc. p_subrc <> 0 signals an error and means the data request is terminated.
    Subprogram FORM COMPUTE_<InfoCube-Name>:
    l_t_request_to_delete
    You give the request number of the request that is to be deleted in parameter l_t_request_to_delete. You can also delete requests from the table. These are then not deleted.
    p_subrc
    You can inform the scheduler about an error with the variable p_subrc. p_subrc  signals an error and means the data request is terminated.
    3. Insert your program code for the routines between $$ begin of routine ... and $$ end of routine ... so that the respective subprogram variables are supplied with the corresponding values.
    4. Check the syntax of your routine with the Check function.
    5. You can then transfer the routine with the Save function.
    You end routine maintenance when you exit the Editor.
    Hope it helps
    Thanks,
    Teja

  • InfoPackage ABAP Routine - compute_time_dependent_dates

    I would like to populate start and end date for time dependent master data using ABAP. BI help / documentation says that it can be done with ABAP as mentioned below:
    InfoPackage
    Selection routines for selecting the from and to date for time-dependent data on tab page 'Update Parameters'.
    form compute_time_dependent_dates
         changing p_datefrom type d
                  p_dateto   type d
               p_subrc like sy-subrc.
    $$ begin of routine - insert your code only below this line-
              p_datefrom =
              p_dateto   =
              p_subrc = 0.
    $$ end of routine - insert your code only before this line-
    ENDFORM.
    I am unable to find the ABAP routine section or window on the update tab in the InfoPackage. Can someone let me know if i am looking at the right tab in the InfoPackage?
    Note: I can see ABAP routine section or window on the extraction tab, where we can write code for form compute_flat_file_filename.......
    Thanks in advance.
    RK.

    Dennis,
    Thanks for your feedback.
    The option you mentioned in the Data Selection tab will help me to filter the start and end dates - as long as i have start and end date as selection fields in the data source. But i was actually looking for the ABAP routine / window where i can populate the start and end dates in the form compute_time_dependent_dates....
    BI help / documentation says that it can be done with ABAP as mentioned below:
    InfoPackage
    Selection routines for selecting the from and to date for time-dependent data on tab page 'Update Parameters'.
    form compute_time_dependent_dates
    changing p_datefrom type d
    p_dateto type d
    p_subrc like sy-subrc.
    $$ begin of routine - insert your code only below this line-
    p_datefrom =
    p_dateto =
    p_subrc = 0.
    $$ end of routine - insert your code only before this line-
    ENDFORM.
    I am looking for ABAP window where i can see  form compute_time_dependent_dates...
    Let me know if you have any questions.
    Thanks,
    RK.

  • Basic Start Date and Schedule Start date

    Dear All,
    In a Preventive Maintenance order generated through IP30, I am getting Basic Start Date and Schedule Start date as different dates. For all other orders those date as coming same.   I am using forward Scheduling. Can any one of you please tell me what would be the problem?
    Regards,
    Babu R

    [SAP Note on Scheduling - Note 45433|https://websmp230.sap-ag.de/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/sapnotes/index2.htm?numm=45433]
    Regards,
    Maheswaran.

  • How to disable selection of  End Date depending on start Date.

    Hello,
    I have  2 DatePicker controls
    1) Start Date
    2) End Date
    When I select a start date  in  date picker depending on that  it should disable the  selection of  dates less than  Start date in End date Date Picker.
    Could anyone please provide solution for it.
    Thanks & regards,
    Viswanath

    You can always check UI5 core files and extend it. FYI, most of UI5 calendars are based on "MobileScroll" UI library, e.g.
    DateTimeInput - Mobiscroll - Demos and Examples - Date &amp;amp; Time - Date with min and max
    DatePicker - Mobiscroll 2.15.1 Documentation - Calendar
    Below you can find few extension examples:
    sap.m.DateTimeInput extend- JS Bin - Collaborative JavaScript Debugging&lt;/title&gt;  &lt;link rel=&quot;alternate&quot; type=&quot;application/jso…
    sap.m.DatePicker extend -> JS Bin - Collaborative JavaScript Debugging&lt;/title&gt;  &lt;link rel=&quot;alternate&quot; type=&quot;application/jso…
    Regards,
    Vladimir

  • Sample ABAP routine code to load only previous month data in INFOPACKAGE

    Hi all,
    I want to create one ABAP routine in InfoPackage (Variables change to selection values with background processing) for 0CALMONTH ( Calender year month) so that whenever this infopackage is executed it should fetch only previous month data.
    Can anyone please provide any sample code for that.
    Thanks in advance.
    Uday shankar.

    Hi
    Please check with below code, hope this will resolve your issue
    WHEN: 'ZLASTP'.
         CLEAR: h_period, h_gjahr.
         CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
           EXPORTING
             i_date               = sy-datum
       I_MONMIT             = 00
             i_periv              = 'AF'
          IMPORTING
            e_buper              = h_period
            e_gjahr              = h_gjahr
    EXCEPTIONS
       INPUT_FALSE          = 1
       T009_NOTFOUND        = 2
       T009B_NOTFOUND       = 3
       OTHERS               = 4
         IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
         ENDIF.
         IF h_period = '001'.
           h_gjahr = h_gjahr - 1.
           h_period = '012'.
         ELSE.
           h_period = h_period - 1.
         ENDIF.
         CLEAR l_s_range.
         CONCATENATE h_gjahr h_period INTO l_s_range-low.
         l_s_range-sign = 'I'.
         l_s_range-opt  = 'EQ'.
         APPEND l_s_range TO e_t_range.

  • ABAP routine for loading previous months data in infopackage

    Hi,
    I have an infopackage included in a process chain. The issue is that I need to load previous month's data through the infopackage and I have a data field which is of date type. I could not find an appropriate OLAP variable so I chose the ABAP code in the infopackage. My knowledge of ABAP is not very good so I thought I could get some insight from someone. Need this to be a periodic job/regular without any developer interference.
    Edited by: BG on Apr 9, 2008 1:03 PM

    Hi
    Try this code and see if you are able to achive the results
    data: month(2).
    data: date  like sy-datum,
          last  like sy-datum,
          first like sy-datum.
    read table l_t_range with key
    fieldname = 'BLDAT'.
    l_idx = sy-tabix.
    date = sy-datum.
    month = date+4(2).
    if month = 12.
      month = 01.
    else.
      month = month - 1.
    endif.
    move month to date+4(2).
    call function 'SLS_MISC_GET_LAST_DAY_OF_MONTH'
      exporting
        day_in                  = date
    IMPORTING
       LAST_DAY_OF_MONTH       = last
    EXCEPTIONS
      DAY_IN_NOT_VALID        = 1
      OTHERS                  = 2
    if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    first = last.
    move 01 to first+6(2).
    l_t_range-low  = first
    l_t_range-high = last
    l_t_range-sign = 'I'.
    l_t_range-option = 'BT'.
    modify l_t_range index l_idx.
    p_subrc = 0.
    paste the code as it is in your editor activate this and see if you are able to achive the results.
    assign points if useful.
    regards
    Vishal
    Edited by: Vishal Vashishta on Apr 9, 2008 2:33 PM

  • Using ABAP routines for data selection

    Hello,
    I want to use ABAP routine to determine value range of data selection in Data Package but when I use routine for one field, selection criterias for other fields are ignored, e.g.:
    in Data Package I have two selection fields:
    CPUDT     Accounting Document Entry Date
    AEDAT     Date of the Last Document Change by Transaction
    For CPUDT I wrote ABAP routine
    and for AEDAT I have just typed in period of time.
    I started data extraction and open Monitor for this Data Package.
    At Header tag I checked selections info and there is selection only for CPUDT.
    Could somebody explain me is it normal system behaviour?
    Thanks
    Andrzej

    Thanks for reply but that would be too easy...
    I have tried your advice but nothing changed.
    I think this is data extraction configuration problem.
    Andrzej

  • Infopackage Abap Routine (Selection based on other fields?)

    Dear Friends,
    I know that Abap routine is used in infopackage to select or restrict using complex data selection.
    My requirement is to restrict Material no field based on 4 other fields. Is that possible?
    Actual condition is  to load Material no only if other 4 fields combination is new.
    Pls help.
    Guru

    Hi,
    Yes you can do this at infoPackage level using the ABAP routine.
    First read the Active Table of the DSO into internal table and do a lookup for the required four fields combination.
    If these four field are new allow the material number.
    Refer the below link for more help.
    http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/a05ac9fa-f44c-2c10-dbb8-ef54c102707c
    Regards
    Manjula.B

  • InfoPackage ABAP Routine

    Hi,
    I have two text tables T1 and T2. The key in T1 and T2 are the same. Only point is T2 has very few records compared to T1.
    T1 has key and Medium Texts. T2 has the same.
    I am loading the data from T1 to T2. I need to write ABAP routine in InfoPackage to load the text data to T2 where the keys match in T1 and T2.
    Appreciate your help.
    Thanks,
    Pradeep

    Hello Kumar,
    You can do this using the following algorithm:
    1) Read the text table for T2. The text table is named /BIC/T<name of T1 infoobject). For example, if my infoobject is ZSAMPLE, then my text table for that is /BIC/TZSAMPLE.
    2) For each row in T2, check if the key can be found in T1.
    3) If yes,then place the key for that current row in a selection.
    4) if not, ignore the key
    Here's a sample code:
    data: l_sel type  rssdlrange.
    data: t_t2 type table of /BIC/TT2,
          e_t2 type  /BIC/TT2,
          e_t1 type /bic/tt1.
    select * from /BIC/TT2 into table t_t2.
    loop at t_t2 into e_t2.
      select single * from /bic/tt1 into e_t1 where
        /bic/t1 = e_t2-/bic/t2.
      if sy-subrc eq 0.
        l_sel-fieldname = '/BIC/T1'.
        l_sel-SIGN = 'I'.
        l_sel-OPTION = 'EQ'.
        l_sel-LOW = e_t2-/bic/t2.
        append l_sel to l_t_range.
      endif.
    endloop.
    Hope this helps.

  • ABAP routin for geeting previous month

    Hello.......
    I want to writ an ABAP routin at the infopackage level.
    I want to get the previous month ( period ).
    example : if sy-datum is 2007.01.01
    output : 2006.12.01.
    reply.
    Thanks in advance.

    Hi,
    Write this in the start routine of infosource or update rules...
    Try this:
      DATA: L_DATE LIKE SY-DATUM.
      DATA: L_YEAR TYPE I.
      DATA: L_MONTH TYPE I.
      L_DATE = (Here enter your input).
      MOVE '01' TO L_DATE+6(2).
      MOVE L_DATE(4) TO L_YEAR.
      MOVE L_DATE+4(2) TO L_MONTH.
      L_MONTH = L_MONTH - 1.
      IF L_MONTH LT 1.
        L_YEAR = L_YEAR - 1.
        L_MONTH = 12.
      ENDIF.
      MOVE L_YEAR TO L_DATE(4).
      MOVE L_MONTH TO L_DATE+4(2).
      MOVE:  L_DATE TO P_DATE.
    Hope this helps
    PB

  • ABAP Routine for FISCPER

    Dear members
    Y would like your help to create an abap routine into the infopackage.
    I want to obtain last period from current month (sy-datum), for the characteristic 0fiscper at the infopackage
    those anyone know how to create a routine that do that?
    For example
    2010001 to 2009012
    Thanks
    Ariel

    Give tnis a try:
    Global Declarations
    CONSTANTS: c_1(1) TYPE n VALUE 1,
               c_fiscvarnt TYPE /bi0/oifiscvarnt VALUE 'Z1',  "Use whatever your default Fiscal Year Variant is"
               c_i(1) TYPE c VALUE 'I',
               c_bt(2) TYPE c VALUE 'BT'.
    DATA: l_tabix LIKE sy-tabix,
          l_fiscper3 TYPE /bi0/oifiscper3,
          l_fiscyear TYPE /bi0/oifiscyear,
          l_min TYPE /bi0/oifiscper,
          l_max LIKE /bi0/oifiscper.
    Routine
    CLEAR: l_fiscper3,
           l_fiscyear.
    CALL FUNCTION
      'DATE_TO_PERIOD_CONVERT'
    EXPORTING
      i_date  = sy-datum
      i_periv = c_fiscvarnt
    IMPORTING
      e_buper = l_fiscper3
      e_gjahr = l_fiscyear.
    CONCATENATE: l_fiscyear l_fiscper3 INTO l_max.
    l_fiscper3 = l_fiscper3 - c_1.
    IF l_fiscper3 LT 1.
      l_fiscyear = l_fiscyear - c_1.
      l_fiscper3 = c_1.
    ENDIF.
    CONCATENATE: l_fiscyear l_fiscper3 INTO l_min.
    READ TABLE
      l_t_range
    WITH KEY
      fieldname = 'FISCPER'.
    MOVE: sy-tabix TO l_tabix,
          c_i TO l_t_range-sign,
          c_bt TO l_t_range-option,
          l_min TO l_t_range-low,
          l_max TO l_t_range-high.
    MODIFY
      l_t_range
    INDEX
      l_tabix.
    p_subrc = 0.

  • ABAP Routine for Deleting and creating index for ODS in Process chains

    Any pointers for the ABAP Routine code for deleting and creating index for ODS in Process chains.

    Hi Sachin,
    find the following ABAP code to delete ODS ondex.
    data : v_ods type RSDODSOBJECT.
    move 'ODSname' to v_ods .
    CALL FUNCTION 'RSSM_PROCESS_ODS_DROP_INDEXES'
      EXPORTING
        I_ODS = v_ods.
    To create index:
    data : v_ods type RSDODSOBJECT.
    move 'ODSname' to v_ods .
    CALL FUNCTION 'RSSM_PROCESS_ODS_CREA_INDEXES'
      EXPORTING
        I_ODS = v_ods.
    hope it helps....
    regards,
    Raju

Maybe you are looking for

  • How can I create a filter for an exact set of characters?

    Hello! I am setting up a filter to catch messages with GG in the subject. Sometimes this will be at the beginning of the subject (no space at the front) and other times it will be somewhere in the middle. The problem I'm having is that this filter ca

  • Macbook pro boots with windows 7 but not with osx lion.

    I have bought macbook pro 1year ago. it has dual boot, its booting with windows 7 perfectly fine but its not booting up OSX lion shows grey screen and wheel just keep moving.

  • Error in running juit test case for struts2 action class

    Hi, I am getting error when i am running my junit test case for struts2 action class. Here is the code. public class RoleMasterNewActionTest extends StrutsTestCase {      public void setUp() throws Exception {         super.setUp();         ObjectFac

  • Functional location is not picking value from F4 help

    Hi experts, In my system for transaction IW21, functional location is not populating when using F4 help. this is only when am selecting through cost centre, for all other selection methods func. loc is populating. could you provide me any solution so

  • Need help installing classic/OS X (10.4) on PowerMac G4

    I'm hoping someone can help me, my brother bought himself a new computer and gave me his Powermac G4 http://support.apple.com/specs/powermac/PowerMac_G4_Quicksilver2002.html the M8666LL/A model. Now this computer is a mess so I want to completely ref