ABAP Routine in the InfoPackage

Hello,
I need to write an ABAP Routine in the infopackage to populate the selection conditions automatically. Coding is for Fiscal year/Period and it should be populated as LOW - Pervious period and HIGH - Current period.
I tried to do the coding myself but couldn't able to fetch the current and previous periods. I would be grateful if some one can share the code with me.
Best Regards,
Nene.

Hello,
Try this.
1) Identify the current period by inputting sy-datum to function module  'DATE_TO_PERIOD_CONVERT'.
2) Find the first day of current period using function module
    'FIRST_DAY_IN_PERIOD_GET'
3) Minus one day from the first day of current period to get previous period last date.
4) Call the same function module 'DATE_TO_PERIOD_CONVERT' by inputting the previous period last date (derived in step 3).
5) Pass the values to the infopackage code.
$$ begin of routine - insert your code only below this line        -
data: l_idx like sy-tabix.
  read table l_t_range with key
       fieldname = '<field name>.
  l_idx = sy-tabix.
  l_t_range-SIGN   = 'I'.
  l_t_range-OPTION = 'BT'.
  l_t_range-LOW    = <previous period> (refer step 4)
  l_t_range-HIGH   =  <current period>  (refer step 1)
  modify l_t_range index l_idx.
Thanks
Viswa
(Assign points if helpful).

Similar Messages

  • ABAP routine in the infopackage for Multiple Selection

    Hi experts,
    I want to include a abap routine in the infopackage for Multiple Selection so that I can fetch only the required Material Numbers when the InfoPackage is schedule. As I have the constraints that I have to select certain Material Numbers only, that are not in series - so I cannot select"BT' fuction. Tell me what ABAP Code will work in this scenario.
    Kind regards,
    Rajesh Giribuwa

    Hi,
    The Routine will have to use 'EQ' operator and Append each selections to the Structure.
    ABAP Routine
    InfoPackage definition for Bespoke SIS Structure
    Infopackage routine !
    Regards
    Happy Tony

  • ABAP Routine in the Infopackage data selection

    All,
    I have requirement where i need to write a routine on a Date field(Activity Year Month) which has to return values from the first to the last day of the Previous month in the data selection of the infopackage.
    I know that on Date there is a STD that can be used but my requirement is on Year Month.
    there are 3 vartypes available
    5. free temporal selection
    6. ABAP routine
    7. OLAP variable
    when i pick ABAP routine it asks me to create a routine i need some help with the code here
    Can someone help.
    Thanks

    Hi there
    If the Data field is 0FISCPER you can use the OLAP variable 0P_PRFP1. If you have developed the field yourself i think you need to write code. The code could look something like this.
    DATA:  sysdat TYPE d.
      sysdat = sy-datum.
      sysdat4(2) = sysdat4(2) - 1.
      IF sysdat+4(2) = '0'.
        sysdat+4(2) = '12'.
        sysdat(4) = sysdat(4) - 1.
      ENDIF.
      CONCATENATE sysdat(4) '0' sysdat+4(2) INTO l_t_range-low.
      MODIFY l_t_range INDEX l_idx.
      p_subrc = 0.
    This code returns the previous months as a single value.
    Chris

  • Routine at the Infopackage level-Urgent

    Hi,
    My requirement is I need to write an routine at the infopackage level for the fiscal period which should have the low value as the current period and the high value as current period +12 months.
    For example.
    As per the system date the
    low value should be 2007.09
    and the high value shoudl be 2008.09.
    Could anyone help me with the ABAP code.Points would be assigned.
    Regards,
    vamsi

    data: l_idx like sy-tabix.
              read table l_t_range with key
                   fieldname = 'FISCPER'.
              l_idx = sy-tabix.
    data: l_year                like T009B-BDATJ,
          l_period              like T009B-POPER,
          today                 like SY-DATUM.
    data: l_fiscperlow like l_t_range-low.
    data: l_fiscperhigh like l_t_range-high.
          today = SY-DATUM.
            CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
              EXPORTING
                I_DATE               = today
              I_MONMIT             = 00
                I_PERIV              = 'Z1'
              IMPORTING
                E_BUPER              = l_period
                E_GJAHR              = l_year
            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.
            concatenate l_year l_period+1(2) into l_fiscperlow.
          l_t_range-low = l_fiscperlow.
          l_t_range-high = l_fiscperlow+12.
          l_t_range-option = 'BT'.
          l_t_range-sign = 'I'.
          modify l_t_range index l_idx.
          p_subrc = 0.
              modify l_t_range index l_idx.
              p_subrc = 0.
    This is the code which i had written but when i execute the infopackage i am aboe to see only the low value 200709 in the infopackage selections and unable to see the high value,Could any one suggest me if i missed something in the code.
    regards,
    Vamsi

  • Routine at the infopackage

    Hi,
    If i write a routine at the infopackage level and if i specify the selection criteria for other infoobjects,they are not taken into consideration while the data is getting loaded.
    Could anyone of you help me as how to handle this.
    Regards,
    Subha

    Hi,
    The selections in the infopackage are the selctions in my routine.
    the code is
      tables /BIC/TZCS_GROUP.
    *data: v_year(4) type c.
      clear l_t_range.
      clear l_t_range[].
      v_year = sy-datum+0(4).
      l_t_range-iobjnm = '0CS_VERSION'.
      l_t_range-fieldname = 'CS_VERSION'.
      l_t_range-sign = 'I'.
      l_t_range-option = 'EQ'.
      l_t_range-low = '100'.
      l_t_range-high = SPACE.
      append l_t_range.
      l_t_range-iobjnm = '0FISCYEAR'.
      l_t_range-fieldname = 'FISCYEAR'.
      l_t_range-sign = 'I'.
      l_t_range-option = 'EQ'.
      l_t_range-low = 2007.
    *l_t_range-low = v_year.
      l_t_range-high = SPACE.
      append l_t_range.
       l_t_range-iobjnm = '0FISCPER3'.
      l_t_range-fieldname = 'FISCPER3'.
      l_t_range-sign = 'I'.
      l_t_range-option = 'EQ'.
      l_t_range-low = 001.
      l_t_range-high = SPACE.
      append l_t_range.
      select * from /BIC/TZCS_GROUP.
        if /BIC/TZCS_GROUP-/BIC/ZCS_GROUP cs 'GROUP'
      or /BIC/TZCS_GROUP-/BIC/ZCS_GROUP cs 'SUBS'
       or /BIC/TZCS_GROUP-/BIC/ZCS_GROUP cs 'WORLD'.
          l_t_range-iobjnm = 'ZCS_GROUP'.
          l_t_range-fieldname = '/BIC/ZCS_GROUP'.
          l_t_range-sign = 'I'.
          l_t_range-option = 'EQ'.
          l_t_range-low = /BIC/TZCS_GROUP-/BIC/ZCS_GROUP.
          l_t_range-high = space.
          append l_t_range.
        endif.
      endselect.
      l_t_range-iobjnm = 'ZCS_GROUP'.
      l_t_range-fieldname = '/BIC/ZCS_GROUP'.
      l_t_range-sign = 'I'.
      l_t_range-option = 'EQ'.
      l_t_range-low = space.
      l_t_range-high = 'XXXXXX'.
      append l_t_range.
      p_subrc = 0.
    or please help me handle this funtionality at the update rule level.
    Points will be assigned
    Regards,
    Subha

  • ABAP routine in Infopackage

    I am in the process of creating an ABAP routine in the Infopackage to load current month based on system data from one cube in BW to another Cube in BW. I am getting the following error in the load. I am not an ABAPer and would appreciate if you can help or guide me with a sample code.
    Here is the error.
    For sel. field '/BIC/Z_APOSNAP', no selection with SIGN = ''; OPTION '' allowed.
    Thank you
    Neelu

    Hi Neelu,
    U can create a ABAP Routine of the type 6 (ABAP Routine),The field you are trying to populate is a select-option so you have to define both Sign and Option along with Low and High values.
    As u want to load current month, from a system values , u can do it from sy-datum.
    data: l_idx like sy-tabix.
              read table l_t_range with key
                   fieldname = ''/BIC/Z_APOSNAP'.
                l_idx = sy-tabix.
                l_t_range-low = 
                l_t_range-high = 
                l_t_range-sign =
                l_t_range-option =
          modify l_t_range index l_idx.
              p_subrc = 0.
    Just u can fill Sign as 'I' and Option 'EQ'.
    Fill Low and High with values u get from System Data.
    Hope this Helps,
    Thanks,
    Krish
    **awarding points is way of saying thanks in SDN.

  • Use ABAP Routine in Selection Tab of Infopackage

    I am trying to use the ABAP routine in the InfoPackage SELECTION Tab to "EXCLUDE" a value. For example, I want to load all the Material types, except ZUN1. But, when I write in the ABAP, l_t_range-sign = 'E' instead of 'I' or l_t_range-option = 'NE' instead of 'E', I get an error saying these values are not permitted.
    Is there any way to exclude any value from Selection in the InfoPackage?
    Regards,
    Milind Vad

    Hi dear and welcome on board!
    You have two options:
    include everything you want in your IP
    load everything and exclude what you don't want in the start routine in transfer rules
    No other ways...
    Hope it helps!
    Bye,
    Roberto
    ...and please don't forget to reward the answers...it's THE way to say thanks here !

  • ABAP Routine using Table: TVARVC in InfoPackage

    hello...i wanted to create an ABAP Routine in the InfoPackage and I am not good in ABAP Routine. I wanted to pull the data of the "selection value" from the TVARVC table to fill in the "Calendar Day" selection option in the InfoPackage. The selection option for the calendar day should be able to pull out the data from the TVARVC table and save the InfoPackage to load the data based on the selection value. Actually what can I do to archieve this???

    Hello
    You ABAP code is quite right, but there is only one little thing wrong :
    Define i_keyfind LIKE TVARVC   (as a structure)
    Don't DELETE l_t_range, you just have to modify the line.
    SELECT LOW FROM TVARVC into i_keyfind-low WHERE NAME = 'ZTEST'.
    IF sy-subrc eq 0.
    l_t_range-low = i_keyfind-low.
    ENDIF.
      IF l_idx <> 0.
        MODIFY l_t_range INDEX l_idx.
      ELSE.
        APPEND l_t_range.
      ENDIF.
    It should work with this.
    Kind Regards
    Mickael

  • Load data only for current month using ABAP Routine

    Hi Everyone,
    I am loading data from R/3 using the 0HR_PA_OS_1 extractor. This requirement is to load the position numbers from R/3. Using the extractor for a given position 28 I get the following dataset results.
    CALMONTH  POSITION
    11-2004           28
    12-2004           28
    01-2005           28
    02-2005           28
          |
    07-2007          28     CURRENT DATE
    Now when I pull data in BW I only want to load the record for most current i.e. 07-2007. I DO NOT want that ALL the records since the day the position was created should be loaded.
    Now I do understand this can be achieved using a ABAP routine in the INFOPACKAGE. Below is the routine that I am using and what it is doing is that it is only bringing in the first record.
    data: l_idx like sy-tabix.
      clear: l_idx.
      read table l_t_range with key
           fieldname = 'CALMONTH'.
      l_idx = sy-tabix.
    Current month only
      l_t_range-low = sy-datum(6).      "Current month
    l_t_range-high.
      l_t_range-option = 'EQ'.                           "equals
    l_t_range-sign = 'I'.
      modify l_t_range index l_idx.
      p_subrc = 0.
    Can anyone suggest a solution as to why this is happening?
    Thanks,
    Rahul

    One explanation would be
    - If there is no CALMONTH selection values specified in the selection tab, l_t_range would be empty. This would mean there would be no line for CALMONTH selection, and the code won't modify the l_t_range.
    If this is true, you need to check sy-subrc after reading from the itab.
    data: l_idx like sy-tabix.
    clear: l_idx.
    read table l_t_range with key fieldname = 'CALMONTH'.
    if sy-subrc = 0.
    l_idx = sy-tabix.
    * Current month only
    l_t_range-low = sy-datum(6). "Current month
    * l_t_range-high.
    l_t_range-option = 'EQ'. "equals
    * l_t_range-sign = 'I'.
    modify l_t_range index l_idx.
    else.   
    move 'CALMONTH' to l_t_range-fieldname.
    l_t_range-low = sy-datum(6).
    l_t_range-sign = 'I'.
    l_t_range-option = 'EQ'.
    append l_t_range.
    endif.
    p_subrc = 0.

  • 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.

  • What is the significance of create routines found in infopackage?

    hi all,
    Can anyone explain me with an example the significance of create routines found in infopackage - external data tab.
    And as well as writing an abap routine in the data selection tab of the info package.
    regds
    hari

    hi,
    if u want to load only particular values to the particular field... let s say example
    material colour = 'Red'
    by writing routine at infopackge in data selection tab u can achive this
    its just one example
    Check this thread...
    Flatfile renaming logic and upload date logic!
    thanks
    Message was edited by:

  • Call function in abap routine of infopackage

    Experts,
    Good day. I have a problem concerning the data to be imported in my ods.I can't find a similar thread corcerning my problem. My ‘File date’ field should contain only 2 years and 3months data of recent data. I'm using a call function fima_date_create to filter values of zfile_date.
    CALL FUNCTION 'FIMA_DATE_CREATE'
      EXPORTING
        I_DATE                             = sy-datum
        I_FLG_END_OF_MONTH   = ' '
        I_YEARS                          = 2-
        I_MONTHS                        = 3-
        I_DAYS                             = 0
        I_CALENDAR_DAYS          = 0
        I_SET_LAST_DAY_OF_MONTH       = ' '
      IMPORTING
        E_DATE                             =
        E_FLG_END_OF_MONTH   =
        E_DAYS_OF_I_DATE         =   
    The sy-datum becomes the “High” value and the date generated by this FM will be the “low” value. I already tested this function module and it is what i want. How Should I write the ABAP code for this in the abap routine for my infopackage? Or what steps do I need to take.

    Hi,
    When you choose the option to write a routine for one of the characteristics in the infopackage selections, you get a window to write your code with some prewritten code as below. Modify it as shown below, for your requirement.
    data: l_idx like sy-tabix.
    read table l_t_range with key
         fieldname = 'CALDAY'.
    l_idx = sy-tabix.
    START of YOUR CODE
    <----
    Required logic -
    >
    L_T_RANGE-LOW  = <lower limit of range>.
    L_T_RANGE-HIGH = <upper limit of range>.
         L_T_RANGE-SIGN = 'I'.
         L_T_RANGE-OPTION = 'BT'.
    END of YOUR CODE
    modify l_t_range index l_idx.
    p_subrc = 0.
    Hope this helps.

  • Need to write ABAP Routine at infopackage Selection Options

    Hi All,
    I need to write ABAP Routine at Info Package Selection Options.
    Requiremnet i need to bring  some Sales Document Types (Sales Orders Types) only from R/3.
    Ex I need OrderTypes ZQT,ZSIV etc
    Can any body help to resolve this.
    Regards,
    P.C.V.

    Hi P.C.V,
    If the order type field is already available in the Data Selection Tab of the InfoPackage, then you just need to place your selections there (e.g. order type = ZQT, ZSIV) without the need to use ABAP routines.
    If ever you really need an ABAP routine, here is an example ABAP routine. The most important concept is to modify the range table l_t_range so that the selection reflect what you need.
    data: l_idx like sy-tabix.
    data: w_startdate like sy-datum,
          w_startweek like scal-week,
          w_maxdate like sy-datum,
          w_maxweek like scal-week.
      w_startdate = sy-datum.
      w_maxdate = w_startdate + 104 * 7.
    * Calculate horizon for extraction
      CALL FUNCTION 'DATE_GET_WEEK'
        EXPORTING
          DATE         = w_startdate
        IMPORTING
          WEEK         = w_startweek
        EXCEPTIONS
          DATE_INVALID = 1
          OTHERS       = 2.
      CALL FUNCTION 'DATE_GET_WEEK'
        EXPORTING
          DATE         = w_maxdate
        IMPORTING
          WEEK         = w_maxweek
        EXCEPTIONS
          DATE_INVALID = 1
          OTHERS       = 2.
              read table l_t_range with key
                   fieldname = 'CALWEEK'.
              l_idx = sy-tabix.
              l_t_range-sign = 'I'.
              l_t_range-option = 'BT'.
              l_t_range-low = w_startweek.
              l_t_range-high = w_maxweek.
              modify l_t_range index l_idx.

  • 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

Maybe you are looking for

  • Capturing Issues

    Setup: Mac Pro 2X2.26 Ghz Quad Core Xeon Mac OSX v. 10.6.5 FCP: v. 7.0.3 AJA Kona LHi Capture Card AJA KLHi Breakout Box Problem: Whenever I capture anything through my AJA Kona LHi Capture Card, I have an issue of a thin strip of distorted lines at

  • HT4864 Mail once again not "online"; Anyone else having this issue?

    Anybody having Mail issues this afternoon? Monday 12/03/2012? iCloud support indicates systems are all online; however, when I login to iCloud and try to access email from there, I get the message that an error has happened and there are "missing res

  • Sorry to start a similar topic ...but

    This is driving me crazy. Today running XP Home in BootCamp 2.0 freezes immediately when it reaches desktop. No mouse or keyboard so I have to power down. I have erased the partition, created a new one and reinstalled windows and the Bootcamp drivers

  • Deski Report Issue

    1. I have a requirement in which I need to show a column values with (lets say A), checkboxes as below CB a1                              CB a2                   CB a3                      CBa4 CB a5                              CB a6                

  • Can't preview .nef in Window or Bridge

    I bought a computer with XP pro. Now I can't preview .nef file any more. Both in Window & Bridge. What am I doing wrong ? Thanks, Ron