Nav attribute in where-statement

Hi Experts,
I have a routine in which I want to select 0MAT_SALES where my navigation attribute ZACCASGRP equals some values. I have written the code below but I get a syntax error when trying to compile it. I do not get any suggestions and I have not been able to figure out the problem.
data: BEGIN OF Z_FUNDGROUP occurs 0,
    /BI0/OIMAT_SALES TYPE /BIC/AZBILCOPA00-MAT_SALES,
END OF Z_FUNDGROUP.
SELECT * FROM /BIC/AZBILCOPA00
    Into corresponding fields of table Z_FUNDGROUP
        where MAT_SALES-ZACCASGRP IN ('a', 'b', 'c').
My problem is the where-statement and I have also tried with the following combinations but non of them works:
/BI0/OIMAT_SALES-ZACCASGRP
/BI0/OIMAT_SALES-0MAT_SALES__ZACCASGRP
MAT_SALES-0MAT_SALES__ZACCASGRP
if I change it to only say: where MAT_SALES IN ('a', 'b', 'c'). I do not get the error (but this is of course useless since I am not restricting on my navigation attrivute).
Can somebody please help me with this.
Thank you in advance,
Mikael

Hi,
You are probably right regarding the Select-statement above. I therefore reasoned that I should be able to re-structure my problem and use the following select-statements instead:
SELECT MAT_SALES
    FROM /BI0/PMAT_SALES
    INTO TABLE Z_FUNDGROUP
    WHERE
        MAT_SALES IN (
            SELECT DISTINCT MAT_SALES
                FROM /BIC/AZBILCOPA00
        AND /BIC/ZACCASGRP IN ('a', 'b', 'c').
but when I do this I still get errors. If I skip the "AND /BIC/ZACCASGRP IN ('a', 'b', 'c')" part it gives me valid results, but I have to be able to use this attribute. When I look at the master data table /BI0/PMAT_SALES in SE16 it shows me that there is a field named /BIC/ZACCASGRP and then I do not understand why I cannot use the above select.
Best regards,
Mikael

Similar Messages

  • Query WHERE statement to compare db record date pt 2

    I'm sorry, I hit the answered button on my last post. I didn't mean to. I have been working on this code and have gotten closer to the solution. I just need to tweek out the WHERE statement to get rid of the time from the output, and I believe my cfif needs a little work to allow it to be taken into the actually dates. I cfdumped my variables from my query and finally got an output and not an [empty string]. This is my code now, and I will leave in the cfdump and abort tags so you can see where I put them:
    <cfquery name="CaleventRec" datasource="#APPLICATION.dataSource#">
    SELECT events.eventDate, events.ID AS ID
    FROM events
    WHERE eventDate Between #NextMonthYear# and #NextMonth# AND eventDate >= #dateFormat(Days, 'dd')#
    </cfquery>
    this is my cfif stement
    <cfoutput query="CaleventRec">
    <cfdump var="#eventDate#">
    <cfabort>
    <cfif Days EQ '#eventDate#'>
    <a href = "detail.cfm?id=#ID#">#Days#</a>
    </cfif>
    </cfoutput>
    this is the whole code:
    <cfquery name="CaleventRec" datasource="#APPLICATION.dataSource#">
    SELECT events.eventDate, events.ID AS ID
    FROM events
    WHERE eventDate Between #NextMonthYear# and #NextMonth# AND eventDate >= #dateFormat(Days, 'dd')#
    </cfquery>
                            <!--- Set the ThisDay variable to 0. This value will remain 0 until the day of the week on which the first day of the month falls on is reached. --->
                            <cfset ThisDay = 0>
                            <!--- Loop through until the number of days in the month is reached. --->
                            <cfloop condition = "ThisDay LTE Days">
                                <tr>
                                <!--- Loop though each day of the week. --->
                                <cfloop from = "1" to = "7" index = "LoopDay">
                                <!--- This turns each day into a hyperlink if it is a current or future date --->
                                  <cfoutput query="CaleventRec">
              <cfdump var="#eventDate#">
                                   <cfabort>
              <cfif Days EQ '#eventDate#'>
                                   <a href = "detail.cfm?id=#ID#">#Days#</a>
                                   </cfif>
              </cfoutput>
                                <!---
                                    If ThisDay is still 0, check to see if the current day of the week in the loop matches the day of the week for the first day of the month.
                                    If the values match, set ThisDay to 1.
                                    Otherwise, the value will remain 0 until the correct day of the week is found.
                                --->
                                    <cfif ThisDay IS 0>
                                        <cfif DayOfWeek(ThisMonthYear) IS LoopDay>
                                            <cfset ThisDay = 1>
                                        </cfif>
                                    </cfif>
                                <!---
                                    If the ThisDay value is still 0, or is greater than the number of days in the month, display nothing in the column. Otherwise, dispplay
                                    the day of the mnth and increment the value.
                                --->
                                        <cfif (ThisDay IS NOT 0) AND (ThisDay LTE Days)>
                                        <cfoutput>
                                        <!--- I choose to highlight the current day of the year using an IF-ELSE. --->
                                            <cfif (#ThisDay# EQ #currentday#) AND (#month# EQ #startmonth#) AND (#year# EQ #startyear#)>
                                                <td align = "center" bgcolor="##FFFF99">
                                                    <cfset dayview = #dateformat(createdate(#year#, #month#, #thisday#), "mm/dd/yyyy")#>
                <font class = "calendartoday">#ThisDay#</font>
                                                </td>
                                            <cfelse>
                                                <td align = "center">
                                                    <cfset dayview = #dateformat(createdate(#year#, #month#, #thisday#), "mm/dd/yyyy")#>
                <font class = "calendar">#ThisDay#</font>
                                                </td>
                                            </cfif>
                                        </cfoutput>
                                        <cfset ThisDay = ThisDay + 1>
                                        <cfelse>
                                            <td></td>
                                    </cfif>
                                </cfloop>
                                </tr>
                        </cfloop>
    the output from the cfdump is this: the first event date in the month of june.
    I need this to match the thisday part of the code in the cfloop function through the days of the week.
    Can anyone help me figure this part out?
    thank you, and really sorry about the 2nd post. I just woke up and hit the wrong button. again, really sorry all.
    CFmonger

    This is a small calendar. it will move to the next month at the end of this one, it can also go to the next month with a next / prev button that will let you go as far as you want. It is like all we have seen before. What I need to do it get the eventDate in my DB, that is set as date and put in as mm/dd/yyyy now, basically what I believe the query needs to do it to not only tell what month the calendar is on, but it needs to match any db records with any of the days in that month. Say we are in June: I have 3 records in June, on the 5th, 20th, and 26th. In all the 31 days in the month of June, just those 3 will show a link with an ID to the record that matches in the DB.
    I had it narrowed down with that query, but lose the variable once I try and cfif it. So I knew either my query is wrong, or my cfif is, probably both.
    does that help? can I make this work? am I even close?
    thank you.
    CFmonger
    By the way, here is the entire code with the next / prev nav for cycling through the months.
    <!--- Declaration of the variables --->
           <cfparam name = "month" default = "#DatePart('m', Now())#">
    <cfparam name = "year" default = "#DatePart('yyyy', Now())#">
    <cfparam name = "currentday" default = "#DatePart('d', Now())#">
    <cfparam name = "startmonth" default = "#DatePart('m', Now())#">
    <cfparam name = "startyear" default = "#DatePart('yyyy', Now())#">
    <!--- Set a requested (or current) month/year date and determine the number of days in the month. --->
    <cfset ThisMonthYear = CreateDate(year, month, '1')>
    <cfset Days = DaysInMonth(ThisMonthYear)>
    <!--- Set the values for the previous and next months for the back/next links.--->
    <cfset LastMonthYear = DateAdd('m', -1, ThisMonthYear)>
    <cfset LastMonth = DatePart('m', LastMonthYear)>
    <cfset LastYear = DatePart('yyyy', LastMonthYear)>
    <cfset NextMonthYear = DateAdd('m', 1, ThisMonthYear)>
    <cfset NextMonth = DatePart('m', NextMonthYear)>
    <cfset NextYear = DatePart('yyyy', NextMonthYear)>
    <cfset PreviousDay = DateAdd('d', -1, ThisMonthYear)>
    <cfset CurrentYear = DatePart('yyyy', Now())>
    <table border="0" width="100%" bgcolor ="#ffffff">
                <tr>
                    <td align = "center" valign="top">
                        <table border="0" width="100%" height="100%">
       <tr>
          <th align="center" colspan="7" bgcolor="#2b4e6e">
       <cfoutput>
       <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="15%" align="left" valign="middle">
      <cfif (LastYear lt CurrentYear) OR (LastYear lte CurrentYear AND LastMonth lt startmonth)>
    <cfelse>
      <a href ="index.cfm?month=#LastMonth#&year=#LastYear#" class="calNav">Prev</a></cfif></td>
            <td width="72%" align="center" valign="middle"><FONT SIZE="3" face="Arial, Helvetica, sans-serif" color="##ffffff">#MonthAsString(month)# #year#</FONT></td>
            <td width="13%" align="right" valign="middle">
      <cfif (NextYear lt CurrentYear) OR (NextYear lte CurrentYear AND NextMonth lt startmonth)>
    <cfelse>
    <a href = "index.cfm?month=#NextMonth#&year=#NextYear#" class="calNav">Next</a>  </cfif></td>
          </tr>
        </table></cfoutput></th>
       </tr>
       <tr>
        <td><FONT SIZE="2" face="Arial, Helvetica, sans-serif" color="#333366">Sun</FONT></td>
        <td><FONT SIZE="2" face="Arial, Helvetica, sans-serif" color="#333366">Mon</FONT></td>
        <td><FONT SIZE="2" face="Arial, Helvetica, sans-serif" color="#333366">Tue</FONT></td>
        <td><FONT SIZE="2" face="Arial, Helvetica, sans-serif" color="#333366">Wed</FONT></td>
        <td><FONT SIZE="2" face="Arial, Helvetica, sans-serif" color="#333366">Thu</FONT></td>
        <td><FONT SIZE="2" face="Arial, Helvetica, sans-serif" color="#333366">Fri</FONT></td>
        <td><FONT SIZE="2" face="Arial, Helvetica, sans-serif" color="#333366">Sat</FONT></td>
       </tr>
    <cfquery name="CaleventRec" datasource="#APPLICATION.dataSource#">
    SELECT events.eventDate, events.ID AS ID
    FROM events
    WHERE eventDate Between #NextMonthYear# and #NextMonth# AND eventDate >= #dateFormat(Days, 'dd')#
    </cfquery>
                            <!--- Set the ThisDay variable to 0. This value will remain 0 until the day of the week on which the first day of the month falls on is reached. --->
                            <cfset ThisDay = 0>
                            <!--- Loop through until the number of days in the month is reached. --->
                            <cfloop condition = "ThisDay LTE Days">
                                <tr>
                                <!--- Loop though each day of the week. --->
                                <cfloop from = "1" to = "7" index = "LoopDay">
                                <!--- This turns each day into a hyperlink if it is a current or future date --->
             <cfoutput query="CaleventRec">
              <!---  <cfdump var="#eventDate#">
                                   <cfabort>--->
              <cfif #dateFormat(eventDate, 'dd')# IS ('Days, LoopDay')>
              <cfdump var="#eventDate#">
                                   <cfabort>
                                   <a href = "detail.cfm?id=#ID#">#Days#</a>
                                   </cfif>
              </cfoutput>
                                <!---
                                    If ThisDay is still 0, check to see if the current day of the week in the loop matches the day of the week for the first day of the month.
                                    If the values match, set ThisDay to 1.
                                    Otherwise, the value will remain 0 until the correct day of the week is found.
                                --->
                                    <cfif ThisDay IS 0>
                                        <cfif DayOfWeek(ThisMonthYear) IS LoopDay>
                                            <cfset ThisDay = 1>
                                        </cfif>
                                    </cfif>
                                <!---
                                    If the ThisDay value is still 0, or is greater than the number of days in the month, display nothing in the column. Otherwise, dispplay
                                    the day of the mnth and increment the value.
                                --->
                                        <cfif (ThisDay IS NOT 0) AND (ThisDay LTE Days)>
                                        <cfoutput>
                                        <!--- I choose to highlight the current day of the year using an IF-ELSE. --->
                                            <cfif (#ThisDay# EQ #currentday#) AND (#month# EQ #startmonth#) AND (#year# EQ #startyear#)>
                                                <td align = "center" bgcolor="##FFFF99">
                                                    <cfset dayview = #dateformat(createdate(#year#, #month#, #thisday#), "mm/dd/yyyy")#>
                <font class = "calendartoday">#ThisDay#</font>
                                                </td>
                                            <cfelse>
                                                <td align = "center">
                                                    <cfset dayview = #dateformat(createdate(#year#, #month#, #thisday#), "mm/dd/yyyy")#>
                <font class = "calendar">#ThisDay#</font>
                                                </td>
                                            </cfif>
                                        </cfoutput>
                                        <cfset ThisDay = ThisDay + 1>
                                        <cfelse>
                                            <td></td>
                                    </cfif>
                                </cfloop>
                                </tr>
                        </cfloop>
                        </table>
                    </td>
                </tr>
            </table>

  • Use of attributes in FIX statement w/ other mbrsets

    Hi all,I just discovered that in 6.1.4, using a FIX statement like:FIX (@ATTRIBUTE("Diet"), @LEVMBRS(Products, 0))will actually select all products, not just a subset that have the attribute "Diet" (where "Diet" is, of course, an attribute of products).Now you might think I'm ignorant, since it seems logical that the subset "Diet" might be overridden by the superset "Products". However the same problem happens if I use:FIX (@ATTRIBUTE("Diet"), @ATTRIBUTE("Discontinued"))This statement returns neither the intersection nor the union of those two subsets - I seem to get ALL products.What gives? Am I just a foolish country boy?-dan

    Does this select ALL of the products, or just the Level 0 products? The reason I ask is that the statement will not be combined using AND logic - only members of different dimensions will be combined using AND logic. Try the following:FIX (@LEVMBRS(Product, 0) AND @ATTRIBUTE(Diet))Now, if your attribute is at level 0 (I assume it is) and you want to select them, just use:FIX (@ATTRIBUTE(Diet))That will select all of the products that have a Diet attribute.Hope that helps.Regards,Jade-------------------------------Jade ColeSenior Business Intelligence ConsultantClarity [email protected]

  • Tricky! Change of navi-attribute values in ABAP and use in selections

    Hi gurus,
    now I have a teaser that really keeps me busy, and which might be interesting for some of you:
    we use several statuses in our <u>Demand Planning in SCM 5.0</u>, some of which can be switched by using a user-function macro which just basically is a ABAP function module that <u>changes navigation attribute values directly on the database</u>, meaning in the master data tables of the respective characteristic.
    Now, the code works, the values are changed accordingly, leaving the data set in object status "active" - <b>BUT</b>:
    <i>when we call a selection, it still shows the old values, even after activating master data or running the attribute change run!</i>
    This is not what we expected. Our wish was, that once the table was updated with the correct field values, we would also see them in our selections.
    <u>Details:</u>
    we have two statuses as navi-attributes to an article:
    <i>DP:</i> YES/NO, and
    <i>oDP:</i> YES/NO
    Combinations originally are: <i>DP</i> YES/<i>oDP</i> NO
    After the status change macro, the table shows the following, as expected:
    <i>DP</i> NO/<i>oDP</i> YES
    As we have two selections, one on DP status "YES", the other one on oDP status "YES", we would like to see the article vanish in the first selection and show up in the other one...
    Does anybody have an idea what is wrong and what we can do to have to proper navi-attribute values from the master data table in the selection? Does the selection not read from the database but from a buffer?
    Looking forward to your answers,
    Klaus

    Hi Fabrice,
    yes indeed, I did check the object version, and it is A.
    Problem is, the function module changes the data record which is "A" anyway. So the changed data record is active - however, I just had a look at the SID master data table, and it looks that direct changes to the P-table do not affect the X-table where the SIDs are stored. So I guess I will also have to update the X-table with the correct SID-values.
    If this works, I let you know. We will be using this change by ABAP quite often, it is rather useful.
    Regards and thanks for your prompt reply,
    Klaus

  • Query WHERE statement to compare db record date

    Hello
    I can't get this where statement to work. I have it now so it is not throwing any errors, but it also isn't doing what it is supposed to.
    I am trying to match records date in my table with the actual calendar date, if there is a match, my cfif will take that match, and make it a link in the proper date. (it is a small calendar with the month, and the days of week with dates, each date will be normal, accept if there is a record for that date, it makes a link.
    This is my code, like I said, It doesn't throw an error, but it is not working either.
    My Query:
    <cfquery name="CaleventRec" datasource="#APPLICATION.dataSource#">
    SELECT events.eventDate, events.ID AS ID
    FROM events
    WHERE eventDate >= #CreateODBCDate("07/12/2005")# AND eventDate = #Days#
    </cfquery>
    This is the cfif statement:
    <cfoutput query="CaleventRec">
    <cfif Days EQ '#eventdate#'>
    <a href = "detail.cfm?id=#ID#">#Days#</a>
    </cfif>
    </cfoutput>
    this is all the code together:
    <cfquery name="CaleventRec" datasource="#APPLICATION.dataSource#">
    SELECT events.eventDate, events.ID AS ID
    FROM events
    WHERE eventDate >= #CreateODBCDate("07/12/2005")# AND eventDate = #Days#
    </cfquery>
                            <!--- Set the ThisDay variable to 0. This value will remain 0 until the day of the week on which the first day of the month falls on is reached. --->
                            <cfset ThisDay = 0>
                            <!--- Loop through until the number of days in the month is reached. --->
                            <cfloop condition = "ThisDay LTE Days">
                                <tr>
                                <!--- Loop though each day of the week. --->
                                <cfloop from = "1" to = "7" index = "LoopDay">
                                <!--- This turns each day into a hyperlink if it is a current or future date --->
                                   <cfoutput query="CaleventRec">
              <cfif Days EQ '#eventdate#'>
                                   <a href = "detail.cfm?id=#ID#">#Days#</a>
                                   </cfif>
              </cfoutput>
                                <!---
                                    If ThisDay is still 0, check to see if the current day of the week in the loop matches the day of the week for the first day of the month.
                                    If the values match, set ThisDay to 1.
                                    Otherwise, the value will remain 0 until the correct day of the week is found.
                                --->
                                    <cfif ThisDay IS 0>
                                        <cfif DayOfWeek(ThisMonthYear) IS LoopDay>
                                            <cfset ThisDay = 1>
                                        </cfif>
                                    </cfif>
                                <!---
                                    If the ThisDay value is still 0, or is greater than the number of days in the month, display nothing in the column. Otherwise, dispplay
                                    the day of the mnth and increment the value.
                                --->
                                        <cfif (ThisDay IS NOT 0) AND (ThisDay LTE Days)>
                                        <cfoutput>
                                        <!--- I choose to highlight the current day of the year using an IF-ELSE. --->
                                            <cfif (#ThisDay# EQ #currentday#) AND (#month# EQ #startmonth#) AND (#year# EQ #startyear#)>
                                                <td align = "center" bgcolor="##FFFF99">
                                                    <cfset dayview = #dateformat(createdate(#year#, #month#, #thisday#), "mm/dd/yyyy")#>
                                                    <font class = "calendartoday">#ThisDay#</font>
                                                </td>
                                            <cfelse>
                                                <td align = "center">
                                                    <cfset dayview = #dateformat(createdate(#year#, #month#, #thisday#), "mm/dd/yyyy")#>
                                                    <font class = "calendar">#ThisDay#</font>
                                                </td>
                                            </cfif>
                                        </cfoutput>
                                        <cfset ThisDay = ThisDay + 1>
                                        <cfelse>
                                            <td></td>
                                    </cfif>
                                </cfloop>
                                </tr>
                        </cfloop>
    I know my where statement is incorrect, I am also not sure if my cfif statement is correct either. Can anyone help me figure this out?
    thank you!
    CFmonger

    All the rest of the code works. The only part of this that doesn't work is the trying to make a link part.
    Let me  show you where I am, and what I did, then maybe you will see I am closer to the solution... I think. I made this calendar so you can cycle through the months. So if you are looking at June, you see Sun - Sat and the dates for each day of the week in the month of june. You can then choose to click the next button that will bring up the month of july, and you can keep on going as long as you want.
    That is one function and it working as of right now. This Calendar also shows what day of the week we are on. If it is June 16th then June 16 is yellow. This also works.NOw, what I need to do it to have my query, not only filter out the records for the month, (if we are in June, then the Query separates out the records for June, the date in my DB is set to mm/dd/yyyy) This query also needs to match it to a number, the days of the month. So, if there is a record on the 25th of June, then the 25th of June will be a link to another page using it's ID in the address line. If you go to July and there are lets say 3 records for that month, then all 3 dates will become a link to the same other page using it's ID in the url.
    This is what I have now. I tied the Query into the next / prev function so it filters the month, so far it seems to work, I can do a cfdump up to the point of my cfif statement and get the proper number from the date, my cfif is not firing so If I do a dump after it, it doesn't dump anyhting.
    I will post JUST the query code, then post the whole calander code so you can see it all together.
    The Query / link code:
    <!--- This is part of the next / prev nav to cycle through the months --->
    <cfset NextMonthYear = DateAdd('m', 1, ThisMonthYear)>
    <cfset NextMonth = DatePart('m', NextMonthYear)>
    <!--- My Query --->
    <cfquery name="CaleventRec" datasource="#APPLICATION.dataSource#">
    SELECT events.eventDate, events.ID AS ID
    FROM events
    WHERE eventDate Between #NextMonthYear# and #NextMonth#
    </cfquery>
    <!--- my output / cfif stement --->
    <cfoutput query="CaleventRec">
    <cfset comparison = DateCompare('#dateFormat(eventDate, 'dd')#', '#Days#', 'd')>
    <!--- When I do a cfdump here, I get the number of the first record with a day date in the DB for the month of june
    <cfdump var="#dateFormat(eventDate, 'dd')#">
                                   <cfabort>--->
    <cfif #Days# EQ ('#dateFormat(eventDate, 'dd')#')>
    <!--- When I do a dump here, I do not get anyhting, no numbers it doesn't fire
    <cfdump var="#eventDate#">
    <cfabort>--->
    <a href = "detail.cfm?id=#ID#">#Days#</a>
    </cfif>
    </cfoutput>
    ok, now that is the part to stream in the DB info into the calander.
    Here is all the code, like I said, it all works, just not making each day a link that has a record in the DB.
    <!--- Declaration of the variables --->
           <cfparam name = "month" default = "#DatePart('m', Now())#">
    <cfparam name = "year" default = "#DatePart('yyyy', Now())#">
    <cfparam name = "currentday" default = "#DatePart('d', Now())#">
    <cfparam name = "startmonth" default = "#DatePart('m', Now())#">
    <cfparam name = "startyear" default = "#DatePart('yyyy', Now())#">
    <!--- Set a requested (or current) month/year date and determine the number of days in the month. --->
    <cfset ThisMonthYear = CreateDate(year, month, '1')>
    <cfset Days = DaysInMonth(ThisMonthYear)>
    <!--- Set the values for the previous and next months for the back/next links.--->
    <cfset LastMonthYear = DateAdd('m', -1, ThisMonthYear)>
    <cfset LastMonth = DatePart('m', LastMonthYear)>
    <cfset LastYear = DatePart('yyyy', LastMonthYear)>
    <cfset NextMonthYear = DateAdd('m', 1, ThisMonthYear)>
    <cfset NextMonth = DatePart('m', NextMonthYear)>
    <cfset NextYear = DatePart('yyyy', NextMonthYear)>
    <cfset PreviousDay = DateAdd('d', -1, ThisMonthYear)>
    <cfset CurrentYear = DatePart('yyyy', Now())>
    <table border="0" width="100%" bgcolor ="#ffffff">
                <tr>
                    <td align = "center" valign="top">
                        <table border="0" width="100%" height="100%">
       <tr>
          <th align="center" colspan="7" bgcolor="#2b4e6e">
       <cfoutput>
       <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="15%" align="left" valign="middle">
      <cfif (LastYear lt CurrentYear) OR (LastYear lte CurrentYear AND LastMonth lt startmonth)>
    <cfelse>
      <a href ="index.cfm?month=#LastMonth#&year=#LastYear#" class="calNav">Prev</a></cfif></td>
            <td width="72%" align="center" valign="middle"><FONT SIZE="3" face="Arial, Helvetica, sans-serif" color="##ffffff">#MonthAsString(month)# #year#</FONT></td>
            <td width="13%" align="right" valign="middle">
      <cfif (NextYear lt CurrentYear) OR (NextYear lte CurrentYear AND NextMonth lt startmonth)>
    <cfelse>
    <a href = "index.cfm?month=#NextMonth#&year=#NextYear#" class="calNav">Next</a>  </cfif></td>
          </tr>
        </table></cfoutput></th>
       </tr>
       <tr>
        <td><FONT SIZE="2" face="Arial, Helvetica, sans-serif" color="#333366">Sun</FONT></td>
        <td><FONT SIZE="2" face="Arial, Helvetica, sans-serif" color="#333366">Mon</FONT></td>
        <td><FONT SIZE="2" face="Arial, Helvetica, sans-serif" color="#333366">Tue</FONT></td>
        <td><FONT SIZE="2" face="Arial, Helvetica, sans-serif" color="#333366">Wed</FONT></td>
        <td><FONT SIZE="2" face="Arial, Helvetica, sans-serif" color="#333366">Thu</FONT></td>
        <td><FONT SIZE="2" face="Arial, Helvetica, sans-serif" color="#333366">Fri</FONT></td>
        <td><FONT SIZE="2" face="Arial, Helvetica, sans-serif" color="#333366">Sat</FONT></td>
       </tr>
    <cfquery name="CaleventRec" datasource="#APPLICATION.dataSource#">
    SELECT events.eventDate, events.ID AS ID
    FROM events
    WHERE eventDate Between #NextMonthYear# and #NextMonth#
    </cfquery>
                            <!--- Set the ThisDay variable to 0. This value will remain 0 until the day of the week on which the first day of the month falls on is reached. --->
                            <cfset ThisDay = 0>
                            <!--- Loop through until the number of days in the month is reached. --->
                            <cfloop condition = "ThisDay LTE Days">
                                <tr>
                                <!--- Loop though each day of the week. --->
                                <cfloop from = "1" to = "7" index = "LoopDay">
                                <!--- This turns each day into a hyperlink if it is a current or future date --->
             <cfoutput query="CaleventRec">
             <cfset comparison = DateCompare('#dateFormat(eventDate, 'dd')#', '#Days#', 'd')>
              <cfdump var="#dateFormat(eventDate, 'dd')#">
                                   <cfabort>
              <cfif #Days# EQ ('#dateFormat(eventDate, 'dd')#')>
              <cfdump var="#eventDate#">
                                   <cfabort>
                                   <a href = "detail.cfm?id=#ID#">#Days#</a>
                                   </cfif>
              </cfoutput>
                                <!---
                                    If ThisDay is still 0, check to see if the current day of the week in the loop matches the day of the week for the first day of the month.
                                    If the values match, set ThisDay to 1.
                                    Otherwise, the value will remain 0 until the correct day of the week is found.
                                --->
                                    <cfif ThisDay IS 0>
                                        <cfif DayOfWeek(ThisMonthYear) IS LoopDay>
                                            <cfset ThisDay = 1>
                                        </cfif>
                                    </cfif>
                                <!---
                                    If the ThisDay value is still 0, or is greater than the number of days in the month, display nothing in the column. Otherwise, dispplay
                                    the day of the mnth and increment the value.
                                --->
                                        <cfif (ThisDay IS NOT 0) AND (ThisDay LTE Days)>
                                        <cfoutput>
                                        <!--- I choose to highlight the current day of the year using an IF-ELSE. --->
                                            <cfif (#ThisDay# EQ #currentday#) AND (#month# EQ #startmonth#) AND (#year# EQ #startyear#)>
                                                <td align = "center" bgcolor="##FFFF99">
                                                    <cfset dayview = #dateformat(createdate(#year#, #month#, #thisday#), "mm/dd/yyyy")#>
                <font class = "calendartoday">#ThisDay#</font>
                                                </td>
                                            <cfelse>
                                                <td align = "center">
                                                    <cfset dayview = #dateformat(createdate(#year#, #month#, #thisday#), "mm/dd/yyyy")#>
                <font class = "calendar">#ThisDay#</font>
                                                </td>
                                            </cfif>
                                        </cfoutput>
                                        <cfset ThisDay = ThisDay + 1>
                                        <cfelse>
                                            <td></td>
                                    </cfif>
                                </cfloop>
                                </tr>
                        </cfloop>
                        </table>
                    </td>
                </tr>
            </table>
    It is kind of complicated and this is why I need help. Maybe I am wrong in the variables I am pulling, but like I say in my comments, so far I pulled the day part of the month I am in out of the records up until my cfif stement.Can this be done with what I have done so far? No need to rewrite the whole calander, just the part with the query if I miss what you are saying.

  • Authorization for multiple nav attributes

    Hi Experts,
    I have 2 doubts that I need to confirm with you:
    Scenario :
    an aggregation level has nav attributes  A__C  and B__C.
    A__C is restricted by authorization variable in the filter section of the query.
    A__C is shown in the rows as well.
    B__C is not defined anywhere in the aggregation level and the query.
    Authorization is created for the user on  A__C   and  B__C   and assigned to user via the BI7 auth admin tcode(s).
    The requirement is to control such that user cannot  access certain values of  Both  A__C  values and  B__C values found in records. In this case,  user is set to access  only  :
    A__C  :   1111
    B__C  :   2222
    A record exist like this :
    A__C     ****     B__C   ****  KF
    1111      ****     3333    ****  $1000
    Question:
    1.  when the query is executed, authorization check is ok for  A__C  and the query should execute.
    But given that this user is not authorized to B__C  = 3333,   will the KF value of $1000  be displayed by the query at runtime assuming the query only is selecting A__C and the KF?
    If it does not show results or shows 'not authorized' , can I say its due to B__C = 2222 is granted and not B__C = 3333 was granted?
    Else if it does show the $1000, can I say that even if B__C  is set = 2222 in the user profile / authorization object assigned,  there is no effect of authorization in this case and the record having B__C = 3333 will be displayed with the KF value (B__C value still will not be shown as its not in the query definition).
    2.   Assuming char C is defined in the query and aggregation level,  must this be individually restricted (i.e set auth of  C = value1, value2 .....)  in authorization object or roles in order that the effect of A__C is achieved where authorization values for A__C is defined by  setting auth of A__C = value 1, value2 ...?
    Scenario A:  char C is in the aggregation level but not used in the query definition in the rows and filter.
    Scenario B :  char C is in the aggregation level and used in the query definition in the rows.
    What would the result be in the above 2 scenarios ?
    Hope to get enlightened about this aspects.
    Thanks in advance.
    Best regards
    PRex
    Edited by: pointes rexiproca on Apr 3, 2008 6:21 PM
    Edited by: pointes rexiproca on Apr 3, 2008 6:22 PM

    Dear Pointes,
    For management authorization by navigational attribute, I suggest the following steps:
    1.     Should check the attribute setup of “A” and “B” InfoObject in Tcode RSD1, and be sure if they are relevant of authorization. Remember, in BI2004s the attribute navigational are different component authorization.
    2.     Then, you should check your analysis authorization in Tcode RSECADMIN Authorization and verify which these attributes navigational A__C and B__C are included in analysis authorization, and what value do they have? Be careful which logical sing “<, >, =…”. Also, remember include colum “:” value in each attribute navigational for avoid problem.
    3.     Before that, you should check the queries structure and be sure if theses attribute is like a entry variable authorization.
    I hope that can help you,
    Luis

  • Look up on Nav Attribute

    Hi Friends !
    Is it possible to write a code in start routine using the look up on Nav attribute? For instance:
    A = Master IO
    B = Nav Attribute
    C = field in source package
    where A__B = SOURCE_PACKAGE-C.
    With Regards
    Rekha

    Hi Rekha,
    you have lookup the P table of the MAster data:-
    in Start Routine:-
    Global section declare the ITAB
    data : itab type table of /BIX/PXXXXXXX,     (Mater data Table name)
              wa like line of itab.
    in Start Routine Section:-
    select * from /BIX/PXXXXXXX into table itab.
    then Compare it either in Fields Level routine or End Routine (depending on your scenario)
    where wa-B= REsult_package-C.
    Best Regards
    Obaid

  • Selection criteria with Nav Attribute

    Hello,
    I have a scenario where I added a navigational attribute in APO BW. The nav attribute is reflecting correctly in Master Planning Object Structure. But it is not reflecting in the selection criteria in interactive planning.
    Please help.
    Regards
    Steve

    Hello,
    That is great point. I tried to edit the planning book and in the characteristics tab (in the edit mode of planning book) the new attribute is not reflecting in the planning area (which is on the characteristics tab on the right hand side) to take me to the left to planning book.
    I hope I am clear.
    Please help. I need it badly.
    Regards
    Steve

  • Report Issue - Nav Attribute

    Hi All,
        Here is my issue...
    I've a sales report against Multi Provider to display a filed <b>'Province Ship To'</b>, it is a Nav attribute of <b>'Customer Ship To'</b>. I've verified in mastre data of <b>'Province Ship To'</b> that there are values for both text (Medium & Short) & Key and also verified values exits in MP through LISTCUBE. But when I run a query I'm getting 'Not Assigned" value for <b>'Province Ship To'</b> and I need to see full description it.
    I'd appreciate if some one could help me on this as this is urgent...
    Thanks
    BI Consultant

    Thats what I did, display as both TEXT & KEY. For KEY it is  showing up, for example OR in KEY but not showing up the description for TEXT/Name column, isntead it is showing as "Not Assigned" for all records.
    I've verified Short & Med description extits for all records in Masterdata.
    Example:
    <b>Key                                    Txt/Name Desc.</b>
    OR                                         Oregon
    CA                                          California
    CT                                           Connecticut
    Thanks

  • How to create variable in BEx on a Nav Attribute?

    Hi All,
    We are creating a report on Master data object 0MILESTONE. 0PROJECT is the navigational attribute of 0milestone.
    and ZSTATUS is the navigational attribute of 0PROJECT.
    Requirement is to create variable on ZSTATUS in BEx. How do I do that? I dont see option of creating variable on Nav attribute of a Nav attribute.
    Regards,
    Bob

    Hi,
    There is nothing as such creating variable for navigation attribute. You can only create variable directly on particular infoobject.
    In your case you are using transitivie attributes. So they can not be accesed directly in BEX query. You can only use 1st level nagivation attributes in bex query.
    [http://help.sap.com/saphelp_nw04/helpdata/en/6f/c7553bb1c0b562e10000000a11402f/content.htm]
    Regards,
    Durgesh.
    Edited by: Durgesh Gandewar on Feb 22, 2012 3:53 PM

  • Using alias in where statement

    simple sql:
    SELECT EMPLOYEE_ID,
    FIRST_NAME,
    LAST_NAME,
    EMAIL,
    PHONE_NUMBER,
    HIRE_DATE,
    JOB_ID,
    SALARY,
    COMMISSION_PCT,
    MANAGER_ID,
    DEPARTMENT_ID
    FROM EMPLOYEES
    WHERE EMPLOYEE_ID > 1000;
    is it somehow possible to use alias in where statement like
    SELECT EMPLOYEE_ID "ID",
    FIRST_NAME,
    LAST_NAME,
    EMAIL,
    PHONE_NUMBER,
    HIRE_DATE,
    JOB_ID,
    SALARY,
    COMMISSION_PCT,
    MANAGER_ID,
    DEPARTMENT_ID
    FROM EMPLOYEES
    WHERE "ID" > 1000;

    Hi,
    is it somehow possible to use alias in where statement likeWhy do you need it?
    To answer your question "Not directly"
    SQL> select empno eno, sal
      2  from emp
      3  where eno = 7900;
    where eno = 7900
    ERROR at line 3:
    ORA-00904: "ENO": invalid identifierColumn Alias are names given to give meaningful names to columns or the arithmetic operations' column.
    Twinkle

  • Left outer join 3 tables with where-statement

    Hi folks,
    I hope you can understand (and maybe solve) my problem.
    Generally I try to left outer join three tables. The third table is used for a WHERE-statement.
    The three table structures are the following:
    table 1 (user)   
    user1 | key
    table 2 (detail)  
    key | ID
    table 3 (header)
    ID | user2                 
    ...and I want to achieve the following structure (as example filled with data):
    user | key | ID
    |-----|----
    xy    | a    | 001
    xy    | b    | #
    z     | b     | #
    The clue ist the usage of the third table. I need the table to set user1 and user2 equal (WHERE) but there are two problems:
    1) Obviously I can't left outer join two tables with each other. In this case I already used the 'key' of table 1 to join it with the 'key' of table 2. So I can't left outer join the 'ID' of table 2 with the 'ID' of table 3. Error message that I can only left outer join a table once. Any proposals?
    2) I have to include a WHERE to equal user1 with user2. But I am not allowed to use the user2 from table 3 because of the left outer join.
    I tried this coding:
    SELECT auser1 akey b~id INTO TABLE itab FROM ( table1 AS a
      LEFT OUTER JOIN table2 AS b ON akey = bkey )
      LEFT OUTER JOIN table3 AS c ON bID = cID )
      WHERE auser1 = cuser2.
    I would really appreciate your help.
    Regards
    MrclSpdl

    IF you want to join a DB table with an internal table, you need to use the 'FOR ALL ENTRIES' statement.
    select dbfields
    into table itab2
    from dbtab
    for all entries in itab
    where dbfield1 = itab-field1.
    This will get you a second internal table with all the corresponding data for the first selection.  You can then join them with a loop through the first table and a read table on the second table (for 1 - 1 relation) or a nested loop statement on both tables (for 1 - N relation).  Make itab a hashed table when using read table with key, use a sorted table if you need to loop without key access.
    Regards,
    Freek

  • I find it annoying that you can't use aliases in where statements

    I find it annoying that you can't use aliases in where
    statements
    for example:
    SELECT TOP 1
    CAST(amount
    / ( CASE WHEN ISNULL(rate, 0) <> 0 THEN rate
    ELSE 1
    END ) AS NUMERIC(10, 2)) AS num
    FROM table
    WHERE num > 1
    ORDER BY num
    Are there any workarounds?

    > I find it annoying that you can't use aliases in where
    statements
    This isn't really (or... "at all") a CF question. You're
    better off asking
    this sort of thing on a SQL Server forum.
    You could use a derived table, I guess:
    select top 1 num
    from (
    SELECT
    CAST(amount
    / ( CASE WHEN ISNULL(rate, 0) <> 0 THEN
    rate
    ELSE 1
    END ) AS NUMERIC(10, 2)) AS num
    FROM table
    where num > 1
    order by num
    (that might not preserve the intent of you SQL (sorry: it's
    late, I'm
    tired), but you get the idea.
    Adam

  • Group function is not allowed here - where statement

    I have a select that is basically:
    select a,b,
    sum(c),sum(d),
    sum(c) - sum(d)
    from A
    group by a, b
    I would like to add:
    where sum(c) - sum(d) <> 0
    I know that I can't use the sum function in the where statement.
    Any ideas how I can get around it?
    Thanks.
    Leah

    Hi ,
    for instance ... using the count aggregate function... which is the same as using sum function.....
    SQL> select job , cnt_emp , cnt_sal
      2    from
      3    (
      4      select job, count(empno) cnt_emp, count(sal) cnt_sal
      5        from emp
      6      group by job
      7    )
      8   where cnt_emp- cnt_sal=0
      9  /
    JOB                            CNT_EMP    CNT_SAL
    CLERK                                5          5
    SALESMAN                             5          5
    PRESIDENT                            1          1
    MANAGER                              3          3
    ANALYST                              2          2Greetings....

  • SQLQuery and Where-Statement

    Hi,
    I need a possibility to enter the where-statement at runtime.
    In the "SQL Query Statement" I can enter a query and parameters.
    My Problem ist that at runtime my forms-application builds the where-Part of the sql-statement and then sends it to the report.
    I know that reports has the &where_clause option.
    In &where_clause I can enter the whole where-clause of every statement.
    But how can I "tell" reports that it's query should based on this &where_clause???
    In other words: can I set the "sql Query Statement" at runtime?
    Thank you for your help
    bye
    Florian

    Hi Florian,
    In the data model, you can create a user parameter "P_WHERE" varchar2(1000), set your query like this:
    select col1,...coln
    from table
    where &P_WHERE;
    At the run time, you should pass the Where value from
    your form_application and send it to the parameter P_WHERE
    of the report.
    Hope this helps,
    CB

Maybe you are looking for