Count rows on SAP BW table thru SAP BODS

Hi guys.
I have the next situation. I have two DataStores defined, one of them to SAP BW and the other one to SQL Server.
I need to know how many rows has a table before download on the SQL Server database.
I done a Dataflow with 2 objects only, SQL object and Template table. In the SQL editor i've defined the SAP BW Datastore and in the SQL text, i was put the sentence "Select count(1) from DS_SAPBW.."/BIC/AZTB_XXXXXX" ", but when i executed appear an error with "Invalid object" description.
I have tryed write the table name with diferent ways, but all of them generate the same error.
Can i use sql command direct over SAP BW or exists something restriction about that?.
Another way to count the rows is with a Dataflow with 3 objects, Source, Query and template table. In the Query i choose one port and use it to count() and write on the template table in SQL Server, but this solution take a lot of time when the source table is a large table, because try read all rows before give the result.
Can anybody help me?.
1st. situation.
Another thing, when save the Dataflow, disappears the Database type when re-entry into that SQL object again ¿¿¿???..
To execute appear the next error.
Help me please. I need to know how can i exceute this sql query in the correct way.
Thanks.

Hi Wil,
it's right you'll have to synchronize the master data. When we implemented SEM-BCS 3.1 we had some problems with the reports so we used the following routine.
1. Upload attributes into SEM-BCS.
2. Put them into the hierarchies if needed.
3. Synchronize attributes to BW.
4. Do attribute change run in BW.
Synchronizing hierarchies was a bit painful so we decided to use different hierarchies (it helped at some other points too because we needed additional features in BW hierarchies like other InfoObjects).
Synchronizing BW attributes into SEM-BCS attributes was even worse because the standard BCS attributes could not be filled this way.
We worked on early SEM 3.1 as one of the ramp-up customers. The programs may have changed in the meantime but the one above has worked for us.
Best regards
   Dirk

Similar Messages

  • Count rows in an internal table

    Anybody how knows how I can count rows in my internal table?

    Hi,
    Data: lines like sy-tabix.
    DESCRIBE TABLE ITAB LINES LINES.
    where itab is your internal table.
    This will work out.
    Please award sutiable points .
    Regards,
    Irfan

  • Procudure to count all the rows in a all tables in the schema

    When I run the following store procedure to count all the rows in all the tables I crash my sql Plus editor:
    CREATE OR REPLACE PROCEDURE TC_TABLEROWCOUNT(OWNER IN varchar2)
    IS
    row_count number;
    cursor get_tab is
    select table_name, num_rows
    from all_tables
    where owner='MAXDEV';
    begin
    dbms_output.put_line('Checking Record Counts for schema maxdev ');
    FOR get_tab_rec IN get_tab LOOP
         BEGIN
              EXECUTE IMMEDIATE 'select count(*) from '||get_tab_rec.table_name
              INTO row_count;
              EXCEPTION WHEN OTHERS THEN
                        dbms_output.put_line('Error counting rows for table '
                                                 ||get_tab_rec.table_name);
         END;
    END LOOP;
    END;
    What am I doing wrong.
    Thanks for any help Tony

    The boss gave me 5 pages of tables and wants to know how many row there are in each table. There is a problem of one DB being out of sync with another.
    But I have managed to work the problem though.
    here is the working code:
    CREATE OR REPLACE PROCEDURE TC_TABLEROWCOUNT (
    TableOwner IN varchar2)
    IS
    row_count number;
    vTable varchar2(30);
    v_sqlstmt varchar2(100);
    cursor get_tab is
    select table_name, num_rows
    from all_tables
    where owner = TableOwner;
    begin
    dbms_output.put_line('Checking Record Counts for schema maxdev ');
    FOR get_tab_rec IN get_tab LOOP
    vTable := get_tab_rec.table_name;
    v_sqlstmt := 'SELECT count(*) from '||vTable;
    EXECUTE IMMEDIATE v_sqlstmt into row_count;
    dbms_output.put_line('Table '|| get_tab_rec.table_name || ' Row ' || row_count);
    END LOOP;
    END;

  • Count rows from multiple tables using SQL only

    Hi, I know this has probably been answered before, but I couldn't find the answer anywhere. Please help.
    I'd like count(*) [rows] for all tables in database using SQL only - no PL/SQL
    The result should be something like:
    Table RowCount
    DBA_TABLES 1000
    DBA_USERS 50
    etc.
    Thanks!

    offcource write this script:
    create or replace procedure count_tables (ip_schema VARCHAR2)
    is
    lv_owner VARCHAR2(100);
    lv_table_name VARCHAR2(100);
    lv_sql_statement VARCHAR2(2000);
    lv_count_table NUMBER;
    CURSOR c1 IS
    SELECT owner, table_name
    FROM all_tables
    WHERE owner = ip_schema
    ORDER BY table_name;
    begin
    dbms_output.put_line ('+--------------------------------------------------------------------+');
    dbms_output.put_line ('¦ | | ¦');
    dbms_output.put_line ('¦ Schema Name | Table Name | Number of Rows ¦');
    dbms_output.put_line ('¦ | | ¦');
    dbms_output.put_line ('¦------------------------------------------------------------------¦');
    OPEN c1;
    LOOP
    FETCH c1 INTO lv_owner , lv_table_name;
    EXIT WHEN c1%NOTFOUND;
    lv_sql_statement := 'SELECT count(*) FROM ' || lv_owner || '.' || lv_table_name;
    EXECUTE IMMEDIATE lv_sql_statement INTO lv_count_table;
    IF lv_count_table > 0 THEN
    dbms_output.put_line ('| '||rpad(lv_owner, 14, ' ')||'| '|| rpad(lv_table_name, 32, ' ')||'| '|| rpad(lv_count_table, 16, ' ')||' |');
    -- dbms_output.put_line ('|---------------|---------------------------------|------------------|');
    END IF;
    END LOOP;
    CLOSE c1;
    dbms_output.put_line ('+--------------------------------------------------------------------+');
    exception
    WHEN OTHERS THEN
    dbms_output.put_line ('owner: '||lv_owner||' - table: '||lv_table_name||' - '||sqlerrm);
    end count_tables;
    set serveroutput on size 1000000
    exec count_tables
    drop procedure count_tables;

  • Count rows from several tables

    hello,
    im trying to count row from multiple tables
    for example i need the select statement to produce the following
    table_name count
    table1 5
    table2 6
    table3 3
    i came up with the following script but it counts the number of tables i have
    select object_name, (select count(*) from user_tables where table_name = object_name) from all_objects
    where object_type = 'TABLE'

    Manik wrote:
    May be possible:
    Check this:
    SELECT table_name,
    TO_NUMBER (
    EXTRACTVALUE (
    xmltype (
    DBMS_XMLGEN.getxml ('select count(*) c from ' || table_name)),
    '/ROWSET/ROW/C'))
    COUNT
    FROM (select * from all_tables where table_name in ('TABLE1','TABLE2'))
    WHERE owner = 'SCOTT';Cheers,
    Manik.Awesome Manik... Just too good. Thanks.
    I wish i could have given you the 'Correct' points. ;-)
    Can you please explain the logic in brief? Will be helpful for everybody to understand...

  • COunt no of rows  of  all the tables

    hai
    Pls tell me COunt no of rows of all the tables in the user SOP
    Output like this
    Tablename rows
    sen 31
    van 45
    etc
    pls help
    S

    set serveroutput on size 100000 feedback off
    declare
    rs integer;
    cur integer;
    rp integer;
    trs integer;
    n integer;
    un varchar2(30);
    begin
    dbms_output.put_line(rpad('Table Name',40)||' Number of Rows Created Date');
    dbms_output.put_line(rpad('-',73,'-'));
    cur:= dbms_sql.open_cursor;
    for t in (select object_name, created from dba_objects where object_type='TABLE' and OWNER='SOP') loop
    dbms_sql.parse(cur,'select count(*) from SOP.' || t.object_name, dbms_sql.v7);
    dbms_sql.define_column(cur, 1, rs);
    rp:= dbms_sql.execute(cur);
    n:=dbms_sql.fetch_rows(cur);
    dbms_sql.column_value(cur, 1, rs);
    dbms_output.put_line(rpad(t.object_name,48,'.')||rpad(rs,15,'.')||t.created);
    end loop;
    dbms_sql.close_cursor(cur);
    dbms_output.put_line(rpad('-',73,'-'));
    end;
    set serveroutput off feedback on feedback 6
    Anyway or...
    set serveroutput on size 100000 feedback off
    declare
    rs integer;
    cur integer;
    rp integer;
    trs integer;
    n integer;
    un varchar2(30);
    v_user varchar2(20);
    begin
    v_user := '&user';
    dbms_output.put_line(rpad('Table Name',40)||' Number of Rows Created Date');
    dbms_output.put_line(rpad('-',73,'-'));
    cur:= dbms_sql.open_cursor;
    for t in (select object_name, created from dba_objects where object_type='TABLE' and OWNER=v_user) loop
    dbms_sql.parse(cur,'select count(*) from '|| v_user ||'.' || t.object_name, dbms_sql.v7);
    dbms_sql.define_column(cur, 1, rs);
    rp:= dbms_sql.execute(cur);
    n:=dbms_sql.fetch_rows(cur);
    dbms_sql.column_value(cur, 1, rs);
    dbms_output.put_line(rpad(t.object_name,48,'.')||rpad(rs,15,'.')||t.created);
    end loop;
    dbms_sql.close_cursor(cur);
    dbms_output.put_line(rpad('-',73,'-'));
    end;
    Enter value for user: TEST
    old 11: v_user := '&user';
    new 11: v_user := 'TEST';
    Table Name Number of Rows Created Date
    TEST_UPDATE2....................................1..............21-JAN-09
    TEST_UPDATE.....................................1..............20-JAN-09

  • How can i count no rows in my database table

    plz tell me how can i count no of rows in my database table with[b] ResultSet object

    Hi ! hope this code helps you .
    We can use the count(*) to get the total no of records in the table ad then access it through the getString method .
    import java.sql.*;
    public class JdbcTest
         public static void main(String [] args ) throws Exception
              Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
              String DBURL = "jdbc:odbc:mydsn" ;
              Connection conn = DriverManager.getConnection(DBURL);
              Statement st = conn.createStatement();
              ResultSet rs = st.executeQuery("select count(*) from table1");
              rs.next();
              System.out.println("total rec = " + rs.getString(1));     
    Cheers !

  • SQL Developer 2.1 EA - count rows with filter on a table

    This is a small problem that I came across today while using 2.1 EA. I opened a table and did a filter to narrow down the results of the table. Then when I right clicked on the search results and clicked on 'Count Rows'....I get the count of the rows in the table and not my search results.
    Is this a feature or a bug?
    Thanks,
    Mike

    In EA2, we get both the total and the filtered total, nice.
    Only remark is we don't get a progress indicator anymore, and thus can't cancel a query that might take up hours to finish!
    Please log a bug for this.
    Thanks,
    K.

  • How to stop the money in a counts bank (in SAP) until the other day

    When we sale a Shoes, SAP take de money of the sale and put a count, but immediately SAP send de money to new a counts in pass, then send the money to a counts bank, so  when i check de  money of the moment in the transaction FBL3N, this money is no real, because the store put the money in the bank tomorrow in the morning, 
    How to do, about the SAP no send or to compensate the money in the moment, in the acount bank, because the money is no real. 
    I need to SAP send de money the acouns to pass tomorrow in the mornig. 
    How  to do it?
    Thanks Lucio

    In FBZP Transaction > Bank Determination > Value Date enter 1 in the "Days to Value Date" field.
    Award me points if found useful.
    Thanks
    Regards
    P.Satish

  • What is the problem with native dynamic sql when counting rows in all table

    what is the problem with native dynamic sql when counting rows in all table?Giving an error "table or view does not exist". Thanks.
    DECLARE
    v_sql_string varchar2(1000);
    v_no_of_rows number;
    BEGIN
    for i in ( select table_name from all_tables )
    loop
    v_sql_string := ' select count(1) from ' || i.table_name;
    dbms_output.put_line( v_sql_string );
    --execute immediate v_sql_string into v_no_of_rows;
    end loop;
    END;

    Usually your problem can be described with 'Who cares'. I mean, for what reason do you do this? I doubt that there's a business need to get 100 % accurate answers for this. Normally such things are used to get a picture about the growth of data.
    Personally I would prefer to have up-to-date statistics for all tables and just query the number of rows from there. Sufficient for me in < 99 % of all cases.
    Just my $ .02...

  • Merging of multiple rows in an internal table as a single record

    Hi All,
    I have an internal table which has the following columns:
    text, date, time, user.
    it stores notes in the internal table.
    The problem is...when I save a note with multiple lines and spaces it saves each line of the note as a row in the internal table.
    Thus i get more no. of rows in the internal table compare to the no. of rows!
    I need to store each notes as single row in the internal table.
    Please advise how to approach this?
    Helpful answers will be rewarded.
    Thanks & Regards,
    Anshumita.

    You can create a deep internal table. You can declare one Column as an internal table and store the NOTES in that Internal table for each row.
    http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb366d358411d1829f0000e829fbfe/content.htm
    you can check the example in the link
    regards,
    abhishek

  • Resukt:Get number of rows from 3 different table...?

    Hi All,
    I need to find out number of rows from 3 different table for the same conditions. Instead of writing 3 queries, is it possible to get it thru one query?
    For example, i need to find out number of rows in tables where name = 'Ameet' from 3 different table, i will end writing 3 queries.
    1. select count(1) from table_a where name = 'Ameet';
    1. select count(1) from table_b where name = 'Ameet';
    1. select count(1) from table_c where name = 'Ameet';
    Is it possible to write a single query to get result of all above 3 queries?
    result:
    table_a table_b table_c
    34 44 2

    One way:
    SELECT      (SELECT     COUNT(*) AS CNT FROM TABLE_A WHERE name='Ameet') AS TABLE_A
    ,     (SELECT     COUNT(*) AS CNT FROM TABLE_B WHERE name='Ameet') AS TABLE_B
    ,     (SELECT     COUNT(*) AS CNT FROM TABLE_C WHERE name='Ameet') AS TABLE_C
    FROM DUALIf you want the total:
    SELECT     SUM(CNT)
    FROM
         SELECT     COUNT(*) AS CNT FROM TABLE_A WHERE name='Ameet'
         UNION ALL
         SELECT     COUNT(*) FROM TABLE_B WHERE name='Ameet'
         UNION ALL
         SELECT     COUNT(*) FROM TABLE_C WHERE name='Ameet'
    )

  • Importing lookup values for Z tables thru FTP connections running MDMGX

    When executing MDMGX and importing into lookup tables of MDM thru FTP connection on MDM Server it is working fine with defined tables,
    But when we want to get the data into Z tables thru FTP connection on MDMserver executing MDMGX,how is it possible
    I have added the Ztables extraction in MDMGX txt file.

    Hi Shifali,
    If I have got your question correct.
    The MDM Generic Extractor Program(MDMGX) is used to extract the ECC Checktable data out form MDM and place it either in to the MDM FTP enabled ready folder or the Local desktop form where it can be imported into MDM Repository.
    If you want to send data out form MDM to ECC system.you need to syndicate the master data from MDM using the MDM syndicator in the XML format using the std XSD schema.
    This XML data is then converted in to idoc by PI/XI an posted to ECC Tables.
    You can simillarly use the MDM_CLNT_EXTR ie the MDM client extractor program to work with the main table data instead of checktable on similar lines.
    These two transaction work with the standard ECC tables extraction.
    You can refer the below links on the same:
    MDMGX:
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f0740b31-a934-2b10-2e95-af2252991baa (MDMGX)
    MDM_CLNT_EXTR:
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/50260ae5-5589-2910-4791-fc091d9bf797 (MDM_CLNT_EXTR)
    Hope It Helped
    Thanks & Regards
    Simona Pinto

  • Reg Row Selection in a Table UI Element

    Hi All,
    Can anyone help me in writing code to select a row from a table.
    I need to read the data from a row selected in a table and print it in the next page of my application.
    I request anyone to send me some coding line on how to select a row from a table and read data from it.
    Regards,
    Murthy.

    Hi Narayana,
    Follow the steps.
    Step1: Create a WD Component.
    Step2:  Under Component Controller create a
    i)  2  Node “EmployeeInfo” and “EmployeeRecord”  with attribute “EmployeeName” and “Position”  of cardinality 0..n for both the node and a context attribute “WindowInstance” of type “com.sap.tc.webdynpro.services.session.api.IWDWindow”
    Step3: Go to the Diagram View. Do the mapping between “EmployeeView” and “Component Controller” and between “DisplayView” and “Component Controller”
    Step4: Design 2 Views layout
    i>EmployeeView
    Layout like
    Employee Name |                                  Employee Position
    EmployeeInfo.EmployeeName| EmployeeInfo.Position
    EmployeeInfo.EmployeeName| EmployeeInfo.Position
    DisplayResultButton
    ii>DisplayView
    Layout like
    Employee Name   |                      Employee Position
    EmployeeRecord.EmployeeName |    EmployeeRecord.Position
    EmployeeRecord.EmployeeName |    EmployeeRecord.Position
    CloseWindowButton
    Step5: Create 2 Windows
    1>EmployeeWindow
    2>DisplayWindow.
    Under “EmployeeWindow” add the “EmployeeView”
    and “DisplayWindow” add the “DisplayView”
    Step5: Associate action “DisplayResult” with the “DisplayResultButton” and use this code inside the Implementation of “EmployeeView”
    public void wdDoInit()
        //@@begin wdDoInit()
    //initialize nodes
    wdContext.nodeEmployeeInfo().addElement(wdContext.createEmployeeInfoElement());
    wdContext.nodeEmployeeRecord ().addElement(wdContext.createEmployeeRecordElement());
        //@@end
    public void onActionDisplayResult(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
        //@@begin onActionDisplayResult(ServerEvent)
    try
    IPrivateDisplayView.IEmployeeRecordElement empRec =
    wdContext.createEmployeeRecordElement();
    int n = wdContext.nodeEmployeeInfo().size();
    int leadSelected = wdContext.nodeEmployeeInfo().getLeadSelection();
    // loop backwards to avoid index troubles     
    for (int i = 0; i < n ; i++) {
    if (wdContext.nodeEmployeeInfo().isMultiSelected(i) || leadSelected == i) {
    empRec.setEmployeeName(wdContext.nodeEmployeeInfo().getElementAt(i).getAttributeValue("EmployeeName"));
    empRec.setPosition(wdContext.nodeEmployeeInfo().getElementAt(i).getAttributeValue("Position"));
    wdContext.nodeEmployeeRecord().addElement(empRec);
    catch(Exception e)
    e.printStackTrace();
    IWDWindowInfo windowInfo =(IWDWindowInfo) wdComponentAPI.getComponentInfo().findInWindows(
         "DisplayWindow");
    //        create the Window
         IWDWindow window = wdComponentAPI.getWindowManager().createWindow(windowInfo, true);
         window.setWindowPosition(WDWindowPos.CENTER);
         window.setTitle("WindowTitle");
         window.setWindowSize(200,200);
    //        Save WindowInstance in Context
         wdContext.currentContextElement().setWindowInstance(window);
    //        and show the window
         window.show();
         //wdThis.wdFirePlugInDisplay();
        //@@end
    Step6: Associate action “CloseWindow” with the “CloseWindowButton
    ” and use this code inside implementation of  “DisplayView”
      public void onActionCloseWindow(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
        //@@begin onActionCloseWindow(ServerEvent)
       IWDWindow window = wdContext.currentContextElement().getWindowInstance();
       window.destroyInstance();
        //@@end
    <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/5f699f90-0201-0010-14a4-8950177281ed">Developing with Tables in WebDynpro</a>
    Regards,
    Mithu

  • Using the Execute Preloaded Option for ABAP Dataflows in SAP BODS

    Hello All,
    This is regarding the use of Advanced Option in SAP Application Type (ECC) Datastore settings in SAP BODS 4.2, where there are two options to select from for ABAP Execution Option property: (1)Generate and Execute and (2) Execute Preloaded. Since our ECC client is often locked by BASIS team even on DEV environment, we would like to make use of the second option 'Execute Preloaded' so that we could extract the data from ECC tables without having to ask the BASIS team to unlock the ECC client every time before extraction.
    The problem is that we are getting an error upon generating and uploading the ABAP program to ECC client. I have searched the blogs and so far I have only found that there are certain ABAP programs or function modules that come with SAP BODS which need to be installed by BASIS team on ECC side to allow the ABAP dataflows to be generated and uploaded to ECC server. I would appreciate it if anyone could provide a list of which function modules BASIS needs to install on ECC or a blog that provides details around using this option.
    So far, from the SAP BODS designer, we are performing below steps but getting an error upon generating and uploading the ABAP dataflow program:
    1. Create a test ABAP Dataflow using SAP ECC datastore. Provide the ABAP program options.
    2. Right click, select Generate ABAP Program.
    3. Once the ABAP Program Generation Dialog box appears, check the box "Upload Generated Program".
    4. Upon clicking OK, we are getting the following error:
    The ABAP program <ZRTEST01> for ABAP data flow <RT_TEST_R3> (datastore <R3_DS>) was not uploaded: < RFC CallReceive error <Function /BODS/RFC_ABAP_INSTALL_AND_RUN: RFC_ABAP_MESSAGE- Exception condition "NOT_SUPPORTED_BY_GUI" trigger[SAP NWRFC 720][SAP Partner ### ][clientname][servername][accountname][4103]>. >.
    Any help would be greatly appreciated.
    Thanks,
    Rizwan

    All,
    The BASIS team reviewed steps provided in the BODS document and attempted to install the Function Modules but now none of the BODS jobs would work. All BODS jobs are being terminted with the Syntax Error error when extracting data from ECC using ABAP dataflows:
    17740 16404 R3C-150412 06/17/2014 9:38:46 AM |Data flow RT_DF_TEST_PC207
    17740 16404 R3C-150412 06/17/2014 9:38:46 AM RFC CallReceive error <Function /BODS/RFC_ABAP_INSTALL_AND_RUN: RFC_ABAP_RUNTIME_FAILURE-(Exception_Key: SYNTAX_ERROR)- Syntax
    17740 16404 R3C-150412 06/17/2014 9:38:46 AM error in program /BODS/SAPLBODS                          .[SAP NWRFC 720][SAP Partner 740 ][DEV1][Server][account][4103]>.
    22052 20572 R3C-150412 06/17/2014 9:38:46 AM |Data flow RT_DF_TEST_PC207
    22052 20572 R3C-150412 06/17/2014 9:38:46 AM RFC CallReceive error <Function /BODS/RFC_ABAP_INSTALL_AND_RUN: RFC_ABAP_RUNTIME_FAILURE-(Exception_Key: SYNTAX_ERROR)- Syntax
    22052 20572 R3C-150412 06/17/2014 9:38:46 AM error in program /BODS/SAPLBODS                          .[SAP NWRFC 720][SAP Partner 740 ][DEV1][Server][account][4103]>.

Maybe you are looking for