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.

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.

  • Approximate operator and recursive call function in abap

    Dear expert,
    Please give me an example about Approximate operator and recursive call function in abap
    thanks so much

    Hi
    About Approximate operator, you can go to tcode 'ABAPDOCU', searching CO,CN,CA etc...each of them have example there.
    And recursive function,
    Say here is a FM,
    FUNCTION recursive_get_number.
    *import im_num type i.
    *export ex_num type i.
    ex_num = im_num + 1.
    IF ex_num GE 100.
       EXIT.
    ELSE.
       CALL FUNCTION recursive_get_number
            EXPORTING
               im_num = ex_num
            IMPORTING
               ex_num = ex_num.
    ENDIF.
    ENDFUNCTION.
    When you call this function from outside with importing parameter '1',  then will return you 100.
    regards,
    Archer.

  • 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

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

  • 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

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

  • 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

  • Call functions in ABAP : CALL 'ThSysInfo'

    hi
    i am in need of certain information abt the blow code\
    i just wanted to knw where the value HWID gets populated from after executing the below code
    can any body help plzzz
    CALL 'ThSysInfo'
         ID 'OPCODE'   FIELD OPCODE_MSGSERVER
         ID 'MSOPCODE' FIELD MS_GET_HWID
         ID 'HW_ID'    FIELD HWID
         ID 'ERRMSG'   FIELD ERRMSG.
    just want to how the value HWID gets populated in this script
    kindly help
    its Urgent
    <b><REMOVED BY MODERATOR></b>
    regards
    shoeb
    Message was edited by:
            Alvaro Tejada Galindo

    pllz help me what is the solution for these
    ThSysInfo - How to change the parameters???
    CALL 'ThSysInfo'
          ID 'OPCODE'        FIELD OPCODE_GET_VIRT_HOSTDATA
          ID 'PROTOCOL'      FIELD PROTOCOL
          ID 'VIRT_IDX'      FIELD VIRT_IDX
          ID 'HOST'          FIELD HOSTNAME
          ID 'PORT'          FIELD PORT.
    i want to change the hostname as by default through system it is taking some hostname but i want to change that hostname can u plzz guide me how to change that hostname as i am using these FM in my webdynpro method
    pllzz hel me as soon as

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

Maybe you are looking for

  • Erase Free Space 7-Pass Problems

    I can't seem to get "7-Pass Erase" to work. It will start, but it only makes it through to about half, on the progress bar, and then just sits in the same spot for hours. The other night I started it, waited a while, then put my pointer where the pro

  • Button not working in Chrome Android Jellybean

    The button code works fine on iPad 2/safari but is not functioning  on Android JellyBean tablet Nexus 7/chrome. What could be the problem? html <a class="btn-red" href="case-study-1.html"><span><span>Case Studies</span></span></a> css .btn-red {    

  • Baseline date as GR date

    Hi, Baseline date is configured based on Payment Terms, that can be possible using customizing, there is no relation with GR date and other dates. Still if you want set the Baseline date with some other default date or PO date, or GR date, - IT IS PO

  • Help with InDesign spread previews in Bridge CS6

    Our company is updating to CS6 and needs to be able to view InDesign files as spreads as we did in CS3. We produce many catalogs a year and each spread is a separate file. We use Bridge (CS3) to view the entire catalog at once. Now, with CS6, we can

  • IPad music library inconsistent with iTunes Library

    I recently sync my iPad mini 3 with my iTunes library, I noticed the music is not consistent with my iTunes library I checked by Artist, and for example, when I checked Aerosmith, in my ipad the "Pump" album is not displaying under artist, is showing