Routine in Infopackage selection

Hi,
We are using DB Connect and hence we need to write a routine in Infopackage selections to restrict the data to be extracted.
In the source file, there is a field called " Time stamp".
This is a Char 23 field with mm-dd-yyyy-hh.mm.ss.sssss format.
My requirement is lookinto first 10 char ( only for date) and filter the records.  If the date = Sy-datum, then only, i want to extract the data in BI staging.
Is it possible to write a routine in Infopackage ?   Can you pls help me ?
Or do i need to take the whole data into PSA and then write a routine in transformation while uploading to Data Target ?
Regds,
BW Small

Hi,
See the below code for Including  0FISCPER dynamically, so in that way you can write code to get your selection or change the data formate etc.., show this code to ABAPer ask according to this code implement your logic.
In below code I'm calculating  0FISCPER based on Sy-Datum using FM.
program conversion_routine.
* Type pools used by conversion program
type-pools: rsarc, rsarr, rssm.
tables: rssdlrange.
* Global code used by conversion rules
*$*$ begin of global - insert your declaration only below this line  *-*
* TABLES: ...
* DATA:   ...
*$*$ end of global - insert your declaration only before this line   *-*
*     InfoObject      = 0FISCPER
*     Fieldname       = FISCPER
*     data type       = NUMC
*     length          = 000009
*     convexit        = PERI7
form compute_FISCPER
  tables   l_t_range      structure rssdlrange
  using    p_infopackage  type rslogdpid
           p_fieldname    type rsfnm
  changing p_subrc        like sy-subrc.
*       Insert source code to current selection field
*$*$ begin of routine - insert your code only below this line        *-*
  DATA: l_idx LIKE sy-tabix,
        zzdate LIKE sy-datum,
        zzbuper LIKE t009b-poper,
        zzbdatj LIKE t009b-bdatj,
        zzperiod(7) TYPE c.
  READ TABLE l_t_range WITH KEY
       fieldname = 'FISCPER'.
  l_idx = sy-tabix.
  zzdate = sy-datum - 1.
  CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
    EXPORTING
      i_date               = zzdate
*             I_MONMIT             = 00
      i_periv              = 'V3'
           IMPORTING
     e_buper              = zzbuper
     e_gjahr              = zzbdatj.
*           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 zzbdatj zzbuper INTO zzperiod.
  l_t_range-low = zzperiod.
  l_t_range-option = 'EQ'.
  l_t_range-sign = 'I'.
  MODIFY l_t_range INDEX l_idx.
  p_subrc = 0.
*$*$ end of routine - insert your code only before this line         *-*
endform.
Thanks
Reddy

Similar Messages

  • ABAP routine at Infopackage selection options

    Dear all,
    I need to write ABAP Routine at InfoPackage Selection Options.
    Requirement is to bring only the versions (contains 2 characters) starting with 'C'.
    Ex. I need versions CR, CP...
    Code template is the following:
    data: l_idx like sy-tabix.
    read table l_t_range with key
         fieldname = 'VERSB'.
    l_idx = sy-tabix.
    modify l_t_range index l_idx.
    p_subrc = 0.
    Can anybody help me to resolve this?
    Regards

    Hi,
    here is an example:
      DATA: string(40) TYPE c.
      CONCATENATE 'C' '%' INTO string.
      SELECT *
      FROM /bi0/hwbs_elemt
      INTO TABLE lt_hwbs_elemt
      WHERE nodename LIKE string.
    Best regards,
    Frank

  • *** Abap Routine in Infopackage selection ***

    Hi !!!
    I have the scenario below:
    I have created an infoobject called CAEMPFF. In the infopackage selection under field 0COMP_CODE I want to create an abap rotine to read all vaules filled in CAEMPFF.
    How can I do that using abap routine ?
    Thanks in advance,
    Leandro.

    Hi Leandro,
    In the infopackage, under 0comp_code (or probably field BUKRS if it's an ERP datasource), you should select ABAP routine (6) under Type field. Then, you'll be prompted to create the routine.
    There you should create a program that reads all the values of your infoobject master data table.
    Hope this helps.
    Regards,
    Diego

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

  • Routine for multiple selection in infopackage???

    hello guys
    I thought of creating one routine for Multiple selections aT Infopackage level....in Selections screen in infopackage,I found one option 'Use Conversion routine' with a check box and it is inactive.....Is it here I need to write my routine inorder to get multiple selection for a infoobject....or is it somehwhere else?How to activate thisoption?
    Thanks,
    Regards,
    S

    Hi,
    Conversion routines are used in the BI system so that the characteristic values (key) of an InfoObject can be displayed or used in a different format to how they are stored in the database. They can also be stored in the database in a different format to how they are in their original form, and supposedly different values can be consolidated into one.
    This will be there at info object level.
    Eg : ALPHA: Fills purely numeric fields from the left with zeroes (0).
    For multiple selections at info package , in data selection tab under type , u need to select 6 and write the code to select the value.When info package runs it takes the value from routine dynamically and extracts the data based on selection.
    Eg: There is a field FISCAL PERIOD For data selection, if u write the code to select current fiscal period. then whenever info package runs it extracts the data for current fiscal period from data source to PSA.
    Thanks,
    Joseph.

  • Infopackage Selections Tab-OLAP Variable/ABAP Routine

    Hi Experts
    In my Infopackage Selections Tab i had Cal Mon/Year field....
    As per my requirment i have to write a selection condion that when we execute info package (it is a monthly data load)  it will extract data only for the months greater than or equal to current month
    Please update me on how can i achieve this either by using OLAP Variable or ABAP Routine in infopackage...will be great if can provide the required ABAP Code
    Thanks in Advance

    here's an example that fills the fiscal year from last month (bold is customer code... the rest is standard):
      data: l_idx like sy-tabix.
      read table l_t_range with key
           fieldname = 'PARAM_P_GJAHR'.
      l_idx = sy-tabix.
      data:
      v_caldy type /BI0/OICALDAY,
      v_calmn type /BI0/OICALMONTH,
      v_calyr type /BI0/OICALYEAR.
      v_caldy = sy-datum.
    determine first day*
      v_caldy+6(2) = '01'.
    determine last month*
      subtract 1 from v_caldy.
      v_calyr = v_caldy(4).
      l_t_range-sign   = 'I'.
      l_t_range-option = 'EQ'.
      l_t_range-low    = v_calyr.
      modify l_t_range index l_idx.
      p_subrc = 0.

  • ABAP Routine in InfoPackage for selection

    Hello,
    I have 2 InfoPackages for loading from ODS1 to ODS2. InfoPackage 1 is restricted via ABAP Routine to load only certain customer numbers.
    InfoPackage 2 is supposed to load all other customer numbers - therefore the ABAP Routine makes ranges that exclude the customer numbers selected in InfoPackage 1.
    Now I face the fact that the selection of InfoPackage 2 is much to small in numbers. Problem is, the ranges only work when entered manually - but via ABAP entry these ranges don`t work. I can`t understand why this problem happens. Do you have an idea?
    Example (first number is from, 2nd number is to)
    InfoPackage 1:       customer numbers     
    5| 5
    100|100
    999|999
    InfoPackage 2: customer numbers
    0|4
    4|99
    101|998
    1000|99999
    But selection of InfoPackage 2 does not work propberly...
                                                                                    Thanks for your help,
    Angelika

    Hi,
    no, that was just a typing mistake. Sorry.
    The problem is, that in Monitoring I can see the selection and it looks good.
    But when I check the number of datasets selected it is far to small. Therefore I don`t believe the selection works.
    I tried manually to put all the ranges selected by ABAP Routine in InfoPackage 2 in another InfoPackage 3 - the selection is identically to InfoPackage 2 (but not made via ABAP, but manually) and in Monitoring the selection looks absolutly alike.
    But the manuall InfoPackage 3 selects far more records than InfoPackage 2.
    I can`t understand the problem. Can you? Can you give me advice?
    Thanks,
    Angelika

  • 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

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

  • ABAP routine in infopackage that runs function in ECC

    Hi All
    I need to have dynamic filter in the info package
    I have program in ECC that brings me the value that I need to filter in my info packege
    I want to use  ABAP routine in infopackage that runs function in ECC and brings the value that was received from the ECC function
    Is that possible?
    Thanks

    Hi All
    my CTO found the following option
    function module that is "remote-enabled module "
    then you call CALL FUNCTION 'Y_FM_IDOC_CATSDB' DESTINATION 'SAP4.7E'
    you need to define it in SM59
    code example
    data: BEGIN OF IT_SOBSL OCCURS 0,
          SOBSL(2),
          END OF IT_SOBSL.
    DATA: ls_range type STANDARD TABLE OF rssdlrange WITH HEADER LINE.
    SELECT /BIC/ZSPEPROCI FROM /BIC/SZSPEPROCI INTO TABLE IT_SOBSL
                          WHERE /BIC/ZSPEPROCI NOT BETWEEN 'AA' AND 'ZZ'
                          AND /bic/zspeproci ne '' .
    BREAK-POINT.
    LOOP AT IT_SOBSL.
    ls_range-IOBJNM = 'SOBSL'.
    ls_range-LOW = IT_SOBSL-SOBSL.
    ls_range-SIGN = 'I'.
    ls_range-OPTION = 'EQ'.
    APPEND ls_range .
    ENDLOOP.
    loop at ls_range.
      append ls_range to l_t_range.
    endloop.

  • Routine in data selection tab

    hi friends,
    i need to write routine in data selection tab , i need like when ever i open need to show current data.
    how can i write coding.
    i have code like this, please correct my code
    L_t_RANGE_IOBJNM = '0CALDAY'.
    L_t_RANGE-FIELD NAME = 'CALDAY'.
    L_t_RANGE-SIGN = 'I'.
    L_t_RANGE-OPTION = 'EQ'.
    L_t_RANGE-LOW = sy-datum .
    I DIDNT UNDERSTAND HERE WHAT IS ACTUALLY IOBJNM  WHAT DO U MEAN BY LOW AND HIGH ACTUALLY. FIELD NAME MEANS I NEED TO MENTION LIKE/BIC/ZMNO LIKE .
    THANKING U,
    SUNEEL.

    Check below link to understand the RANGE type objects in ABAP. The OBJNAM is the object name which is used for selection in the InfoPackage. l_t_range is the internal table which contains all the selections used in the InfoPackage. So, if you need dynamic selections you have to code to populate dynamic values for the corresponding InfoObject in this Internal table. Low/High are the fields which actually contains the "From" and "to" range in selection. 
    Option -  <,>,=, <> etc.
    Sign -Include/Exclude (I/E)
    http://help.sap.com/saphelp_nw2004s/helpdata/en/9f/dba71f35c111d1829f0000e829fbfe/content.htm
    Regards,
    Sree

  • ABAP Routine at infopackage dataselection

    I got one scenario to use ABAP Code.
    In data selections we have CALWEEK.
    We are loading to from flatfile to cube.Every week we load the data to cube.
    If the flat file week=present week(sys week) then update to cube or else fail.

    Hello,
    In infopackage write the below routine for week selection.
    data: l_idx like sy-tabix.
    read table l_t_range with key
         fieldname = 'CALWEEK'.
    l_idx = sy-tabix.
    data: g_week type /BI0/OICALWEEK.
    CALL FUNCTION 'DATE_GET_WEEK'
    Exporting
         DATE = sy-datum
    Importing
         WEEK = g_week.
    l_t_range-iobjnm = '0CALWEEK'.
    l_t_range-FIELDNAME = 'CALWEEK'.
    l_t_range-sign = 'I'.
    L_T_RANGE-OPTION = 'EQ'.
    l_t_range-LOW = g_week.
    modify l_t_range index l_idx.
    p_subrc = 0.
    Note: the above example is with reference to char 0CALWEEK.
    Regds,
    Shashank

  • Regarding the routine in infopackage

    Hi Experts,
    I have an infopackage with only full load update,i am loading a daily load into the target with that ..now what i want to know is that i want to create a routine in infopackage so that it deletes the previous day data automatically ..so that if i am loading todays data it wont be duplicated..so can any one give me the code and step by step ways to  do that ..i would appreciate the answers and assign maximum points for the valuable one...
    regards,
    Rk

    If it is going to be full load, you have some options like:-
    a. At Infopackage Level:- Under the data-targets tab, you have a check box for deleting the targets contents before loading, if you check that tab, the data will be deleted automatically before loading.
    But beware that ALL data will be deleted and only today's data will remain there.
    b. Process Chains:- If your selections are same, you can use a process type "Delete Overlapping Request" in the process chain, and it will delete the contents before reloading them.
    Hope this helps.
    Cheers,
    Sumit

  • Routine in Infopackage - Extraction

    Hi All,
    I want to know ; How to write Routine in the Infopackage Extraction?
    I know that we can write Routine in Infopackage extraction.
    PLease let me know the steps.
    Regards,
    Macwan James.

    Hi
    In ifopackage we use routine for selection, please find below threads related to this which will be helpfull to you:
    Infopackage Selections Tab-OLAP Variable/ABAP Routine
    ABAP Routine correction in the selections fields of a Infopackage
    Re: how to write routine for infopackage
    Regards
    Ravi

  • Number of Lines limited in InfoPackage Selection?

    Hello Experts!
    I have 2 InfoPackage in order to load Data from ODS1 into ODS2. Selection is made for customer number - exact criteria is made via Abap Routine in InfoPackage. (InfoPackage 1 has all customers meeting a certain criteria - InfoPackage 2 has all the ranges in between the customer Numvers of InfoPackage 1).
    Therefore the load of both InfoPackages should load all data - but the problem is, I only get a small part of the Data. In ODS 1 there are some 2.800.000 entries and in ODS2 the load of the 2 InfoPackages only select about 30.000 entries.
    Since the selection criteria in monitoring seem fine - do you have any idea where the problem comes from? Is there a max. number of lines for selection to be made in infoPackage?
    Thanks for your help!
    Angelika

    Hi Angelika,
    check out the monitor --> in the request tree check the numbers coming into the update rules an coming out of the update rules, may be you are loosing some records there. The only thing that I know about the size of selections is that you will get a dump if you have to many entries in a select-option table (and having those lines in a infopackage is nothing else).
    Another reason might be a missing alpha conversion of the entries in the infopackage.
    kind regards
    Siggi

Maybe you are looking for