Output of Query--Little urgent

Hi All,
I had Emp Table as follows.
Emp table
Empid DeptId Hiredate Salary
1 100 10/1/2006 80,000
2 100 1/1/2007 100,000
3 100 2/1/2007 100,000
4 100 3/1/2007 90,000
5 100 4/1/2007 200,000
6 100 5/1/2007 80,000
7 200 6/1/2007 10,000
8 200 7/1/2007 20,000
9 200 8/1/2007 30,000
10 200 9/1/2007 40,000
Pls provide the out put for the following queries.
1)Select count(*),Empid,DepItd
From EMP
Groupby empid,DeptId;
2)Select Count (*) ,EmpId,Depid
from Emp
Groupby DepiId;
Thank You,
rampa.

Pls provide the out put for the following queries.Why don't you check it yourself ?
Correct the queries first. There is no space between Group and By. EmpId is not in Group By in the second query.
And what is that you want to achieve and what is the help you need?? Be more clear and specific.

Similar Messages

  • How to output a query results into a text file

    How to output a query results into a text file instead of outputing it to the screen..
    is there a way for us to write a SQL query which specifies to output the query results to a text file.
    Pls let me know how to do it
    Thanking u in advance
    regards
    Muraly

    Muraly,
    If you are using SQL*Plus 8.1.6 or later, you can also spool output to a file in HTML format, eg
    SET MARKUP HTML ON SPOOL ON PREFORMAT OFF ENTMAP ON
    SPOOL c:\temp\report.html
    SELECT DEPARTMENT_NAME, CITY
    FROM EMP_DETAILS_VIEW
    WHERE SALARY>12000;
    SPOOL OFF
    SET MARKUP HTML ENTMAP OFF
    In iSQL*Plus 9.0.1 (the browser-based interface to SQL*Plus) onwards, you can also send the HTML output to a new web browser window, or an html file -- much easier than the command line method.
    Alison

  • Change display Date format from 06.2011 to june 2011 in output of Query

    Hi All,
                Change display Date format from 06.2011 to june 2011 in output of Query  Execution. i used time charcteristics 0calmonth in query, output display is coming 06.2011, i want to display output in june 2011 format, anyone tell me how to convert this Date format.

    Hi Nandish,
    as tibollo said you just need to mark 0CALMONTH with text in RSD1.
    Kindly note that you don't need to do data load for this object.
    It will automatically derive by system.
    Just change the Info object 0CALMONTH in RSD1, Go to Master Data/text column and check mark on with text.
    Then activate it.
    Regards,
    Ashish

  • Outputing a query

    I thought I used to be able to do this but since I have not done it for awhile I forgot how to do it.
    I have a query result that looks like this:
    Categories    Course_Name  Course_No  Course_level
    Language     English             E100001        Intro
    Language     English             E20001        Intermediate
    Language     English             E30001        Advance
    Language     Spanish           S10001        Intro
    Language     Spanish           S20001        Intermediate
    Language     Spanish           S30001        Advance
    Art                 Piano               P11001       Intorduction
    Art                 Piano               P21001       Intermediate
    Art                 Piano               P31001       Advance
    I need to output this query in a table so when user look at this table, category will only showed once:
    Categories    Course_Name  Course_No  Course_level
    Language     English             E100001        Intro
                         English             E20001        Intermediate
                         English             E30001        Advance
                         Spanish           S10001        Intro
                         Spanish           S20001        Intermediate
                         Spanish           S30001        Advance
    Art                 Piano               P11001       Intorduction
                         Piano               P21001       Intermediate
                         Piano               P31001       Advance
    I used table but I can' get it  right, can anyone help, thank you!!
    <table>
      <tr>
         <td>Category</td>
         <td>Course Name</td>
         <td>Course Number</td>
         <td>Course Level</td>
       </tr>
      <cfquery name="GetCourses datasource="#dsn#">
       select * from program 
       order by category
      </cfquery>
    <cfoutput query="GetCourses">
      <cfquery name="GetCategory datasource="#dsn#">
       select distinct categorry from program
      </cfquery>
      <tr>
         <td>#GetCategory.Category#</td>
         <td>#Course_Name#</td>
         <td>#Course Number#</td>
         <td>#Course Level#</td>
       </tr>
    </cfquery>    
    </table>

    <cfoutput query="GetCourses" group="Categories">
         #Categories#
         <cfoutput>
              #Course_Name# #Course_No# #Course_Level#
         </cfoutput>
    </cfoutput>

  • Output select query in OLEDB Command

    Hi I am trying to write a simple output query to get the Count of rows  in OLE Db Commnad Adavnced editor and getting error. Please help!
    Declare @Count INT;
    Select @Count(*) AS ? FROM <tablename>WHERE Column 1  =?  AND Column2 = ?
    Please help as this is my first project!
    Thanks in advance.

    Not sure what went wrong, but the typical pitfall is not mapping the parameters properly, so see this:
    http://blogs.msdn.com/b/msdnts/archive/2006/11/17/amazing-ssis-parameters-in-execute-sql-task.aspx
    Arthur My Blog

  • ABAP QUERY - ITS URGENT

    Hi Experts,
    In this scenario we have one Material – Mat1 and 2 plants namely, P1 and P2. At time of execution, in the selection screen, if we give for example: Mat1 and P1, data is displayed for that particular material and plant. Where as if we give MAT1 for P1 and P2 , the material again displayed for P1 which is in first row and it is not displaying the material for P2 which is in 2nd row.
    If we interchange P2 is in first row, the material is displayed and it is not displaying for P1 which is in 2nd row.
    In general – Any material for any plant which is in   2nd row is not displayed only zeros are visible.
    Kindly locate the solution for the above query in the below program.                                                                               
    Specification Name      :  Production Tracker                       
    REPORT  zpp_ptk                                 .
    TYPE-POOLS : slis.
    TABLES : pbed,
             mara,
             mast,
             marc,
             makt,
             pbid,
             pbim,
             stpo,
             t001w,
             scal,
             kna1,
             knmt,
             equi,
             a304,
             konp,
             zcalendar,
             am60x.
    DATA :   gt_sort TYPE slis_t_sortinfo_alv,
             gt_fieldcat TYPE slis_t_fieldcat_alv,
             gt_fieldcat1 TYPE slis_fieldcat_alv,
             gt_events TYPE slis_t_event ,
             gv_pc_start(2) TYPE n,
             gv_pcno(6),
             BEGIN OF gt_pbed OCCURS 0,
             matnr TYPE matnr,
             p_matnr TYPE matnr,
             plnmg TYPE plnmg,
             entmg TYPE entmg,
             perxx TYPE perxx,
             ojtxb TYPE ojtxb,
             ojtxp TYPE ojtxp,
             backlog TYPE plnmg,
             future  TYPE plnmg,
             END OF gt_pbed,
             l_knumh LIKE a304-knumh,            " added by ****** 08.06.2005
             l_datab LIKE a304-datab,           " added by ****** 08.06.2005
             BEGIN OF it_date1 OCCURS 0,
             it_date1 TYPE zstartdt,
             enddt TYPE zenddt,
             sapweekno TYPE zsapweekno,
             END OF it_date1,
             BEGIN OF gt_matnr OCCURS 0,
             matnr TYPE matnr,
             plnmg TYPE plnmg,
             entmg TYPE entmg,
             END OF gt_matnr,
             BEGIN OF gt_stock OCCURS 0,
             matnr TYPE matnr,
             stock TYPE entmg,
             END OF gt_stock,
             gt_fpbed LIKE gt_pbed OCCURS 0 WITH HEADER LINE,
             it_zcalendar LIKE zcalendar OCCURS 0 WITH HEADER LINE,
             l_counter TYPE i,
             l_plus15  LIKE scal-week,
             l_wfpweekno LIKE scal-week,
             l_selectedweekno LIKE scal-week,
             BEGIN OF gt_backlog OCCURS 0,
             matnr TYPE matnr,
             backlog TYPE entmg,
             END OF gt_backlog,
             gt_future LIKE gt_backlog OCCURS 0 WITH HEADER LINE,
             gt_output TYPE zpp_rollplan OCCURS 0 WITH HEADER LINE,
             BEGIN OF gt_out OCCURS 0,
             head(15) TYPE c,
             matnr TYPE matnr,
             stock TYPE labst,
             backlog TYPE plnmg,
             week1 TYPE wmeng,
             week2 TYPE wmeng,
             week3 TYPE wmeng,
             week4 TYPE wmeng,
             week5 TYPE wmeng,
             week6 TYPE wmeng,
             week7 TYPE wmeng,
             week8 TYPE wmeng,
             week9 TYPE wmeng,
             week10 TYPE wmeng,
             week11 TYPE wmeng,
             week12 TYPE wmeng,
             week13 TYPE wmeng,
             END OF gt_out,
           BEGIN OF gt_out26 OCCURS 0,
           head(15) TYPE c,
           matnr TYPE matnr,
           stock TYPE labst,
           backlog TYPE plnmg,
           week1 TYPE wmeng,
           week2 TYPE wmeng,
           week3 TYPE wmeng,
           week4 TYPE wmeng,
           week5 TYPE wmeng,
           week6 TYPE wmeng,
           week7 TYPE wmeng,
           week8 TYPE wmeng,
           week9 TYPE wmeng,
           week10 TYPE wmeng,
           week11 TYPE wmeng,
           week12 TYPE wmeng,
           week13 TYPE wmeng,
           week14 TYPE wmeng,
           week15 TYPE wmeng,
           week16 TYPE wmeng,
           week17 TYPE wmeng,
           week18 TYPE wmeng,
           week19 TYPE wmeng,
           week20 TYPE wmeng,
           week21 TYPE wmeng,
           week22 TYPE wmeng,
           week23 TYPE wmeng,
           week24 TYPE wmeng,
           week25 TYPE wmeng,
           week26 TYPE wmeng,
           END OF gt_out26,
           BEGIN OF it_week OCCURS 0,
           it_week TYPE zsapweekno,
           END OF it_week,
             dd(4) TYPE c,
             cc(2) TYPE c,
             dd1(6) TYPE c,
            l_val1(7)  TYPE c,
            l_val2(7)  TYPE c,
            l_val3(7)  TYPE c,
            l_val4(7)  TYPE c,
            l_val5(7)  TYPE c,
            l_val6(7)  TYPE c,
            l_val7(7)  TYPE c,
            l_val8(7)  TYPE c,
            l_val9(7)  TYPE c,
            l_val10(7)  TYPE c,
            l_val11(7)  TYPE c,
            l_val12(7)  TYPE c,
            l_val13(7)  TYPE c,
            l_val14(7)  TYPE c,
            l_val15(7)  TYPE c,
            l_val16(7)  TYPE c,
            l_val17(7)  TYPE c,
            l_val18(7)  TYPE c,
            l_val19(7)  TYPE c,
            l_val20(7)  TYPE c,
            l_val21(7)  TYPE c,
            l_val22(7)  TYPE c,
            l_val23(7)  TYPE c,
            l_val24(7)  TYPE c,
            l_val25(7)  TYPE c,
            l_val26(7)  TYPE c,
            it_ph TYPE plnmg,
            it_dm TYPE dbmng,
            it_mard LIKE mard OCCURS 0 WITH HEADER LINE,
            it_tot1 TYPE p DECIMALS 3,
            it_tot1_2  TYPE p DECIMALS 3,
           it_tot2 TYPE p DECIMALS 3,
           it_tot2_2  TYPE p DECIMALS 3,
           it_tot3 TYPE p DECIMALS 3,
           it_tot3_2  TYPE p DECIMALS 3,
           it_tot4 TYPE p DECIMALS 3,
           it_tot4_2  TYPE p DECIMALS 3,
           it_tot5 TYPE p DECIMALS 3,
           it_tot5_2  TYPE p DECIMALS 3,
           it_tot6 TYPE p DECIMALS 3,
           it_tot6_2  TYPE p DECIMALS 3,
           it_tot7 TYPE p DECIMALS 3,
           it_tot7_2  TYPE p DECIMALS 3,
           it_tot8 TYPE p DECIMALS 3,
           it_tot8_2  TYPE p DECIMALS 3,
           it_tot9 TYPE p DECIMALS 3,
           it_tot9_2  TYPE p DECIMALS 3,
           it_tot10 TYPE p DECIMALS 3,
           it_tot10_2  TYPE p DECIMALS 3,
           it_tot11 TYPE p DECIMALS 3,
           it_tot11_2  TYPE p DECIMALS 3,
           it_tot12 TYPE p DECIMALS 3,
           it_tot12_2  TYPE p DECIMALS 3,
           it_tot13 TYPE p DECIMALS 3,
           it_tot13_2  TYPE p DECIMALS 3,
           it_tot14 TYPE p DECIMALS 3,
           it_tot14_2  TYPE p DECIMALS 3,
           it_tot15 TYPE p DECIMALS 3,
           it_tot15_2  TYPE p DECIMALS 3,
           it_tot16 TYPE p DECIMALS 3,
           it_tot16_2  TYPE p DECIMALS 3,
           it_tot17 TYPE p DECIMALS 3,
           it_tot17_2  TYPE p DECIMALS 3,
           it_tot18 TYPE p DECIMALS 3,
           it_tot18_2  TYPE p DECIMALS 3,
           it_tot19 TYPE p DECIMALS 3,
           it_tot19_2  TYPE p DECIMALS 3,
           it_tot20 TYPE p DECIMALS 3,
           it_tot20_2  TYPE p DECIMALS 3,
           it_tot21 TYPE p DECIMALS 3,
           it_tot21_2  TYPE p DECIMALS 3,
           it_tot22 TYPE p DECIMALS 3,
           it_tot22_2  TYPE p DECIMALS 3,
           it_tot23 TYPE p DECIMALS 3,
           it_tot23_2  TYPE p DECIMALS 3,
           it_tot24 TYPE p DECIMALS 3,
           it_tot24_2  TYPE p DECIMALS 3,
           it_tot25 TYPE p DECIMALS 3,
           it_tot25_2  TYPE p DECIMALS 3,
           it_tot26 TYPE p DECIMALS 3,
           it_tot26_2  TYPE p DECIMALS 3,
           it_back1 TYPE p DECIMALS 3,
           it_back2 TYPE p DECIMALS 3,
           it_back3 TYPE p DECIMALS 3,
           it_back4 TYPE p DECIMALS 3,
           it_back5 TYPE p DECIMALS 3,
           it_back6 TYPE p DECIMALS 3,
           it_back7 TYPE p DECIMALS 3,
           it_back8 TYPE p DECIMALS 3,
           it_back9 TYPE p DECIMALS 3,
           it_back10 TYPE p DECIMALS 3,
           it_back11 TYPE p DECIMALS 3,
           it_back12 TYPE p DECIMALS 3,
           it_back13 TYPE p DECIMALS 3,
           it_back14 TYPE p DECIMALS 3,
           it_back15 TYPE p DECIMALS 3,
           it_back16 TYPE p DECIMALS 3,
           it_back17 TYPE p DECIMALS 3,
           it_back18 TYPE p DECIMALS 3,
           it_back19 TYPE p DECIMALS 3,
           it_back20 TYPE p DECIMALS 3,
           it_back21 TYPE p DECIMALS 3,
           it_back22 TYPE p DECIMALS 3,
           it_back23 TYPE p DECIMALS 3,
           it_back24 TYPE p DECIMALS 3,
           it_back25 TYPE p DECIMALS 3,
           it_back26 TYPE p DECIMALS 3,
           it_pbhi LIKE pbhi OCCURS 0 WITH HEADER LINE,
           int1 TYPE i,
           int2 TYPE i,
           int3 TYPE i,
           int4 TYPE i,
           int5 TYPE i,
           int6 TYPE i,
           int7 TYPE i,
           int8 TYPE i,
           int9 TYPE i,
           int10 TYPE i,
           int11 TYPE i,
           int12 TYPE i,
           int13 TYPE i,
           int14 TYPE i,
           int15 TYPE i,
           int16 TYPE i,
           int17 TYPE i,
           int18 TYPE i,
           int19 TYPE i,
           int20 TYPE i,
           int21 TYPE i,
           int22 TYPE i,
           int23 TYPE i,
           int24 TYPE i,
           int25 TYPE i,
           int26 TYPE i,
    *forecast purpose
            p_fnavl TYPE c VALUE 'X',
            it_zcal LIKE zcalendar OCCURS 0 WITH HEADER LINE,
           BEGIN OF it_mkpf OCCURS 0,
           mblnr TYPE mblnr,
           budat TYPE budat,
           END OF it_mkpf,
          it_mseg LIKE mseg OCCURS 0 WITH HEADER LINE,
          st_date TYPE zstartdt,
          en_date TYPE zenddt.
    *BUDAT
    SELECTION-SCREEN : BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001..
    SELECT-OPTIONS   : s_matnr FOR pbim-matnr OBLIGATORY.
    PARAMETERS       : p_werks TYPE werks_d OBLIGATORY,
                       p_dispo TYPE dispo,
                       p_mov TYPE bwart OBLIGATORY DEFAULT '321',
                       p_date1 TYPE pbed-wdatu DEFAULT '20070401'. "  MODIF ID ABC..
    *SELECT-OPTIONS    : p_date2 FOR pbed-wdatu.
    PARAMETERS : p_date2  TYPE wdatu.
    SELECTION-SCREEN  : END OF BLOCK blk1.
    SELECTION-SCREEN  : BEGIN OF BLOCK bb1 WITH FRAME TITLE text-002 .
    PARAMETERS        : p_13week RADIOBUTTON GROUP grp1,
                        p_26week RADIOBUTTON GROUP grp1.
    SELECTION-SCREEN  : END OF BLOCK bb1.
    SELECT-OPTIONS    : s_week FOR zcalendar-sapweekno NO-DISPLAY.
    AT SELECTION-SCREEN OUTPUT.
      LOOP AT SCREEN.
        IF screen-name = 'P_DATE1'.
          screen-input = '0'.
          screen-active = '1'.
          MODIFY SCREEN.
        ENDIF.
      ENDLOOP.
    INITIALIZATION.
    START-OF-SELECTION.
      IF  '20070401' > p_date2.
        MESSAGE 'Please Give Greater that 01.04.2007 ' TYPE 'I'.
        LEAVE LIST-PROCESSING.
      ENDIF.
      SELECT SINGLE sapweekno INTO s_week-low
      FROM zcalendar
      WHERE startdt >=  p_date2. "-high AND enddt >= p_date2-low.
      s_week-option = 'EQ'.
      s_week-sign   = 'I'.
      APPEND s_week.
      SELECT * FROM zcalendar INTO TABLE it_zcalendar.
      SELECT * FROM mard INTO TABLE it_mard WHERE matnr IN s_matnr.
    *********************FOR 13 WEEK*********************************************************************
      IF p_13week EQ 'X'.
        LOOP AT s_week.
          s_week-high = s_week-low + 12.
          MODIFY s_week TRANSPORTING high.
          SELECT SINGLE startdt FROM zcalendar INTO st_date WHERE sapweekno = s_week-low.
          SELECT SINGLE enddt FROM zcalendar INTO en_date WHERE  sapweekno = s_week-high.
          SELECT mblnr budat FROM mkpf INTO TABLE it_mkpf WHERE budat GE st_date AND budat LE en_date.
         SELECT * FROM mseg INTO TABLE it_mseg FOR ALL ENTRIES IN it_mkpf WHERE mblnr = it_mkpf-mblnr
                   AND matnr IN s_matnr
                   AND werks = p_werks
                   and shkzg = 'S'
                   AND bwart IN ('321','322','101','102','131','132') .
          LOOP AT it_mkpf.
            SELECT * FROM mseg INTO it_mseg WHERE mblnr = it_mkpf-mblnr
                            AND matnr IN s_matnr
                            AND werks = p_werks
                            AND shkzg = 'S'
                            AND bwart IN ('321','322','101','102','131','132') .
              APPEND it_mseg.
              CLEAR it_mseg.
            ENDSELECT.
          ENDLOOP.
        ENDLOOP.
        PERFORM get_pbid.
        BREAK-POINT.
        PERFORM s_week_days.
        PERFORM get_backlog.
        PERFORM gt_out.
        PERFORM build_fieldccatlog1.
        PERFORM 13alv.
      ENDIF.
    ******************END OF 13 WEEK*************************************************************************
    *****************For 26 th Week*************************************************************************
      IF p_26week EQ 'X'.
        LOOP AT s_week.
          s_week-high = s_week-low + 25.
          MODIFY s_week TRANSPORTING high.
          SELECT SINGLE startdt FROM zcalendar INTO st_date WHERE sapweekno = s_week-low.
          SELECT SINGLE enddt FROM zcalendar INTO en_date WHERE  sapweekno = s_week-high.
          SELECT mblnr budat FROM mkpf INTO TABLE it_mkpf WHERE budat GE st_date AND budat LE en_date.
          SELECT * FROM mseg INTO TABLE it_mseg FOR ALL ENTRIES IN it_mkpf WHERE mblnr = it_mkpf-mblnr
                    AND matnr IN s_matnr
                    AND werks = p_werks
                    AND shkzg = 'S'
                    AND bwart IN ('321','322','101','102') .
        ENDLOOP.
        PERFORM get_pbid.
        PERFORM s_26week_days.
        PERFORM gt_out26.
        PERFORM build_fieldccatlog1.
        PERFORM 26alv.
      ENDIF.
    **************END OF 26 TH WEEK **********************************************************************
    *&      Form  get_pbid
          text
    FORM get_pbid .
      DATA : lv_line TYPE i,
             lv_perxx LIKE scal-week.
      DATA it_dispo(1) TYPE c. " ashish
    LOOP AT s_matnr. " TODAY
      BREAK-POINT.
      SELECT SINGLE diber INTO it_dispo FROM marc WHERE matnr = s_matnr-low
                                                    AND werks = p_werks.
      IF it_dispo NE 'X'.
        SELECT * FROM pbim WHERE matnr = s_matnr-low
                             AND werks EQ p_werks
                             AND loevr = space.
          SELECT startdt enddt sapweekno INTO TABLE it_date1 FROM zcalendar WHERE sapweekno GE s_week-low AND sapweekno LE s_week-high.
         SORT by s_matnr p_werks.
          LOOP AT it_date1.
            SELECT * FROM pbhi INTO TABLE it_pbhi WHERE bdzei = pbim-bdzei AND ( pdatu GE it_date1-it_date1 AND pdatu LE it_date1-enddt ).
            IF sy-subrc EQ 0.
              DELETE it_pbhi WHERE aenam = 'ABBAU'.
              LOOP AT it_pbhi.
                it_ph =  it_ph + it_pbhi-plnmg.
                it_dm = it_dm + it_pbhi-dbmng.
              ENDLOOP.
              it_ph = it_ph - it_dm.
              gt_pbed-matnr = s_matnr-low.
              gt_pbed-plnmg = it_ph.
              gt_pbed-perxx = it_date1-sapweekno.
              APPEND gt_pbed.
              CLEAR it_pbhi.
              CLEAR it_ph.
              CLEAR it_dm.
              REFRESH it_pbhi.
              CLEAR gt_pbed.
            ELSE.
            ENDIF.
          ENDLOOP.
        ENDSELECT.
      ELSE.
        SORT BY s_matnr p_werks.
        LOOP AT s_matnr.
          SELECT * FROM pbid WHERE  matnr =  s_matnr-low
                             AND   werks = p_werks
                             AND   loevr EQ space.
    ****PHANI
         SELECT * FROM pbed WHERE bdzei = pbid-bdzei.
           MOVE-CORRESPONDING pbed TO gt_pbed.
           PERFORM convert_to_week USING pbed-pdatu
                                CHANGING gt_pbed-perxx.
         check gt_pbed-perxx in r_week.
           gt_pbed-matnr = pbid-matnr.
         PERFORM GET_PARENT USING gt_bom-MATNR
                         CHANGING gt_pbed-p_matnr
                                  GT_pbed-OJTXB.
           COLLECT gt_pbed.
           CLEAR gt_pbed.
    *PHANI
    data it_date1 type ZSTARTDT.
            SELECT startdt enddt sapweekno INTO TABLE it_date1 FROM zcalendar WHERE sapweekno GE s_week-low AND sapweekno LE s_week-high.
            LOOP AT it_date1.
              SELECT * FROM pbhi INTO TABLE it_pbhi WHERE bdzei = pbid-bdzei AND ( pdatu GE it_date1-it_date1 AND pdatu LE it_date1-enddt ).
              IF sy-subrc EQ 0.
                DELETE it_pbhi WHERE aenam = 'ABBAU'.
                LOOP AT it_pbhi.
                  it_ph =  it_ph + it_pbhi-plnmg.
                  it_dm = it_dm + it_pbhi-dbmng.
                ENDLOOP.
                it_ph = it_ph - it_dm.
                gt_pbed-matnr = s_matnr-low.
                gt_pbed-plnmg = it_ph.
                gt_pbed-perxx = it_date1-sapweekno.
                APPEND gt_pbed.
                CLEAR it_pbhi.
                CLEAR it_ph.
                CLEAR it_dm.
                REFRESH it_pbhi.
                CLEAR gt_pbed.
              ELSE.
              ENDIF.
            ENDLOOP.
          ENDSELECT.
        ENDLOOP.
      ENDIF.
    ENDFORM.                    " get_pbid
    *&      Form  convert_to_week
          text
         -->IV_DATE    text
         -->XV_WEEK    text
    FORM convert_to_week USING iv_date
                     CHANGING xv_week.
      DATA : lv_week LIKE scal-week.
      CALL FUNCTION 'DATE_GET_WEEK'
        EXPORTING
          date = iv_date
        IMPORTING
          week = lv_week.
      xv_week = lv_week.
    ENDFORM.                    "CONVERT_TO_WEEK
    *&      Form  get_stock
          text
    FORM get_stock .
      DATA : lv_stock LIKE mard-insme.
      LOOP AT gt_pbed.
        READ TABLE gt_stock WITH KEY matnr = gt_pbed-matnr.
        CHECK sy-subrc NE 0.
        SELECT SUM( labst ) INTO lv_stock FROM mard
        WHERE matnr = gt_pbed-matnr AND   werks = p_werks.
        SELECT SUM( insme ) INTO gt_stock-stock FROM mard
        WHERE matnr = gt_pbed-matnr AND   werks = p_werks.
        gt_stock-stock = gt_stock-stock + lv_stock.
        gt_stock-matnr = gt_pbed-matnr.
        APPEND gt_stock.
      ENDLOOP.
    ENDFORM.                    " get_stock
    FORM s_week_days .
      DELETE gt_pbed WHERE perxx < s_week-low. " and perxx > s_week-high.
      CONCATENATE 'WEEK' '-' s_week-low+4(2) INTO l_val1.
      s_week-low4(2) = s_week-low4(2) + 1.
      CONCATENATE 'WEEK' '-' s_week-low+4(2) INTO l_val2.
      s_week-low4(2) = s_week-low4(2) + 1.
      CONCATENATE 'WEEK' '-' s_week-low+4(2) INTO l_val3.
      s_week-low4(2) = s_week-low4(2) + 1.
      CONCATENATE 'WEEK' '-' s_week-low+4(2) INTO l_val4.
      s_week-low4(2) = s_week-low4(2) + 1.
      CONCATENATE 'WEEK' '-' s_week-low+4(2) INTO l_val5.
      s_week-low4(2) = s_week-low4(2) + 1.
      CONCATENATE 'WEEK' '-' s_week-low+4(2) INTO l_val6.
      s_week-low4(2) = s_week-low4(2) + 1.
      CONCATENATE 'WEEK' '-' s_week-low+4(2) INTO l_val7.
      s_week-low4(2) = s_week-low4(2) + 1.
      CONCATENATE 'WEEK' '-' s_week-low+4(2) INTO l_val8.
      s_week-low4(2) = s_week-low4(2) + 1.
      CONCATENATE 'WEEK' '-' s_week-low+4(2) INTO l_val9.
      s_week-low4(2) = s_week-low4(2) + 1.
      CONCATENATE 'WEEK' '-' s_week-low+4(2) INTO l_val10.
      s_week-low4(2) = s_week-low4(2) + 1.
      CONCATENATE 'WEEK' '-' s_week-low+4(2) INTO l_val11.
      s_week-low4(2) = s_week-low4(2) + 1.
      CONCATENATE 'WEEK' '-' s_week-low+4(2) INTO l_val12.
      s_week-low4(2) = s_week-low4(2) + 1.
      CONCATENATE 'WEEK' '-' s_week-low+4(2) INTO l_val13.
    ENDFORM.                    " s_week_days
    *&      Form  build_fieldccatlog
          text
    FORM build_fieldcatlog .
      CLEAR gt_fieldcat1.
      gt_fieldcat1-fieldname = 'MATNR'.
      gt_fieldcat1-tabname = 'GT_OUT'.
      gt_fieldcat1-seltext_l = 'MATERIAL'.
      APPEND gt_fieldcat1 TO gt_fieldcat.
      CLEAR gt_fieldcat1.
      gt_fieldcat1-fieldname = 'WERKS'.
      gt_fieldcat1-tabname = 'GT_OUT'.
      gt_fieldcat1-seltext_m = 'WERKS'.
      APPEND gt_fieldcat1 TO gt_fieldcat.
      CLEAR gt_fieldcat1.
      gt_fieldcat1-fieldname = 'HEAD'.
      gt_fieldcat1-tabname = 'GT_OUT'.
      gt_fieldcat1-seltext_l = 'REF'.
      APPEND gt_fieldcat1 TO gt_fieldcat.
      CLEAR gt_fieldcat1.
      gt_fieldcat1-fieldname = 'STOCK'.
      gt_fieldcat1-tabname = 'GT_OUT'.
      gt_fieldcat1-seltext_l = 'FG-STOCK'.
      APPEND gt_fieldcat1 TO gt_fieldcat.
      CLEAR gt_fieldcat1.
      gt_fieldcat1-fieldname = 'BACKLOG'.
      gt_fieldcat1-tabname = 'GT_OUT'.
      gt_fieldcat1-seltext_l = 'BACKLOG'.
      APPEND gt_fieldcat1 TO gt_fieldcat.
      dd = sy-datum+0(4).
      cc = l_val1+5(2).
      CONCATENATE dd cc INTO dd1.
      LOOP AT it_zcalendar WHERE sapweekno = dd1.
        CONCATENATE 'WEEK-' it_zcalendar-wfpweekno+4(2) INTO l_val1.
        CLEAR gt_fieldcat1.
        gt_fieldcat1-fieldname = 'WEEK1'.
        gt_fieldcat1-tabname = 'GT_OUT'.
        gt_fieldcat1-seltext_l = l_val1.
        APPEND gt_fieldcat1 TO gt_fieldcat.
      ENDLOOP.
      CLEAR : cc,dd1.
      cc = l_val2+5(2).
      CONCATENATE dd cc INTO dd1.
      LOOP AT it_zcalendar WHERE sapweekno = dd1.
        CONCATENATE 'WEEK-' it_zcalendar-wfpweekno+4(2) INTO l_val2.
        CLEAR gt_fieldcat1.
        gt_fieldcat1-fieldname = 'WEEK2'.
        gt_fieldcat1-tabname = 'GT_OUT'.
        gt_fieldcat1-seltext_l = l_val2.
        APPEND gt_fieldcat1 TO gt_fieldcat.
      ENDLOOP.
      CLEAR : cc,dd1.
      cc = l_val3+5(2).
      CONCATENATE dd cc INTO dd1.
      LOOP AT it_zcalendar WHERE sapweekno = dd1.
        CONCATENATE 'WEEK-' it_zcalendar-wfpweekno+4(2) INTO l_val3.
        CLEAR gt_fieldcat1.
        gt_fieldcat1-fieldname = 'WEEK3'.
        gt_fieldcat1-tabname = 'GT_OUT'.
        gt_fieldcat1-seltext_l = l_val3.
        APPEND gt_fieldcat1 TO gt_fieldcat.
      ENDLOOP.
      CLEAR : cc,dd1.
      cc = l_val4+5(2).
      CONCATENATE dd cc INTO dd1.
      LOOP AT it_zcalendar WHERE sapweekno = dd1.
        CONCATENATE 'WEEK-' it_zcalendar-wfpweekno+4(2) INTO l_val4.
        CLEAR gt_fieldcat1.
        gt_fieldcat1-fieldname = 'WEEK4'.
        gt_fieldcat1-tabname = 'GT_OUT'.
        gt_fieldcat1-seltext_l = l_val4.
        APPEND gt_fieldcat1 TO gt_fieldcat.
      ENDLOOP.
      CLEAR : cc,dd1.
      cc = l_val5+5(2).
      CONCATENATE dd cc INTO dd1.
      LOOP AT it_zcalendar WHERE sapweekno = dd1.
        CONCATENATE 'WEEK-' it_zcalendar-wfpweekno+4(2) INTO l_val5.
        CLEAR gt_fieldcat1.
        gt_fieldcat1-fieldname = 'WEEK5'.
        gt_fieldcat1-tabname = 'GT_OUT'.
        gt_fieldcat1-seltext_l = l_val5.
        APPEND gt_fieldcat1 TO gt_fieldcat.
      ENDLOOP.
      CLEAR : cc,dd1.
      cc = l_val6+5(2).
      CONCATENATE dd cc INTO dd1.
      LOOP AT it_zcalendar WHERE sapweekno = dd1.
        CONCATENATE 'WEEK-' it_zcalendar-wfpweekno+4(2) INTO l_val6.
        CLEAR gt_fieldcat1.
        gt_fieldcat1-fieldname = 'WEEK6'.
        gt_fieldcat1-tabname = 'GT_OUT'.
        gt_fieldcat1-seltext_l = l_val6.
        APPEND gt_fieldcat1 TO gt_fieldcat.
      ENDLOOP.
      CLEAR : cc,dd1.
      cc = l_val7+5(2).
      CONCATENATE dd cc INTO dd1.
      LOOP AT it_zcalendar WHERE sapweekno = dd1.
        CONCATENATE 'WEEK-' it_zcalendar-wfpweekno+4(2) INTO l_val7.
        CLEAR gt_fieldcat1.
        gt_fieldcat1-fieldname = 'WEEK7'.
        gt_fieldcat1-tabname = 'GT_OUT'.
        gt_fieldcat1-seltext_l = l_val7.
        APPEND gt_fieldcat1 TO gt_fieldcat.
      ENDLOOP.
      CLEAR : cc,dd1.
      cc = l_val8+5(2).
      CONCATENATE dd cc INTO dd1.
      LOOP AT it_zcalendar WHERE sapweekno = dd1.
        CONCATENATE 'WEEK-' it_zcalendar-wfpweekno+4(2) INTO l_val8.
        CLEAR gt_fieldcat1.
        gt_fieldcat1-fieldname = 'WEEK8'.
        gt_fieldcat1-tabname = 'GT_OUT'.
        gt_fieldcat1-seltext_l = l_val8.
        APPEND gt_fieldcat1 TO gt_fieldcat.
      ENDLOOP.
      CLEAR : cc,dd1.
      cc = l_val9+5(2).
      CONCATENATE dd cc INTO dd1.
      LOOP AT it_zcalendar WHERE sapweekno = dd1.
        CONCATENATE 'WEEK-' it_zcalendar-wfpweekno+4(2) INTO l_val9.
        CLEAR gt_fieldcat1.
        gt_fieldcat1-fieldname = 'WEEK9'.
        gt_fieldcat1-tabname = 'GT_OUT'.
        gt_fieldcat1-seltext_l = l_val9.
        APPEND gt_fieldcat1 TO gt_fieldcat.
      ENDLOOP.
      CLEAR : cc,dd1.
      cc = l_val10+5(2).
      CONCATENATE dd cc INTO dd1.
      LOOP AT it_zcalendar WHERE sapweekno = dd1.
        CONCATENATE 'WEEK-' it_zcalendar-wfpweekno+4(2) INTO l_val10.
        CLEAR gt_fieldcat1.
        gt_fieldcat1-fieldname = 'WEEK10'.
        gt_fieldcat1-tabname = 'GT_OUT'.
        gt_fieldcat1-seltext_l = l_val10.
        APPEND gt_fieldcat1 TO gt_fieldcat.
      ENDLOOP.
      CLEAR : cc,dd1.
      cc = l_val11+5(2).
      CONCATENATE dd cc INTO dd1.
      LOOP AT it_zcalendar WHERE sapweekno = dd1.
        CONCATENATE 'WEEK-' it_zcalendar-wfpweekno+4(2) INTO l_val11.
        CLEAR gt_fieldcat1.
        gt_fieldcat1-fieldname = 'WEEK11'.
        gt_fieldcat1-tabname = 'GT_OUT'.
        gt_fieldcat1-seltext_l = l_val11.
        APPEND gt_fieldcat1 TO gt_fieldcat.
      ENDLOOP.
      CLEAR : cc,dd1.
      cc = l_val12+5(2).
      CONCATENATE dd cc INTO dd1.
      LOOP AT it_zcalendar WHERE sapweekno = dd1.
        CONCATENATE 'WEEK-' it_zcalendar-wfpweekno+4(2) INTO l_val12.
        CLEAR gt_fieldcat1.
        gt_fieldcat1-fieldname = 'WEEK12'.
        gt_fieldcat1-tabname = 'GT_OUT'.
        gt_fieldcat1-seltext_l = l_val12.
        APPEND gt_fieldcat1 TO gt_fieldcat.
      ENDLOOP.
      CLEAR : cc,dd1.
      cc = l_val13+5(2).
      CONCATENATE dd cc INTO dd1.
      LOOP AT it_zcalendar WHERE sapweekno = dd1.
        CONCATENATE 'WEEK-' it_zcalendar-wfpweekno+4(2) INTO l_val13.
        CLEAR gt_fieldcat1.
        gt_fieldcat1-fieldname = 'WEEK13'.
        gt_fieldcat1-tabname = 'GT_OUT'.
        gt_fieldcat1-seltext_l = l_val13.
        APPEND gt_fieldcat1 TO gt_fieldcat.
      ENDLOOP.
    ENDFORM.                    " build_fieldccatlog
    *&      Form  13alv
          text
    FORM 13alv .
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
       EXPORTING
      I_INTERFACE_CHECK              = ' '
      I_BYPASSING_BUFFER             =
      I_BUFFER_ACTIVE                = ' '
      I_CALLBACK_PROGRAM             = ' '
      I_CALLBACK_PF_STATUS_SET       = ' '
      I_CALLBACK_USER_COMMAND        = ' '
      I_STRUCTURE_NAME               =
      IS_LAYOUT                      =
          it_fieldcat                    = gt_fieldcat
      IT_EXCLUDING                   =
      IT_SPECIAL_GROUPS              =
      IT_SORT                        =
      IT_FILTER                      =
      IS_SEL_HIDE                    =
      I_DEFAULT                      = 'X'
      I_SAVE                         = ' '
      IS_VARIANT                     =
      IT_EVENTS                      =
      IT_EVENT_EXIT                  =
      IS_PRINT                       =
      IS_REPREP_ID                   =
      I_SCREEN_START_COLUMN          = 0
      I_SCREEN_START_LINE            = 0
      I_SCREEN_END_COLUMN            = 0
      I_SCREEN_END_LINE              = 0
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER        =
      ES_EXIT_CAUSED_BY_USER         =
        TABLES
          t_outtab                       = gt_out
    EXCEPTIONS
      PROGRAM_ERROR                  = 1
      OTHERS                         = 2
    ENDFORM.                                                    " 13alv
    *&      Form  gt_out
          text
    FORM gt_out .
      LOOP AT s_matnr.
        AT NEW low.
          gt_out-matnr = s_matnr-low.
    ************BEGIN OF FIRST WEEK******************************
          LOOP AT gt_pbed WHERE matnr = s_matnr-low AND perxx4(2) = l_val15(2).
            gt_out-week1 = gt_pbed-plnmg.
            LOOP AT it_zcalendar WHERE sapweekno = gt_pbed-perxx.
              IF p_mov = '321'.
                LOOP AT it_mkpf WHERE budat  GE it_zcalendar-startdt AND budat LE it_zcalendar-enddt.
                  LOOP AT it_mseg WHERE mblnr = it_mkpf-mblnr AND matnr = s_matnr-low AND bwart = '321'.
                    it_tot1 = it_tot1 + it_mseg-erfmg.
                    CLEAR it_mseg.
                  ENDLOOP.
                  LOOP AT it_mseg WHERE mblnr = it_mkpf-mblnr AND matnr = s_matnr-low AND bwart = '322'.
                    it_tot1_2 = it_tot1_2 + it_mseg-erfmg.
                    CLEAR it_mseg.
                  ENDLOOP.
                ENDLOOP.
              ENDIF.
              IF p_mov = '101'.
                LOOP AT it_mkpf WHERE budat  GE it_zcalendar-startdt AND budat LE it_zcalendar-enddt.
                  LOOP AT it_mseg WHERE mblnr = it_mkpf-mblnr AND matnr = s_matnr-low AND bwart = '101'.
                    it_tot1 = it_tot1 + it_mseg-erfmg.
                    CLEAR it_mseg.
                  ENDLOOP.
                  LOOP AT it_mseg WHERE mblnr = it_mkpf-mblnr AND matnr = s_matnr-low AND bwart = '102'.
                    it_tot1_2 = it_tot1_2 + it_mseg-erfmg.
                    CLEAR it_mseg.
                  ENDLOOP.
                ENDLOOP.
              ENDIF.
              IF p_mov = '131'.
                LOOP AT it_mkpf WHERE budat  GE it_zcalendar-startdt AND budat LE it_zcalendar-enddt.
                  LOOP AT it_mseg WHERE mblnr = it_mkpf-mblnr AND matnr = s_matnr-low AND bwart = '131'.
                    it_tot1 = it_tot1 + it_mseg-erfmg.
                    CLEAR it_mseg.
                  ENDLOOP.
                  LOOP AT it_mseg WHERE mblnr = it_mkpf-mblnr AND matnr = s_matnr-low AND bwart = '132'.
                    it_tot1_2 = it_tot1_2 + it_mseg-erfmg.
                    CLEAR it_mseg.
                  ENDLOOP.
                ENDLOOP.
              ENDIF.
              CLEAR gt_pbed.
            ENDLOOP.
          ENDLOOP.
          it_tot1 = it_tot1 - it_tot1_2.
          it_back1 = gt_out-week1 - it_tot1.
          CLEAR it_zcalendar.
    END OF FIRST WEEK ************************
    **********************SECOND WEEK***************************************
          LOOP AT gt_pbed WHERE matnr = s_matnr-low AND perxx4(2) = l_val25(2).
            int2 = int2 + 1.
            CHECK int2  = 1.
            gt_out-week2 = gt_pbed-plnmg.
            LOOP AT it_zcalendar WHERE sapweekno = gt_pbed-perxx.
              IF p_mov = '321'.
                LOOP AT it_mkpf WHERE budat  GE it_zcalendar-startdt AND budat LE it_zcalendar-enddt.
                  LOOP AT it_mseg WHERE mblnr = it_mkpf-mblnr AND matnr = s_matnr-low AND bwart = '321'.
                    it_tot2 = it_tot2 + it_mseg-erfmg.
                    CLEAR it_mseg.
                  ENDLOOP.
                  LOOP AT it_mseg WHERE mblnr = it_mkpf-mblnr AND matnr = s_matnr-low AND bwart = '322'.
                    it_tot2_2 = it_tot2_2 + it_mseg-erfmg.
                    CLEAR it_mseg.
                  ENDLOOP.
                ENDLOOP.
              ENDIF.
              IF p_mov = '101'.
                LOOP AT it_mkpf WHERE budat  GE it_zcalendar-startdt AND budat LE it_zcalendar-enddt.
                  LOOP AT it_mseg WHERE mblnr = it_mkpf-mblnr AND matnr = s_matnr-low AND bwart = '101'.
                    it_tot2 = it_tot2 + it_mseg-erfmg.
                    CLEAR it_mseg.
                  ENDLOOP.
                  LOOP AT it_mseg WHERE mblnr = it_mkpf-mblnr AND matnr = s_matnr-low AND bwart = '102'.
                    it_tot2_2 = it_tot2_2 + it_mseg-erfmg.
                    CLEAR it_mseg.
                  ENDLOOP.
                ENDLOOP.
              ENDIF.
              IF p_mov = '131'.
                LOOP AT it_mkpf WHERE budat  GE it_zcalendar-startdt AND budat LE it_zcalendar-enddt.
                  LOOP AT it_mseg WHERE mblnr = it_mkpf-mblnr AND matnr = s_matnr-low AND bwart = '131'.
                    it_tot1 = it_tot1 + it_mseg-erfmg.
                    CLEAR it_mseg.
                  ENDLOOP.
                  LOOP AT it_mseg WHERE mblnr = it_mkpf-mblnr AND matnr = s_matnr-low AND bwart = '132'.
                    it_tot1_2 = it_tot1_2 + it_mseg-erfmg.
                    CLEAR it_mseg.
                  ENDLOOP.
                ENDLOOP.
              ENDIF.
              CLEAR gt_pbed.
            ENDLOOP.
          ENDLOOP.
          it_tot2 = it_tot2 - it_tot2_2.
          it_back2 = gt_out-week2 - it_tot2.
          it_back2 = it_back2 + it_back1.
          CLEAR it_zcalendar.
    ********************************End of The Second week***********************************************
    *********************Third week*************************************************************************
          LOOP AT gt_pbed WHERE matnr = s_matnr-low AND perxx4(2) = l_val35(2).
            int1 = int1 + 1.
            CHECK int1 =  1.
            gt_out-week3 = gt_pbed-plnmg.
            LOOP AT it_zcalendar WHERE sapweekno = gt_pbed-perxx.
              IF p_mov = '321'.
                LOOP AT it_mkpf WHERE budat  GE it_zcalendar-startdt AND budat LE it_zcalendar-enddt.
                  LOOP AT it_mseg WHERE mblnr = it_mkpf-mblnr AND matnr = s_matnr-low AND bwart = '321'.
                    it_tot3 = it_tot3 + it_mseg-erfmg.
                    CLEAR it_mseg.
                  ENDLOOP.
                  LOOP AT it_mseg WHERE mblnr = it_mkpf-mblnr AND matnr = s_matnr-low AND bwart = '322'.
                    it_tot3_2 = it_tot3_2 + it_mseg-erfmg.
                    CLEAR it_mseg.
                  ENDLOOP.
                ENDLOOP.
              ENDIF.
              IF p_mov = '101'.
                LOOP AT it_mkpf WHERE budat  GE it_zcalendar-startdt AND budat LE it_zcalendar-enddt.
                  LOOP AT it_mseg WHERE mblnr = it_mkpf-mblnr AND matnr = s_matnr-low AND bwart = '101'.
                    it_tot3 = it_tot3 + it_mseg-erfmg.
                    CLEAR it_mseg.
                  ENDLOOP.
                  LOOP AT it_mseg WHERE mblnr = it_mkpf-mblnr AND matnr = s_matnr-low AND bwart = '102'.
                    it_tot3_2 = it_tot3_2 + it_mseg-erfmg.
                    CLEAR it_mseg.
                  ENDLOOP.
                ENDLOOP.
              ENDIF.
              IF p_mov = '131'.
                LOOP AT it_mkpf WHERE budat  GE it_zcalendar-startdt AND budat LE it_zcalendar-enddt.
                  LOOP AT it_mseg WHERE mblnr = it_mkpf-mblnr AND matnr = s_matnr-low AND bwart = '131'.
                    it_tot3 = it_tot3 + it_mseg-erfmg.
                    CLEAR it_mseg.
                  ENDLOOP.
                  LOOP AT it_mseg WHERE mblnr = it_mkpf-mblnr AND matnr = s_matnr-low AND bwart = '132'.
                    it_tot3_2 = it_tot3_2 + it_mseg-erfmg.
                  

    My first question to you would be ...you have defined the plant code as parameters so you can enter multiple plants...change that to a select-option and you would be able to display all the results.
    Regards
    Anurag

  • Output CFC query to Flex app

    I have a CFC which simply calls the DB and returns the
    results to the Flex app.
    CFC:
    <cfcomponent>
    <cffunction name="runQuery" output="false"
    access="public" returntype="Query">
    <cfquery name="qry_login" datasource="EWPROJ">
    SELECT *
    FROM ROBERTTEST
    </cfquery>
    <cfreturn qry_login>
    </cffunction>
    </cfcomponent>
    Simple enough.......
    Here is my Flex file...
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="absolute" creationComplete="initApp();">
    <mx:Script>
    <![CDATA[
    import mx.rpc.events.ResultEvent;
    import mx.collections.ArrayCollection;
    [Bindable]
    private var qry_result:ArrayCollection;
    private function initApp():void //first thing to load
    callCFC.runQuery()
    private function resultHandler(event:ResultEvent):void
    var qry_result:ArrayCollection = new ArrayCollection();
    //New Array Object called p1
    qry_result.source=event.result as Array;
    trace(qry_result);
    ]]>
    </mx:Script>
    <mx:RemoteObject id="callCFC" destination="ColdFusion"
    source="CFIDE.samples.FlexToCFC.CFC.myCFC"
    result="resultHandler(event)"
    showBusyCursor="true" />
    </mx:Application>
    my problem is within the [resultHandler] I want to simply
    create a variable that will contain my results of the object I
    passed so I can trace it to the screen.... I know that the object
    is returning correctly, by tracing result.event. What am I doing
    wrong here, cause it shows nothing.
    I'm guessing that my problem is that I am not putting the
    object into some sort of array or string where I can access it...
    How do I do this correctly? Thanks everyone.

    Ahhh,,, yes, I appologize. I will make better headings next
    time.. Okay, I tried your solution and it printed out what I wanted
    and more. SWEET!! Now I think all I need to do is put it in an
    associated array so I can reference things better. Not sure yet,
    but I'll play with it. Thanks again... Genius! BTW, here is the
    output when I ran it:
    mx.collections::ArrayCollection)#0
    filterFunction = (null)
    length = 6
    list = (mx.collections::ArrayList)#1
    length = 6
    source = (Array)#2
    [0] (Object)#3
    NAME = "Rob Capilli"
    TYPE = "Male"
    [1] (Object)#4
    NAME = "Meatball"
    TYPE = "Cat"
    [2] (Object)#5
    NAME = "Sanket"
    TYPE = "male"
    [3] (Object)#6
    NAME = "Sarah"
    TYPE = "Female"
    [4] (Object)#7
    NAME = "1"
    TYPE = "1"
    [5] (Object)#8
    NAME = ""
    TYPE = ""
    uid = "21B5BECE-6A2E-6940-9543-E830E43DAAFA"
    sort = (null)
    source = (Array)#2

  • Tuning the query : Very Urgent

    Hi
    We have query wich needs tuning.when we are putting REGULAR EXPRESSION query is running fine but whne we put like LIKE stmt it is taking time.Here is the query below.Please help on tuning.
    SELECT a.order_number, b.last_update_date,TO_CHAR( b.split_percent,'FM99999.009') SPLIT_PERCENTAGE,
    rs.NAME " SALES_PERSON_NAME ", rs.salesrep_number, b.effective_date,
    b.creation_date "CREATION_DATE", rt.NAME "TERRITORY_NAME",
    rt.segment1 "ERP_CODE", a.booked_date "DATE_BOOKED",
    TO_CHAR(ROUND((( (SELECT SUM (ordered_quantity * unit_selling_price)
    FROM apps.oe_order_lines_all ol
    WHERE ol.header_id = a.header_id)
    * b.split_percent
    / 100
    ) , 2),'FM99999999999999999999.009') order_total ,
    (SELECT user_name
    FROM fnd_user
    WHERE user_id = b.last_updated_by) requested_by,
    b.obsolete_date
    FROM oe_order_headers_all a,
    apps.csm_header_sales_cr_hist b,
    jtf_rs_salesreps rs,
    ra_territories rt
    WHERE 1 = 1
    AND a.header_id = b.source_header_id
    AND b.territory_id = rt.territory_id
    AND b.salesrep_id = rs.salesrep_id
    AND b.source_type = 'O'
    AND a.order_number IN (
    SELECT a.order_number
    FROM oe_order_headers_all a,
    apps.csm_header_sales_cr_hist b,
    jtf_rs_salesreps rs,
    ra_territories rt
    WHERE 1 = 1
    AND a.header_id = b.source_header_id
    AND b.territory_id = rt.territory_id
    AND b.salesrep_id = rs.salesrep_id
    AND b.source_type = 'O'
    -- AND b.obsolete_date IS NULL --ommented by andondap as per TD#9648 Changes
    AND  REGEXP_LIKE ( rs.name , '(svc)|(Muti.*Y)|(Multi.*Y)|(._MY)')  Commented by andondap as per TD#9648 Changes
    AND b.last_update_date BETWEEN TO_DATE ('2012/11/25', 'YYYY/MM/DD') AND TO_DATE ('2013/03/23', 'YYYY/MM/DD')+ 0.9999
    AND REGEXP_LIKE ( rs.name,'(.MY)|(Muti.*Y))|(Multi.*Y)|(._MY) |(mlti)')
    AND rs.name LIKE '%SVC%MULTI%' OR rs.name NOT LIKE '%DUMMY%' OR rs.name LIKE 'Svc%Multi%' OR rs.name LIKE 'Svc%MY%'
    OR rs.name LIKE 'Service%Multi%' OR rs.name LIKE '%MY_SHARE_TM' OR rs.name LIKE '%MY_SHARE_T')
    ORDER BY a.order_number, b.creation_date
    Thanks
    Hibin

    Hmmm, let's see...
    1. OP provided formatted code using {noformat}{noformat} tags.... - FAILED
    2. OP provided database version in full... - FAILED
    3. OP provided table structures and index information... - FAILED
    4. OP provided cardinality and selectivity information... - FAILED
    5. OP provided explain plans... - FAILED
    6. OP provided execution traces... - FAILED
    7. OP is a new member and can be excused for above failures... - FAILED
    8. OP has asked previous questions and followed forum etiquette by marking them as answered... - FAILED
    9. OP has respected volunteers and other questioners by not marking his question as Urgent... - FAILED
    10. OP has read the forum FAQ ({message:id=9360002}) for posting his question...  - FAILED
    11. OP has read the forum FAQ ({message:id=9360003}) for posting a tuning question... - FAILED
    It's a good job you're not a computer program, you wouldn't have even compiled.
    so, points to note:
    This is a forum of volunteers.  There's no such thing as an Urgent question here, and it's considered rude to suggest your question is urgent, as that indicates you want immediate attention from the people who are giving up their own time to help, and who have their own jobs to do.  It's also rude for the other people who are asking questions, as everyone would like an answer to their problem as soon as possible, so what makes you any more special?  An urgent issue is one where a live system is down potentially putting people's lives at risk or causing a company to lose money, or somehow damage their services.  Such issues should be logged with Oracle Support, not on the free OTN forums.
    Next, when you post your question, ensure you provide all the information that is needed for people to be able to help you.  Read the FAQ posts which point to useful threads indicating what information is required, especially for tuning requests.
    Finally, when your questions have been answered, it is common courtesy to mark them as answered (and award points if appropriate), otherwise it indicates that you have no respect for the people who are helping you.
    If you follow all the advice above, you will end up creating a good question that people will be willing to help you with.   If you don't follow the advice above, such as in this question you've posted, you will find that few experts will bother to help (or if they post it will not likely be helpful advise you receive).  The choice is yours.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Date format in Query Extract - Urgent

    Hi,
      I'm using Query-Extract (RSCRM_BAPI) to extract query data and store it in separate location.
    While extracting the data into .csv ot .txt file, date will be displayed as yyyymm (200807). As per the requirement we should display the date in the format mmm-yyyy (Jul-2008).
    Please help me. its very urgent.
    Thanks,
    Varun

    Hi ,
    This issue can be solved by writing a routine in update rules pls take the help of abap experts to solva this
    this is not a big issue for them
    Hope i have guided u properly
    Pls assign me points my boss ??
    Regards ,
    Subash Balakrishnan

  • ABAP Coding Help for Subtotal type output - SAP Query

    I've created a SAP Query to display a stock overview by storage type using the table LQUA.
    The output that I get is:
    Material
    Description
    Plant
    WHN
    SLOC
    Storage Type
    Batch
    GR Date
    Available stock
    2057 
    STRAWBERRIES
    BP01
    100
    0088
    200
    0001081766
    17.06.2014
    225
    2057
    STRAWBERRIES
    BP01
    100
    0088
    200
    0001081766
    17.06.2014
    720
    2061
    VOSTIZZA CURRANTS
    BP01
    100
    0088
    200
    0001081272
    17.06.2014
    1,000
    2061
    VOSTIZZA CURRANTS
    BP01
    100
    0088
    200
    0001081272
    17.06.2014
    1,000
    2061
    VOSTIZZA CURRANTS
    BP01
    100
    0088
    200
    0001081272
    17.06.2014
    1,000
    2061
    VOSTIZZA CURRANTS
    BP01
    100
    0088
    200
    0001081272
    17.06.2014
    1,000
    I can get a subtotal for each Material, batch and GR date combination by using the ALV grid functionality.
    This method adds too much clutter to my query and can't be easily manipulated in Excel afterwards for what I want. I want to condense the results down and just keep a cumulated available stock, e.g:
    Material
    Description
    Plant
    WHN
    SLOC
    Storage Type
    Batch
    GR Date
    Available stock
    2057 
    STRAWBERRIES     
    BP01
    100
    0088
    200
    0001081766
    17.06.2014
    945
    2061
    VOSTIZZA CURRANTS
    BP01
    100
    0088
    200
    0001081272
    17.06.2014
    4,000
    How can this be done?

    Hi,
    Please try to use STATISTICS in your SAP Query. you can sort and add your value based on condiiton then it will be show you collect value in SQ01.
    Please see the below documents for STATISTICS
    https://help.sap.com/saphelp_erp2004/helpdata/en/d2/cb4263455611d189710000e8322d00/content.htm
    Regards,
    Prasenjit Mishra

  • GETTING FORM OUT OF QUERY MODE (URGENT)

    I have a form which start in Query mode, user enter in say employee ID. If that employee exists than user bring its record else create a new record.
    What I did is start in query mode, when user enter employee ID, I check to see if record exist, if it does then I just use EXECUTE_QUERY. Now I don't know what to do for new record. If I use CREATE_RECORD that doesn't work because form is in query mode. How can I make form come out of query mode programmically?
    I am using Form 5. Trigger I am using is KEY_NEXT_ITEM in Employee ID field.
    Need urgent reply
    Thanks

    Well Faisal, I have tried this code on the EMP table in the user Scott. I think it will solve your problem
    use the key-next-item trigger
    declare
    empid emp.empno%type;
    begin
    select empno into empid
    from emp
    where empno = :empno;
    clear_block(no_validate);
    set_block_property('emp', default_where, 'empno=' &#0124; &#0124; empid);
    execute_query;
    set_block_property('emp', default_where, '');
    next_item;
    exception
    when no_data_found then
    next_item;
    end;

  • Where to see query details(urgent)

    Hi xperts,
    Can you please tell me where to see the runtime detaile of the query if we excute in the browser or in query analiser it is not aback ground job by default.Due points will be given.
    Thanks in advance,
    Dan

    Hello Dan,
    I am not sure about the BW release you are using, therefore, I would provide the solution for both the releases.
    BW 3.5 (NW04)
    In case, you are using BEx Analyzer or the browser for executing the query, you can see the query runtime statistics in the BW system only if the BW statistics for the InfoCube are activated on which the query is running.
    Therefore, please activate the BW statistics on all the Basic InfoCubes on which the query is running. You can do this from TCode: RSDDSTAT or from RSA1-> Tools -> BW Statistics for InfoProviders.
    Now, execute the query from BEx or the portal and after executing login to the BW system (ABAP system) and go to Transaction SE16.
    In transaction SE16, enter the table name as (Table Name = RSDDSTAT)and in the QueryID field enter the technical name of the "query" and then press execute.
    Now, you will see all the runtime statistics for the query, like the total runtime, DB time, OLAP time and the frontend time.
    The other way to see the query details is to run the same query in the "Query Monitor" (TCode : RSRT) with the option "execute and debug" and in the options select "display runtime statistics". After you execute the query on the output screen, just go back and you will see the query statistics for the current exection of the query.
    BI 7.0 (NW 7.0)
    Same things need to be followed here also.
    The difference is that you can activate the BI statistics on a query also in case of BI 7.0.
    Therefore, from "RSA1 -> Tools -> Settings for BI statistics" or from TCode: RSDDSTAT, activate the statistics on the query, you are referring to.
    Now, after running the query in BEx Web Analyzer or BEx Excel addin, you can again go to SE16 and here now, you need to enter the table name as "RSDDSTAT_OLAP" to see the new BI query runtime statistics.
    For getting the details of the DM time, you can also use the RSDDSTAT_DM table.
    The other option of RSRT is also valid in this case.
    I hope, I have answered your query.
    Please let me know in case of any doubts.
    Regards,
    Yash Vardhan

  • Error when executing query its urgent

    hi,
    when iam executing my query in query designer through web morning i got the result in web.
    but when iam executing the same query in wad it is throughing an error like (System error in program SAPLRRK0 and form GET_FIELD_POSITION-01-))
    now again i check that one in querydesigner again it is showing the same error in querydesigner also
    vijay

    Hi,
    Refer Note 931975 - Problems when you execute a query
    Symptom
    At runtime, a query contains a generated ABAP program and a data structure, which is stored in the shared buffer. Due to the gap described here, the version of the ABAP program may not correspond to the version of the data structure.
    This causes several terminations when you execute this query:
    X299 Brain SAPLRRK0; Form GET_FIELD_POSITION-01-,
    X299 Brain SAPLRRK0; Form APPEND_KHANDLE_1-02-,
    ASSIGN COMPONENT L_FIELDNAME OF STRUCTURE C_SX_GVAR, and others.
    Other terms
    RSIX, SX_REPORT,
    Reason and Prerequisites
    The error can occur if one person changes a query and another person simultaneously executes the query. A query may also be changed implicitly if one of the objects used in the query is changed in another query.
    Solution
    The attached corrections apply only to Releases 3.X. An advance correction cannot be provided for NetWeaver 2004s.
    Before you implement the attached correction (in 3.X), you must change the two following method interfaces. Otherwise syntax errors occur in the CL_RSR_REPORT_RSIX class and the RRI0 function group when you implement the corrections.
    1. In Transaction SE24: Change the MODIFY method of the CL_RSR_REPORT_RSIX class as follows:
                  Insert the I_S_RKB1D import parameter with the type RSR_S_RKB1D.
    2. In Transaction SE24: Change the READ_SX_REPORT method of the CL_RSR_REPORT_RSIX class.
                  Delete all existing import parameters (that is, I_GENUNIID, I_DVERS, I_IDVERS and I_GENTIME) and insert the I_S_RKB1D import parameter with the type RSR_S_RKB1D.
    After you implement the corrections, you must delete the incorrect information in the shared buffer. To do this, enter '/$SYNC' in the command field in every application server. Alternatively, you can also call RSRT -> Environment -> Generate Queries. As a result, all queries are regenerated but all OLAP caches are rejected.
    BW 3.0B
               Import Support Package 31 for 3.0B (BW 3. 0B Patch 31 or SAPKW30B31) into your BW system. The Support Package is available when Note 0872272 "SAPBWNews BW 3.0B Support Package 31", which describes this Support Package in more detail, is released for customers.
    BW 3.10 Content
               Import Support Package 25 for 3.10 (BW 3. 10 Patch 25 or SAPKW31025) into your BW system. The Support Package is available when Note 0872274 "SAPBWNews BW 3.1 Content Support Package 25", which describes this Support Package in more detail, is released for customers.
    BW 3.50
               Import Support Package 17 for 3.5 (BW 3. 50 Patch 17 or SAPKW35017) into your BW system. The Support Package is available when Note 0872277 "SAPBWNews BW Support Package 17 NetWeaver'04 Stack 17", which describes this Support Package in more detail, is released for customers.
    SAP NetWeaver 2004s BI
               Import Support Package 08 for SAP NetWeaver 2004s BI (BI Patch 08 or SAPKW70008) into your BI system. The Support Package is available when Note 0872280 "SAPBINews BI 7.0 Support Package 08", which describes this Support Package in more detail, has been released for customers.
               In urgent cases, you can use the correction instructions.
    To provide information in advance, the notes mentioned above may be released before the Support Package is available. In this case, however, the short text of the notes still contains the words "preliminary version".
    Thanks

  • Trouble outputting all query results

    For some reason this code doesn`t output all the results only
    the first one. How can I can it working I did try a way that output
    all the results the same amount of times as there are Referer
    entries in the db which is obviously not what I want. What is the
    way to do thisso that it is cfoutput right? Thank you very much
    <cfquery name="qrysales">
    SELECT Referer
    FROM clientinfo
    </cfquery>
    <cfoutput><cfif len(qrysales.Referer)>
    <cfif find("?", qrysales.Referer)>
    <cfset paramList = "q,p,terms,search,query,qkw">
    <cfset strStart = find("?", qrysales.Referer)>
    <cfset referer_queryString =
    right(Referer,len(qrysales.Referer)-strStart)>
    <cfset referer_url =
    left(qrysales.Referer,(strStart-1))>
    <cfloop list="#referer_queryString#" delimiters="&"
    index="i">
    <cfif listfind(paramList,listfirst(i,"="))>
    <cfset variables.searchPhrase = listlast(i,"=")>
    </cfif>
    </cfloop>
    </cfif>
    </cfif>
    <cfif isdefined("variables.searchPhrase")>
    <cfoutput>#variables.searchPhrase#</cfoutput>
    </cfif>
    </cfoutput>

    The code works fine using the querynew values. When I use the
    db cfquery then I get the results output over and over again. Why
    is that?! Thanks
    <!---
    <cfquery name="qrysales">
    SELECT Referer
    FROM clientinfo
    </cfquery>--->
    <h3>QueryNew Example</h3>
    <cfset qrysales = QueryNew("referer")>
    <!--- make some rows in the query --->
    <cfset newRow = QueryAddRow(qrysales, 4)>
    <!--- set the cells in the query --->
    <cfset temp = QuerySetCell(qrysales, "referer", "
    http://search.live.com/results.aspx?q=environment+property+study&FORM=SSRE2
    ", 1)>
    <cfset temp = QuerySetCell(qrysales, "referer", "
    http://search.live.com/results.aspx?q=healthcare&mrt=en-us&FORM=LIVSOP",
    2)>
    <cfset temp = QuerySetCell(qrysales, "referer", "
    http://www.google.co.uk/search?q=grande+rio&sourceid=navclient-ff&ie=UTF-8&rlz=1B2GGFB_enG B251",
    3)>
    <cfset temp = QuerySetCell(qrysales, "referer", "
    http://www.google.de/search?q=Rio-Grande&ndsp=20&hl=de&ie=UTF-8&oe=ISO-8859-1&start=30&sa= N",
    4)>
    <cfoutput query="qrysales"><cfif len(#Referer#)>
    <cfif find("?", #Referer#)>
    <cfset paramList = "q,p,terms,search,query,qkw">
    <cfset strStart = find("?", #Referer#)>
    <cfset referer_queryString =
    right(Referer,len(#Referer#)-strStart)>
    <cfset referer_url = left(#Referer#,(strStart-1))>
    <cfloop list="#referer_queryString#" delimiters="&"
    index="i">
    <cfif listfind(paramList,listfirst(i,"="))>
    <cfset variables.searchPhrase = listlast(i,"=")>
    </cfif>
    </cfloop>
    </cfif>
    </cfif>
    <cfif isdefined("variables.searchPhrase")>
    #variables.searchPhrase#
    </cfif>
    </cfoutput>

  • Query needed urgently.Pls help in this regard

    1.I need to display the details of employee no,name,image if at all an employee is having a photo attached with his profile and their count.
    I need to display the count and the same details for the employees having no photo too.
    I did with a query also.But I need some better Query for performance.I used per_images,per_all_people_f(per_people_f) for the above.Could u suggest me any query relating to this.And moreover,can u suggest any settings need to be done in rdf for the same image to display.
    2.I need to display the approved time sheets between 3 months period.But I used HXC_Timecard_Summary .But in that table thr is no date duration such as time period column.Its having only start time and stop time which will count only for one day and not for a particular duration.SO,could you suggest me the solution for the same.

    Sorry, all my crystal balls are on the blink.
    You couldn't have guarenteed that you won't get your questions answered any better than you have:
    1. Use of the word "Urgent" in your title. To us, your problems aren't any more urgent than anyone else's problems on the forum, and a great deal less urgent than our own problems are!
    2. You have provided zero information on your tables, data, etc in terms of what you're working with and what you want it to look like. You expect us to know your table and data structures in depth ... well, see my initial comment re. my crystal balls.
    3. You say you've come up with a solution for your first point, but haven't provided it, nor do you appear to have done any searching or anything else that makes me think that you're not expecting us to do your work for you.
    I suggest you edit your title to remove the word "urgent" and provide much more detail (table create statements, insert statements, etc) than you have.

Maybe you are looking for

  • Panel

    Could someone please tell whats going wrong in the following code. I realise that I never specified the size of the panel, but I dont know where I am supposed to do that. Please help me out. The values of "x" that prints out on mouse press and realea

  • [svn] 4001: Adding support for asdoc in flex ant tasks

    Revision: 4001<br />Author:   [email protected]<br />Date:     2008-11-03 13:46:13 -0800 (Mon, 03 Nov 2008)<br /><br />Log Message:<br />-----------<br />Adding support for <asdoc> in flex ant tasks<br /><br />QE Notes: Tests need to be added to the

  • Cross hair in photoshop elements?

    When I often open up Elements my curser is a crosshair; this is very inaccurate and I find it impossible to work with;  I have tried altering it in the 'preference' tab but nothing changes and I am always left with this crosshair. help please thanks

  • Has anybody modified the Aperture Web Themes for a Fluid Grid or Responsive Web design

    I have had some experience modifigying Apple's WebThemes inside Aperture in Aperture.app/Contents/Resources/WebThemes I would like to create or modify an existing Web Theme in order to have my site follow the Fluid Grid principles of Responsive Web d

  • How well does OSX Yosemite run on a Mid 2007 iMac?

    I own a Mid 2007 iMac with 4GB 667Mhz DDR2 RAM, Intel Core 2 Duo 2.0Ghz processor and has ATI Radeon HD 2400 XT 128 MB graphics. I was considering upgrading from OSX Mavericks 10.9.4 to OSX Yosemite, but fear it may slow the Mac down. If anybody has