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.

Similar Messages

  • Data selection in info package using ABAP routine.

    Hi,
    when we are  scheduling the info package(Infp package name is like XYZ),we want to load past 6 months data from the current date(INFO OBJECT(0CREATEDON) BETWEEN (Sy-Datum - 6 months TO  Sy-Datum),in the selection tab in schedule i want to write the abap routine (type 6).please can any one have this type of code please sedn to me asap.
    this is very urgent.delivery is tomorrow.

    hi Lekha,
    try following code.
    seems you post the same question twice, one posting is sufficient. and please don't forget to reward helpful answers.
    data: l_idx like sy-tabix.
    read table l_t_range with key
    iobjnm = '0CREATEDON'.
    l_idx = sy-tabix.
    DELETE l_t_range
    WHERE iobjnm = '0CREATEDON'.
    L_t_RANGE-SIGN = 'I'.
    L_t_RANGE-OPTION = 'EQ'.
    if not work, try
    L_t_RANGE-OPTION = 'BT'.
    BT = between
    last 6 month
    L_t_RANGE-LOW = sy-datum - 180.
    current date
    L_t_RANGE-HIGH = sy-datum.
    append l_t_range.
    modify l_t_range index l_idx.
    p_subrc = 0.
    $$ end of routine - insert your code only before this line -
    endform.

  • CUIC 9.1.1 Report scheduling issue - getting data only for current date

    Hi,
    CUIC : 9.1.1
    ICM: 9.0.3
    Description:We have CUIC publisher and Subscriber deployed in Cisco UCS C series server. When we schedule a report in Subscriber, we are getting data of current date even we schedule for old dates. Eg. If I schedule a report for yesterday, getting output as today's data. This is applicable for all the historical reports.
    There is no such issue in Publisher.
    Regards,
    Alag

    Try this...
    {TableName.DateField} < DateAdd("d", -2, CurrentDate)
    HTH,
    Jason

  • Can i add data for current month only

    can I add data for current month only?

        Knowing your plan options is important marlingut! So that we are able to provide correct information, what make and model phone are you trying to add data too? Is this device already activated on your account?
    Thank You,
    MichelleL_VZW
    VZW Support
    Follow us on Twitter @VZWSUPPORT

  • Filtering 13 months of data by top 5 for current month

    Hello,
    I am wanting to create a table/chart to display the last 13 months worth of data filtered by the top 5 product categories for the current month.
    I have to be able to have this dynamically gerenate, as I am unable to modify the filters each time the report is run.
    I was doing this by having a little table to display the top 5 for the current month, and then filtering the 13 months of data based on that table, but this isn't working when I am unable to modify the report.
    Is there any sort of formula that I can use to achieve this?
    Thanks!
    Stephanie

    Hi Stephanie,
                           For displaying the data only for the last 13 months, you can try using the DaysBetween() function. Now, 13 months would approximately be 390 days. So assuming that you have at least one object in your report that displays the date (say for e.g. "MyDate"), you can use the following formula: If DaysBetween(CurrentDate(),MyDate) < 390 Then 1 Else 0. Give a name to this formula, and then drag it onto the report filter pane. In the condition, set it as 'Equal to 1'. This will filter the data for the past 13 months, and then you can apply the ranking for the Top 5 as per your requirement.
    Regards,
    Alok.

  • Get data for current month in VC from query - Urgent

    Hi all,
    I have designed a query for cube FIAR_C03 for overdue items and query output contains customer, net due date, document date, fiscal year period and amount. I want a chart for that query in VC that only contains those items in which net due date is in current month. How can i do that?
    Where I can place the condition to display only those items in vc in which net due date is in current month and how ?
    Please respond.
    Regards,
    Aisha Ishrat
    ICI Pakistan Ltd.

    Hi Aisha,
    It is possible to do with following steps:
    1. In Query Design make your field 'Net Due' filter with variable for date input (0CALMONTH for example where your date should be this format MMYYYY). Test your query and see if you input a month/year date it would would work;
    2. Build one table from output of your query (choose fields);
    3. In Visual Composer, drag your query into your board and from 'Varaiables' port  (NOT FROM INPUT) drag a line to create a Start point. As soon you realease to create 'Start' a box will ask which fields you want. Choose your date as field;
    4. Select the line between Start point a query. In Input Field assigned the following formula (DSTR(NOW(),'MMYYYY') *
    5. Deploy your model
    at this formula I said: transform NOW(), current date, in Text with format MMYYYY (012002 for example).
    It works!
    Assigned points if was helpful.
    Kind Regards,
    Gilson Teixeira

  • Calendar - when I want to edit a monthly recurring event but only for one month I am no longer given the box to update only that date.

    Calenndar - when I want to edit a monthly recurring event but only for one month I am no longer given the box to update only that date month.  How do I do this with the new operating system?

    Adding to Alan's answer:
    One of the problems that comes with these tricks for variable-rate acquisition is being able to match up sample data with the time that it was sampled. 
    If you weren't using either of E-series board's counters, there is a nifty solution to this!  You'll be using 1 of the counters to generate the variable-rate sampling clock.  You can then use the 2nd counter to perform a buffered period measurement on the output of the 1st counter.  This gives you a hw-timed measurement of every sampling interval.  You would need to keep track of a cumulative sum of these periods to generate a hw-accurate timestamp value for each sample.
    Note:  the very first buffered period measurement is the time from starting the 2nd counter until the first active edge from the 1st.  For your app, you should ignore it.
    -Kevin P.

  • Using ABAP routines for data selection

    Hello,
    I want to use ABAP routine to determine value range of data selection in Data Package but when I use routine for one field, selection criterias for other fields are ignored, e.g.:
    in Data Package I have two selection fields:
    CPUDT     Accounting Document Entry Date
    AEDAT     Date of the Last Document Change by Transaction
    For CPUDT I wrote ABAP routine
    and for AEDAT I have just typed in period of time.
    I started data extraction and open Monitor for this Data Package.
    At Header tag I checked selections info and there is selection only for CPUDT.
    Could somebody explain me is it normal system behaviour?
    Thanks
    Andrzej

    Thanks for reply but that would be too easy...
    I have tried your advice but nothing changed.
    I think this is data extraction configuration problem.
    Andrzej

  • Load FI data only for open items

    Hi all
    I want to load FI data only for open items.
    We started off with FI_GL_4 which has STATUSPS(status of FI line item)based on which we have written a start routine to filter out the closed items.
    But for other FI-GL datasources we dont have STATUSPS field.
    Then can we load data directly without applying any restriction on it as we dont have STATUSPS field in it?
    Or is there an other way to find all open items ?
    Please helpout.
    Awaiting replies.
    Harika.

    Hi Harikag,
    when you are loading delta data in 0FI_GL_4, it is NOT the right approach to load only the open items.
    Say for example, you have loaded a record with open status.
    If the status of the record gets changed to 'Closed' in SAP, then this will not flow to BW, because of the filter that you are trying to apply in the data load.
    So the item will continue to remain open in BW, though it is closed in R3.
    hence it is highly recommended to do this filtering at report level.
    Otherwise, you are looking at full load option by dropping data everyday, which will have performance issues in loading.
    Thanks,
    Krishnan

  • Check 3G data usage for previous months?

    Where do I go to check my 3G iPad2 data usage for previous months?
    I look in the Settings / Cellular Data / View Account - but only see the current month.
    I tried to create a My Verizon account on the verizon wireless web site using my iPad phone number but I get the error "We're sorry, but at this time you cannot register your account for My Verizon. Please access your account information on your device."
    I installed the "My Verizon" app for ipad from the App Store but I get "System under maintenance.  Please Try again." all the time.
    Is there someplace else I can see previous months data usage?  I would like to get a sense how much I have used in the past.
    Thanks
    Joe

    Dear AdamE+VZW and AntoniioC_VZW
    Have you actually tried the advice you gave?  I'm 6 days into my billing cycle.  The furthest back I am able to see data traffic is 6 days.
    The specific navigation path "View Bill --> I Want To...  --> Month ---> Usage Details --> Data"  does not currently exist.
    As far as I can tell, AdamE's claim that "You can easily see the past six months of data usage on our website " is untrue.
    The report generated by the "Account Analysis" is plainly false as well.  It reports that both of my data phones used exactly 1024.00 MB in February, March, and April. (sic: 2 decimal points!!).  That is an exceedingly unlikely coincidence, and flatly contradicts the current month summary which reports that one of my phones has used only 23 MB, and the other line even less.  The "Account Analysis" has a bug so serious as to render its data traffic output absolutely useless.  Since it is providing false output, it should be removed from the site until it can be fixed to generate accurate reports.
    I can't even find a way to see my prior month's summary bill, though I can't be sure it is unavailable since the site is large.  But I can say that when a customer spends 15 minutes clicking around a site trying to find their prior month's bill (not merely the bill's dollar amount, but the bill's usage summary) and fails, the site navigation should be improved!!

  • Sales report for current month and year a go month

    i could you please guide me builting report for current monthwise for current month and year a ago month
    report parameter month_year='06-2010'
    tables = sales and below are the table fields
    customer_id
    invoice_dt
    invoice_am
    thanks
    nhm

    Okay, Still you did not mention how you will pass value in report while generating.
    Anyway the query with UNION ALL will work. For Example.
    I am assuming that the parameter for date/month you will pass in range like 01-JUN-2010 to 30-JUN-2010
    SELECT customer_id, SUM(curr_value) curr_value, SUM(past_value) past_value
    FROM
    SELECT customer_id, NVL(SUM(invoice_amount),0) curr_value, 0 past_value
    FROM sales
    WHERE invoice_dt BETWEEN :P_FROM_DATE AND :P_TO_DATE  -- here P_FROM_DATE and P_TO_DATE will be the date range for current year as i showed above.
    AND  -- Any Condition goes here...
    GROUP BY customer_id
    UNION ALL
    SELECT customer_id, 0, NVL(SUM(invoice_amount),0)
    FROM sales
    WHERE invoice_dt BETWEEN ADD_MONTHS(:P_FROM_DATE,-12) AND ADD_MONTHS(:P_TO_DATE,-12) -- This add_months function for the previous year same month.
    AND -- Any condition goes here...
    GROUP BY customer_id
    GROUP BY customer_idNow using the above query you can design the tabular report as you showed the format.
    -Ammad
    Edited by: Ammad Ahmed on Jul 3, 2010 7:55 PM
    added GROUP BY

  • How to load data only at the upper level in ASO

    We are loading the Days member with values 31/30/29/28 for the top level combinations in Block storage cube using a rule file.<BR>Now we need to carry out the same thing in ASO but ASO has a constraint that we can load data only at zero level.<BR>If we do that, then data at higher levels, after aggregation is incorrect. What can be done ?

    Also possible but a little more complicated is to create a separate cube with a DayCount account and only accounts and time dimensions. The time dimension goes down to day. You load it with 1 record per day. Then, you use this cube and your original cube as source, transparent partitions to a BSO cube. <BR><BR>This way, you have no bogus "input" members anywhere. Formulas that combine DayCount with other things would be written as outline formulas in BSO, since it doesn't support MDX. If you need those to be in MDX, then this wouldn't work for you.

  • Loading data only from access

    Hi,
    I just want to load data only from MS Access tables to oracle tables.I already have oracle tables. Can i do this with Oracle Migration workbench.
    Thanks

    Hi,
    The Oracle Migration Workbench can be used to migrate table data from your MS Access to your migrated Oracle database schema. The data can be transferred either online, using the Migration Wizard of the workbench or offline using SQL*Loader scripts generated by the workbench, to copy data from the source database to your destination Oracle database.
    You mention that you already have the Oracle tables. Did you use the migration workbench to migrate your Access MDB file to Oracle?
    If so, then you can do the following to load your data into the Oracle database using the offline capture method:
    1. Use the Exporter for MS Access tool (omwb<version>.mde) to extract the data from your Access MDB file. This generates .DAT files containing the table data.
    2. Launch the workbench, pointing to the repository containing the source and oracle model information for your Access MDB file. This will be the repository you used during the initial migration of your Access database to Oracle.
    3. Select the Oracle Model tab, then select a user schema in the Oracle Model that you want to migrate the data to.
    4. Select the associated "Tables" node of the tree.
    5. From the "Objects" menu, select the "Generate SQL*Loader Scripts.
    6. Use the generated SQL*Loader scripts to load the Access data, contained in the .DAT files generated in step 1 above, into the Oracle database.
    For further information on the steps outlined above, please refer to Chapter 6 Migration the Database of the Oracle Migration Workbench User's Guide, specifically
    section "Transferring the Data Offline". The User's Guide can be obtained in the /omwb/docs/usersguide folder of your omwb installation, or via the Help | User's Guide of the workbench.
    I hope this helps.
    Regards,
    Hilary

  • Build a data warehouse for crystal report use

    OS: AIX 5.3 with Oracle 10g R2/Baan 5c
    I proposed my colleage to create a data warehouse for his heavily use of crystal report activity, so that his activites will not drag the normal database performance. The data will collect from the current Oracle 10 g database. Because I have never physically worked on the data warehouse, where should I start to look for information to proceed? I have an extra Sun Solris 8 box with a spare HD. I think it will be better to build the warehouse on that server, am I right? or the 10g R2 provides the capability to host another warehouse activity -- create a materialized view within? Thanks,

    Thanks for the help Ted
    Works like a charm now.
    Or atleast my very very simple XML report works.
    Now I just need to play around and see what I can do and what I cant.
    I just want to make sure I understand how this works.
    1) I start of with a XML file (or URL or other data source as explained in your BLOG)
    2) I then have to create blank report which will have its data source set to my XML file.
        This report (rpt file) will always have its data source set to the original XML location
    Can this be dynamically changed, or does a new rpt file need to be created each time
        (or atleast I will have to re-run "CreateXMLInlineSchemaReport" from your BLOG)
    3) I can now use this rpt file as I would any other rpt file but its data source will be the original XML file
       - If I update or change the XML file, the report will dynamically reflect these changes.
    4) To change the data source, I need to recreate a new rpt file as per point 2. Which will now be blank.
    5) Filtering.... if I want to filter the XML data do I use normal parameters. If I want to filter the data before
        I pull it do I need to change anything. In otherwords if I have a XML file with 1000 records, but I only want say
    5 of them, how do I only pull those 5 without first pulling the whole 1000 records. Hope that makes sense.
    As I said I am very new to this so some things still fly over my head, but I do play around abit so hopefully
    will find what I am looking for.
    Cheers
    Darren
    PS any other links to info on creating and running reports of XML data sources would be greatly appriciated

  • Parameter for Current Month and Previous Month

    I'm trying to create a parameter for current month and previous month based on the ex_date, but not sure what i'm doing wrong. 
    where ex_date = @SelectDate
    I created a second dataset below for the values in the parameters.
    SELECT Month(CURRENT_TIMESTAMP) AS 'Month', 'Current Month' as 'Current Month'
    union all
    SELECT Month(CURRENT_TIMESTAMP)-1 AS Month, 'Previous Month' as 'Previous Month'
    Results
    Month Current Month
    3 Current Month
    2 Previous Month
    Once I preview it I get "Conversion failed when converting date and/ or time from character string" I changed the data type to "date/Time" but that did not make a difference. The date is convert (varchar(10), ex_date, 101) so looks like
    11/12/2014. 
    I've also tried expressions like =month(now()) to pull current month with same error so i'm not sure what i'm doing wrong. Any ideas?

    i tired this real simple report
     in the first dataset - my main report query - select name from sysdatabases where month(crdate())=@month
    in the second dataset - select month(getdate()) as Month1
    in the parameters - choose int data type and available values - select the second data set
    in the first data set- add this parameter..( i am assumming you know this, since you have done)
    in the preview you should get the drop down with current month number - 3
    and if you run the report, it will display the database names that were created in march. remember we are no checking year, so will get all that were created in march across the years.
    Hope it Helps!!
    I'm looking to have the dropdown say "Previous Month" and "Current Month" as a option. I know how to get the information in SQL, but not sure how this translates or put into a parameter.
    Current Month
    list_date BETWEEN
    DATEADD(MONTH, DATEDIFF(MONTH, 0, GETDATE()), 0)
    AND
    DATEADD(MONTH, DATEDIFF(MONTH, 0, GETDATE()) + 1, 0)
    Previous Month
    list_date between
    CONVERT(varchar,dateadd(d,-(day(dateadd(m,-1,getdate()-2))),dateadd(m,-1,getdate()-1)),106) /* Last Month */
    and
    CONVERT(varchar,dateadd(d,-(day(getdate())),getdate()),106)

Maybe you are looking for