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

Similar Messages

  • What is use of routine in Infopackage screen

    Hi,
    What is use of routine in Infopackage screen.
    can anyone provide me a scenerio.
    Thanks,
    cheta.

    Yes they are very helpful...
    I will explain you one scenario....
    Because of certain irregularities in the system, I have to take a full upload everyday from 1st Apr 2007 to the current date...earlier I was extracting that data manually because I have to give the current date in the "TO" field....now my From date is 1st April 2007 and From Date is Sy-Datum...now this package is scheduled and I have removed the manual intervention.
    Hope this clears you.
    Regards
    Gajendra

  • Include for Routine in Infopackages

    Hi All,
    i created a routine in infopackage. The extraction is working as expected.
    We have several Infopackages which should work with the same logic.  That means i have to copy the routine in all IP.
    I would like to avoid that by inserting  the routine in an include so that by changing something, the chnage should be central.
    I could i do it?
    Thanks

    Hello,
    you can write a universal routine in se38 and call it in all your IP. You can also implement OOPs concept and use a global class for your requirement. Goto tcode SE24 and declare the class with methods. Call this class in all your IP.\
    Else you can write a global routine in SE38 (INCLUDE) and call this include in all your IP. This what we are doing in our project where we need to implement the same logic in all 10 IPs. We declared a subroutine and call this subroutine every where.
    Regards,
    satyam

  • 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

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

  • 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

  • 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

  • Routine in Infopackage not working

    Hi all..
    I wrote a routine in Infopackage with the selection Abap routine 6. for some reason the code is not selecting..i mean if the code has to get fisc year 2007, instead its getting all the records from all the years. i tested out the code in abap se38, it works fine, the function module is working fine, i am missing something here in infopackage, can anyone please let me know.
    Here is the code.
    data: l_idx like sy-tabix,
            Year  type /BIC/CS8ZCBFCOPA-FISCYEAR.
    data : begin of itab occurs 0.
    include structure /BIC/PZOCDPYCTA.
    data : end of itab.
      CALL FUNCTION 'ZBW_GET_FY_PKG_SELECTIONS'
        EXPORTING
          VTYPE     = '010'
        IMPORTING
          ZOCDPYCTA = itab.
      loop at itab.
      read table l_t_range with key
           fieldname = 'FISCYEAR'.
      l_idx = sy-tabix.
      l_t_range-SIGN = ' I '.
      l_t_range-OPTION = ' EQ '.
      l_t_range-LOW = itab-FISCYEAR.
      modify l_t_range index l_idx.
      endloop.
      p_subrc = 0.
    The FM takes the input as 010 and gets all the records related to that..which is 2007 year records instead its getting all the records from all years..please help me.
    Thanks
    Vj

    Check the monitor to see what values are entered as the restrictions in the infopackages for fiscal year. if the correct values don't show up in the monitor you know the routine is the problem and not a system bug.
    Also, you may want to consider doing a range if the multiple single values isnt working.

  • 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

  • Replacement char at InfoPackage Extraction Tab

    To BI experts
    I have a quick question about "replacement char" in InfoPackage.
    (Set as follows: InfoPackage > Extraction Tab > Character Set Settings: Direct Entry)
    In general, I believe you set [#] for "replacement char" to replace character that cannot be recognized in the system.
    And I'm trying to find out which characters can be such unrecognized characters.
    can anyone tell me exactly which characters are those?

    Hi Naokiño,
    This is normally useful in a system where Unicode is enabled (which allows non English characters) to be permitted to be entered (as it is) into BW. Here let us assume a case where the source file has got some french characteris coming in the records.
    You got to enable the corresponding Character set (for French).  If you do not enable the corresponding character set, then all those characters will be replaced by '#'.
    Good Luck!

  • 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 in InfoPackage DataSelection

    Hi,
         Can someone provide me the ABAP code for the below mentioned scenario.
    In the InfoPackage, I want to extract only those Business Partners which are available in the other DSO.
    Thanks in Advance
    Mahesh Kumar

    Below is the sample routine used at infopackage level in one of our projects to load only the data for few plants, i had modified the code replace you IO(Business partner) and check
    data: l_idx like sy-tabix.
    DATA : IT_PLANT LIKE TABLE OF /BI0/P<Business partner>.
    data : IT_BPART_WA type /BI0/P<Business partner>
    read table l_t_range with key
    fieldname = 'BUSINESS PARTNER'.
    l_idx = sy-tabix.
    SELECT * FROM /BI0/P<info object> INTO TABLE IT_BPART WHERE <use the logic if any>
    LOOP AT IT_PLANT INTO IT_BPART_WA.
    l_t_range-low = IT_BPART_WA-<IO>.
    l_t_range-SIGN = 'I'.
    l_t_range-OPTION = 'EQ'.
    append l_t_range.
    ENDLOOP.
    modify l_t_range index l_idx.
    p_subrc = 0.

  • Routine in Infopackage data selection doesnt give appropriate results...

    Hi Gurus,
    I need to pull data into PSA (BW 3.5) based on a certain selections in the Infopackage. Selection is based on specific values of Infoobject 0PLANT , however, as these values are multiple and do not fall in a specific range I have written a routine to derive these values.
    The routine  does the following steps :
    - creates an internal table from /bio/mplant and deletes the plant values that I do not wish to consider in the extraction.
    - delete data from l_t_range for fieldname = 'PLANT'
    - Appends data from the internal table to l_t_range.
    However, when I execute the infopackage, the extraction is done for ALL the 0PLANT values i.e it includes the data for 0PLANT value which have been delete from the internal table.
    My routine is :
    $$ end of global - insert your declaration only before this line   -
        InfoObject      = 0PLANT
        Fieldname       = PLANT
        data type       = CHAR
        length          = 000004
        convexit        =
    form compute_PLANT
      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        -
    TYPES ls_range like l_t_range.
    data: l_idx like sy-tabix.
    DATA: lt_plant like /bi0/mplant OCCURS 0 with header line.
              SELECT PLANT from /bi0/mplant into lt_Plant WHERE objvers = 'A
              ENDSELECT.
              delete lt_plant WHERE plant = 'W206'.
              delete lt_plant WHERE plant = 'WF11'.
              delete lt_plant WHERE plant = 'W945'.
              DELETE lt_plant WHERE plant = 'W530'.
              read table l_t_range with key
                   fieldname = 'PLANT'.
              l_idx = sy-tabix.
              DELETE l_t_range where fieldname = 'PLANT'.
              Loop at lt_plant.
                    l_t_range-sign = 'I' .
                    l_t_range-low = lt_plant-plant.
                    l_t_range-OPTION = 'EQ'.
                    append l_t_range.
              endloop.
              modify l_t_range index l_idx.
              p_subrc = 0.
    $$ end of routine - insert your code only before this line         -
    endform.
    Any bugs in the routines ?

    try this one:
    Loop at lt_plant.
    if lt_plant-plant ne 'WF11' or lt_plant-plant ne 'W945' or lt_plant-plant ne 'W530'.
    l_t_range-sign = 'I' .
    l_t_range-low = lt_plant-plant.
    l_t_range-OPTION = 'EQ'.
    append l_t_range.
    endif.
    endloop.
    or
    don't use a table with header ( use a standard table and use a work area to access the table ) and do an other select like this:
    SELECT PLANT from /bi0/mplant
    into corresponding fields of table lt_Plant
    WHERE objvers = 'A
    and plant ne 'WF11'
    and plant ne 'W945'
    and plant ne 'W530'.
    I hope it helps...
    Kind regard.
    Tobias
    Edited by: Tobias Kreuser on Aug 23, 2010 11:34 AM

  • Use Conversion Routine in Infopackage

    Hello friends,
    I would like to know whats the purpose and function of 'Use Conversion Routine' in the Infopackage  under 'Data Selection' tab. I wasnt able to get any data as long as that box was checked.As soon as I unchecked the box, i was able to get data.Please explain in detail.
    Points will be assigned.
    Thanks.

    Hi,
    The function of "Use Conversion Routine" is to convert the data that user enter in the field (is called external format) into internal format (database format).
    example Alpha Conversion (general used): in the field ABC (assume this char is 8 characters long) you enter value '1234' and you check that box, this will look up into your data source with value ABC = '00001234' and match then data will be extracted, but if <u>in your data source</u> the value of field ABC is '1234'  the data won't be extracted.
    in your case, please check in your data source at field you selected whether the data format match or not with value that you have entered(with condition checked or unchecked).
    I hope it helps
    Cheers
    IR

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

Maybe you are looking for