Month-to-Date and Year-to-Date values in Query

Hello experts,
One of our BI reports has the following requirement: the user should be asked for the report date. After the user inputs the date, the report shows the key figures in three different "flavors": one is the values for that date, the second one is the cumulate values from the first day of the month of the report date to the report date itself, and the third is the cumulate values from the first day of the year of the report date to the report date itself.
  I created my report date variable based on 0CALDAY. Then I searched for SAP-exit variables that would help me achieve this, but could not really find any, except for 0P_ABO10, 0P_ABO11, 0P_ABO12 variables, all of them have as description "Start of Key Date Year". I tried creating a few selections in which the dates taken were defined as a range from each of these variables to the report date variable (for the year-to-date values), but I got the error "Variable 0P_ABO10 could not be substituted". I also got this error for the other two variables. And I could not find any SAP-exit variables like "Start of Key Date Month", in order to do the Month-to-Date part. My next try was to use the field "Key Date" with a variable in it, instead my own report date variable based on 0CALDAY, but it gave me the same errors.
I searched the forums and found a few threads that looked useful, like
First and Last day of month and
1st day of month / 1st day of week variables
However, they require some ABAP coding, and I do not know where to place the code (actually, I do not know where to work with ABAP code), and I also believe that I would have to do some changes to it.
Any suggestions?

Hi Pedro,
You have to create customer exit in T_Code: CMOD
1. Create a Z project
2. Select RSR00001 as enhancement type.
3. Go into include ZXRSRU01
4. create a code like
Here A is your variable based on 0calmonth with type customer exit and B is variable for 0calday.
Try to write logic for your case taking this as example.
WHEN 'A'.
    IF I_Step = 2.
      Loop at I_T_VAR_RANGE into L_T_VAR_RANGE where VNAM = 'B'.
        Concatenate L_T_VAR_RANGE-LOW(4) '001' into D1.
        Concatenate L_T_VAR_RANGE-LOW(4) '012' into D2.
        Clear L_S_Range.
        L_S_Range-low = D1.
        L_S_RANGE-high = D2.
        L_S_RANGE-sign = 'I'.
        L_S_RANGE-opt = 'BT'.
        Append L_S_Range to E_T_Range.
      ENDLOOP.
    ENDIF.
If you want exact code I can help you in that.
Thanks,
Kams

Similar Messages

  • Month to Date and Year to Date Scenarios

    <b>Dear SAP BI Gurus,
    Can anyone please give me guidance how to create a Month to Date and Year To Date Scenarios (Variables perhaps?) for 0SRR_CF_C1?  The date is in decimal and not DATE format…  I’m assuming the reason for this is to get the Time variance….  Nonetheless, I’d like to create a MTD and YTD scenario for reporting.
    Much Thanks
    Philips Manalaysay</b>

    Hi,
    You should take a look at the blog and doc below.
    /people/vikash.agrawal/blog/2006/10/17/enable-trend-reporting-150-by-manipulating-variable-value
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/25d98cf6-0d01-0010-0e9b-edcd4597335a
    Regards,

  • Month to Date and Year to date calculation

    Hello Experts,
    It would be great If you could provide the formula to implement in BO universe or in the Reporting level for the below requirement.
    MTD, LastMonth, Year to Date, Last to LastMonth and examples are below.
    Last Week:
    Eg: Monday through Sunday
    Description: Based on Todayu2019s date, select the Monday of the previous week for the start date and Sunday will be the end date.
    Example:
    If Today is May 22, 2009
    The result would be, Monday = May 11, 2009, Sunday = May 17, 2009
    MTD:
    If Today is May 22, 2009
    I need a result MTD = May 1, 2009 u2013 May 21, 2009
    LastMonth:
    If Today is May 22, 2009
    I need a result LastMaont = April 1, 2009 u2013 April 30, 2009
    Last to LastMonth:
    If Today is May 22, 2009
    I need a result LastMaont = March 1, 2009 u2013 March 31, 2009
    Thank you.

    Nisniki,
    Here are the methods using WebI:
    MTD: 
    Create a local variable "MTD Start"
    =RelativeDate(LastDayOfMonth(RelativeDate(CurrentDate();-30));1)
    Create a local variable "MTD End"
    =currentdate()
    LastMonth
    =LastDayOfMonth(RelativeDate(CurrentDate();-30))
    Year to Date
    create a local variable "YTD Begin"
    =ToDate("01/01/"+FormatNumber(Year(CurrentDate());"####");"mm/dd/yyyy")
    (reuse "MTD End" or build a "YTD End" variable same as "MTD End")
    Last to LastMonth
    (similiar to MTD, but using "60" versus "30" to move back two months versus moving back 1 month.
    To perform this stuff in the universe requires an understanding of the SQL syntax for the paricular vendor your are working with.  ANSI SQL agrees to represent and compute dates uniformly, however, the functions to make it happen varies by the vendor.
    Thanks,
    John

  • Quarter to date and year to date

    i need to create a formula that if the end user selects parameter  QTD, the report should retrieve all records where the effective date  is in the current quarter. having trouble with that anyone help?  The following is somewhat working, but i need to retrieve records in the currentqtr.
    if {?Date Range}='QTD' and {Sheet1_.EFF_DT} in Calendar1stQtr then {@qtd}=1.00
    else
    if {?Date Range}='QTD' and {Sheet1_.EFF_DT} in Calendar2ndQtr then {@qtd}=2.00
    else
    if {?Date Range}='QTD' and {Sheet1_.EFF_DT} in Calendar3rdQtr then {@qtd}=3.00
    else
    if {?Date Range}='QTD' and {Sheet1_.EFF_DT} in Calendar4thQtr then {@qtd}=4.00

    If all you want is to get the records with Effective date in the current quarter when QTD is chosen in the parameter then try this:
    if {?Date Range}='QTD' then
    {Sheet1_.EFF_DT} in
    select month(currentdate)
    case 1 to 3:
    Calendar1stQtr
    case 4 to 6:
    Calendar2ndQtr
    case 7 to 9:
    Calendar3rdQtr
    case 10 to 12:
    Calendar4thQtr
    default:
    date(1800,01,01) to date(1800,01,01);  // This will never process

  • Split month, date and year

    How to split month,date and year from date field ? is there any standard function module.

    You can do this.
    data: year(4) type c,
          month(2) type c,
          day(2) type c.
    year = sy-datum(4).
    month = sy-datum+4(2).
    day = sy-datum+6(2).
    write:/ year.
    write:/ month.
    write:/ day.
    Regards,
    Rich Heilman

  • Arbitrary change of date and year on photos taken in folder structure

    I run Adobe Photoshop Elements 8.0 in a Microsoft Office 2007 environment originally on a Dell laptop. Before installing Adobe I had a library in My Pictures that I have maintained and uses this structure (folders by year and events). I have moved everything to a stationary computer. Now dates has been changed on the pictures pictures from 2001 has been changed to 2010 also in properties). When adding new folders (by year and months) for transfere of pictures from my camera pictures alrready in the files starts populate the folder just established.
    On the old Dell laptop the correct dates and year are still maintained (used as a second back-up).
    What happens?

    Finally got the date fixed, it was simple once I got palm support. I did a hard reset, then set the date but DID NOT click on TODAY at the bottom of the screen, the secret is to tap on the actual DAY on the calendar, NOT TODAY (after you set the year)
    Post relates to: Tungsten E2

  • How to display planned movement date and actual movement date together?

    Hi, Professionals,
    My purpose is to list delayed outbound deliveries.
    Anyone could tell me how to display planned movement date and actual movement date?
    Appreciate your help.

    Thanks Shiva.
    I tried another way to do it. It works only for a short period of time.
    By using VL06O, I list all outbound deliveries by limiting both planned goods movement dates and actual goods movements dates to the same week I would like to inspect. Say both from 7th/11 to 14th/11.
    then I list outbound delivery list with planned goods movement date to 7th/11 but left out actual goods movements dates this time.
    In excel, I compare those two lists and filter out those unique ones because those unique documents means delayed deliveries which cannot delivery according to planned date.
    However, the "delayed" list generated by this method has some noises. Not all of documents are really delayed although most of them do.
    I'm also looking for a way to list sales documents number of these delayed delivery documents so i can retrieve order details from it such as order value.
    Help still needed.

  • Diff bet invoice date and Invoices list date

    Hello Experts.
    Good Morning to all.
    1) what is the difference between invoice date and invoicing list dates, please telltheir signigficance and  why they needed in customer master billing tab.
    2)what is the use of the field Payment guar proced field.what actully is its purpose.
    3)Subsequent invoice processing:- It indicates if the invoices for manual
    post processing should be printed out.If the business wants to post invoices manually(not
    by system automatically) that invoice can be printed out.
    In the above sentence what does manual posting means and what is automatic posting means?
    And tell me is there will be any need for this field in the real time , if so , then in which case?
    Thank you for all the replies..

    Dear SD Beginner,
    These fields will be used to assign the calendars that determines the schedule of billing dates and invoice list for the customer.
    Invoice dates (calendar identification)
    Identifies the calendar that determines the schedule of billing dates for the customer.
    Use
    If, for example, a customer wants to consolidate the invoices you send out, you can predefine the billing schedule in a calendar in the system. During billing, the system automatically proposes the appropriate billing date from the calendar.
    Procedure
    The system proposes the billing schedule from the customer master record of the payer. You can change the value manually in the sales document.
    Invoice list Dates (calendar identification)
    Identifies the customer's factory calendar that is used during the processing of invoice lists.
    Use
    An invoice list is a list of invoices (single or collective) that you create for the customer either periodically or on predefined dates. The periods and dates are defined in the customer's factory calendar. Typically, the recipient of an invoice list takes on the responsibility for collecting payments from numerous individual customers and receives a factoring or del credere discount for the service.
    Procedure
    If you want to create invoice lists for the customer, you must enter an identifier for a predefined factory calendar.
    Requirements
    You must first define a factory calendar for the customer either in Customizing for Sales or as part of the master data for Sales (Menu path: Logistics -> Sales & distribution -> Master data -> Others -> Billing schedules).
    I hope this will help you,
    Regards,
    Murali.

  • I just got a new iPhone and i set up iCloud on my girlfriend's account. To change it on settings it says delete account. Will this delete her all her data and back up data for iCloud on her iPhone and iPad?

    I just got a new iPhone and i set up iCloud on my girlfriend's account. To change it on settings it says delete account. Will this delete her all her data and back up data for iCloud on her iPhone and iPad? Can i change it without deleting it? Please help.

    Delete the account on your phone. This will not delete any data on her phone or iPad, or data stored in iCloud.

  • PO creation Date and Invoice creation Date

    Hi,
    Can any one help me regarding which table I can look for PO creation date and Invoice creation date. I require these fields for my reporting requirement.
    Thanks in advance,
    Arvind.

    Thanks for your response Bala.
    I got the Table which I require. I have one more question on this.
    Can you tell me Invoice Creation Date is RBKP-BLDAT(Document Date in Document) or RBKP-BUDAT(Posting Date in the Document) and PO creation Date is EKKO-AEDAT(Date on which the record was created) or EKKO-BEDAT(Document Date in Document).
    Points already rewarded.

  • Planned order creation with PDS valid on only order start date and not finish date

    Hi All,
    We have requirement to allow creation of planned order manually if production version is valid on order start date and not finish date.  This is because lead time of order is longer. I refered OSS notes 385602. I could find out solution for this is implementation of OSS note 694140 to change validity mode at activity level to consider start date of first produce activity  in validity interval. Problem is even If I create order in APO by implementiong this note planned order is not transfered to ECC and it gets stuck with error production version not valid.
    Is there any way in ECC to control this? Any config or customization?
    Regards,
    Santosh

    Nilesh,
    I think there is a simple procedural skip happening in your business process. You are right when a planned order is created after MRP it would default assign it to the first available production version. 2options available for us,
    1. First use transaction MF50 and do the line loading and assign the quantites to the production versions/Production lines, so that the actual capacity planning is getting completed. This way you can have planned orders with both the production versions and matching to your actual line capacity.
    2. Use Quota arrangement concept, to automatically split the Planned orders during MRP for a percentage based on individual production versions.
    Now when backflush is performed S225 table is updated and Planned order qty also gets reduced.
    Hope this helps....
    Regards,
    Prasobh

  • Goods issue date and goods receipt date

    Hi Guys,
                 i was asked to display STO list.They asked me add goods issue date and goods Report date in the o/p columns.So any body can tell me what are the fields for goods issue and goods Receipt date's.?can u guys tell me the Tr code for these fields .?
    Thanks,
    Gopi.

    Hi there,
    I already solve it by myself.
    Actually is i call the initialization twice:
    Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInventoryGenEntry)
    Thats what make this problem happened.
    Sorry.
    Best Regards,
    danny

  • Process Order Basic Finish Date and Scheduled Finish Date

    Folks,
    I have a requirement from the business to be able to update the Process Order Basic Finish Date and Scheduled Finish Date independently from each other.
    In other words, update the Basic Finish Date and the Scheduled Finish Date cannot change or update the Scheduled Finish Date and the Basic Finish Date cannot change.
    I believe the reason for this is to be able to use the Basic Date to maintain the ATP accurately and keep the Scheduled Date to mark when the order was originally due from the shop floor to be able to measure if orders are being completed on time or late.
    I have worked in tnx OPUZ and had some success with other issues with these dates but I can't seem to make them work independently from each other.
    Or does anyone have any ideas how to measure proces order performance to the production schedule?
    Thank you for your help,
    Greg

    Rajesha, thank you for your reply but it doesn't solve my problem.
    Let me restate my scenario:
    I start a process order and both the basic and scheduled finish dates are the same, June 1.
    At some point, shop floor tells me they will be late and cannot deliver until June 15.
    I need to update a date in the system so the ATP and the MRP planning runs have correct information for promising customers, I will update the Basic Finish date with June 15.
    I also need to keep the original June 1 date in order to measure the shop floor performance to the production schedule to measure how early or late the  order was delivered. How can I keep the original finish date or how can I measure if a process order is early or late??
    Thank you for your help,
    Greg

  • Difference between "Database Variant To Data" and "Variant To Data"

    Can anyone tell me the differnce between the 2 VI's "Database Variant To Data" and "Variant To Data"?
    I am using the database connectivity toolset and making a query.
    I have tried using both, but the give me the same result.
    Attachments:
    Variant to Data.JPG ‏45 KB

    You won't see a difference between these two functions with just a string or other simple data types.  Where you'll see a difference is with clusters and more complex data types that come from the database.  The variants returned by databases can be slightly different than the standard variant.  That is where the Database Variant To Data is needed.  Otherwise, if you are just reading string information, either function will work fine.
    Crystal

  • Using attribute as a set of data and parsing this data

    Hi everyone,
    I present below a (little) challenge with the use of attributes in XQuery. Consider the following XML document:
    <showroom>
    <car id="1">
    <name>Clio</name>
    <family>Renault</family>
    </car>
    <car id="n">
    <name>Q5</name>
    <family>Audi</family>
    </car>
    </showroom>
    Each client of the showroom is identified by a unique Id (e.g., 1,2,3,....). Then, i want to add some data to my XML document which should represent, for each car, the set of all clients' Id that have rented this car.
    The desired XML document could look like this:
    <showroom>
    <car id="1">
    <name>Clio</name>
    <family>Renault</family>
    +*<history>*+
    +*<client id="2"/>*+
    +*<client id="23"/>*+
    +*</history>*+
    </car>
    <car id="n">
    <name>Q5</name>
    <family>Audi</family>
    +*<history>*+
    +*<client id="56"/>*+
    +*</history>*+
    </car>
    </showroom>
    However, by using elements in order to represent the rental historic, the document's size will increase significantly.
    As i use only the clients' id, are there any way to represent the history data using only attributes ?+.
    In the following document, the clients' id are represented, as a set, through the attribute +@history+:
    <showroom>
    <car id="1" history="2,23">
    <name>Clio</name>
    <family>Renault</family>
    </car>
    <car id="n" history="56">
    <name>Q5</name>
    <family>Audi</family>
    </car>
    </showroom>
    However, are there any way to check if a given car of id='x' has been rented by a client of Id='y' ?+.
    Does someone know how to represent the history data (sequence of clients' id), using only attributes, and how to look for a given client's id as explained above ?
    Please suggest. I appreciate your help.

    The two following documents represent examples of the showroom data and the clients' data respectively:
    First document:
    <showroom>
    <car id="1">
    <name>Clio</name>
    <family>Renault</family>
    </car>
    <car id="n">
    <name>Q5</name>
    <family>Audi</family>
    </car>
    </showroom>
    Second document:
    <clients>
    <client id="2">
    <name>...</name>
    <firstname>...</firstname>
    <driverLicence serialNumber="2156311"/>
    </client>
    </clients>
    The DTDs of these documents are defined as follows:
    The showroom DTD:
    <!ELEMENT showroom (car)*>
    <!ELEMENT car (name,family)>
    <!ELEMENT name (#PCDATA)>
    <!ELEMENT family (#PCDATA)>
    <!ELEMENT N3 (#PCDATA)>
    <!ATTLIST car id ID #REQUIRED>
    The clients DTD:
    <!ELEMENT clients (client)*>
    <!ELEMENT client (name,firstname,driverLicence)>
    <!ELEMENT name (#PCDATA)>
    <!ELEMENT firstname (#PCDATA)>
    <!ELEMENT driverLicence EMPTY>
    <!ATTLIST client id ID #REQUIRED>
    <!ATTLIST driverLicence serialNumber ID #REQUIRED>
    Whenever a car is rented, I must add some information either in the same showroom document (it will be better for me) or in another document which relies rented car id with the id of the client which rented this car.
    Thanks in advance for your help.

Maybe you are looking for