Month count from 0CALMONTH

I am trying to get the count of the month from 0CALMONTH using an exit variable. Is this code correct? Thanks.
  WHEN 'ZMONTHCT'.
    IF i_step = 2.
data: month_num type i.
        LOOP AT I_T_var_range
           INTO loc_var_range WHERE vnam = '0PCALMONTH' or
                                    vnam = 'ZCMONTH2' OR
                         vnam = 'ZCMONTH3' OR
                         vnam = 'ZCMONTH4'.
        month_num = loc_var_range-low+4(2).
        l_S_range-low = month_num.
        l_s_range-sign = 'I'.
        l_s_range-opt = 'EQ'.
        APPEND l_s_range TO E_T_range.
        EXIT.
      ENDLOOP.
    ENDIF.

sohini,
Instead of doing all that...
Take the calmonth variable value - have a formula variable in your query to get the text value of the charactewristic..
Lets take 022007...
The internal format would be 022007 use the formula to calculate absolute value of (022007 / 10000) you would get 2 which is what you want - you need not use any exit for this or use the other number functions to get the value that you want when you divide this value by 10000 ...
Arun
Assign points if useful

Similar Messages

  • Month count

    Oracle -9i Release 2
    How do I write a sql query to get month-wise count for actual working day, i.e. exclude saturday and sundays from the month count, is there a way to do it, i have the following query that gives total count for each month, also it is not ordered by month.
    SELECT TO_CHAR(xmonth.ddate,'MON'),COUNT(1)
    FROM (SELECT TRUNC(SYSDATE,'mon') + ROWNUM - 1 ddate
    FROM ALL_OBJECTS
    WHERE TRUNC(SYSDATE,'mon') + ROWNUM - 1 <= LAST_DAY(TO_DATE('12/31/2005','mm/dd/yyyy')) ) xmonth
    GROUP BY TO_CHAR(xmonth.ddate,'MON')

    The following example should help.
      1  SELECT TO_CHAR(MYDATE,'MONTH YYYY') MONTH, COUNT(*) COUNT
      2  FROM(SELECT DATE '2004-01-01'+ ROWNUM -1 MYDATE
      3         FROM(SELECT 1 FROM DUAL
      4               GROUP BY CUBE(1,2,3,4,5,6,7,8,9)))
      5  WHERE MYDATE < DATE '2005-01-01'
      6  AND TO_CHAR(MYDATE,'DY') NOT IN ('SAT','SUN')
      7  GROUP BY TO_CHAR(MYDATE,'MONTH YYYY')
      8* ORDER BY TO_DATE(TO_CHAR(MYDATE,'MONTH YYYY'),'MONTH YYYY')
    SQL> /
    MONTH                               COUNT
    JANUARY   2004                         22
    FEBRUARY  2004                         20
    MARCH     2004                         23
    APRIL     2004                         22
    MAY       2004                         21
    JUNE      2004                         22
    JULY      2004                         22
    AUGUST    2004                         22
    SEPTEMBER 2004                         22
    OCTOBER   2004                         21
    NOVEMBER  2004                         22
    DECEMBER  2004                         23
    12 rows selected.
    SQL> disconnect
    Disconnected from Oracle9i Enterprise Edition Release 9.2.0.3.0 - 64bit Production
    With the Partitioning, OLAP and Oracle Data Mining options
    JServer Release 9.2.0.3.0 - Production

  • Derive 0fiscyerar from 0calmonth in a query

    Hello all,
    We need to build a query which will show three columns: the first two will use calendar month using the value of the entry variable the user will enter. The third one has to show YTD values using 0fiscyear. But the user only wants to enter 0calmonth, so, is there a way to derive 0fiscyear from 0calmonth in a query?
    Thanks in advance
    Kenya

    hi,
    to get the YTD value you can use SAP EXIT variable.
    for 0FISC YEAR check the variable which sap has provided.
    there r variable like >>cumulated upto current month>>.
    u check them.
    regards
    sridhar.v

  • 13 months back from the Chosen Month

    Hi, I am using SAP BW Query as Source for my Universe and i dont have any BI Variables in the Query.
    My Month and Year Objects is [0CALMONTH] it will display like JAN 2009.
    here the requirement is i am using this dimension as FILTER in my Query Panel. i have to get 13 months back from the chosen month and year.
    Suppose the User has chose JAN2009 in Prompt. the report should disaplay the months from JAN 2009 to Jan2008.
    Can anyone please Tell me how to construct my Prompt in the Universe to get 13 months.
    i know its very easy in Relational world but here the problem is i am using SAP query as backend.
    So Need MDX solution for this.
    Thanks,
    Kalyan

    Hi,
    It is possible to define such a filter using MDX expression.
    Thi is a little bit tricky because calculated members defined in MDX with SAP is limited to numeric expressions and supports very few string expressions.
    Moreover the result of any calculated expression MUST be numeric.
    So, in order to build the filter we have to use
    [0CALMONTH]
    display attributes:
      [20CALYEAR]
      [20CALMONTH2]
    For instance you can build a calculated expression that will return the YEAR and the MONTH of the characteristic using the following format: YYYY.MM:
    <EXPRESSION>([0CALMONTH].[20CALYEAR] + ( [0CALMONTH].[20CALMONTH2] /100))</EXPRESSION>
    Now you can define a filter taht includes a promppt where the user can enter manually (in free mode) a YEAR / MONTH like this: YYYY.MM
    Here is the code:
    <FILTER EXPRESSION=" IIF ( ([0CALMONTH].[20CALYEAR] + ( [0CALMONTH].[20CALMONTH2] /100))  < @Prompt('Year/Month (YYYY.MM)','N',,mono,free,persistent)-1, 0, IIF ( ([0CALMONTH].[20CALYEAR] + ( [0CALMONTH].[20CALMONTH2] /100))  <= @Prompt('Year/Month (YYYY.MM)','N',,mono,free,persistent),1,0)) "><CONDITION OPERATORCONDITION="Equal"><CONSTANT CAPTION="1"/></CONDITION></FILTER>
    This filter returns "1" when the 0CALMONTH value is between the date entered by the user minus 13 months, otherwise the filter returns "0".
    Didier.

  • Wrong results from "Select count(*) from tbl"

    I am the user of an Oracle DB and I am getting what
    look like wrong counts using "Select count(*)" statments.
    It first occurred when I tried to get monthly record counts with
    Select count(*), month
    from tbl
    group by month
    (Note this is the query I used with the exception
    of a change in the table name. The month field is numeric)
    All the monthly counts but one looked like it was 2x what it should be.
    Oddly enough if I tried
    Select count(*), month
    from tbl
    where month = 200302
    group by month
    OR
    Select count(*), month
    from tbl
    where month in (200301 200302)
    group by month
    I got what looked correct.
    I even got the 2X problem when I asked for a count on
    the entire table using
    Select count(*)
    from tbl
    One of our DBAs suggested the problem has somehting to do with
    the indexes and not running analyze on the table recently.
    I'll note also that the table is partitioned.
    I think it's Oracle version 8.1.7.4.0 running on a Sun box.
    Has anyone seen this before or does anyone have any
    suggestions on the cause of the problem?
    I have been told it has to do with indexes
    and I know there are many indexes on this table.
    The table is also partitioned.
    Thanks,
    - john

    plz copy and paste here your tests
    i am running 8.1.7.4.0 too and all is fine here...
    (i heard about a count(*) problem but on a lite version of an old 8.0.x...)
    Fred

  • File Adapter - how to get the file count from a folder

    Hi All,
    I have a requirement that have to poll a directory when the file count is reached to number N (ex:number of files avilable in folder is 5) otherwise it should wait and not pick any of the files. Is it possible to get the file count from a folder using file adapter ?? otherwise please suggest me an approach to achieve this requirement.
    Thanks,
    JJ

    Hi Sarath,
    Thank you for your reply.
    Go with the list files operation of file adapter it will gives you the number of files in the specified folder as you given. . - this step is already done.
    When the number of files reaches your count startup your webservice that which can polls the files. . . - how can i acheive this?? Have to poll the directory and process the number files - please let me know, what could be added to the webservice which is being invoked after cheking file count from parent process.
    The reason for the above question is - we cannot use ReadFile operation in second webservice because it will be automatically triggered when the file is avilable. Also SyncRead operation supports reading one file in b/w bpel process. Kindly explain me the implementation steps.
    Thanks,
    JJ

  • Link between Delivery schedule line counter from PO and the material docume

    Dear Gurus,
    I have one PO with single line item having delivery schedule -
    Material 1 -
    delivery schedule 01.01.2009     2000
                                                         01.03.2009    5000
    I have received quantity against this Po
    I want to know where I can find the link between Delivery schedule line counter from PO and the material document
    Best regards
    Sar

    There is no link from the MAterial document line item (Table Mseg) to the PO Schedule Line (EKET).
    If this is for Evaluating an on time delivery or GR, you may consider the following approach.
    PO details Po Date  QTY
    Sch1   01Jun2009   200   
    SCH2  08Jun2009   100
    GR Details
    GR1   01Jun2009   180
    GR2   07Jun2009   110
    GR3  09Jun2009      10
    Calculate a *** total qty for the PO Line.
    PO details Po Date  CUMUL QTY
    Sch1   01Jun2009   200   
    SCH2  08Jun2009   300
    Calculate a *** total qty for the ontime GR.
    PO details Po Date  CUMUL PO QTY  CUMUL GR on time
    Sch1   01Jun2009   200                180
    SCH2  08Jun2009   300                 290 (180+110)  the 3rd GR was too late
    Evaluate the PO SChedule Lines as follows:
    Po SCL qty + CUMUL GR QTY - CUMUL PO QTY = ADJ GR ON Time Qty
    SCH1 01Jun2009
    200 + 180 - 200 = 180 on time for 01Jun2009 date ( 90% fill rate)
    SCH2 08Jun2009
    100 + 290 - 300 = 90 on time for 08Jun2009 date (90 % fill rate) the first 20 of the GR on 07Jun2009 went to fill the late, early date.
    Best of luck !
    SCH2 100 +290 - 300 = 90 on time for 07Jun2009 date

  • How to derive month/year from date in SAP BW 3.5 data flow

    Hi
    How we can derive cal year/month and fiscal month/year from date in SAP BW 3.5 data flow (we're using transfer and update rule)..
    Thanks,
    PK

    Hi,
    if you have any date filed in source side you can just map to any time char system will automatically convert to target objects.
    please look at the screen shot for understanding. (not 3.x it is 7.x)
    Thanks,
    Phani.

  • Extract Month & Year  From Date

    Hi All,
    I have a key figure quantity and i want the data on date,for the month and for the year.
    i create the variables for the date,for the month(ie from date to date) and for the year(ie, from date to date) seperatly that means i have three input variables which may sometimes create confusion.
    My problem is that I want to enter only date and the variable itself calculate the month and year from the date so that it returns the data as desired above.
    for eg. : Now i to enter date : 3/14/2009
              enter MTD (FROM/TO) : 3/01/2009 - 3/14/2009
              enter YTD (FROM/TO) : 4/01/2008 - 3/14/2009
    I want to enter only date : 3/14/2009
    and the variable itself extract the month and year till date.
    and also the same variable calculates number of days so that need not to take the formula variable of date difference to calculate the average qty.
    Neha..

    Hi,
    1. Create User Entry Variable on 0CALDAY : Name = ZCDAY.
    2. Craete a Customer Exit Variable on 0CALDAY: Name  = ZMTD.
    3. Craete a Customer Exit Variable on 0CALDAY: Name  = YMTD.
    Properties of Customer Exit Variables.
    Variable reporesents = Single
    Variable Entry = Mandatory
    Processing By = Customer Exit.
    Character = Calender Day
    Here I'm thinking that ZKF is your key figure.
    In columns you create two selections one is for MTD and other is for YTD.
    In MTD selection, drag and drop ZKF and Drag and Drop 0CALDAY and then Right Clcik and Restrict-->
    Selection = Value Range. (In Between) and restrict with the follwoing Variables
    []ZMTD; ZCDAY.
    In YTD selection, drag and drop ZKF and Drag and Drop 0CALDAY and then Right Clcik and Restrict-->
    Selection = Value Range. (In Between) and restrict with the follwoing Variables
    []YTD; ZCDAY.
    Then write the following code in I_STEP = 2.
    DATA: ZT_DT1 TYPE SY-DATUM,
              ZT_DT2 TYPE SY-DATUM,
              ZT_SDT TYPE SY-DATUM,
              ZT_YR(4) TYPE N,
              ZT_DY(2) TYPE N,
              ZT_MT(2) TYPE N,
              ZE_TT(2) TYPE N,
              ZPOPER TYPE POPER,
             ZRELJR TYPE RELJR.
    WHEN 'ZMTD_A'.
      LOOP AT i_t_var_range INTO loc_var_range WHERE vnam = 'ZCDAY'.
        IF sy-subrc = 0.
          CLEAR: l_s_range.
          ZT_DY = '01'.
          ZT_SDT = loc_var_range-low.
          ZT_MT = ZT_SDT+4(2).
          ZT_YR = ZT_SDT+0(4).
          CONCATENATE ZT_YR ZT_MT ZT_DY INTO ZT_DT1.
          l_s_range-low = ZT_DT1.
          l_s_range-sign = 'I'.
          l_s_range-opt = 'EQ'.
          APPEND l_s_range TO e_t_range.
        ENDIF.
      ENDLOOP.
    WHEN 'ZYTD'.
      LOOP AT i_t_var_range INTO loc_var_range WHERE vnam = 'ZCDAY'.
        IF sy-subrc = 0.
          CLEAR: l_s_range.
          ZT_DY = '01'.
          ZT_SDT = loc_var_range-low.
          CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
            EXPORTING
              I_DATE               = ZT_SDT
    *         I_MONMIT             = 00
              I_PERIV              = 'V3'
           IMPORTING
             E_BUPER              = zbuper
             E_GJAHR              = zbdatj
           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.
          CALL FUNCTION 'FIRST_AND_LAST_DAY_IN_YEAR_GET'
            EXPORTING
              I_GJAHR              = zbdatj
              I_PERIV              = 'V3'
           IMPORTING
             E_FIRST_DAY          = ZT_DT2
    *         E_LAST_DAY           =
           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.
          l_s_range-low = ZT_DT2.
          l_s_range-sign = 'I'.
          l_s_range-opt = 'EQ'.
          APPEND l_s_range TO e_t_range.
        ENDIF.
      ENDLOOP.
    Thanks
    Reddy

  • I cant seem to open some photos on Iphoto. I downloaded like 3 months ago from my phone into the iphoto. I could access ALL of my photos back then but when I try and access them now I cant seem to open the file

    I cant seem to open some photos on Iphoto. I downloaded like 3 months ago from my phone into the iphoto. I could access ALL of my photos back then but when I try and access them now I cant seem to open the file. When i open iphoto and open the folder thats on it, i can see ALL the photos that are there but when I click on different ones some appear in the larger screen but A LOT of them dont appear. Iphoto seems to have erased the file or I dont know.
    Also I tried clicking on the photo that doesnt appear and making it "Reveal it on finder" - "original file" and it says 'The operation can’t be completed because the item can’t be found.".
    I really want those photos because they involve a really special family vacation, please help me find those photos

    A LOT of them dont appear.
    What do you see in the window when you click on those?  A blank, black window?  An exclamation mark?  What?

  • Returning a count from a query using Union

    Hi. I'm attempting to select a count from this query and then display the total in a message, but I'm getting a 'Too many rows returned' (ORA-01422). Can anyone tell me how I can achieve a total for this query?
             SELECT nvl(count(*),0)
           INTO conflict_cnt
           FROM dropper_assign
           WHERE dropper_id = :dropper_vacations.dropper_id AND
                trunc(sched_date) between :begin_dt and :end_dt
              union                          
       SELECT nvl(count(*),0)
        FROM exfc.bundle a, splits b
        WHERE a.bundle = b.bundle AND
             b.dropper_id = :dropper_vacations.dropper_id AND
             trunc(a.actual_dt) between :begin_dt and :end_dt;
              call_alert.the_error('test: '||to_char(conflict_cnt));Any help would be greatly appreciated.

    Thanks Christian, I can know return to my favourite present occupation named HOLIDAYS ;)
    btw with count function as the first message
    WITH
      data AS
        SELECT
          COUNT(*) cnt
        FROM
          dual
          CONNECT BY level <= 10
        UNION
        SELECT
          COUNT(*) cnt
        FROM
          dual
          CONNECT BY level <= 20
    SELECT
      SUM(cnt)
    FROM
      data
    SUM(CNT)              
    30        
    /* and */
    WITH
      data AS
        SELECT
          COUNT(*) cnt
        FROM
          dual
          CONNECT BY level <= 10
        UNION ALL /****** returns me also 30 *****/
        SELECT
          COUNT(*) cnt
        FROM
          dual
          CONNECT BY level <= 20
    SELECT
      SUM(cnt)
    FROM
      data
    SUM(CNT)              
    30       result will defer only if both count return exactly the same value so definitely UNION ALL for that case or the simple solution I have provided before ...
    but leave it. that's enough messages for this thread ;)
    Jean-Yves
    Edited by: JeanYves Bernier on 9 août 2011 17:42

  • Select count from large fact tables with bitmap indexes on them

    Hi..
    I have several large fact tables with bitmap indexes on them, and when I do a select count from these tables, I get a different result than when I do a select count, column one from the table, group by column one. I don't have any null values in these columns. Is there a patch or a one-off that can rectify this.
    Thx

    You may have corruption in the index if the queries ...
    Select /*+ full(t) */ count(*) from my_table t
    ... and ...
    Select /*+ index_combine(t my_index) */ count(*) from my_table t;
    ... give different results.
    Look at metalink for patches, and in the meantime drop-and-recreate the indexes or make them unusable then rebuild them.

  • Select Count(*) from Sample_table - how to get the count using JDBC?

    Hi All,
    It would be glad if anyone could help me with this. The problem is that I have to get the 'count' of records selected from a arbitrary table say, 'sample_table'. Is that possible to form the SQL in JDBC as
    Select Count(*) from Sample_table
    and get the value of the count? If yes, how?
    Thanks in advance
    Prabz

    stmt = con.createStatement();
    ResultSet recordcnt_rs = stmt.executeQuery("Select Count (*) as record_ctr From Sample_table");
    recordcnt_rs.next();     
    record_ctr = recordcnt_rs.getInt("record_ctr");
    hope this helps.

  • How to get the FILE COUNT from File directory

    Hello,
    i have to develop a scenario like, get  the file count from source file directory and validate whether the file count is 5 or not. if 5 files exist i need to process those 5 files to DB tables. if file count is not equal to 5 then i need to send a mail to customer that files are missed at source directory. (subject as files were missed at source directory and in content i need to display the file names exist at source file directory. So that missed file will be generated by the customer based on this mail).
    Could you please let me know how to get the count of files from source file directory. if it is possible only with UDF please provide the Java code
    Best Regards,
    SARAN

    Do these files have some fixed names?
    Can you try to use the option Advanced Selection For Source File to make XI  pick all 5 files in one shot?
    Check this blog on the same -
    /people/mickael.huchet/blog/2006/09/18/xipi-how-to-exclude-files-in-a-sender-file-adapter
    If this is not a option - BPM sounds the only possible way.
    Regards,
    Bhavesh

  • IPad unread email count doesn't tally with Microsoft Exchange 2007 email count from OWA.

    I discovered that when we first setup the iPad to sync email from Microsoft Exchange 2007 server via ActiveSync, the total number of unread email count tally with the count from OWA. After a few days, the unread email count will be out of sync. The settings for iPad "Mail days to syn": No limit. Mail to show: 1000. iPad iOS: 5.1.1
    We performed the following:
    1.     Compare email by email to verify which are the read email from OWA doesn't sync to iPad. We discovered that some emails read from OWA doesn't sync with iPad even performed forced update. However, if we delete that read email from OWA, it will delete (unread) from iPad immediately after sync.
    2.     Email recall message for successful recalled displayed in OWA but not on iPad.
    3.     Calendar invite message forward as email displayed in OWA but not in iPad.
    Is there a bug for Microsoft Exchange 2007 or there is limitation for iPad?
    Any kind expert can advice?
    Thanks.

    Can you do setup an unread mail folder that shows all unread mail regardless of what folder it really is in on the iPhone mail program somehow?
    No.
    If not, can this be submitted as an enhancement as it makes email use very cumbersome.
    Yes. You can submit feedback to Apple: http://www.apple.com/feedback/iphone.html.

Maybe you are looking for

  • Two iTunes music libraries on one computer

    Currently my iTunes library is on my work computer. I want to switch to my home computer, which already has my son's iTunes account and library that he synchs his iPod to. Can I add my account/library separate from his so our music and content don't

  • HT201317 In iCloud, Photo Stream will not turn on.   I Have latest iPhoto ?

    In iCloud, Photo Stream will not turn on.   I Have latest iPhoto ?  Yet it tells me I need to update iPhoto or Aperture.  How do I turn photo Stream on,? The FAQ were no help

  • Layout and DPI

    Hello, I know how to change text padding for different dpi with @media tag in css file. I konw how to choose image with MultiDPIBitmapSource Layout properties like gap, padding... are not styles, not bitmapSource How can I simply choose layout visual

  • Cannot close a tab

    I have Firefox 3.6.12. In the last couple of days I have been having problems cosing tabs. I click on the cross on the tab but nothing happens. It only happens occasionaly on 1 tab. I can close other tabs in the session without a problem. It is not s

  • Faulting application name: InDesign.exe

    Hi I am a systems admin trying to sort out a problem for a client. The client will be working on files in Indesign and it will crash. Also other Adobe products are crashing Here is the errors from the application logs: Faulting application name: InDe