SapExit for Current month

Hi,
We have a scenario where we run the query monthly, expectation is the query should automatically default to using the current month. So do we have any sap exit for current month.
Regards,
Ravi

Hello Please refer the following code
MTD / MTM(For current default Month)
Variable: ZP_X_09 For enetered month (on 0CALMONTH)
For current Month by default or for any given Month (For full month)
e.g. If current month/given month is 15.08.2009. It will give Aug-09.(200908)
  WHEN 'ZP_X_09'.
    IF i_step = 1.
      w_fm_month = sy-datum.
      CLEAR l_s_range.
      l_s_range-low    = w_fm_month.
      l_s_range-sign   = 'I'.
      l_s_range-opt    = 'EQ'.
      APPEND l_s_range TO e_t_range.
      CLEAR : w_fm_month.
    ENDIF.
    IF i_step = 2.
      LOOP AT i_t_var_range INTO loc_var_range
        WHERE vnam = 'ZP_X_09'.
        CLEAR l_s_range.
        l_s_range-low    = loc_var_range-low.
        l_s_range-sign   = 'I'.
        l_s_range-opt    = 'EQ'.
        APPEND l_s_range TO e_t_range.
        EXIT.
      ENDLOOP.
      CLEAR : w_fm_month.
    ENDIF.
Regards,
Krunalkumar Rathod

Similar Messages

  • 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

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

  • Report for getting an oppotunity for current month

    Please tell what can be a filter or function for getting an oppotunity for current month , i have the field as "Opportunity created date" so what function or SQL expression can b eused to get created date = current month's date

    Thanks..i'll do taht
    Edited by: user1074008 on Sep 28, 2010 3:11 AM

  • 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

  • Showing Calendar for Current Month

    Dear Forum,
    I intend to display calendar in corner region of my home page for current month, and also want to highlight dates in calendar based on certain parameter or query output.
    How should i accomplish this in HTMLDB?
    Regards,
    Manpreet Johal

    Sir,
    Please answer to this problem asap.
    Regards,
    Manpreet Johal

  • Mobile Email not retrieving messages for current month

    I did a couple of quick searches on this problem, but I couldn't find any information if this is a known bug with the Mobile Email application.  For the last week or so, whenever I access Mobile Email on my LG enV Touch, the first page of emails shown are for the previous month, but the same day of the month (so today is August 16th, 2010, and the newest messages I can access are from July 16, 2010).  There is no software update available.  From the application's info page it seems like my version is 3.1.3.2.
    Also, the email address that is being accessed is for an @comcast.net account, but this setup has been working fine for over a year now, until this issue came up. When I access this account elsewhere, it does show messages for the current day, like normal.
    Has anybody seen a problem like this?  Any suggestions for next step on looking into this?
    Thank you.
    - Wes

    I do apologize that you are not able to retrieve any of the current months emails.from your device.However you may need to re download the mobile email application in order to get the emails to start coming through. Here are some steps to downloading the mobile email application from  your device. Hope this helps!
    From the main screen, select Menu.
    Select Media Center (Get It Now).
    Select Browse & Download (Tools on the Go).
    Select Get New Applications.
    Select Mobile Email.
    Select the purchase option.
    If prompted, select Yes to start the download.
    Select Yes.
    To continue the installation, review the Terms of Use, then select Accept.
    Select the desired email provider, then choose Select.
    If prompted, review the Terms of Use for the email provider, then select Accept.
    Enter the username and password, then select Sign In.
     Username and password are case sensitive

  • 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

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

  • Delete cost run & reset release for current month

    For our client we have created a new plant while testing this plant user created a material and they have done a cost run in ck11n  with costing varient zv01 but in they released the cost with costing varient ppc1 with this system got inconsistency and not not allowing to release cost for any other material in the current month if we try to mark it for next month it is working fine.
    we deleted the cost run through ck44 & ckr1 then also we are faceing the same problem. Kindly give me the solution how can i reset the release and later i want to run the ck11n & ck24 for material in the current month  to do  the production cycle.  please consider this is as a urgent.
    Regards
    Chakravarthy

    Hi
    Whether you should do MR21 or not ??
    a. If the cost estimate you reversed belongs to Last month and you are going to post the GR in last month then you should do MR21
    b. if the cost estimate you reversed belongs to may and GR will also be posted in May - No need for Mr21... Because, even though you release cost on say, may 2nd, the cost always gets released from the Start of the Month
    br, Ajay M

  • Delete DSO data for current month on a daily basis.

    Hi Gurus,
    We have a requirement where we have to delete the data in the BW DSO's for the Current Month every day before loading data into it. The reason for this is that in R3 they delete data for the current month in addition to adding new records and changing existing records. Since we do a Full load in BW, the deleted records in R3 will still exist in the BW DSO, hence the need for deletion.
    We can't delete ALL the data in the DSO as we use the BW DSO for Archiving purpose and the R3 table at any point of time will have just 3 months of data, while BW will have historical data.
    I know there is a process to delete DSO contents in the Process Chain, but can it be set up to just delete the current months data??
    Thanks
    Arvind

    Hi Arvind,
    The program RSDRD_DELETE_FACTS or transaction DELETE_FACTS will help you in deleting the records. Execute the program and select the option 'Generate Selection Program'. It will create a Z program , you can then dynamically select the current month in the Variant and assign the Z program and the variant in ABAP step of the process chain.
    Hope this helps with your requirement.
    Regards,
    BINETWEAVER2004s

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

  • Calendar does not show events for current month unless I switch away and back

    I have had this issue on my iPad 1st gen (with OS 5.1, also happened on previous OS version) where when I open my calendar in month view, the entire month will be blank (have no events showing). I have to swipe to a different month and then back to the first month, and then it will show all of my events for the month. This is a pretty annoying bug. Are there any fixes for this?
    edit: I see this has also been reported at https://discussions.apple.com/message/17750848

    Happening to me, too.  Started with 5.0 and continues on 5.1.  I referenced your thread in the one that you listed, just to keep them linked up and build up a list of affected users.

  • Query on DSO is taking more time for current month

    Hi All,
    I have query bulit on DSO is running fine for all the month, but only the problem with ccurrent month. For April is taking more than 15 min to run query though it got less records. For other month is taking less than one sec. Could you help me to resolve the issue.
    Regards,
    J B

    Hi JB,
      Same problem we are facing. Last month users ran till from 01.03.2011 to 15.03.2011 around 17.03.2011 even the data volume is less it is running slow or some times not coming. This month it is slow for 01.04.2011 to 11.04.2011 ...
    I am also weird, and this is happening after latest patch implementation.I am not exactly sure why it happens.
    The fix we have done is restricted in the backend on that date from 01.01.1900 -  31.12.9999 and now allowed filter again on the same date. Now if we use the same date range it is running fine.
    Also try if you inpit 01.01.2011 -  31.12.2011 and check the time whether it is running fast or not....it is running normal ...
    Regards
    vamsi

  • Customer exit in APO for current month in query

    Hi,
    I need to create a customer exit which automatically restricts 0calmonth on the current month in a query.
    How should I do this APO?
    Most important, Which table should I use to find the input, i.e current month and year?
    If possible please provide some code to show the solution.
    Best regards,
    Sebastian

    Use the standard SAP exit 0I_CLMTH.

Maybe you are looking for

  • Wireless iBook + Wired PC to Airport Express?

    Is it possible to use my Airport Express for a wireless network with my iBook while at the same time have my PC connected with a wire through a switch to the Express? I have everything hooked up and the PC recognizes that it is connected to the Expre

  • Leave the computer on sleep or turn it off-which is better?

    Friend of mine has an intel iMac, I have an iMac PPC-G5. He told me that it's better to ALWAYS leave the computer on. Instead of doing a complete shutdown, one should log out and select sleep. The computer will last longer. Anyone got any thoughts or

  • Query on 800x600 @72Hz VGA controller

    Hi I want to design a 800x600 @72Hz VGA controller. below is a counter module which generates hsynch and vsynch signals. The horizontal counter works fine but the vertical counter remains at 0 in simulation. Also when I go for assigning values to sig

  • Trouble importing stored photos from 60g ipod to iphoto.

    I downloaded 500 photos while on vacation to 60 g ipod. I go to iphoto and select import which opens a window but don't know where to locate the stored photos. imac G5 and 60g ipod   Mac OS X (10.4.7)  

  • File Properties (Meta Data) and Indexing

    Meta Edit™ Find what you need, when you need it. If you manage a large network or portal, chances are that there are thousands of documents floating around that are difficult to locate due to poor file property information. With MetaEdit™, it's easy