Two query single output

Hi,
I am using 10.2.0.1 on windows xp and need your help please:
create table test (datecol date,col1 number(1),col2 number(1));
insert into test values (to_date('2010-07-25','yyyy-mm-dd'),2,3);
insert into test values (to_date('2010-07-25','yyyy-mm-dd'),3,4);
insert into test values (to_date('2010-07-25','yyyy-mm-dd'),7,1);
insert into test values (to_date('2010-07-25','yyyy-mm-dd'),3,7);
insert into test values (to_date('2010-07-25','yyyy-mm-dd'),7,7);
insert into test values (to_date('2010-07-25','yyyy-mm-dd'),3,3);
insert into test values (to_date('2010-07-25','yyyy-mm-dd'),4,4);
insert into test values (to_date('2010-07-25','yyyy-mm-dd'),6,4);
insert into test values (to_date('2010-07-25','yyyy-mm-dd'),0,4);
insert into test values (to_date('2010-07-25','yyyy-mm-dd'),0,0);
insert into test values (to_date('2010-07-25','yyyy-mm-dd'),4,0);
insert into test values (to_date('2010-07-25','yyyy-mm-dd'),5,0);
insert into test values (to_date('2010-07-25','yyyy-mm-dd'),0,8);
insert into test values (to_date('2010-07-25','yyyy-mm-dd'),9,8);
insert into test values (to_date('2010-07-25','yyyy-mm-dd'),6,8);
insert into test values (to_date('2010-07-25','yyyy-mm-dd'),6,0);
insert into test values (to_date('2010-07-25','yyyy-mm-dd'),9,9);
Required output:
      COL1       GTOT         COL2       GTOT
         0          3          0          4
         2          1          1          1
         3          3          3          2
         4          2          4          4
         5          1          7          2
         6          3          8          3
         7          2          9          1
         9          2Means output of :
select col1,count(*) gtot from test group by col1 order by 1;
and
select col2,count(*) gtot from test group by col2 order by 1;
should be looks like above. And if i want to add another column like datecol of test table
then how do i get another column(s).
Thanks.

Hi,
Interesting problem!
What does each row of output represent?
The 1st row represents the lowest value of each of the columns being summarized.
The 2nd row represents the 2nd lowest value of each of the columns.
The 3rd row represents the 3rd lowest value of each of the columns.
The nth row represents the nth lowest value of each of the columns.
Start by assigning numbers 1, 2, 3, ..., n (let's call this number r) to each of the rows, indicating if this is the lowest, 2nd lowest, 3rd lowest, ..., nth lowest value. DENSE_RANK is perfecct for that.
You could unpivot the data onto a separate row for each of the columns being summarized, and then pivot them back into r rows. The approach below is a variant on that, in effect unpivoting only the r value. This way, the values being summarized do not all have to be of the same data type; you can easily have some NUMBER columns and a DATE column, for example.
WITH     got_rs     AS
     SELECT     col1, col2
     ,     DENSE_RANK () OVER (ORDER BY col1)     AS col1_r
     ,     DENSE_RANK () OVER (ORDER BY col2)     AS col2_r
     FROM     test
,     all_rs     AS
     SELECT     col1_r     AS r
     FROM     got_rs
    UNION
     SELECT     col2_r     AS r
     FROM     got_rs
SELECT       MIN   (CASE WHEN g.col1_r = a.r THEN col1 END)     AS col1
, NULLIF (COUNT (CASE WHEN g.col1_r = a.r THEN 1    END), 0)     AS col1_tot
,       MIN   (CASE WHEN g.col2_r = a.r THEN col2 END)     AS col2
, NULLIF (COUNT (CASE WHEN g.col2_r = a.r THEN 1    END), 0)     AS col2_tot
FROM            all_rs     a
LEFT OUTER JOIN     got_rs     g  ON  a.r IN (col1_r, col2_r)
GROUP BY  a.r
ORDER BY  a.r
;

Similar Messages

  • Can we Concatinate two XML files to a single output?

    I was stuck up with one scenario where I am getting a XML file output from a File Adapter say x1.
    And another XML file output say x2 from other adapter. Now I want to club this two XML files into a single output where it should contain the contents of x1 and x2
    When I am doing the Transformation I am getting the two files in the output folder but I want single file as output. Is it possible with ESB? If so Please suggest.
    --Chandra                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    Hi Chandra,
    Maybe the enrichment interaction scenario would work in your case.
    My colleague Lucas Jellema wrote a blog post on it: http://technology.amis.nl/blog/?p=1464.
    Or putting the same in a larger perspective: http://www.oracle.com/technology/pub/articles/jellema-esb.html.
    Hth,
    Sjoerd

  • Saving a report with two  query providers into .csv format

    Hi,
    I have developed a webi report which has two query providers. I have linked the objects from these two queries at the report level using merged dimensions. the report is running fine. When I save it in EXCEL or PDF it saves the same report, but when I try to save the report in .CSV format, the output of the second query provided is getting appened at the bottom of the report.
    Has anyone encountered similar problem is so whats the solution for it.
    For me business wants the report to be saved as .csv only as it acts as a source file to other application.

    Hi
    please take a look at the explanation area in the following note
    https://css.wdf.sap.corp/sap/support/notes/1417382
    When saving Web Intelligence document as Excel format, the result is saved based on the report design.
    When saving Web Intelligence document as CSV format, all data in the Data Provider are saved.
    I believe that the behaviour you described is by design so there is not much to do about it. You can open a case by SAP support though asking if this changed in a later service pack (actual service pack version for XI R2 is SP 6).
    Regards,
    Stratos

  • Single Output to Multiple Fax Numbers

    Hello
            I have a scenario where a single output should be directed to 2 Fax #'s. I tried the standard way in SAP via Fax address management and it had option of entering 2 #;s.
    However, only 1 is being sent. Do we have some other ways of doing it? Yes, i don't want to
    1) Send manually by selecting and re-send
    2) Create/Duplicate the Output and assign the second fax #.
    Any other ways are highly appreciated.
    Thanks
    Ashwini

    Hi,
    As per standard you can not send output to two different fax numbers at once in creation mode. If you want u can enter manually in change mode which you are not interested.
    The only way is with the help of user exit just try to put some code in output program as per your requirement...
    Thanks

  • Query in output of sh interface

    Hi all,
    I have a query in output of sh interface on ASA.
    On ASA's when we do 'show interface' for a gig interface, we can get any among two,
    input queue (blocks free curr/low): hardware (255/230)
    output queue (blocks free curr/low): hardware (255/0)
    OR
    input queue (curr/max packets): hardware (0/7)
    output queue (curr/max packets): hardware (0/13)
    cur/low I suppose when we have underruns and overruns going on.
    What i want to know is the meaning of the output. In case of curr/max its very clear.
    input queue (curr/max packets): hardware (0/7)
    output queue (curr/max packets): hardware (0/13)
    Above means (correct me if I am incorrect), there are Zero packets currently in input queue, and 7 were the max packets seen at one time. For output queue, zero are the current packets in ouput queue and 13 were max that were seen in output queue. This is documented.
    But I could not find an explaination for,
    input queue (blocks free curr/low): hardware (255/230)
    output queue (blocks free curr/low): hardware (255/0)
    How should I interpret it? I need supporting documentaion please.
    I have gone through this link :
    http://www.cisco.com/en/US/docs/security/asa/asa84/command/reference/s3.html#wp1497263
    But i couldn't find an explanation for blocks free current/low
    Please explain me the following output:
    2506116 packets input, 2624544574 bytes, 0 no buffer
           Received 0  broadcasts, 0 runts, 0 giants
           8036 input errors, 0 CRC, 0 frame, 8036  overrun, 0 ignored, 0 abort
           0 L2 decode drops
           5065834  packets output, 6024814558 bytes, 0 underruns
           0 pause output, 0 resume  output
           0 output errors, 0 collisions, 0 interface resets
           0  late collisions, 0 deferred
           0 input reset drops, 0 output reset drops,  0 tx hangs
           input queue (blocks free curr/low): hardware  (255/230)
           output queue (blocks free curr/low): hardware (254/0)

    i am mainly concerned about
      input queue (blocks free curr/low): hardware  (255/230)
           output queue (blocks free curr/low): hardware (254/0)

  • Attaching multiple smartform to single output type

    Hello Experts,
    I have 2 different smartforms for invoice....
    these two i have to call depending upon the type of customer.
    I want to know that is it possible to attach both smartform to single output type ( in this case RD00).
    if not..., Please suggest me how i can achieve this.
    Thanks,
    Amar

    If your question is if is it possible to have 2 different SMFs in one single output the answer is yes.
    You have to use the control_parameters-no_open and control_parameters-no_close
      CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
        EXPORTING
          formname           = 'ZSMF1''
        IMPORTING
          fm_name            = g_funcion
        EXCEPTIONS
          no_form            = 1
          no_function_module = 2
          OTHERS             = 3.
      IF sy-subrc EQ 0.
        g_control_param-no_close = 'X'.
        CALL FUNCTION g_funcion
          EXPORTING
            control_parameters         = g_control_param
          TABLES
            g_t_lugares                = g_t_lugares2
          EXCEPTIONS
            formatting_error           = 1
            internal_error             = 2
            send_error                 = 3
            user_canceled              = 4
            OTHERS                     = 5 .
    *   Smartform Puestos
        CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
          EXPORTING
            formname           = 'ZSMF2''
          IMPORTING
            fm_name            = g_funcion
          EXCEPTIONS
            no_form            = 1
            no_function_module = 2
            OTHERS             = 3.
        IF sy-subrc = 0.
          g_control_param-no_close = ''.
          g_control_param-no_open  = 'X'.
            CALL FUNCTION g_funcion
              EXPORTING
                control_parameters = g_control_param
                i_num_pages        = l_tot_pages
                i_curr_pages       = l_pages_2
              TABLES
                g_t_puestos        = g_t_puestos_ssf
              EXCEPTIONS
                formatting_error   = 1
                internal_error     = 2
                send_error         = 3
                user_canceled      = 4
                OTHERS             = 5.
          ENDIF.
      ENDIF.

  • JDBC Query Single Row service Parse Query

    Using JDBC Query Single Row service on an Oracle database,
    I specify a SQL statement like this:
    select abc, to_char(aDate, 'MM/DD/YYYY') from xyz where def = 123
    then I click the "Parse Query" button to try to map the query results to my variables, but the mapping window gives me 3 fields instead of 2:
    1. abc
    2. to_char(aDate)
    3. 'MM/DD/YYYY'
    how do I let it understand that there are only 2 fields in the results so that I can map it properly?
    thanks

    Got a new minor issue unrelated to the above, but I don't want to flood this forum with another new topic, so I'll stick this new thing here.
    I have a very simple process that only contains this JDBC Query Single Row service.
    In this query single row service, at the bottom of the property sheet, there's a section where it says "number of rows retrieved"...
    now, if I map this 'number of rows' to a variable (I set the variable's type as "int"), when I call my process (as a web service), it returns me nothing... all the output parameters are empty.
    If I remove the mapping of "number of rows", that is, there's nothing in that bottom section. Then my process works correctly, all the output variables contain correct data from my database.
    Has anybody encountered this? what's your solution please?

  • Outputting multiple variable types from single output vi

    Hello,
    I am trying to make a vi that takes some inputs (they are not too relevant to my problem) and has a single output.
    My problem is that I'd like the output variable type to be left unknown until runtime.
    For example, the vi will decide appropriately when to output an integer, string or double variable type.
    Furthermore, inside the vi, I need a way to select the appropriate variable type to send, hence I need a way to check the type of a variable (I don't really know how to do that either).
    Can someone give me some advice?
    Thanks
    David

    Data types are determined at compile time.  You cannot have a run-time decision for a data type.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Combine two query

    Hi friends,
    I am using oracle 10g and forms 6i with windows 2008 server
    I have a two query with different where clause.
    I need output like below format
           HEADER         IMPORT     EXPORT
           TEST               100            400
    Select 'TEST' HEADER ,Sum(Decode(t.type, 1, amount, 3, amount)) import,
           from sales_dtls t
           where to_char(t.sales_date,'YYYYMM')=201309
           and item_code=1
    Select 'TEST' HEADER ,Sum(Decode(t.type, 2, amount, 4, amount)) export,
           from sales_dtls t
           where to_char(t.sales_date,'YYYYMM')=201309
           and item_code=2
    Rgds
    Rdk

    Hi,
    Here's one way:
    SELECT   'TEST'  AS header
    ,        SUM ( CASE
                       WHEN  type IN (1, 3)
                       AND   item_code  = 1
                       THEN  amount
                   END
                 )  AS import
    ,        SUM ( CASE
                       WHEN  type IN (2, 4)
                       AND   item_code  = 2
                       THEN  amount
                   END
                 )  AS export
    FROM      sales_dtls
    WHERE     item_code     IN (1, 2)
    AND       type          IN (1, 2, 3, 4)
    AND       sales_date    >= TO_DATE ('2013-09', 'YYYY-MM')
    AND       sales_date    <  TO_DATE ('2013-10', 'YYYY-MM')
    The strategy here is to make the WHERE clause just broad enough to include anything that might contribute to either SUM, and use the CASE expressions to do the filtering that only applies to one SUM or the other.
    I hope this answers your question.
    If not, post  a little sample data (CREATE TABLE and INSERT statements, relevant columns only), and also post the results you want from that data.
    Point out where the query above is giving the wrong results, and explain, using specific examples, how you get the correct results from the given data in those places.  If you changed the query at all, post your code.See the forum FAQ: https://forums.oracle.com/message/9362002

  • Synchronization of two analogue DAQmx outputs, error -89131

    I am trying to synchronize two analogue waveform outputs.  I can run and observe both channels  in isolation but cannot work out how to run both at the same time.  I'm a novice Labview user.
    My system contains the following:
    Labview 2012
    Windows 7
    PCI-6035 DAQ card
    I've attempted to write code configured as MASTER/SLAVE, an error occurs when the code attempts to write the waveform to the SLAVE output (DAQmx Write), error code -89131
    Any help would be much appreciated
    Thanks
    Duncan

    Hi Duncan,
    For most DAQ devices, only one hardware timed task per subsystem (i.e. analog input, analog output, digital input/ouput, ...) can run at once.  Each subsystem has its own dedicated timing and triggering circuitry, and your code has two separate AO tasks trying to configure the AO subsystem's resources simultaneously.  After the resources are configured the first time, the second task notices that they're already being used, and it tosses you an error indicating as much.
    In order to configure multiple AO channels on a single device, you need to include both (or all) of them in a single task.  For your application, since it looks like your channels will be updating at the same rate, this will be fairly straightforward.
    Open the Voltage - Continuous Output example that you used as a starting point for your code.
    Configure the Physical Channel(s) input -- either in the existing front panel control or as a block diagram constant -- to include both channels.  You can use the dropdown, select Browse, and Ctrl-click multiple channels or you can simply type Dev1/ao0:1 into the field.
    Now that the task contains two channels, it expects you to define two waveforms to write to the output.  In the example, all you have to do is initialize a second element in the Waveform Settings array.  Just increase the array index value to 1 to view the second entry (should be grayed out, at first) and select the Waveform Type, Frequency, or Amplitude for the waveform you want to send out on AO1.
    That should get you going.  Let us know if you run into any other hurdles as you develop your DAQ application!
    KB
    - Additional reference: Simultaneous AO Tasks on the Same Device

  • Spool file problem,Can't see the query in output file.

    Hello ,
    I am facing a very old school kind of problem .....about spool file ....
    The scenario -
    I have made a script by name DB_Status_checkup.sql which i want to fire on the database to check the database status. In this script their are many queries regarding the data dictionary views to know about the database. It consist of nearly 25-30 different select queries..
    The problem is i want to make a spool file of the output of that query....i want to see the SQL query & the output below in the spool file, so it will be easy for me to judge the result. But i can't see the SQL query , i can only see the output , & in so many queries it all gets jumbled up....even i can't understand where the next output starts ...
    Sample of my SQL Script ....
    clear buffer
    spool D:\DB_status.txt
    /*To check the database startup time*/
    Select to_char(startup_time, 'HH24:MI DD-MON-YY') "Startup time"
    from v$instance
    .........next query n so on....
    spool off;
    In the output pf the spool file at D:\db_status.txt..
    Startup time
    08:25 16-JUL-10It shows only the output of the query in the spool file not the query,
    What should i do to get the SQL query as well as the output of that query just below it in the spool file ???
    Please suggest if you have anymore ideas , regarding this .....
    ORACLE 10g R2
    Windows Server 2008
    Thanks in advance ...

    Why don't you just use database control, instead of re-inventing the wheel?
    Apart from that, SQL*Plus has it's own reference manual, which you apparently refuse to read.
    The answer to your quiz/doc question is
    set echo on
    Sybrand Bakker
    Senior Oracle DBA

  • Since changing over to Mountain Lion I discover that I am no longer able to adjust spaces between lines. If I choose spacing of 1.3 after two lines single-spaced, the entire previous lines end up with 1.3 spacing. What am I missing?

    Since changing over to Mountain Lion I discover that I am no longer able to adjust spaces between lines. If I choose spacing of 1.3 after two lines single-spaced, the entire previous lines end up with 1.3 spacing. What am I missing?

    Do those previous lines have a Return/Linefeed after them, or are they just wrapped to a new line?
    What App is it you're using?

  • Use of  "findByMultipleParameters" for   "OR " between two Query Filters

    Hi,
    I am also working in CE7.1 .I have  a query regarding the use of  "findByMultipleParameters" .
    That is how to use "OR " between two Query Filter condition,because if we add multiple queries into Query Filter List it will by default taking "AND " .
    For an example, I have to pull data from a table/BO with a condition col A = 10 OR ( col B > 100 AND col c = "XYZ") .
    My code snippet looks like given below.......
    List queryFilters = new ArrayList();
    QueryFilter queryFilterOne = QueryFilterFactory.createFilter("ROLLUMBER",Condition.EQ, rollNumber);
    QueryFilter queryFilterTwo = QueryFilterFactory.createFilter("NAME",Condition.EQ, "123");
    queryFilters.add(queryFilterOne);
    queryFilters.add(queryFilterTwo);
    List students = studentServiceLocal.findByMultipleParameters(queryFilters, false, "xyz");
    I have tried all these and found all of them deprecated,Please suggest something appropriate.Your quick response will help a lot.
    //queryFilterOne.setAction(QueryFilter.OPERATION_OR);
    //QueryFilterFactory.createBoolOperator(queryFilterOne.OPERATION_OR);
    //queryFilters.add(QueryFilter.OR);
    //queryFilters.add(queryFilterOne.setOperation(QueryFilter.OPERATION_OR));
    My another Query is what is the role of implCheck(Boolean),findByName(String) in "findByMultipleParameters()" ?
    Thanking you for your help in advance.
    Regards,
    Sonali
    Edited by: Sonali Das on Sep 14, 2010 2:32 PM

    Hi Praveen/Harris,
    As Mr Bhanu said , we can get the result by using formula variable defined on attribute with replacement path as processing type.
    There is document in https://websmp101.sap-ag.de/bi
    in infoindex->How to Calculate with attributes
    To findout the difference between formula variable and current date, define one more formula variable with processing as custoemr exit.And fill this variable with sy-datum or something else.
    with rgds,
    Anil Kumar Sharma .P

  • How to switch between two query in Web templete.

    Hi all,
      Here i am facing problem to switch between two query in web template by using one 'table' web item. is there any way to use hyperlink 'SAP_BW_URL' and we can switch to query. here i am using these HTML code..
    <table><tr><td class="SAPBEXBtnStdBorder" cellspacing="0" cellpadding="0" border="0"><tr><td>
    <table><tr><td class="sapbexbtnstd" ><A href="<SAP_BW_URL cmd='reset_item' item='table_data' query_ID='ZSD_ZSD_M01_Q20' apply_cmd_on_target= "X">" >Switch to other query</A></td></tr></table>
    but i am not getting correct functionality.
    please help me to solve this problem.
    I know the best way to say thanks in SDN.
    thanks
    Kiran Patel

    Kiran,
      Use the web api reset_data_provider as links or in select option in HTML.
       Onchange event of this select option should call JAVASCRIPT method and
       this in turn resets the current dataprovider to your concerned one.
       How to change graphs:
       The graph item has the default data provider:
       <object>
             <param name="OWNER" value="SAP_BW"/>
             <param name="CMD" value="GET_ITEM"/>
             <param name="NAME" value="CHART_1"/>
             <param name="ITEM_CLASS" value="CL_RSR_WWW_ITEM_CHART"/>
             <param name="DATA_PROVIDER" value="DATAPROVIDER_1"/>
             <param name="TMP_CHART_DATA_HANDLE" value="IIP_49MOXB0UVNOMM6JOZMZU7QO21"/>
             ITEM:            CHART_1
       </object>
      So if you change the DATAPROVIDER_1 using RESET_DATA_PROVIDER to your concerned DP, this changes chart as well !!
       Please use this method and refer to sample code for Onchange Event on SELECT OPTION:
      <HTML>
    <HEAD>
    <script>
    function callDP() {
         if(document.forms[0].dp.value == "1") {
            //form your URL here..
           url = SAP_BW_URL_Get() + "&CMD=RESET_DATA_PROVIDER&DATA_PROVIDER_1=..&...";
            SAPBWOpenURL(url);
            //or docuemtn.location.href = url..
            //etc..
    </script>
    </HEAD>
    <BODY>
    <form>
    <select name="dp" onChange="javascript:callDP();">
    <option value="1">1</option>
    <option value="2">2</option>
    </select>
    </form>
    </BODY>
    </HTML>
    HOPE THIS HELPS !!!

  • How to create 2 ALV output lists in a single output?

    Hi guys...
    My clients requirement is to create 2 ALV output lists in a single output list.how can i do this?i mean which function module i can use for this requirement?please help me out...
    Regards..

    *& Report  ZLCL_ALV_INT_INVOICE                                        *
    REPORT  ZLCL_ALV_INT_INVOICE                    .
    DATA: O_CONT1 TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
          O_CONT2 TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
          O_GRID1 TYPE REF TO CL_GUI_ALV_GRID,
          O_GRID2 TYPE REF TO CL_GUI_ALV_GRID.
    DATA: IT_VBRK LIKE VBRK OCCURS 1 WITH HEADER LINE.
    DATA: IT_VBRP LIKE VBRP OCCURS 1 WITH HEADER LINE.
    DATA: WA_VBRK LIKE VBRK.
    *--Layout
    DATA: WA_LAYO TYPE LVC_S_LAYO.
          CLASS LCL_BILLING DEFINITION
    CLASS LCL_BILLING DEFINITION.
      PUBLIC SECTION.
        CLASS-METHODS: HANDLE_HOTSPOT_CLICK
                 FOR EVENT HOTSPOT_CLICK
                 OF CL_GUI_ALV_GRID
                 IMPORTING E_ROW_ID.
    ENDCLASS.                    "LCL_BILLING DEFINITION
          CLASS LCL_BILLING IMPLEMENTATION
    CLASS LCL_BILLING IMPLEMENTATION.
      METHOD HANDLE_HOTSPOT_CLICK.
        IF NOT E_ROW_ID IS INITIAL.
    *--Reading selected billing docno
          READ TABLE IT_VBRK INTO WA_VBRK INDEX E_ROW_ID-INDEX.
    *--GETTING BILLING DOC ITEMS
          REFRESH IT_VBRP.
          SELECT *
            FROM VBRP
            INTO TABLE IT_VBRP
            WHERE VBELN = WA_VBRK-VBELN.
          CALL SCREEN 200.
        ENDIF.
      ENDMETHOD.                    "HANDLE_HOTSPOT_CLICK
    ENDCLASS.                    "LCL_BILLING IMPLEMENTATION
    SELECT-OPTIONS: S_VBELN FOR IT_VBRK-VBELN.
    START-OF-SELECTION.
      PERFORM GET_DATA.
      SET SCREEN 100.
    *&      Form  GET_DATA
          text
    FORM GET_DATA .
    *--billing header data
      SELECT *
        FROM VBRK
        INTO TABLE IT_VBRK
        WHERE VBELN IN S_VBELN.
      IF SY-SUBRC <> 0.
        MESSAGE I000(Z00) WITH 'No Data Found'.
      ENDIF.
      EXIT.
    ENDFORM.                    " GET_DATA
    *&      Module  STATUS_0100  OUTPUT
          text
    MODULE STATUS_0100 OUTPUT.
      SET PF-STATUS 'MENU'.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
          text
    MODULE USER_COMMAND_0100 INPUT.
      CASE SY-UCOMM.
        WHEN 'BACK'.
          PERFORM EXIT_PROGRAM.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Module  PBO_100  OUTPUT
          text
    MODULE PBO_100 OUTPUT.
      IF O_CONT1 IS INITIAL.
        CREATE OBJECT O_CONT1
          EXPORTING
            CONTAINER_NAME              = 'VBRK_CONT'
          EXCEPTIONS
            CNTL_ERROR                  = 1
            CNTL_SYSTEM_ERROR           = 2
            CREATE_ERROR                = 3
            LIFETIME_ERROR              = 4
            LIFETIME_DYNPRO_DYNPRO_LINK = 5
            OTHERS                      = 6
        IF SY-SUBRC <> 0.
          MESSAGE I000(Z00) WITH 'Error in container'.
          EXIT.
        ENDIF.
        CREATE OBJECT O_GRID1
          EXPORTING
             I_PARENT          = O_CONT1
          EXCEPTIONS
            ERROR_CNTL_CREATE = 1
            ERROR_CNTL_INIT   = 2
            ERROR_CNTL_LINK   = 3
            ERROR_DP_CREATE   = 4
            OTHERS            = 5
        IF SY-SUBRC <> 0.
          MESSAGE I000(Z00) WITH 'Error in Grid'.
          EXIT.
        ENDIF.
      ENDIF.
    *--Layout for 1st grid
      WA_LAYO-KEYHOT = 'X'.
      WA_LAYO-GRID_TITLE = 'Billing Document Header Data'.
      CALL METHOD O_GRID1->SET_TABLE_FOR_FIRST_DISPLAY
        EXPORTING
          I_STRUCTURE_NAME              = 'VBRK'
          IS_LAYOUT                     = WA_LAYO
        CHANGING
          IT_OUTTAB                     = IT_VBRK[]
        EXCEPTIONS
          INVALID_PARAMETER_COMBINATION = 1
          PROGRAM_ERROR                 = 2
          TOO_MANY_LINES                = 3
          OTHERS                        = 4.
      IF SY-SUBRC <> 0.
        MESSAGE I000(Z00) WITH 'Error in showing grid'.
        EXIT.
      ENDIF.
    *-Setting the focus on the grid
      CALL METHOD CL_GUI_CONTROL=>SET_FOCUS
        EXPORTING
          CONTROL           = O_GRID1 "Grid control object
        EXCEPTIONS
          CNTL_ERROR        = 1
          CNTL_SYSTEM_ERROR = 2
          OTHERS            = 3.
      IF SY-SUBRC <> 0.
        MESSAGE I000(Z00) WITH 'Error in setting focus'.
      ENDIF.
    *--Event handler registration
      SET HANDLER LCL_BILLING=>HANDLE_HOTSPOT_CLICK FOR O_GRID1.
    ENDMODULE.                 " PBO_100  OUTPUT
    *&      Module  STATUS_0200  OUTPUT
          text
    MODULE STATUS_0200 OUTPUT.
      SET PF-STATUS 'MENU'.
    ENDMODULE.                 " STATUS_0200  OUTPUT
    *&      Module  USER_COMMAND_0200  INPUT
          text
    MODULE USER_COMMAND_0200 INPUT.
      CASE SY-UCOMM.
        WHEN 'BACK'.
          LEAVE TO SCREEN 100.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0200  INPUT
    *&      Module  PBO_200  OUTPUT
          text
    MODULE PBO_200 OUTPUT.
      IF O_CONT2 IS INITIAL.
        CREATE OBJECT O_CONT2
            EXPORTING
            CONTAINER_NAME              = 'VBRP_CONT'
        EXCEPTIONS
          CNTL_ERROR                  = 1
          CNTL_SYSTEM_ERROR           = 2
          CREATE_ERROR                = 3
          LIFETIME_ERROR              = 4
          LIFETIME_DYNPRO_DYNPRO_LINK = 5
          OTHERS                      = 6
        IF SY-SUBRC <> 0.
          MESSAGE I000(Z00) WITH 'Error in container'.
          EXIT.
        ENDIF.
        CREATE OBJECT O_GRID2
          EXPORTING
            I_PARENT          = O_CONT2
          EXCEPTIONS
            ERROR_CNTL_CREATE = 1
            ERROR_CNTL_INIT   = 2
            ERROR_CNTL_LINK   = 3
            ERROR_DP_CREATE   = 4
            OTHERS            = 5.
        IF SY-SUBRC <> 0.
          MESSAGE I000(Z00) WITH 'Error in grid linking'.
          EXIT.
        ENDIF.
        CALL METHOD O_GRID2->SET_TABLE_FOR_FIRST_DISPLAY
          EXPORTING
            I_STRUCTURE_NAME              = 'VBRP'
          CHANGING
            IT_OUTTAB                     = IT_VBRP[]
          EXCEPTIONS
            INVALID_PARAMETER_COMBINATION = 1
            PROGRAM_ERROR                 = 2
            TOO_MANY_LINES                = 3
            OTHERS                        = 4.
        IF SY-SUBRC <> 0.
          MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                     WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
      ELSE.
    *--refreshing the alv grid with the latest content of the internal table
    *--which is linked
        CALL METHOD O_GRID2->REFRESH_TABLE_DISPLAY
          EXCEPTIONS
            FINISHED = 1
            OTHERS   = 2.
        IF SY-SUBRC <> 0.
          MESSAGE I000(Z00) WITH 'Error in Refreshing gird'.
        ENDIF.
      ENDIF.
    ENDMODULE.                 " PBO_200  OUTPUT
    *&      Form  EXIT_PROGRAM
          text
    FORM EXIT_PROGRAM .
    *--Deallocating the memory
      IF NOT O_CONT2 IS INITIAL.
        CALL METHOD O_CONT2->FREE
          EXCEPTIONS
            CNTL_ERROR        = 1
            CNTL_SYSTEM_ERROR = 2
            OTHERS            = 3.
        IF SY-SUBRC <> 0.
          MESSAGE I000(Z00) WITH 'Error in deallocating memory'.
          EXIT.
        ENDIF.
        CLEAR: IT_VBRP,
               IT_VBRP[].
        FREE:  IT_VBRP,
               IT_VBRP[].
      ENDIF.
      IF NOT O_CONT1 IS INITIAL.
        CALL METHOD O_CONT1->FREE
          EXCEPTIONS
            CNTL_ERROR        = 1
            CNTL_SYSTEM_ERROR = 2
            OTHERS            = 3.
        IF SY-SUBRC <> 0.
          MESSAGE I000(Z00) WITH 'Error in deallocating memory'.
          EXIT.
        ENDIF.
        CLEAR: IT_VBRK,
               IT_VBRK[].
        FREE:  IT_VBRK,
               IT_VBRK[].
      ENDIF.
    *--Cearing the buffered content
      CALL METHOD CL_GUI_CFW=>FLUSH
        EXCEPTIONS
          CNTL_SYSTEM_ERROR = 1
          CNTL_ERROR        = 2
          OTHERS            = 3.
      IF SY-SUBRC <> 0.
        MESSAGE I000(Z00) WITH 'Error in clearing Buffer'.
        EXIT.
      ENDIF.
      LEAVE PROGRAM.
    ENDFORM.                    " EXIT_PROGRAM
    SCREEN 100
    PROCESS BEFORE OUTPUT.
      MODULE STATUS_0100.
      MODULE PBO_100.
    PROCESS AFTER INPUT.
      MODULE USER_COMMAND_0100.
    SCREEN200
    PROCESS BEFORE OUTPUT.
      MODULE STATUS_0200.
      MODULE PBO_200.
    PROCESS AFTER INPUT.
      MODULE USER_COMMAND_0200.

Maybe you are looking for

  • Changing iTunes account on iPad Mini

    I originally set up my daughter's iPad Mini with my iTunes account because she didn't have one of her own.  Now I need to change her iTunes account from my account to her account.  How do I do that?

  • Blocking PO creation for Materials

    Hi ! The procurement block on the material master can be applied on the Purchasing view using the 'Plant Specific Material Status'. I was wondering if this can be made document type specific as well. We have document NB for regular POs, and ZRT for r

  • Changing photo aspect ratio with QT 7 Pro

    Can I use QT 7 Pro to change the aspect ratio of my iPhoto pictures so they can be used in HD video? David

  • Change the size and style of the menu

    How can I change the size and font on the automatically created menu in iWeb? I cannot select it like other text on the site..

  • Process chains administration

    Hi experts! I want your advice about the best way for administering process chains. We have been adding process chains because of delivering new models and now we want to adopt best practices about the way to monitor these process. We use RSPCM trans