Query to refresh the output data.

Hi,
I have displayed an hierarchy list using 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'  FM.  Now I am trying to refresh the output screen, I have tried the selfield-refresh = 'X' functionality but its is not working.
Have thought of other ways like getting the screen instance and then call the refresh method etc, but don't know if that's feasible.
Please suggest..
Thanks,
Ketan

Please find my piece code below..
**Function module to display the ALV output.
  CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
       EXPORTING
            i_callback_program        = ws_repid
            i_callback_user_command   = 'F0009_USER_COMMAND'
            i_callback_pf_status_set  = 'f0008_set_pf_stat'
            is_layout                 = wa_layo
            it_fieldcat               = i_fieldcat[]
            is_variant                = wa_vari
            i_tabname_header          =  'I_VTTK_1'
            i_tabname_item            =  'I_HEADER'
            is_keyinfo                = ws_keyinfo
       TABLES
            t_outtab_header           = i_vttk_1
            t_outtab_item             = i_header
       EXCEPTIONS
            program_error             = 1
            OTHERS                    = 2.
FORM f0009_user_command  USING ucomm LIKE sy-ucomm
                               selfield TYPE slis_selfield. "#EC CALLED
to handle the user commands if different from standard ALV
  CASE ucomm.
     WHEN 'REFRESH'.
Here I am reselecting the data again to get the new changes done.
      PERFORM f0002_get_selection_data.
Here the flag is getting set.
      selfield-refresh = 'X'.
  ENDCASE.
ENDFORM.

Similar Messages

  • Can I get a query to get the output data like 4th column instead of 3rd col

    Can I get a query to get the output data like 4th column instead of 3rd column ?
    SQL> select emp.deptno, empno, rownum from emp, dept where emp.deptno=dept.deptno;
    DEPTNO EMPNO ROWNUM
    10 7782 *1* *1*
    10 7839 *2* *2*
    10 7934 *3* *3*
    20 7369 *4* *1*
    20 7876 *5* *2*
    20 7902 *6* *3*
    20 7788 *7* *4*
    20 7566 *8* *5*
    30 7499 *9* *1*
    30 7698 *10* *2*
    30 7654 *11* *3*
    30 7900 *12* *4*
    30 7844 *13* *5*
    30 7521 *14* *6*
    14 rows selected.

    SQL> select emp.deptno, emp.empno,
      2    row_number() over(order by emp.deptno, emp.empno) rn,
      3    row_number() over(partition by emp.deptno order by emp.empno) dept_rn
      4  from emp, dept
      5  where emp.deptno=dept.deptno
      6  order by emp.deptno, emp.empno;
        DEPTNO      EMPNO         RN    DEPT_RN
            10       7782          1          1
            10       7839          2          2
            10       7934          3          3
            20       7369          4          1
            20       7566          5          2
            20       7788          6          3
            20       7876          7          4
            20       7902          8          5
            30       7499          9          1
            30       7521         10          2
            30       7654         11          3
            30       7698         12          4
            30       7844         13          5
            30       7900         14          6
    14 rows selected.Regards,
    Dima

  • How to use Add Query Criteria for the MySQL data Base in Netbeans ?

    How to use Add Query Criteria for the MySQL data Base in Netbeans Visual web pack.
    When the Query Criteria is add like
    SELECT ALL counselors.counselors_id, counselors.first_name, counselors.telephone,counselors.email
    FROM counselors WHERE counselors.counselors_id = ?
    when i run this Query in the Query Window
    i get a error message Box saying
    Query Processing Error Parameter metadata not available for the given statement
    if i run the Query with out Query Criteria its working fine.

    *I am glad I am not the only one who have this problem. Part of issue has been described as above, there are something more in my case.
    Whenever I try to call ****_tabRowSet.setObject(1, userDropList.getSeleted()); I got error message as shown below:*
    The Java codes are:
    public void dropDown1_processValueChange(ValueChangeEvent event) {
    Object s = this.dropDown1.getSelected();
    try {
    this.User_tabDataProvider1.setCursorRow(this.User_tabDataProvider1.findFirst("User_Tab.User_ID", s));
    this.getSessionBean1().getTrip_tabRowSet1().setObject(1, s);
    this.Trip_tabDataProvider1.refresh();
    } catch (Exception e) {
    this.log("Error: ", e);
    this.error("Error: Cannot select user"+e.getMessage());
    SQL statement for Trip_tabRowSet:
    SELECT ALL Trip_Tab.Trip_Date,
    Trip_Tab.User_ID,
    Trip_Tab.Destination
    FROM Trip_Tab
    WHERE Trip_Tab.User_ID = ?
    Error messages are shown below:
    phase(RENDER_RESPONSE 6,com.sun.faces.context.FacesContextImpl@5abf3f) threw exception: com.sun.rave.web.ui.appbase.ApplicationException: java.sql.SQLException: No value specified for parameter 1 java.sql.SQLException: No value specified for parameter 1
    com.sun.rave.web.ui.appbase.faces.ViewHandlerImpl.cleanup(ViewHandlerImpl.java:559)
    com.sun.rave.web.ui.appbase.faces.ViewHandlerImpl.afterPhase(ViewHandlerImpl.java:435)
    com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:274)
    com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:140)
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
    org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:397)
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:184)
    com.sun.webui.jsf.util.UploadFilter.doFilter(UploadFilter.java:240)
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:216)
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:184)
    org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:216)
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:184)
    org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:276)
    org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
    org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:240)
    org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:179)
    org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
    com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:73)
    org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:182)
    org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
    com.sun.enterprise.web.VirtualServerPipeline.invoke(VirtualServerPipeline.java:120)
    org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
    org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:137)
    org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
    org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
    org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:239)
    com.sun.enterprise.web.connector.grizzly.ProcessorTask.invokeAdapter(ProcessorTask.java:667)
    com.sun.enterprise.web.connector.grizzly.ProcessorTask.processNonBlocked(ProcessorTask.java:574)
    com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:844)
    com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTask(ReadTask.java:287)
    com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.java:212)
    com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:252)
    com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:75)
    tandardWrapperValve[Faces Servlet]: Servlet.service() for servlet Faces Servlet threw exception
    java.sql.SQLException: No value specified for parameter 1
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:910)
    at com.mysql.jdbc.PreparedStatement.fillSendPacket(PreparedStatement.java:1674)
    at com.mysql.jdbc.PreparedStatement.fillSendPacket(PreparedStatement.java:1622)
    at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1332)
    at com.sun.sql.rowset.internal.CachedRowSetXReader.readData(CachedRowSetXReader.java:193)
    at com.sun.sql.rowset.CachedRowSetXImpl.execute(CachedRowSetXImpl.java:979)
    at com.sun.sql.rowset.CachedRowSetXImpl.execute(CachedRowSetXImpl.java:1439)
    at com.sun.data.provider.impl.CachedRowSetDataProvider.checkExecute(CachedRowSetDataProvider.java:1274)
    at com.sun.data.provider.impl.CachedRowSetDataProvider.setCursorRow(CachedRowSetDataProvider.java:335)
    at com.sun.data.provider.impl.CachedRowSetDataProvider.setCursorIndex(CachedRowSetDataProvider.java:306)
    at com.sun.data.provider.impl.CachedRowSetDataProvider.getRowCount(CachedRowSetDataProvider.java:639)
    at com.sun.webui.jsf.component.TableRowGroup.getRowKeys(TableRowGroup.java:1236)
    at com.sun.webui.jsf.component.TableRowGroup.getFilteredRowKeys(TableRowGroup.java:820)
    at com.sun.webui.jsf.component.TableRowGroup.getRowCount(TableRowGroup.java:1179)
    at com.sun.webui.jsf.component.Table.getRowCount(Table.java:831)
    at com.sun.webui.jsf.renderkit.html.TableRenderer.renderTitle(TableRenderer.java:420)
    at com.sun.webui.jsf.renderkit.html.TableRenderer.encodeBegin(TableRenderer.java:143)
    at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:810)
    at com.sun.webui.jsf.component.Table.encodeBegin(Table.java:1280)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:881)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:889)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:889)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:889)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:889)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:889)
    at com.sun.faces.application.ViewHandlerImpl.doRenderView(ViewHandlerImpl.java:271)
    at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:182)
    at com.sun.rave.web.ui.appbase.faces.ViewHandlerImpl.renderView(ViewHandlerImpl.java:285)
    at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:133)
    at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:244)
    at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:140)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
    at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:397)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:184)
    at com.sun.webui.jsf.util.UploadFilter.doFilter(UploadFilter.java:240)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:216)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:184)
    at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:216)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:184)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:276)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
    at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:240)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:179)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
    at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:73)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:182)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
    at com.sun.enterprise.web.VirtualServerPipeline.invoke(VirtualServerPipeline.java:120)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:137)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
    at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:239)
    at com.sun.enterprise.web.connector.grizzly.ProcessorTask.invokeAdapter(ProcessorTask.java:667)
    at com.sun.enterprise.web.connector.grizzly.ProcessorTask.processNonBlocked(ProcessorTask.java:574)
    at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:844)
    at com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTask(ReadTask.java:287)
    at com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.java:212)
    at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:252)
    at com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:75)
    Also when I tried to update my MYSQL connector / J driver to version 5.1.5 from 5.0.5 (NB 5.5.1) and 5.0.7 (NB 6.1), I could not get it work (looooong time to search some JDBC classes and with no response in the end) on both of my Netbean 5.5.1(on PC) and Netbean 6.1(on laptop) IDEs.
    Could anybody look into this issue.
    Many thanks
    Edited by: linqing on Nov 22, 2007 4:48 AM

  • How to get the output data of Standard drill down report into z-program?

    HI every one,
            I want to get the output data of drill down report into z-program.
           Actually,if the output is only one, I can get into z-program,
          But, Here the report consists 3 alv outputs. when double clicking function happens, it will direct to another alv output.
        Those, all the outputs of report i want to get into z-program.
    PLease , give reply as early as possible.
    Thank u in advance,
    karthik

    HI,
      When i download,only one output i will get.
      But,if i double-click the particular record it will show another output. I want that output also.
      Like that,when i double-click particular record, it will show some other alv ouput based on record,     
    i wanted all those outputs.
    If  i copy the code, whether i face any problems?

  • Sql query to indetify the identical data

    Hi
    I would like to know the query to identify the identical data in same table.
    Example: I have table called 'AA" having same data for load_ctry i.e. 'MY' and 'HK' ,I need sql query to indetify the identical data for above countries in that table.
    Thanks
    MR

    Hi,
    Table called "AA" with columns col1,col2,col3,load_ctry with following sample date
    col1 col2 col3 load_ctry
    3 bg xx TH
    4 op xc TH
    3 bg xx MY
    4 op xc MY
    3 vb nb MY
    When query ,if data is identical for both countries ,no data to fecth or data identical .If data is differ ,it will return the mismatching data becuase we are using same table for both countries .
    Thanks
    MR

  • Refreshing the Output Table in ALV

    Hi All,
    Please let me know how to refresh the output table using refresh button in ALV.
    Thanks & Regards,
    Priya.
    Edited by: SathyaPriya Neelagaru on Jun 26, 2008 7:00 AM

    Hi,
    We can refresh the output table for ALV by below code :
    CLEAR  : g_wa_outtab.
    REFRESH: g_t_outtab.
    When we append something to output table of ALV we need to clear the workarea for that table.
    APPEND g_wa_outtab TO g_t_outtab.
    CLEAR g_wa_outtab.
    If you are using object oreinted concept we have
    CALL METHOD g_alv_grid_9001->refresh_table_display.
    In case you have to use your own PF Status - Always copy the standard GUI status
    (Program : SAPLSLVC_FULLSCREEN,
    Status : STANDARD_FULLSCREEN )
    For REFRESH - Include parameter for "USER_COMMAND" in the Function module interface.
    Inside the User command subroutine - set
    "RS_SELFIELD-REFRESH" = "X".
    It will automatically refresh the ALV and there is no requirement to call ALV again.
    Or else if u have a Refresh button on screen.
    we can have
    WHEN 'REFRESH'.
          CLEAR : g_wa_outtab.         
          REFRESH : g_t_outtab.
    Hope this helps you.
    Plz reward if useful.
    Thanks,
    Dhanashri
    Edited by: Dhanashri Pawar on Jun 26, 2008 7:08 AM
    Edited by: Dhanashri Pawar on Jun 26, 2008 7:14 AM
    Edited by: Dhanashri Pawar on Jun 26, 2008 7:15 AM

  • A query to obtain the communication data (t.code XD03)

    Hi All,
    I have to create a query to extract the comunication data (mainly email) for each customer. 
    Which table or database should I use ?
    Thanks
    gandalf

    Hi,
    List of tables in which email ids are stored SRIRAGRP, ECAMIOPREMAIL, ADR6, TO24, ADR6S, ADR6S, EFISEL, USR21.
    Cheers!!
    VEnk@

  • Very Important (Query to display the output in required format)

    CREATE TABLE TEMP(X VARCHAR2(10),Y VARCHAR2(100));
    INSERT INTO TEMP('RIDER1','2001-12;2002-32;2003-42');
    INSERT INTO TEMP('RIDER2','2001-52;2003-72');
    SELECT * FROM TEMP
    Initial Out Put in 2 columns X/Y_
    X Y
    RIDER1 2001-12;2002-32;2003-42
    RIDER2 2001-52;2003-72
    Write a Query to display the above data in the format below in 3 columns A/B/C*
    A B C
    Rider1 2001 12
    Rider1 2002 32
    Rider1 2003 42
    Rider2 2001 52
    Rider2 2003 72

    So your old version doesn't support Regular expression. It will be very easy and efficient if you could use regular expression.
    SQL> SELECT x,TRIM(REGEXP_SUBSTR(col2,'[^-]+', 1, 1)) col2,
      2           TRIM(REGEXP_SUBSTR(col2,'[^-]+', 1, 2)) col3
      3   FROM (
      4     SELECT DISTINCT x,regexp_substr (y, '[^;]+', 1, level) col2 
      5     FROM temp 
      6     CONNECT BY LEVEL <= LENGTH (REGEXP_REPLACE (y, '[^;]+'))  + 1
      7     ORDER BY 1,2
      8        );
    X          COL2
    COL3
    RIDER1     2001
    12
    RIDER1     2002
    32
    RIDER1     2003
    42
    X          COL2
    COL3
    RIDER2     2001
    52
    RIDER2     2003
    72But for your version you can use something like
    SQL> /* By curtesy Frank Kulash */
    SQL> SELECT x,SUBSTR(the_value,1,INSTR(the_value,'-',1)-1) col2,
      2           SUBSTR(the_value,INSTR(the_value,'-',1)+1)col3
      3  FROM (
      4        SELECT DISTINCT x,SUBSTR(y,
      5                            DECODE(level,
      6                                   1,
      7                                   1,
      8                                   INSTR(y, ';', 1, level - 1) + 1),
      9                            DECODE(INSTR(y, ';', 1, level),
    10                                   0,
    11                                   length(y),
    12                                   instr(y, ';', 1, level) -
    13                                   DECODE(level,
    14                                          1,
    15                                          0,
    16                                          INSTR(y, ';', 1, level - 1)) - 1)) the_value
    17                FROM temp
    18              CONNECT BY level <=
    19                         LENGTH(y) - LENGTH(REPLACE(y, ';')) + 1
    20          )
    21  ORDER BY 1,2,3                     
    22       ;
    X          COL2
    COL3
    RIDER1     2001
    12
    RIDER1     2002
    32
    RIDER1     2003
    42
    X          COL2
    COL3
    RIDER2     2001
    52
    RIDER2     2003
    72
    SQL>

  • Drop down selection is not refreshing the page data correctly

    I have a drop down menu for a CREATE DATE. The record is based on a Identification ID. This identification ID can be in our system for multiple CREATE DATES. The CREATE DATE drop down is populated by checking how many different CREATE DATES there are for a particular identification ID.
    The last identification ID looks great. It populates all the fields. However if you select an older CREATE DATE, the page does not get populated with that CREATE DATES data. The whole page even looks different. It looks like an older version of the page before I added all the new fields.
    What is causing the older CREATE DATES not to look like the current create date.
    Please let me know if you need any additional information. Thank you!!
    Pattibz

    Thank you for your reply. Here are some details. Please let me know if I am not giving the information you need.
    One page item called CREATE_DATE displayed as a Select LIST with submit. The source type is a database column called ID_IDENT. The ID_IDENT is just a
    The List of Values is: Named LOV is the Select Named LOV. The list of values definition is a query against a table in our database:
    select CRE_DT, ID_IDENT from IDENT_TABLE where UNIQ_ID = :P3_UNIQ_ID
    ORDER BY CRE_DT DESC
    This is the date on which the ID_IDENT data was created. The date is displayed in a pull down menu, which allows you to select from a list of available "as of" dates when viewing the data. Only data on the most recent ID_IDENT record may be manually altered.
    I have a UNIQ_ID = '34587443'. It acutally has records in the database with that UNIQ_ID. The only difference is the create date. On record of 345778 was done on 10/1/2008 and the current date 10/13/2008.
    I see these two dates in the CREATE_DATE pull down menu. This is fine. The drop down orders the dates by DESC so I have the lastest date on top fo the pull down.
    If I want to pick the date of 10/1/2008, I need go into the web page, open the Create Date pull down and select the older date.
    When I pick the older date 10/1/2008, the page does not look the same as the defaul tor oldest time date and numbers.
    The page is different and most of the data on the webpage is there.
    What should have happened is that I choice the newer date from the drop down, the page refreshes with the data from 10/1/2008
    and all the parameters are displayed from the date of 10/1/2008. It isn't only part of the fields are being populated and the page itself doesn't refresh to the look of the original page. Thank you.
    Edited by: pattibz on Sep 12, 2008 11:15 AM

  • Help in Pivot Query- To change the column data to rows data!

    Hello Gurus -
    I have to change the row to Column -
    When i use the query -
    select NVL (T2.NAME, ' Grand Total') AS State,count(T2.NAME) as Total
    from Defect T1,statedef T2,repoproject T3
    WHERE T1.STATE=T2.ID AND T1.repoproject = T3.dbid AND T3.name like '%Compass Juice' GROUP BY ROLLUP (T2.NAME)
    Then i have got the following data -
    STATE          TOTAL
    Analysis     17
    Closed          1302
    Development     9
    Duplicate     24
    Failed          2
    OnHold          4
    Opened          146
    QA          1
    ReadyForQA     1
    Withdrawn      335
    Grand Total     1841
    But i want the data in following format -
    State Analysis     Closed     Development      Duplicate     Failed     OnHold     Opened     QA     ReadyForQA     Withdrawn     GrandTotal
    Total 17     1302     9          24          2     4     146     1     1          335          1841
    Kindly help me with this. I searched the forum and saw the usage of Max and NVL, Decode but i am unable to understand it to use in my query. kindly help me with this.

    Hi,
    In 11g you can use pivot.
    [http://www.oracle.com/technology/pub/articles/oracle-database-11g-top-features/11g-pivot.html]
    example
    SQL> desc customers
    Name                                      Null?    Type
    CUST_ID                                            NUMBER(10)
    CUST_NAME                                          VARCHAR2(20)
    STATE_CODE                                         VARCHAR2(2)
    TIMES_PURCHASED                                    NUMBER(3)
    When this table is selected:
    select cust_id, state_code, times_purchased
    from customers
    order by cust_id;
    The output is:
    CUST_ID STATE_CODE TIMES_PURCHASED
          1 CT                       1
          2 NY                      10
          3 NJ                       2
          4 NY                       4
    ... and so on ...
    Note how the data is represented as rows of values: For each customer, the record shows the customer's home state and how many times the customer purchased something from the store. As the customer purchases more items from the store, the column times_purchased is updated.
    Now consider a case where you want to have a report of the purchase frequency each state�that is, how many customers bought something only once, twice, thrice and so on, from each state. In regular SQL, you can issue the following statement:
    select state_code, times_purchased, count(1) cnt
    from customers
    group by state_code, times_purchased;
    Here is the output:
    ST TIMES_PURCHASED        CNT
    CT               0         90
    CT               1        165
    CT               2        179
    CT               3        173
    CT               4        173
    CT               5        152
    ... and so on ...
    This is the information you want but it's a little hard to read. A better way to represent the same data may be through the use of crosstab reports, in which you can organized the data vertically and states horizontally, just like a spreadsheet:
    Times_purchased
                 CT           NY         NJ      ... and so on ...
    1             0            1          0      ...
    2            23          119         37      ...
    3            17           45          1      ...
    ... and so on ...
    Prior to Oracle Database 11g, you would do that via some sort of a decode function for each value and write each distinct value as a separate column. The technique is quite nonintuitive however.
    Fortunately, you now have a great new feature called PIVOT for presenting any query in the crosstab format using a new operator, appropriately named pivot. Here is how you write the query:
    select * from (
       select times_purchased, state_code
       from customers t
    pivot
       count(state_code)
       for state_code in ('NY','CT','NJ','FL','MO')
    order by times_purchased
    Here is the output:
    . TIMES_PURCHASED       'NY'       'CT'       'NJ'       'FL'       'MO'
                  0      16601         90          0          0          0
                  1      33048        165          0          0          0
                  2      33151        179          0          0          0
                  3      32978        173          0          0          0
                  4      33109        173          0          1          0
    ... and so on ...

  • Adhoc Query- problem with the output file format

    Hi Gurus,
    I have a problem in exporting the output of an adhoc query to Excel format.
    The menu option I chose to export the report data into Excel is List>Export>Spreadsheet.
    However,I think I've just pressed the wrong option to export my report and now I can't seem to change it from a HTML file option.
    Can anybody help me correct this output setting.
    Points assured for apt help...

    Hi Sushil,
    There are two ways to save the output in the excel format.
    As you have mentioned, you can use
    List -> Export-> Spreadsheet.
    Then select table. Now the output will open in a spreadsheet.
    The other way is
    List -> Export-> Local File
    Here you need to select the option spreadsheet. Then mention the path where you want the file to be stored. Also mention the format as .xls
    Hope this helps
    Regards,
    Brinda

  • ALV- Changing the output data and saving in database

    hi friends,
    I have to change the material description in the output and have to save the changes in database..
    For changing the description I have to raise a pop-up, then I have to give the required change and then save..
    How to do it?
    My code is as follows:
    TABLES : vbrk,vbrp,vbpa,adrc.
    TYPE-POOLS : slis.
    DATA: w_report_id  LIKE sy-repid.
    DATA: w_title    TYPE lvc_title VALUE      'DIPLAY CUSTOMER BILLING DOCUMENT'.
    DATA: w_layout   TYPE slis_layout_alv.
    DATA: w_fieldcat TYPE slis_t_fieldcat_alv.
    DATA: w_events   TYPE slis_t_event.
    DATA: w_header   TYPE slis_t_listheader.
    DATA: sum LIKE vbrk-netwr.
    SELECT-OPTIONS:
         erdat FOR vbrk-erdat,
         vkorg FOR vbrp-vkorg_auft,
         kunag FOR vbrk-kunag.
    DATA : BEGIN OF itab OCCURS 0,
           fkdat TYPE vbrk-fkdat,
           kunrg TYPE vbrk-kunrg,
           name1 TYPE adrc-name1,
           vbeln TYPE vbrk-vbeln,
           augru_auft TYPE vbrp-augru_auft,
           netwr TYPE vbrk-netwr,
           waerk TYPE vbrk-waerk,
           vbtyp TYPE vbrk-vbtyp,
           fkart TYPE vbrk-fkart,
           END OF itab.
    DATA itab1 LIKE STANDARD TABLE OF itab.
    SELECT vbrkfkdat vbrkkunrg adrcname1 vbrkvbeln vbrp~augru_auft
           vbrknetwr vbrkwaerk
           INTO TABLE itab1
           FROM ( ( ( vbrk INNER JOIN vbrp ON vbrkvbeln = vbrpvbeln )
           INNER JOIN vbpa ON vbpavbeln = vbrkvbeln )
           INNER JOIN adrc ON adrcaddrnumber = vbpaadrnr )
           WHERE vbtyp = 'O'
           AND vbrk~erdat IN erdat
           AND vbrp~vkorg_auft IN vkorg
           AND vbrk~kunag IN kunag.
    w_report_id = sy-repid.
    PERFORM i_layout CHANGING w_layout.
    PERFORM i_fieldcat CHANGING w_fieldcat.
    SORT itab1 BY waerk fkart .
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
      EXPORTING
        i_callback_program = 'ZTRAINING2'
        i_grid_title       = w_title
        is_layout          = w_layout
        it_fieldcat        = w_fieldcat
        i_save             = 'A'
      TABLES
        t_outtab           = itab1
      EXCEPTIONS
        program_error      = 1
        OTHERS             = 2.
    IF sy-subrc <> 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    *&      Form  i_fieldcat
          text
         -->P_W_FEILDCAT  text
    FORM i_fieldcat  CHANGING p_w_feildcat.
      DATA: l_line_fieldcat TYPE slis_fieldcat_alv.
      CLEAR l_line_fieldcat.
      l_line_fieldcat-fieldname = 'FKDAT'.
      l_line_fieldcat-ref_tabname = 'ITAB1'.
      l_line_fieldcat-edit_mask  = '__-__-____'.
      l_line_fieldcat-seltext_m = 'Billing Document date '.
      APPEND l_line_fieldcat TO w_fieldcat.
      CLEAR l_line_fieldcat.
      l_line_fieldcat-fieldname = 'KUNRG'.
      l_line_fieldcat-ref_tabname = 'ITAB1'.
      l_line_fieldcat-seltext_m = 'Cust no'.
      APPEND l_line_fieldcat TO w_fieldcat.
      CLEAR l_line_fieldcat.
      l_line_fieldcat-fieldname = 'NAME1'.
      l_line_fieldcat-ref_tabname = 'ITAB1'.
      l_line_fieldcat-seltext_m = 'Name of the reseller'.
      APPEND l_line_fieldcat TO w_fieldcat.
      CLEAR l_line_fieldcat.
      l_line_fieldcat-fieldname = 'VBELN'.
      l_line_fieldcat-ref_tabname = 'ITAB1'.
      l_line_fieldcat-seltext_m = 'Billing document number'.
      APPEND l_line_fieldcat TO w_fieldcat.
      CLEAR l_line_fieldcat.
      l_line_fieldcat-fieldname = 'AUGRU_AUFT'.
      l_line_fieldcat-ref_tabname = 'ITAB1'.
      l_line_fieldcat-seltext_m = 'Order reason'.
      APPEND l_line_fieldcat TO w_fieldcat.
      CLEAR l_line_fieldcat.
      l_line_fieldcat-fieldname = 'NETWR'.
      l_line_fieldcat-ref_tabname = 'ITAB1'.
      l_line_fieldcat-seltext_m = 'Amount'.
      APPEND l_line_fieldcat TO w_fieldcat.
      CLEAR l_line_fieldcat.
      l_line_fieldcat-fieldname = 'WAERK'.
      l_line_fieldcat-ref_tabname = 'ITAB1'.
      l_line_fieldcat-seltext_m = 'Currency'.
      APPEND l_line_fieldcat TO w_fieldcat.
    ENDFORM.                    "i_fieldcat
    *&      Form  i_layout
          text
         -->P_W_LAYOUT text
    FORM i_layout  CHANGING p_w_layout.
      CLEAR w_layout.
      w_layout-colwidth_optimize = 'X'.
      w_layout-edit = 'X'.
    ENDFORM.                    " i_layout
    Thanks,
    Revathi Raju.

    Check out the following link for top_of_page event in OOPs ALV.
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d9719a415907
    You can also check out the following program.
    DATA: save_ok LIKE sy-ucomm,
    g_container TYPE scrfname VALUE 'CC1',
    g_grid TYPE REF TO cl_gui_alv_grid,
    g_custom_container TYPE REF TO cl_gui_custom_container,
    gt_fieldcat TYPE lvc_t_fcat,
    g_max TYPE i VALUE 100.
    * declarations for top of page event
    Data: gv_c_split type ref to cl_gui_splitter_container,
    gv_c_ptv type ref to cl_gui_container,
    gv_alv_ptv type ref to cl_gui_alv_grid,
    o_dd_doc TYPE REF TO cl_dd_document,
    text TYPE sdydo_text_element,
    o_split type ref to cl_gui_easy_splitter_container,
    o_top type ref to cl_gui_container,
    o_bot type ref to cl_gui_container,
    gv_c_vp type ref to cl_gui_container.
    * end of declaration for top of page.
    CLASS lcl_event_receiver DEFINITION DEFERRED.
    *class lcl_application_dc definition deferred.
    DATA: o_event_receiver TYPE REF TO lcl_event_receiver.
    * g_dc type ref to lcl_application_dc.
    DATA: gt_outtab TYPE TABLE OF sbook.
    * CLASS lcl_event_receiver DEFINITION
    CLASS lcl_event_receiver DEFINITION.
    PUBLIC SECTION.
    METHODS: handle_f4 FOR EVENT onf4 OF cl_gui_alv_grid
    IMPORTING e_fieldname
    es_row_no
    er_event_data
    et_bad_cells
    e_display,
    handle_top_of_page FOR EVENT top_of_page OF cl_gui_alv_grid
    IMPORTING e_dyndoc_id.
    METHODS: reset.
    METHODS: show_f4.
    PRIVATE SECTION.
    * attributes for creating an own F4-Help
    * (using a second ALV Grid Control
    DATA: f4_grid TYPE REF TO cl_gui_alv_grid,
    f4_custom_container TYPE REF TO cl_gui_custom_container.
    TYPES: BEGIN OF ty_f4.
    TYPES: value TYPE s_class.
    TYPES: descr(20) TYPE c.
    TYPES: END OF ty_f4.
    DATA: f4_itab TYPE TABLE OF ty_f4.
    DATA: f4_fieldcatalog TYPE lvc_t_fcat.
    * attributes to store event parameters
    * (after the CALL SCREEN command, the event parameters
    * are not accessible)
    TYPES: BEGIN OF onf4_event_parameters_type.
    TYPES: c_fieldname TYPE lvc_fname.
    TYPES: cs_row_no TYPE lvc_s_roid.
    TYPES: cr_event_data TYPE REF TO cl_alv_event_data.
    TYPES: ct_bad_cells TYPE lvc_t_modi.
    TYPES: c_display TYPE char01.
    TYPES: END OF onf4_event_parameters_type.
    DATA: f4_params TYPE onf4_event_parameters_type.
    * Methods to create own F4-Help
    * (This is done using a second ALV Grid Control)
    METHODS: init_f4.
    METHODS: build_fieldcatalog.
    METHODS: fill_f4_itab .
    METHODS: on_double_click FOR EVENT double_click OF cl_gui_alv_grid
    IMPORTING es_row_no.
    ENDCLASS. "lcl_application_f4 DEFINITION
    * CLASS lcl_event_receiver IMPLEMENTATION
    CLASS lcl_event_receiver IMPLEMENTATION.
    *§2. Implement an event handler method for event ONF4.
    METHOD handle_f4.
    * Save event parameter as global attributes of this class
    * (maybe solved differently if you use a function module!)
    f4_params-c_fieldname = e_fieldname.
    f4_params-cs_row_no = es_row_no.
    f4_params-cr_event_data = er_event_data.
    f4_params-ct_bad_cells = et_bad_cells.
    f4_params-c_display = e_display.
    *§3. Call your own f4 help. To customize your popup check
    * first if the cell is ready for input (event parameter E_DISPLAY).
    * (parameter E_DISPLAY is checked later in method on_double_click)
    * (Probably, you would call a function module at this point,
    * pass the needed event parameter and call the popup screen
    * within that function module. This is not done in this example
    * to avoid scattering its code).
    CALL SCREEN 101 STARTING AT 10 10.
    *§7. Inform the ALV Grid Control that an own f4 help has been processed
    * to suppress the standard f4 help.
    er_event_data->m_event_handled = 'X'.
    ENDMETHOD. "on_f4
    METHOD show_f4.
    * DATA: ls_outtab TYPE sbook.
    * initialize own f4 help if needed
    IF f4_custom_container IS INITIAL.
    CALL METHOD init_f4.
    ENDIF.
    CALL METHOD fill_f4_itab.
    * refresh list of values in f4 help and show it
    CALL METHOD f4_grid->refresh_table_display.
    * CAUTION: Do not use method REFRESH_TABLE_DISPLAY for
    * your editable ALV Grid instances while handling events
    * DATA_CHANGED or ONf4. You would overwrite intermediate
    * values of your output table on frontend.
    * 'f4_grid' is a non-editable ALV Grid Control for the
    * application specific F4-Help. Therefore, calling
    * REFRESH_TABLE_DISPLAY for this instance has no
    * negative effect.
    CALL METHOD cl_gui_cfw=>flush.
    ENDMETHOD. "show_f4
    METHOD init_f4.
    DATA: ls_f4_layout TYPE lvc_s_layo.
    * build fieldcatalog entries for f4
    CALL METHOD build_fieldcatalog.
    * create controls
    CREATE OBJECT f4_custom_container
    EXPORTING container_name = 'CC_ONF4'.
    CREATE OBJECT f4_grid
    EXPORTING i_parent = f4_custom_container.
    * hide toolbar
    ls_f4_layout-no_toolbar = 'X'.
    CALL METHOD f4_grid->set_table_for_first_display
    EXPORTING
    is_layout = ls_f4_layout
    CHANGING
    it_fieldcatalog = f4_fieldcatalog
    it_outtab = f4_itab.
    * register event double click on backend
    SET HANDLER me->on_double_click FOR f4_grid.
    * flush since 'ls_layout' is local!
    CALL METHOD cl_gui_cfw=>flush.
    ENDMETHOD. "init_f4
    METHOD fill_f4_itab.
    DATA ls_f4_itab TYPE ty_f4.
    * Delete all entries in f4_itab to determine
    * offered values dynamically
    CLEAR f4_itab[].
    ls_f4_itab-value = 'C'.
    ls_f4_itab-descr = text-t03. "Business Class
    APPEND ls_f4_itab TO f4_itab.
    ls_f4_itab-value = 'Y'.
    ls_f4_itab-descr = text-t04. "Economie Class
    APPEND ls_f4_itab TO f4_itab.
    ls_f4_itab-value = 'F'.
    ls_f4_itab-descr = text-t05. "First Class
    APPEND ls_f4_itab TO f4_itab.
    ENDMETHOD. "fill_f4_itab
    METHOD build_fieldcatalog.
    DATA: ls_fcat TYPE lvc_s_fcat.
    CLEAR ls_fcat.
    ls_fcat-fieldname = 'VALUE'.
    ls_fcat-coltext = text-t02.
    * ls_fcat-inttype = 'S_CLASS'.
    ls_fcat-outputlen = 5.
    APPEND ls_fcat TO f4_fieldcatalog.
    CLEAR ls_fcat.
    ls_fcat-fieldname = 'DESCR'.
    ls_fcat-coltext = text-t01.
    ls_fcat-inttype = 'C'.
    ls_fcat-outputlen = 20.
    APPEND ls_fcat TO f4_fieldcatalog.
    ENDMETHOD. "build_fieldcatalog
    METHOD on_double_click.
    *§5. If not already caught by your own f4 help, check whether
    * the triggered cell was ready for input by using E_DISPLAY
    * and if not, exit.
    IF f4_params-c_display EQ 'X'.
    LEAVE SCREEN.
    ENDIF.
    *§6. After the user selected a value, pass it to the ALV Grid Control:
    *§ 6a. Define a field symbol of type: LVC_T_MODI and a structure of
    * type LVC_S_MODI to pass the value later on.
    FIELD-SYMBOLS <itab> TYPE lvc_t_modi.
    DATA: ls_modi TYPE lvc_s_modi,
    ls_f4_itab TYPE ty_f4.
    *§ 6b. Dereference attribute M_DATA into your field symbol and add
    * the selected value to the table to which this symbol points to.
    ASSIGN f4_params-cr_event_data->m_data->* TO <itab>.
    ls_modi-row_id = f4_params-cs_row_no-row_id.
    ls_modi-fieldname = f4_params-c_fieldname.
    READ TABLE f4_itab INTO ls_f4_itab INDEX es_row_no-row_id.
    ls_modi-value = ls_f4_itab-value.
    APPEND ls_modi TO <itab>.
    LEAVE TO SCREEN 0.
    ENDMETHOD. "on_double_click
    METHOD reset.
    FIELD-SYMBOLS <itab> TYPE lvc_t_modi.
    ASSIGN f4_params-cr_event_data->m_data->* TO <itab>.
    CLEAR <itab>[].
    ENDMETHOD. "reset
    METHOD handle_top_of_page.
    text = 'Top of page for program ZAMIT_SPLIT_CONTAINER'.
    CALL METHOD e_dyndoc_id->add_text
    EXPORTING text = text
    sap_fontsize = 'LARGE'
    sap_style = 'HEADING'.
    CALL METHOD e_dyndoc_id->display_document
    EXPORTING parent = o_top.
    ENDMETHOD. "handle_top_of_page
    ENDCLASS. "lcl_application_f4 IMPLEMENTATION
    END-OF-SELECTION.
    CALL SCREEN 100.
    * MODULE PBO OUTPUT *
    MODULE pbo OUTPUT.
    SET PF-STATUS 'MAIN100'.
    SET TITLEBAR 'MAIN100'.
    IF g_custom_container IS INITIAL.
    PERFORM create_and_init_alv CHANGING gt_outtab[]
    gt_fieldcat.
    ENDIF.
    ENDMODULE. "pbo OUTPUT
    * MODULE PAI INPUT *
    MODULE pai INPUT.
    save_ok = sy-ucomm.
    CLEAR sy-ucomm.
    CASE save_ok.
    WHEN 'EXIT' OR 'BACK' OR 'CANCEL'.
    PERFORM exit_program.
    WHEN 'SWITCH'.
    PERFORM switch_edit_mode.
    WHEN OTHERS.
    * do nothing
    ENDCASE.
    ENDMODULE. "pai INPUT
    * FORM EXIT_PROGRAM *
    FORM exit_program.
    LEAVE PROGRAM.
    ENDFORM. "exit_program
    *& Form build_fieldcat
    * text
    * -->PT_FIELDCAT text
    FORM build_fieldcat CHANGING pt_fieldcat TYPE lvc_t_fcat.
    DATA ls_fcat TYPE lvc_s_fcat.
    CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
    EXPORTING
    i_structure_name = 'SBOOK'
    CHANGING
    ct_fieldcat = pt_fieldcat.
    LOOP AT pt_fieldcat INTO ls_fcat.
    * Exchange smoker field with invoice field - just to
    * make the dependance between SMOKER and CLASS more transparent
    * (Smoking is only allowed in the first class).
    IF ls_fcat-fieldname EQ 'SMOKER'.
    ls_fcat-col_pos = 11.
    ls_fcat-outputlen = 10.
    ls_fcat-edit = 'X'.
    * Field 'checktable' is set to avoid shortdumps that are caused
    * by inconsistend data in check tables. You may comment this out
    * when the test data of the flight model is consistent in your system.
    ls_fcat-checktable = '!'. "do not check foreign keys
    MODIFY pt_fieldcat FROM ls_fcat.
    ELSEIF ls_fcat-fieldname EQ 'INVOICE'.
    ls_fcat-col_pos = 7.
    MODIFY pt_fieldcat FROM ls_fcat.
    ELSEIF ls_fcat-fieldname EQ 'CLASS'.
    ls_fcat-edit = 'X'.
    ls_fcat-outputlen = 5.
    ls_fcat-checktable = '!'. "do not check foreign keys
    MODIFY pt_fieldcat FROM ls_fcat.
    ENDIF.
    ENDLOOP.
    ENDFORM. "build_fieldcat
    *& Form create_and_init_alv
    * text
    * -->PT_OUTTAB text
    * -->PT_FIELDCAT text
    FORM create_and_init_alv CHANGING pt_outtab TYPE STANDARD TABLE
    pt_fieldcat TYPE lvc_t_fcat.
    DATA: lt_exclude TYPE ui_functions,
    ls_layout TYPE lvc_s_layo.
    CREATE OBJECT g_custom_container
    EXPORTING container_name = g_container.
    * CREATE OBJECT g_grid
    * EXPORTING i_parent = g_custom_container.
    CREATE OBJECT gv_c_split
    EXPORTING
    * link_dynnr = lv_dynnr
    * link_repid = lv_repid
    parent = g_custom_container
    rows = 2
    columns = 1
    EXCEPTIONS
    cntl_error = 1
    cntl_system_error = 2
    others = 3 .
    CALL METHOD gv_c_split->set_border
    EXPORTING
    border = space.
    CALL METHOD gv_c_split->get_container
    EXPORTING
    row = 1
    column = 1
    RECEIVING
    container = gv_c_ptv.
    CALL METHOD gv_c_split->set_row_height
    EXPORTING
    id = 1
    height = 20
    EXCEPTIONS
    cntl_error = 1
    cntl_system_error = 2
    OTHERS = 6 .
    CALL METHOD gv_c_split->get_container
    EXPORTING
    row = 2
    column = 1
    RECEIVING
    container = gv_c_vp .
    CALL METHOD gv_c_split->set_row_height
    EXPORTING
    id = 2
    height = 10
    EXCEPTIONS
    cntl_error = 1
    cntl_system_error = 2
    OTHERS = 3 .
    CREATE OBJECT o_split
    EXPORTING
    parent = gv_c_ptv
    with_border = 1
    EXCEPTIONS
    cntl_error = 1
    cntl_system_error = 2
    others = 3.
    IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    o_top = o_split->top_left_container.
    o_bot = o_split->bottom_right_container.
    CREATE OBJECT gv_alv_ptv
    EXPORTING
    i_parent = o_bot
    EXCEPTIONS
    error_cntl_create = 1
    error_cntl_init = 2
    error_cntl_link = 3
    error_dp_create = 4
    others = 5 .
    CREATE OBJECT g_grid
    EXPORTING
    i_parent = gv_c_vp
    EXCEPTIONS
    error_cntl_create = 1
    error_cntl_init = 2
    error_cntl_link = 3
    error_dp_create = 4
    others = 5 .
    PERFORM build_fieldcat CHANGING pt_fieldcat.
    * Optionally restrict generic functions to 'change only'.
    * (The user shall not be able to add new lines).
    PERFORM exclude_tb_functions CHANGING lt_exclude.
    PERFORM build_data CHANGING pt_outtab.
    ls_layout-grid_title = 'F4 help implemented for field CLASS'.
    CREATE OBJECT o_event_receiver.
    SET HANDLER o_event_receiver->handle_top_of_page FOR gv_alv_ptv.
    SET HANDLER o_event_receiver->handle_top_of_page FOR g_grid.
    CREATE OBJECT o_dd_doc EXPORTING style = 'ALV_GRID'
    no_margins = 'X'.
    CALL METHOD gv_alv_ptv->set_table_for_first_display
    EXPORTING
    is_layout = ls_layout
    CHANGING
    it_outtab = pt_outtab[]
    it_fieldcatalog = pt_fieldcat
    EXCEPTIONS
    invalid_parameter_combination = 1
    program_error = 2
    too_many_lines = 3
    OTHERS = 4.
    CALL METHOD g_grid->set_table_for_first_display
    EXPORTING
    it_toolbar_excluding = lt_exclude
    is_layout = ls_layout
    CHANGING
    it_fieldcatalog = pt_fieldcat
    it_outtab = pt_outtab[].
    CALL METHOD gv_alv_ptv->list_processing_events
    EXPORTING
    i_event_name = 'TOP_OF_PAGE'
    i_dyndoc_id = o_dd_doc.
    * register f4 for field CLASS
    PERFORM register_events.
    * Set editable cells to ready for input initially
    CALL METHOD g_grid->set_ready_for_input
    EXPORTING
    i_ready_for_input = 1.
    ENDFORM. "CREATE_AND_INIT_ALV
    *& Form exclude_tb_functions
    * text
    * -->PT_EXCLUDE text
    FORM exclude_tb_functions CHANGING pt_exclude TYPE ui_functions.
    * Only allow to change data not to create new entries (exclude
    * generic functions).
    DATA ls_exclude TYPE ui_func.
    ls_exclude = cl_gui_alv_grid=>mc_fc_loc_copy_row.
    APPEND ls_exclude TO pt_exclude.
    ls_exclude = cl_gui_alv_grid=>mc_fc_loc_delete_row.
    APPEND ls_exclude TO pt_exclude.
    ls_exclude = cl_gui_alv_grid=>mc_fc_loc_append_row.
    APPEND ls_exclude TO pt_exclude.
    ls_exclude = cl_gui_alv_grid=>mc_fc_loc_insert_row.
    APPEND ls_exclude TO pt_exclude.
    ls_exclude = cl_gui_alv_grid=>mc_fc_loc_move_row.
    APPEND ls_exclude TO pt_exclude.
    ENDFORM. " EXCLUDE_TB_FUNCTIONS
    *& Form build_data
    * text
    * --> p1 text
    * <-- p2 text
    FORM build_data CHANGING pt_outtab TYPE STANDARD TABLE.
    DATA: ls_sbook TYPE sbook,
    l_index TYPE i.
    SELECT * FROM sbook INTO TABLE gt_outtab UP TO g_max ROWS.
    IF sy-subrc NE 0.
    PERFORM generate_entries CHANGING pt_outtab.
    ENDIF.
    LOOP AT pt_outtab INTO ls_sbook.
    l_index = sy-tabix.
    CLEAR ls_sbook-class.
    * Alternate between smoker and non smoker to make
    * it more obvious what this example is about
    l_index = l_index MOD 2.
    IF l_index EQ 1.
    ls_sbook-smoker = 'X'.
    ELSE.
    ls_sbook-smoker = ' '.
    ENDIF.
    MODIFY pt_outtab FROM ls_sbook.
    ENDLOOP.
    ENDFORM. " build_data
    *& Form generate_entries
    * text
    * -->PT_SBOOK text
    FORM generate_entries CHANGING pt_sbook TYPE STANDARD TABLE.
    DATA: ls_sbook TYPE sbook,
    l_month(2) TYPE c,
    l_day(2) TYPE c,
    l_date(8) TYPE c,
    l_prebookid TYPE i.
    ls_sbook-carrid = 'LH'.
    ls_sbook-connid = '0400'.
    ls_sbook-forcurkey = 'DEM'.
    ls_sbook-loccurkey = 'USD'.
    ls_sbook-custtype = 'B'.
    DO 110 TIMES.
    l_prebookid = sy-index.
    ls_sbook-forcuram = sy-index * 10.
    ls_sbook-loccuram = ls_sbook-loccuram * 2.
    ls_sbook-customid = sy-index.
    ls_sbook-counter = 18.
    ls_sbook-agencynum = 11.
    l_month = sy-index / 10 + 1.
    DO 2 TIMES.
    l_day = 3 + l_month + sy-index * 2.
    l_date+0(4) = '2000'.
    l_date+4(2) = l_month.
    l_date+6(2) = l_day.
    ls_sbook-fldate = l_date.
    SUBTRACT 3 FROM l_day.
    ls_sbook-order_date+0(6) = l_date+0(6).
    ls_sbook-order_date+6(2) = l_day.
    ls_sbook-bookid = l_prebookid * 2 + sy-index.
    IF sy-index EQ 1.
    ls_sbook-smoker = 'X'.
    ELSE.
    ls_sbook-smoker = space.
    ENDIF.
    ls_sbook-luggweight = l_prebookid * 10.
    IF ls_sbook-luggweight GE 1000.
    ls_sbook-wunit = 'G'.
    ls_sbook-class = 'C'.
    ELSE.
    ls_sbook-wunit = 'KG'.
    ls_sbook-class = 'Y'.
    ENDIF.
    IF ls_sbook-bookid > 40 AND ls_sbook-wunit EQ 'KG'.
    ls_sbook-invoice = 'X'.
    ENDIF.
    IF ls_sbook-bookid EQ 2.
    ls_sbook-cancelled = 'X'.
    ls_sbook-class = 'F'.
    ENDIF.
    APPEND ls_sbook TO pt_sbook.
    ENDDO.
    ENDDO.
    ENDFORM. " generate_entries
    *& Form register_events
    * text
    FORM register_events.
    *§1. Register event ONF4 at frontend using method
    * register_f4_for_fields. For this purpose, you pass a table
    * with all fields, for which you want to implement your own
    * f4 help.
    * remark: If you want to use an own f4 help for fields where
    * no standard f4 help exists set field F4AVAILABL for
    * this field in the fieldcatalog.
    DATA: lt_f4 TYPE lvc_t_f4 WITH HEADER LINE.
    CLEAR lt_f4.
    lt_f4-fieldname = 'CLASS'.
    * If you would like to deregister the field again,
    * pass value SPACE with field 'register'.
    lt_f4-register = 'X'.
    *§ 1b. If the value range in your f4 help depends on other
    * values of cells that are input enabled, set the
    * GETBEFORE parameter.
    * The consequence is that the ALV Grid Control raises
    * event DATA_CHANGED before the f4 help is called to
    * check values that the f4 help depends on.
    lt_f4-getbefore = 'X'.
    * The next parameter is used to change values after onf4 has
    * been processed. The ALV Grid Control will raise
    * event DATA_CHANGED afterwards, if you set it.
    lt_f4-chngeafter = space.
    INSERT TABLE lt_f4.
    CALL METHOD g_grid->register_f4_for_fields
    EXPORTING
    it_f4 = lt_f4[].
    * register events for abap objects (backend)
    SET HANDLER o_event_receiver->handle_f4 FOR g_grid.
    ENDFORM. " register_events
    * MODULE status_0101 OUTPUT
    MODULE status_0101 OUTPUT.
    SET PF-STATUS 'POPUP'.
    SET TITLEBAR 'POPUP'.
    CALL METHOD o_event_receiver->show_f4.
    ENDMODULE. " STATUS_0101 OUTPUT
    *& Module USER_COMMAND_0101 INPUT
    * text
    MODULE user_command_0101 INPUT.
    PERFORM user_command.
    ENDMODULE. " USER_COMMAND_0101 INPUT
    *& Form user_command
    * text
    FORM user_command.
    DATA: save_ok TYPE sy-ucomm.
    save_ok = sy-ucomm.
    CLEAR sy-ucomm.
    CASE save_ok.
    WHEN 'CANCEL'.
    CALL METHOD o_event_receiver->reset.
    LEAVE TO SCREEN 0.
    ENDCASE.
    ENDFORM. "user_command
    *& Form switch_edit_mode
    * text
    FORM switch_edit_mode.
    IF g_grid->is_ready_for_input( ) EQ 0.
    * set edit enabled cells ready for input
    CALL METHOD g_grid->set_ready_for_input
    EXPORTING
    i_ready_for_input = 1.
    ELSE.
    * lock edit enabled cells against input
    CALL METHOD g_grid->set_ready_for_input
    EXPORTING
    i_ready_for_input = 0.
    ENDIF.
    ENDFORM. "switch_edit_mode
    For popup try this
    reward if helpfull
    Regards
    Pavan

  • Issue with usage of Clob variable to hold the output data...

    Hi All,
    we are getting the output of the sql query out from a function and this function return type is defined as CLOB.
    because of the volume of data being fetched we are getting the below mentioned error message when this Function is getting executed.
    “ORA-06502: PL/SQL: numeric or value error”. : character string buffer too small
    Now even with CLOB if we are getting the buffer too small error message ...is there any other way or approach we could handle this..
    our requirement is to fetch the complete value from this function in one shot and we don't want to split the data based on the size / number of characters...
    This is causing us lot of issues...could someone please suggest as to what could be done regards this ...

    Post your script. How can we tell when we can't see your code.
    Also, better to post the table ddl's script and some demo insert statement here. And, please provide the DB version, too.
    Generally, you should not get such error. So, please post these details.
    Regards.
    Satyaki De.

  • Error when executing the query or refreshing the workbook

    Hi All,
    Whenever I am trying to execute a query or refresh a workbook a error message is poping up saying that
    Error: <internal error> Problem when writing table: E_T_cel.
    I face this error in few of the queries and when i refresh workbooks. These queries have lot of calculations and filters and they sum up lot of records.
    Any help greatly appreciated.
    Thanks
    Raj.

    Hi Maik,
    Thanks for reply, I went into tran sm21 but i could not understand the messages there. Below is the list of messages in sm21
                         System Log: Local Analysis of cdsap9d                    1                                                    
    From date/time............. 04/20/2005 / 10:00:00
    To date/time............... 04/21/2005 /        
    User....................... KADALPR    
    Transaction code...........                    
    Terminal...................        
    Task.......................  
    Problem class..............           
    Further restrictions.......                                                                               
    Sorted ? ................ SOFI
    Pages with single entries 00000100
    With statistics............ 
                         System Log: Local Analysis of cdsap9d                    2                                                    
    Time     Ty. Nr Cl. Tcod MNo Text                                                                                Date : 20.04.05 
    12:58:10 DIA  0 100      R49 Communication error, CPIC return code 019, SAP return code 728                                                 
    12:58:10 DIA  0 100      R5A > Conversation ID: 29858195                                                                               
    12:58:10 DIA  0 100      R64 > CPI-C function: CMSEND(SAP)                                                                               
    12:58:10 DIA  0 100      R68 Perform rollback                                                                               
    12:58:10 DIA  0 100      R47 Delete session 001 after error 003                                                                             
    23:54:49 DIA  1 100      R49 Communication error, CPIC return code 019, SAP return code 728                                                 
    23:54:49 DIA  1 100      R5A > Conversation ID: 44959947                                                                               
    23:54:49 DIA  1 100      R64 > CPI-C function: CMSEND(SAP)                                                                               
    System Log: Local Analysis of cdsap9d                    3                                                    
    Time     Ty. Nr Cl. Tcod MNo Text                                                                                Date : 21.04.05 
    09:32:50 DIA  2 100      R49 Communication error, CPIC return code 019, SAP return code 728                                                 
    09:32:50 DIA  2 100      R5A > Conversation ID: 83536783                                                                               
    09:32:50 DIA  2 100      R64 > CPI-C function: CMSEND(SAP)                                                                               
    Reading:  
    Number of records read.........       2777
    Number of records selected.....         11
    Old records skipped............       2733
    Records of invalid users skippe         33
    Further selection:  
    Number of records read.........         11
    Number of records selected.....         11
    Number of records printed......         11
    End of system log
                         System Log: Local Analysis of cdsap9d                    4                                                    
                        C o n t e n t s                              
    Contents              Page              Start            End  
    Selection criteria     1
                           2        20.04.2005  12:58:10 - 23:54:49
                           3        21.04.2005  09:32:50 - 09:32:50
    Contents               4
    End of program  -
    If you can help me out as where to look at these messages then it great.
    Thanks,
    Raj.

  • Is it possible to return a database query without refreshing the page?

    I have a form which has a drop-down select box. What I want to do is send the value from the select list to a CFC which runs some SQL code and returns a recordset. I then want to use this recordset on my original CFM page that has the form on it.
    Is it possible to do this without refreshing the page through some kind of AJAX? Apologies I am a newbie at AJAX but I did manage to write a bit of code that uses <cfdiv> to bind to a URL that does the database work and returns some HTML. But really I just want the database recordset and not sure how to get it?

    You could use AJAX, Flex Remoting or any such remoting technique. That is, if there is a case for it. However, from what you describe in the first paragraph, you don't need to. Just send the form to its own page.
    In the following example, the CFC and CFM page are both in the same directory under the root. I have made use of the cfdocexamples datasource which ships with ColdFusion.
    Employee.cfc
    <cfcomponent>
    <cffunction name="getEmployeeDetails"  output="false" returntype="query">
    <cfargument name="employee_id">
    <cfset var employeeDetails = queryNew("","")>
    <cfset var emp_id = arguments.employee_id>
    <cfif isNumeric(emp_id)>
        <cfquery name = "employeeDetails" dataSource = "cfdocexamples">
            SELECT firstname, email as email_name, department, phone, location
            FROM Employees
            WHERE emp_id = <cfqueryparam cfsqltype="cf_sql_integer" value="#emp_id#">
        </cfquery>
    </cfif>
    <!--- Will activate error-handler in the caller --->
    <cfif NOT isNumeric(emp_id) or employeeDetails.recordcount EQ 0>
        <cfthrow message="You selected no employee.">
    </cfif>
    <cfreturn employeeDetails>
    </cffunction>
    </cfcomponent>
    testPage.cfm
    <cfif isDefined("form.employee_id")>
        <cfset employeeObj = createobject("component","Employee")>
        <!--- employeeDetails is a query--->
        <cfset employeeDetails = employeeObj.getEmployeeDetails(form.employee_id)>
        <cfdump var="#employeeDetails#">
    </cfif>
    <cfform action="#CGI.SCRIPT_NAME#">
    <cfselect name="employee_id">
    <option value="0">Employee</option>
    <option value="1">Carolynn Petersen</option>
    <option value="2">Dave Heartside</option>
    <option value="3">Linda Stewart</option>
    </cfselect>
    <cfinput name="sbmt" type="submit" value="Send">
    </cfform>

Maybe you are looking for