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

Similar Messages

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

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

  • 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

    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.

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

  • ABAP ROUTINE AT INFOPACKAGE FOR DATE RANGE

    hi all,
    I want to Schedule my infopackge with selection options 
    0DATE  infoobject with First date of current month( 01.02.2008)  to last date of current month ( 29.02.2008).
    this i have to get automatically bcoz i have to use this in process chain.
    so I want to write a routine for this at the infopackage level with ABAP Routine -6 option.
    So please suggest me how to write the code for this case.
    thanks,
    kiran manyam.

    Hi Kiran,
    Please paste the following code there and also check for syntax error.
    data first_date type d.
    data last_date type d.
    first_date = sy_datum.
    first_dat+6(2) = '01'.
    CALL FUNCTION 'SLS_MISC_GET_LAST_DAY_OF_MONTH'
    Exporting
    DAY_IN = first_date
    Importing
    LAST_DAY_OF_MONTH = last_date.
              read table l_t_range with key
                   fieldname = 'DATE'.
               if sy-subrc = 0.
                   l_idx = sy-tabix.
                   l_t_range-sign = 'I'.
                   l_t_range-option = 'BT'.
                   l_t_range-low = first_date.
                   l_t_range-high = last_date.
                   modify l_t_range index l_idx.
                else.
                   move 'DATE' to l_t_range-fieldname.
                   l_t_range-sign = 'I'.
                   l_t_range-option = 'BT'.
                   l_t_range-low = first_date.
                   l_t_range-high = last_date.
                   append l_t_range.
                   endloop.
                endif.
              p_subrc = 0.

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

  • Debug abap routine in infopackage

    Hi experts,
    What is the easiest way to debug an abap routine used in the infopackage for dynamic selection? When I go into the code I cannot place a breakpoint. Optionally I can do a /h before hitting the schedule button but what can I look for to go directly to my abap code?
    mark

    HI
    Below is an excerpt from a reply by AHP few months back
    put a loop on the routine,
    data : debug(1).
    do.
    if debug = 'X'.
    exit.
    endif.
    enddo.
    and when run infopackage, go to sm50,
    on that process, menu program->debug program,
    in debug screen, type in debug, and fill with X and click 'edit'-pencil icon.
    F5 to next step.
    hope this helps.
    Regards
    Prakash

  • ABAP routine for InfoPackage

    Hi,
    I have an InfoPackage that loads into multiple InfoCubes. Sometime at the end of this year we will stop loading one of the InfoCube.
    What ABAP code do I use to achieve this result? How do I do this type of filter from InfoPackage?
    Thanks in advance for your precious time and help
    Best regard
    Arjun

    Hi Arjun,
    Would be having an InfoPackage against which you would be checking  the 'End of the year' ie any time characteristics say 0CALDAY,
    In your routine check this InfoObject for End of the year and if true you can allow this to load to further InfoProviders or Datatargets.
    Othervise do what ur business logic says.
    This you can do provided you know the exact date ( value) .
    Otherwise try to find out any infoobject whose value is important in terms for ur infoprovider loading . and you can use that infoobject to check in routine.
    Say you want to load XYZ if its not the end of year and otherwise you waht keep it constant.
    if  SOURCE_FIELDS-Ocalday < '20081231'.
    temp = xyz.
    else.
    temp = '00000000'.
    endif.
    Results  = temp.
    Hope this Helps.
    Regards
    Praeon

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

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

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

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

Maybe you are looking for

  • Safari fails to open on lion 10.7.5 but chrome on my MBP 2011

    Process:         Safari [355] Path:            /Applications/Safari.app/Contents/MacOS/Safari Identifier:      com.apple.Safari Version:         5.1.7 (7534.57.7) Build Info:      WebBrowser-7534057007000000~2 Code Type:       X86-64 (Native) Parent

  • How to display page numbers in report

    hi all, i would like to know how to display page numbers in this format " 1 of 5" in the report. Any help would be much appreciated. thanks seema

  • Best way to read a switch - Help!

    This should be easy and probably is but I just cant seem to track the state of a switch effectivly. What Im testing: Code written in C++ using DAQmx on Scientific Linux. Hardware is a 6221 PCI card. I have a switch which is configured to be active hi

  • Disable keychain

    Can keychain be disabled? We require user to change passwords every 30 days and I can't continue troubleshooting keychain problems with Safari. I have to fix the chain problems once and for all or switch to a different browser. I have had most of the

  • Why does DIO6534 behaves differently from its lesser relatives?

    I am developing under LabWindows/CVI some code for the DIO 653X family. It's almost two years since I started working with'em, so it's disappointing the problem I'm talking about. This is the guilty code: DIG_Grp_Config(DIO_BOARD, 2, 2, 2, 0); DIG_Bl