How to fetch the data based on header in detail.

Hi,
Below is my requirement:
I need to create a two non-database control blocks(header and detail) with multirecord.
When i press the one button i need to fetch the data header block.
If i select the any record i need to get the detail record values in detail block.
Please suggest in which trigger i need to write the code. Please explain clearly.
Regards,
M. Satish

hello
I agree with Mr. Andreas Weiden . use the standard function for the blocks.
First if you have any PK or FK relationship with the two tables then you can use the table wizard then just follow the procedure and be sure you click the checkbox which is default, automatically create relationship.
If you dont have PK/FK then just follow again the table block wizard ... just unclick the check box for autocreate relationship then press button to create base on the SQL join.
on the create join editor :
deptno = empdepno
the press okey. forms wizards will create all the rest... you can now notice a new object RELATIONSHIP below the DEPARMENT BLOCK and some forms genareted triggers.
And CHANGE THE BLOCK PROPERTIES TO UPDATE ABLE,INSERT ABLE, DELETE to NO.. IF YOU WANT ONLY ON DISPLAY
OR BETTER CREATE A 2 VIEWS CORRESPONDENT TO YOUR QUERY ON YOUR CURSOR.... and follow the procedure i gave above.
In your button:
go_block(your.block);execute_query(no_validate);

Similar Messages

  • How to fetch the data & display the data if fields got the same name in alv

    hi frnds, i need ur help.
    how to fetch the data & display the data if fields got the same name in alv grid format.
    thanks in advance,
    Regards,
    mahesh
    9321043028

    Refer the url :
    http://abapexpert.blogspot.com/2007/07/sap-list-viewer-alv.html
    Go thru the guide for OOPs based ALV.
    Use SET_TABLE_FOR_FIRST_DISPLAY to display the table:
    CALL METHOD grid->set_table_for_first_display
     EXPORTING
    I_STRUCTURE_NAME = 'SFLIGHT'     “Structure data
    CHANGING
    IT_OUTTAB = gt_sflight.          “ Output table
    You can also implement
    Full Screen ALV, its quite easy. Just pass the output table to FM REUSE_ALV_GRID_DISPLAY. 
    For controlling and implementing the FS-ALV we have to concentrate on few of the components as follows :
    1. Selection of data.
    2. Prepare Layout of display list.
    3. Event handling.
    4. Export all the prepared data to REUSE_ALV_GRID_DISPLAY.
    Regd,
    Vishal

  • How to fetch the data records in summary format based on previous day

    drop table T1;
    create table T1(Class, Fees_Collected, Submit_Date) as select
    'MBA', 100000, '7/30/2012' from dual union all select
    'Btech', 20000, '7/10/2012' from DUAL union all select
    'MBA', 45000, '8/1/2012' from dual union all select
    'Btech', 55550, '7/31/2012' from DUAL union all select
    'BBA', 250660, '7/30/2012' from dual union all select
    'MBBS', 44556000, '7/31/2012' from DUAL union all select
    'BDS', 420050, '8/1/2012' from DUAL union all select
    'BBA', 30450, '7/30/2012' from DUAL union all select
    'MBBS', 120450, '7/31/2012' from DUAL union all select
    'BDS', 45950, '7/30/2012' from DUAL union all select
    'MBA', 252450, '8/1/2012' from DUAL;My requirment is to fetch the records based on summary format to display the data with following columns -
    Class |Prev Day Traded Value |Prev Day % of Total |Prev Day % MBA
    Note - Previous Day definiton (Buisness Day) = calendar days - (weekends + US Holidays)
    Kindly help me, as i want to keep it customized so that without specifying the hard coded dates ( Previous Day) it runs through and provide me the resultset....
    All of your help and time is highly appericated.

    You mean business days I guess ?
    I use a function (I had to write it myself) <tt><b> next_business_day(p_start_date in date,p_days_count in number) return date </b></tt>
    where I loop forward/backward from p_start_date according to the sign of p_days_count the required number of steps skipping weekends and holidays as the absolute value of p_days_count is mostly under 30 for the rest (at least around here) Oracle's <tt><b> add_months </b></tt> gets it done.
    Regards
    Etbin
    Edited by: Etbin on 6.8.2012 17:55
    Year till date: <tt><b> your_date between trunc(sysdate,'year') and sysdate </b></tt> is it ? http://en.wikipedia.org/wiki/Year-to-date ?
    Edited by: Etbin on 6.8.2012 18:27
    NOT TESTED!
    function next_business_date(p_start_date in date,p_count_days in number) return date is
      steps  number := abs(p_count_days);
      retval date := p_start_date;
    begin
      if p_start_date is null or p_count_days is null then
        return to_date(null);
      end if;
      while steps > 0
      loop
    /* skipping weekends and (yet to be implemented) holidays */
        while to_char(retval,'dy') in ('sat','sun') /* or is_holiday(retval) */
        loop
          retval = retval + sign(p_count_days);
        end loop;
    /* retval contains a business day now */
        retval = retval + sign(p_count_days);
        step := step - 1;
      end_loop
      return retval;
    end;

  • How to Fetch the Data from a Cube

    Dear All,
    We created a cube containing dimensions
    Customer, Product, Branch, Activity, Time dimensions
    using Oracle Analytical WorkSpace Manager.
    Once Cube is created,
    How can I see the Data existing in the Cube using normal SQL Queries ??? Through Analytical Workspace Manager Toll we r able to see the data. But our requirement is to see the data from the Cube using SQL Queries.
    Regards,
    S.Vamsi Krishna

    Hey I got the Solution. It follows in this way :
    A Cube is nothing but a Data Storage. Based on the Mapping we given it considers the data.
    To fetch the data from the Cube -> we have to write the SQl Query as below :
         SELECT dealer_name,model_name,sales
         FROM TABLE(OLAP_TABLE('MDB.FINAL_AW DURATION SESSION',
         'DIMENSION dealer_name AS varchar2(30) FROM FINALDEAL
         DIMENSION model_name AS varchar2(30) FROM FINALMODEL'));
    We can create View for the above statement o
    we can apply group by ,rollup, etc etc clauses
    and even we can write where clauses for the above select statement.
    But now my doubt is :
    can we apply any calculations while mapping the Level to an Dimension.
    Generally we will map Level toa dimension as DBUSER.TABLENAME.COLUMN NAME
    can we apply any calculation like :
    MIS.PROPKEY020MB.MATURITY_DATE+2
    Please help for the above.
    If any wrong is there please let me know
    Regards,
    S.Vamsi Krishna
    can we apply

  • How to fetch MIR4 data based on MB51 refrence number

    hi Experts.
    i want to fetch MIR4 data based on MB51 refrence number.
    I want to fetch below fileds in MIR4 TCODE.
    1.  RBKP-BELNR (Invoice Document NUMBER)
    2. DRSEG-MENGE ( quantity )
    3. DRSEG-WRBTR ( Amount in document currency)
    As mentioned above DRSEG is structure.
    please help me how to fetch 3 data fileds based on my MB51 refrence.( mkpf-xblnr ).
    In MIR4 , Number of External Delivery Note( DRSEG-XBLNR ) is same as my MB51 refrence ( mkpf-xblnr).
    This is the only link avilable to fetch above 3 fields.
    kindly give any suggestions .
    thanks & regards,
    hari priya

    Hi ,
    can anybody give me suggestions .
    What is the table name for fetching above 3 fileld data  . 
    DRSEG  is structure .
    Thanks & regards,
    Hari priya

  • How to fetch the data from databse table and get the required output

    Hi,
    I have made a project that connects CEP to database table but i m getting some problem in fetching the data from database.
    From the following code :
    If the where condition is removed then the application runs fine but i am still not able to fetch the data from the table because it is not showing any output.
    Can anyone please suggest me that how to write WHERE statement correctly and how i will be able to see the output.
    Following is the config.xml for processor:
    ======================================
    <?xml version="1.0" encoding="UTF-8"?>
    <wlevs:config xmlns:wlevs="http://www.bea.com/ns/wlevs/config/application"
         xmlns:jdbc="http://www.oracle.com/ns/ocep/config/jdbc">
         <processor>
              <name>JDBC_Processor</name>
              <rules>
                   <query id="q1"><![CDATA[
                             SELECT STOCK.SYMBOL as symbol, STOCK.EXCHANGE as exchange
                             FROM ExchangeStream [Now] as datastream, STOCK
                             WHERE datastream.SYMBOL = datastream.SYMBOL ]]></query>
              </rules>
         </processor>
         <jms-adapter>
              <name>JMS_IN_Adapter</name>
              <jndi-provider-url>t3://CHDSEZ135400D:7001</jndi-provider-url>
              <destination-jndi-name>jms.TestKanikaQueue</destination-jndi-name>
              <user>weblogic</user>
              <password>welcome1</password>
         </jms-adapter>
    </wlevs:config>
    Following is the assembly file:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:osgi="http://www.springframework.org/schema/osgi"
         xmlns:wlevs="http://www.bea.com/ns/wlevs/spring" xmlns:jdbc="http://www.oracle.com/ns/ocep/jdbc"
         xmlns:spatial="http://www.oracle.com/ns/ocep/spatial"
         xsi:schemaLocation="
              http://www.springframework.org/schema/beans
              http://www.springframework.org/schema/beans/spring-beans.xsd
              http://www.springframework.org/schema/osgi
              http://www.springframework.org/schema/osgi/spring-osgi.xsd
              http://www.bea.com/ns/wlevs/spring
              http://www.bea.com/ns/wlevs/spring/spring-wlevs-v11_1_1_3.xsd
              http://www.oracle.com/ns/ocep/jdbc
              http://www.oracle.com/ns/ocep/jdbc/ocep-jdbc.xsd
              http://www.oracle.com/ns/ocep/spatial
              http://www.oracle.com/ns/ocep/spatial/ocep-spatial.xsd">
         <wlevs:event-type-repository>
              <wlevs:event-type type-name="StockEvent">
                   <wlevs:properties>
                        <wlevs:property name="SYMBOL" type="byte[]" length="16" />
                        <wlevs:property name="EXCHANGE" type="byte[]" length="16" />
                   </wlevs:properties>
              </wlevs:event-type>
              <wlevs:event-type type-name="ExchangeEvent">
                   <wlevs:class>com.bea.wlevs.event.example.JDBC_CEP.ExchangeEvent</wlevs:class>
              </wlevs:event-type>
              <wlevs:event-type type-name="StockExchangeEvent">
                   <wlevs:properties>
                        <wlevs:property name="symbol" type="byte[]" length="16" />
                        <wlevs:property name="price" type="byte[]" length="16" />
                        <wlevs:property name="exchange" type="byte[]" length="16" />
                   </wlevs:properties>
              </wlevs:event-type>
         </wlevs:event-type-repository>
         <bean id="readConverter" class="com.bea.wlevs.adapter.example.JDBC_CEP.Adapter_JDBC" />
         <bean id="outputJDBCBean" class="com.bea.wlevs.bean.example.JDBC_CEP.OutputBean_JDBC">
         </bean>
         <wlevs:adapter id="JMS_IN_Adapter" provider="jms-inbound">
              <wlevs:listener ref="ExchangeStream" />
              <wlevs:instance-property name="converterBean"
                   ref="readConverter" />
         </wlevs:adapter>
         <wlevs:processor id="JDBC_Processor" advertise="true">
              <wlevs:listener ref="OutputChannel" />
              <wlevs:table-source ref="STOCK" />
         </wlevs:processor>
         <wlevs:channel id="ExchangeStream" event-type="ExchangeEvent" advertise="true">
              <wlevs:listener ref="JDBC_Processor" />
         </wlevs:channel>
         <wlevs:channel id="OutputChannel" event-type="StockExchangeEvent"
              advertise="true">
              <wlevs:listener ref="outputJDBCBean" />
         </wlevs:channel>
         <wlevs:table id="STOCK" event-type="StockEvent"
              data-source="StockDs" table-name="STOCK" />
         <wlevs:table id="STOCK_EXCHANGE" event-type="StockExchangeEvent"
              data-source="StockDs" table-name="STOCK_EXCHANGE" />
    </beans>
    ExchangeEvent.java:
    package com.bea.wlevs.event.example.JDBC_CEP;
    public class ExchangeEvent {
         public String SYMBOL;
         public String symbol;
         public String exchange;
         public ExchangeEvent() {
         public String getSYMBOL() {
              return SYMBOL;
         public void setSYMBOL(String sYMBOL) {
              SYMBOL = sYMBOL;
         public String getSymbol() {
              return symbol;
         public void setSymbol(String symbol) {
              this.symbol = symbol;
         public String getExchange() {
              return exchange;
         public void setExchange(String price) {
              this.exchange = price;
    Adapter Class:
    package com.bea.wlevs.adapter.example.JDBC_CEP;
    import com.bea.wlevs.adapter.example.JDBC_CEP.MyLogger;
    import com.bea.wlevs.adapters.jms.api.InboundMessageConverter;
    import java.text.DateFormat;
    import java.util.Date;
    import com.bea.wlevs.adapters.jms.api.MessageConverterException;
    import com.bea.wlevs.event.example.JDBC_CEP.ExchangeEvent;
    import javax.jms.JMSException;
    import javax.jms.Message;
    import javax.jms.TextMessage;
    import java.util.ArrayList;
    import java.util.List;
    import java.util.Random;
         public class Adapter_JDBC implements InboundMessageConverter{
         @SuppressWarnings("unchecked")
         public List convert(Message message) throws MessageConverterException, JMSException {
              Random rand = new Random();
              int unique_id = rand.nextInt();
              DateFormat dateFormat;
              dateFormat = DateFormat.getTimeInstance();
              dateFormat.format(new Date());
              MyLogger.info(unique_id + " CEP Start Time is: " + dateFormat.format(new Date()));
              System.out.println("Message from the Queue is :"+ message);
              TextMessage textMessage = (TextMessage) message;
              String stringMessage = textMessage.getText().toString();
              System.out.println("Message after getting converted into String is :"+ stringMessage);
                   String[] results = stringMessage.split(",\\s*"); // split on commas
                   ExchangeEvent event1 = new ExchangeEvent();
                   event1.setSYMBOL(results[0]);
         List events = new ArrayList(2);
         events.add(event1);
         return events;
    Output Bean Class :
    package com.bea.wlevs.bean.example.JDBC_CEP;
    import com.bea.wlevs.ede.api.StreamSink;
    import com.bea.wlevs.event.example.JDBC_CEP.ExchangeEvent;
    import com.bea.core.datasource.DataSourceService;
    public class OutputBean_JDBC implements StreamSink{
         public void onInsertEvent(Object event) {
         if (event instanceof ExchangeEvent) {
              ExchangeEvent cacheEvent = (ExchangeEvent) event;
         System.out.println("Symbol is: " + cacheEvent.getSymbol());
         System.out.println("Exchange is: " + cacheEvent.getExchange());
         System.out.println(DataSourceService.class.getClass());
    Kindly let me know if you need further info.

    Do you have StockDs configured in your server config.xml?
    I think the query should look more like this:
    SELECT stocks.SYMBOL, stocks.EXCHANGE
    FROM STOCK as stocks, ExchangeStream [Now] as datastream WHERE stocks.SYMBOL = datastream.SYMBOL
    Thanks
    andy

  • How to fetch the Date column(or Month column) from the file name from the specified path in ODI 11g

    Hi ALL,
    Can any one help us regarding How to fecth the Date column(or month column) from the file name specified in the path in a generalized way .
    For example :
    file name is :subscribers (Cost) Sep13.csv is specified in the below path
      E:\Accounting\documents\subscribers (Cost) Sep13.csv
    here I need to fetch the "Sep13" as a Date column in the ODI 11g in the generalized way.
    Can any one help us in this case as early as possible.

    I would suggest using a piece of Jython code for this.  Something like this...
    import os
    import os.path
    filelist  = os.listdir(E:\Accounting\documents\)
    for file in filelist:
    datestr = file[19:-4]
    You'd need to work out what to do with datestr next...  perhaps write it to a table or update an ODI variable with it.
    Hope this is of some help.

  • How to pick the data based on customer number

    Hi All ,
    greets....
    i have a requirement to select  the data based on customer number and then do furthur processing .
    example:
    this is some 10 dcouments in customer nr:v1000
    and 20 documents in customer v2000 in a internal table how to select that,
    thank s in advance.

    thier is an internal table which is having some 1000records.
    and their is 6 customers.
    in which i should pick the data based on customer number.
    how to write a code for that?

  • How to delete the data based on concurrent request Id

    Hi
    from account receivable to gl i am posted a cheque through concurrent program.
    right now my problem is I want to delete that data in database tables based on concurrent request id.
    how to delete that data based on concurent request id, Please give me some suggessions

    What is the application version ? what exactly you want to achieve ?
    Direct deletion is not recommended in oracle application database.
    regards,

  • How to fetch the data from Ecc to BI ?

    Hi everybody.
    Can anyone briefly explain with the screen shots > How to fetch the datasource from  RSA5 tcode in ECC to BI? How you replicate there? how the INFO PACKAGE , TRANSFORMATIONS, DTP , DSO, INFO CUBE was created? where we see the catalogs for this data.......THANKS IN ADVANCE

    Hi.
    You can follow the below steps to fetch the data from ECC to BI System.
    1>Connection should be there between ECC and BW System.
    2>Go to Tcode-RSA5 in ECC system and find your data source and then activate it.
    3> Go to Tcode-RSA6 in ECC system to check whether your DS is available..if it is there then its been activated.
    4>Go to Extract Checker tcode RSA3 and test the data and make sure data is correct.
    5>login to BW Side..go to tcode RSA1-->Choose your source system. ECC -> double click on it and you will move to Data source>Select your Application component ex, SD,FI ...>Right click and replicate the Datasouce> Now on refresh you can see the datasource in BI System.
    6>Install the related the Infoprovider .. cube or dso ..Connect the datasouurce and create Transformation.
    7> Now create infopackage and run it in ful & init mode then do the delta for the new records.
    Please refer the below link for more details on extraction.
    http://www.trinay.com/SAP%20BW%20Extraction.pdf
    Hope this helps.
    Br.
    Alok

  • How to fetch the data from pl/sql table dynamically

    Hi All, I have the requirement of comparing two db views data in pl/sql. So, I have bulk collect the view into pl/sql table. But, the issue is, It is expecting to provide the column name for comparison. But, in my case, column name is dynamic. So, i cannot provide the column name directly for comparison.
    For eg: In my view t1_VW, i have 4 columns. stid, c1,c2,c3,c4 and similar structure for t2_vw
    my code
    TYPE v1_type IS TABLE OF t1_vw%ROWTYPE;
    l_data v1_type;
    TYPE v1_type1 IS TABLE OF t2_vw%ROWTYPE;
    l_data1 v1_type1;
    test varchar2(1000);
    test1 varchar2(1000);
    temp1 number;
    begin
    SELECT * Bulk collect into l_data
    FROM T1_VW;
    SELECT * Bulk collect into l_data1
    FROM T2_VW;
    select l_data(1).stid into temp1 from dual; -- It is working fine and gives me the value properly
    -- But, in my case, we are reading the column names from array, i am constructing the query dynamically and execute it.
    test :='select l_data(1).stid into temp1 from dual';
    execute immediate test into temp1;
    -- I am getting error as follows:
    Error report:
    ORA-00904: "L_DATA": invalid identifier
    ORA-06512: at "SYSTEM.BULKCOMPARISON", line 93
    ORA-06512: at line 2
    00904. 00000 - "%s: invalid identifier"
    *Cause:   
    *Action
    end;
    - Please help me to get rid of this issue. Is it possible to construct the query dynamically and fetch the data?. If not, is there any other better approach to compare the data between two views?.

    Output should display what are all columns changed and its old value and new value.
    For eg., output should be
    COLUMNNAME OLD_VALUE NEW_VALUE STID
    C1 20 10 1
    C2 50 40 2
    C3 60 70 2
    C2 80 90 3Why no do this only via a simple sql ?
    create table a (STID number, C1 number,  C2 number, C3 number);
    insert into a values (1, 20, 30, 40)
    insert into a values (2, 40, 50, 60);
    insert into a values (3, 90, 80, 100);
    create table b as select *
    from a where 1 = 0;
    insert into b values (1, 10, 30, 40)
    insert into b values (2, 40, 40, 70);
    insert into b values (3, 90, 90, 100);
    commit;And now you can issue such a kind of select
    SELECT stid , c1, c2, c3                      
       FROM
      ( SELECT a.*,
             1 src1,
             to_number(null) src2        
       FROM  a   
       UNION ALL
       SELECT b.*,
             to_number(null) src1,
             2  src2        
        FROM b
       GROUP BY stid , c1, c2, c3
       HAVING count(src1) <> count(src2)
       order by stid;I would then create a new table a_b_difference having the same structure as a or b and insert into it like this
    create table a_b_diff as select * from a where 1 = 0;
    insert into a_b_diff
    SELECT stid , c1, c2, c3                      
       FROM
      ( SELECT a.*,
             1 src1,
             to_number(null) src2        
       FROM  a   
       UNION ALL
       SELECT b.*,
             to_number(null) src1,
             2  src2        
        FROM b
       GROUP BY stid , c1, c2, c3
       HAVING count(src1) <> count(src2)
       order by stid
       ;Then each time there is a difference between a column in a and its equivalente one in b (per unique stid ) a record will be inserted in this table.
    You can do more by adding the name of the table in front of each record in this table to see exactly where the data comes from
    Best Regards
    Mohamed Houri

  • How to fetch the data from a pl/sql table and varray, with some example

    I want to fetch the data using a cursor from Pl/sql table and varry and I want to update the data.
    Please provide me some example.

    PL/SQL Table  - please note that, right term is Associative Array.
    Presumably you are referring to the 'often heated' back-and-forth that sometimes goes on in the forums when people refer to ANY PL/SQL type using a term with the word 'table' in it?
    Curious that you then show an example of a nested table!
    type emp_tab is table of employees%rowtype;
    The 'right term' for that is 'nested table'. The following would be an 'associative array' or 'index-by table'
    type emp_tab is table of employees%rowtype INDEX BY PLS_INTEGER;
    Those used to be called 'PL/SQL tables' or 'index-by tables' but 'associative array' is the current term used.
    Associative Arrays
    An associative array (formerly called PL/SQL table or index-by table) is a set of key-value pairs. Each key is a unique index, used to locate the associated value with the syntax variable_name(index).
    The data type of index can be either a string type or PLS_INTEGER.
    Since the Oracle docs often use 'PL/SQL table' or 'index-by table' it isn't unusual for someone asking a question to use those terms also. Technically the types may not be 'tables' but it's clear what they mean when they use the term.
    In PL/SQL the term 'nested table' is still used even though the PL/SQL collection is not really a table. SQL does have nested tables where the data is actually stored in a table. The PL/SQL  'nested table' type can be used as the source/destination of the SQL data from a nested table so that may be why Oracle uses that term for the PL/SQL type.
    The doc that SKP referenced refers to this use:
    Nested Tables
    In the database, a nested table is a column type that stores an unspecified number of rows in no particular order. When you retrieve a nested table value from the database into a PL/SQL nested table variable, PL/SQL gives the rows consecutive indexes, starting at 1.

  • How to split the data based on one column

    Dear All,
    I have the table data like this.
    type quantity revenue_mny count country
    a 10           10          2 India
    a 20          12          3 India
    b 30          15          1 India
    a 35          20          2 US
    b 20          10          1 US
    b 60          15          1 US
    I woulkd like to split the date based on type column.
    For each country, for Type "a" get the sum of revenue count quanity ans same for b
    and all shuld come in on row for each country.
    output should be like
    country revenue_mny(For a) quantity(for a) count(For a) revenue_mny(for b) quantity(for b) count(For b)
    India 22 30 5 15 30 1
    US 20 35 2 25 80 2
    I tried the below query . its not splittng the date for each country in one row.
    select country,
    sum(case when type='a') then revenue_mny else 0 end ) revenue_mny_a,
    sum(case when type='b' then revenue_mny else 0 end ) revenue_mny_b
    sum(case when type='a' then quantity else 0 end) quantity_a,
    sum(case when type='b' then quantity else 0 end) quantity_b from
    test
    group by country
    Please need your helo

    Like this?
    with t as
    select 'a' type, 10 quantity, 10 revenue_mny, 2 cnt, 'India' country from dual union all
    select 'a', 20, 12, 3, 'India' from dual union all
    select 'b', 30, 15, 1, 'India' from dual union all
    select 'a', 35, 20, 2, 'US' from dual union all
    select 'b', 20, 10, 1, 'US' from dual union all
    select 'b', 60, 15, 1, 'US' from dual
    select country,
    sum(case when type='a' then revenue_mny else 0 end ) revenue_mny_a,
    sum(case when type='a' then quantity else 0 end) quantity_a,
    sum(case when type='a' then cnt else 0 end) cnt_a,
    sum(case when type='b' then revenue_mny else 0 end ) revenue_mny_b,
    sum(case when type='b' then quantity else 0 end) quantity_b ,
    sum(case when type='b' then cnt else 0 end) cnt_b
    from t
    group by country;result:
    COUNTRY  REVENUE_MNY_A QUANTITY_A CNT_A REVENUE_MNY_B QUANTITY_B CNT_B
    India    22            30         5     15            30         1
    US       20            35         2     25            80         2Or you can do it with a decode instead of case. The result will be the same:
    with t as
    select 'a' type, 10 quantity, 10 revenue_mny, 2 cnt, 'India' country from dual union all
    select 'a', 20, 12, 3, 'India' from dual union all
    select 'b', 30, 15, 1, 'India' from dual union all
    select 'a', 35, 20, 2, 'US' from dual union all
    select 'b', 20, 10, 1, 'US' from dual union all
    select 'b', 60, 15, 1, 'US' from dual
    select country,
    sum(decode(type,'a',revenue_mny,0)) revenue_mny_a,
    sum(decode(type,'a',quantity,0)) quantity_a,
    sum(decode(type,'a',cnt,0)) cnt_a,
    sum(decode(type,'b',revenue_mny,0)) revenue_mny_b,
    sum(decode(type,'b',quantity,0)) quantity_b,
    sum(decode(type,'b',cnt,0)) cnt_b
    from t
    group by country;(I changed tablename from TEST to T and columnname from COUNT to CNT, because you should not use reserved words as tablename or columnname.)
    Edited by: hm on 09.10.2012 06:17

  • How to fetch the data to the internal table with out using mandt

    Hi all,
    Iam giving my code please observer... and give me the reasonable solution.
      t_mar LIKE STANDARD TABLE OF z_mar.
    SELECT  mandt
             werks                         " Plant
             lifnr                         " Vendor
        FROM z_mar
        INTO TABLE t_mar
    where sal = 2000.
    By removing MANDT from select query, it is going to dump.
    ex:
       SELECT 
              werks                         " Plant
              lifnr                         " Vendor
         FROM z_mar
         INTO TABLE t_mar
    where sal = 2000.
    > Now it is going to dump ( here i removed the mandt field ).
    Please give me a solution to fetch the data by removing mandt in select statement, with out chaning the internal table structure.
    Thanks,
    Ravi

    hi Ravi,
    i also had to avoid move-corresponding and the following is what i did...its extra work and goes around but it will
    do the needed work..............
    t_mar LIKE STANDARD TABLE OF z_mar.
    SELECT *
    FROM z_mar
    INTO TABLE t_mar
    where sal = 2000.
    the above gets you all the fields ...but if you still want to narrow it down to just two fields
    *****Declaring structure with 2 fields
    data:begin of fs_data.
    data:werks type z_mar-werks,
         lifnr type z_mar-lifnr ,
    data:end of fs_data.
    *******internal table of above
    data:int_data like fs_data occurs 0 with headerline.
    *****moving the only 2 required fields
    loop at t_mar.
    t_mar-werks  = int_data-werks.
    t_mar-lifnr  = int_data-lifnr.
    append int_data.
    endloop.
    Hope you found it useful...
    Regards
    Bx

  • Pls let me know how to fetch the data from tables bdcp or bdcps

    Hi guru's!!!!
    I want to post the changed master data to the legacy.
    I am npt using IDOC. I want to go ahead by using the change doc. I want to know how we can filer the change doc. data for my equirement. & also how to send the data
    transaction wise. I am using the FMs "change_pointers_read.
    it is very urgent..
    Thanks in advance!!!!!

    Hi,
    1. You will have to activate the change pointers for the master data you are looking for.
    2. You can do the configuration so that whenever master data is changed, a IDOC is triggered for that master data.
    3. You can configure the IDOC's to be transmitted to your legacy system in the form of files or to your middleware system.
    <b>You don't have to read the CHANGE POINTERS yourself.</b>
    Regards,
    Ravi
    Note : Please mark all the helpful answers
    Message was edited by: Ravikumar Allampallam

Maybe you are looking for

  • FileName in the AS2 receiver?

    Hi Guys, we are sending a file to the partner with the AS2 and we want to maintain the same file name as the sender. I dont see any adapter specific attributes in the AS2 adapter. How can i maintain the same file in the AS2 receiver adapter. any help

  • Could I get a quick review of proposed NLE system?

    Hello-I was hoping for some input on a recommended system for NLE. I've been looking through the discussions and finding some great info.  I'm looking to updgrade to CS5 and Premiere Pro after years of using a Mac/Final Cut/After Effects system. I've

  • Automatic Credit Check FI-AR-CR from CRM

    Hi, when creating a sales order, the credit limit check in CRM gives a positive result, but the order is blocked for credit limit check in ECC (which is actually correct). Why does the check not work in CRM? We have set up the middleware, changed all

  • Link DMS document to LISP and PLPO object types?

    Hi, I am trying to link the  Objects LISP & PLPO  to the DMS. In the process of this I followed the note - 321531 I did the following steps. 1.Copy screen 1204 in function group CV130 to the screen number 9003  to the program SAPLCV130 and did the re

  • Photos not changed to iPhoto on iPad

    OS x 10.9.2 has been installed succesfully on the mac, but my ipad iOS 7.1 has not changed it is still in photos. It syncs but no changes are made to photos? The problem now is that when I take a photo with my ipad I cannot email it. Can anyone guide