Counting Columns in a Structure or Table?

HI,
can any one tell me the best way to count the number of Columns a structure or internal table has.
Thanks
C

Hi,
Try using the describe field type s_struc components n..
data: begin of s_struc,
       field1,
       field2,
      end of s_struc.
data: v_int type int4.
describe field s_struc type s_struc components v_int.
write: / v_int.
Thanks,
Naren
Message was edited by: Narendran Muthukumaran

Similar Messages

  • How to check  which column data differs from master table and archive table

    Hi All,
    i have two tables, table a (a1 number,a2 varchar2,a3 varchar2) and table b (b1 number,b2 varchar2,b3 varchar2).
    how to check the data in both the table are same( including all columns).
    data in a.a1 is same as b.b1 and a.a2 is same as b.b2 like that.
    if they not same , i need to know which field differs.
    Kindly Share ur ideas.

    887268 wrote:
    thanks Sven W. ,
    above reply clearly shows what my question is.
    one column must be primary key, based on that key i need to find out which are the fields having different data..
    im strugling with this, i tried the following already, but not able to get.
    select the columns from a MINUS select the columns from b.
    -- from this i can find whether the difference occurred or not.
    but i cant able to get which are the fields value changed.Good. Then you would match the rows using the PK column and need to compare the columns
    Instead of a MINUS + UNION ALL + MINUS we can now use a FULL OUTER JOIN
    It is a little task to write out all column names, but 40 columns can be handled.
    This statement would show you both tables with matching rows on the same line.
    select a.*, b.*
    from a
    FULL OUTER JOIN b on a.id = b.idNow filter/check for mismatches
    select case when a.col1 != b.col1 then 'COL1 value changed'
                    when a.col2 != b.col2 then 'COL2 value changed'
                    when a.col3 != b.col3 then 'COL3 value changed'
             end as compare_result
            ,a.*, b.*
    from a
    FULL OUTER JOIN b on a.id = b.id
    /* return only non matching columns */
    where (a.col1,a.col2,a.col3) != (b.col1,b.col2,b.col3) You might need to add nvls to take care of null values. Test this!
    Another way could be to group upon the primary key
    select *
    from (
      select id 
               ,count(distinct col1)-1 cnt_col1
               ,count(distinct col2)-1 cnt_col2
               ,count(distinct col3)-1 cnt_col3
       from
         select 'A' source, a.*
         from a
         UNION ALL
         select 'B' source, b.*
         from b)
       group by ID
    /* only records with differences */
    where 1 in (cnt_col1, cnt_col2, cnt_col3)
    ;The count columns will hold either 1 or 0. If it is 1 then this column has a difference.

  • SAP database tables - Column statistics not found for table in DB02 - During import, inconsistent tables were found - Some open conversion requests still exist in the ABAP dictionary.

    Hi Experts,
    I'm implementing SAP note 1990492 which requires manual implementation. Implementation includes modifying standard tables (i.e. append
    the structure FIEU_S_APP_H to table FIEUD_FIDOC_H). After this I've adjusted the table in SE14 (Database Utility). I've done checks in SE14 and it shows the table is consistent.
    But during DB02 -> Space folder -> Single table analysis -> Input table name -> Indexes tab -> Upon clicking statistics, there is a warning "Column statistics not found for table".
    Our basis team is implementing an Add-On in the development system related to RWD Context Sensitive Help. They cannot proceed due to the following inconsistencies found in the table.
    Screenshot error from the activity:
    Screenshot from DB02:
    I'm an ABAP developer and have no other ideas on what to do. Thanks in Advanced.

    Hi All,
    We were able to fix the issue through the following:
    1. Call transaction
    SE14.
    2. Enter the name of
    the table and choose "Edit".
    3. Choose
    "Indexes".
    4. Select the index
    and choose "Choose (F2)".
    5. If you choose
    "Activate and adjust", the system creates the index again and it is
    consistent.
    6. Check the object
    log of this activation.
    7. If an error
    occurs, eliminate the cause and reactivate the index.

  • Duplicate fact column  as percentage in pivot table.

    Hi,
    I created duplicate fact column set as percentage in pivot table.
    Duplicate column not visible for graph generation.My requirement is need to use percentage column for graph .
    How to achieve this.kindly let me know.

    Thanks for reply.
    Sorry if im not clear.
    Here is my requirement.
    1.In my report contains 2 columns.
    2.Example - year,count.(Here- Count is fact)
    3.I make the count as duplicate column and set as percentage.
    4.If i create graph in pivot table itself then graph contains 3 column information i.e.,Year,Count,% Count.
    5 Here i unable to hide/remove original count column.
    My requirement is my graph has to contains 2 column information i.e., Year,%Count.
    How to achive this.kindly let me know.

  • Changing structure of tables

    Hi all,
    I would like to know whether it is possible to change the structure of tables in Visual Composer. As far as I know it is only possible to put characteristics and key figures in the colums of the table. However, I would like to put some characteristics in the rows of the table. Is this possible?
    Thanks in advance,
    Ralph

    If I understand you correctly, you are asking for a pivot control in VC, similar to the one in BW?
    Alas, there is no pivot control available in VC, but as long as you use e.g. MDX statements or BW queries and the dynamic port functionality (like in the adding columns), you can always add "rows". VC flattens the multidimensional result into a 2 dimensional.
    The number of rows itself is not limited.
    Other things known from WAD, like hierarchies in rows, automatic coloring, etc. is not available with the current version of VC.
    Hope this answers your question. If not, could you provide an example, what you would like to achieve?

  • 2 column definitions for a single table view

    Hi Experts,
    I have a requirement in which i need 2 column definitions for a single table view.
    The requirement is :
    ..............Week1...........              |....................Week2...............
    01/01/2007 |  02/01/2007  |    15/01/2007 | 16/01/2007 | 17/01/2007
    data.......... |  data..........  |    data.......... | data..........  |   data..........      
    data.......... |  data..........  |    data.......... | data..........  |   data..........    
    data.......... |  data..........  |    data.......... | data..........  |   data..........   
    the weeks shud be displayed for the corresponing dates below......
    Is it possible to have 2 column definitions
    Please help me out.
    Thanks in advance

    Hi Balaiji,
    proceed as follows:
    Create a structure in the dictionary called ZSTRU_USR02_F
      with  field1 type int4
              field3 type int4
              field3 type int4
    Create a table type in the dictionary:
    zusr02  line type ZSTRU_USR02_F.
    Create a structure in the dictionary:
    ZSTRU_USR02
      with tab1  type zusr02
      and tab2  type zusr02
    Create a table type in the dictionary:
    zttusr02 line type ZSTRU_USR02
    Create a controller (table.do) in a BSP-application
    Add the controller class to this controller.
    Add a attribute (table) instance public type zttusr02
    redefine method do_request, add the following coding:
      FIELD-SYMBOLS: <fs_tab> LIKE LINE OF table,
                     <fs_row> TYPE zstru_usr02_f.
      DATA: lirv_view TYPE REF TO if_bsp_page,
            lv_int    TYPE i.
    * Dispatch Input for event handling
      dispatch_input( ).
    * Navigation requested during Event handling?
      IF is_navigation_requested( ) IS NOT INITIAL.
        RETURN.
      ENDIF.
    * get some data into the table.
      INSERT INITIAL LINE INTO TABLE table ASSIGNING <fs_tab>.
      DO 3 TIMES.
        INSERT INITIAL LINE INTO TABLE <fs_tab>-tab1 ASSIGNING <fs_row>.
        ADD 1 TO lv_int.
        <fs_row>-field1 = lv_int.
        ADD 1 TO lv_int.
        <fs_row>-field2 = lv_int.
        ADD 1 TO lv_int.
        <fs_row>-field3 = lv_int.
      ENDDO.
      DO 3 TIMES.
        INSERT INITIAL LINE INTO TABLE <fs_tab>-tab2 ASSIGNING <fs_row>.
        ADD 1 TO lv_int.
        <fs_row>-field1 = lv_int.
        ADD 1 TO lv_int.
        <fs_row>-field2 = lv_int.
        ADD 1 TO lv_int.
        <fs_row>-field3 = lv_int.
      ENDDO.
    * Create the view
      lirv_view ?= create_view( view_name = 'table.htm' ).
    * Hand over the data
      lirv_view->set_attribute( name = 'table' value = table ).
    * Call the view
      call_view( lirv_view ).
    Create a view called table.htm. Add your controller class as controller class for the view and add the attribute table type zttusr02.
    Add the following to the layout:
    <%@page language="abap"%>
    <%@extension name="htmlb" prefix="htmlb"%>
    <htmlb:content design="design2003">
      <htmlb:page title = " ">
        <htmlb:form>
    <htmlb:tableView id             = "tableToDisplay"
                     table          = "<%=table%>"
                     emptyTableText = "No Data"
                     iterator       = "<%=controller%>"
                     footerVisible  = "FALSE"
                     encode         = "TRUE"
                     width          = "100%"/>
        </htmlb:form>
      </htmlb:page>
    </htmlb:content>
    Go back to your controller class. Add the interface IF_HTMLB_TABLEVIEW_ITERATOR
    Implement the method IF_HTMLB_TABLEVIEW_ITERATOR~GET_COLUMN_DEFINITIONS
      DATA: lwa_column  LIKE LINE OF p_column_definitions.
    * Column 1
      CLEAR lwa_column.
      lwa_column-columnname          = 'TAB1'.
      lwa_column-title               = 'Column 1'.
      lwa_column-tooltipheader       = 'Tooltip Column 1'.
      lwa_column-width               = '50%'.
      lwa_column-wrapping            = 'FALSE'.
      lwa_column-horizontalalignment = 'LEFT'.
      lwa_column-verticalalignment   = 'MIDDLE'.
      APPEND lwa_column TO p_column_definitions.
    * Column 1
      CLEAR lwa_column.
      lwa_column-columnname          = 'TAB2'.
      lwa_column-title               = 'Column 2'.
      lwa_column-tooltipheader       = 'Tooltip Column 2'.
      lwa_column-width               = '50%'.
      lwa_column-wrapping            = 'FALSE'.
      lwa_column-horizontalalignment = 'LEFT'.
      lwa_column-verticalalignment   = 'MIDDLE'.
      APPEND lwa_column TO p_column_definitions.
    Implement the method IF_HTMLB_TABLEVIEW_ITERATOR~RENDER_CELL_START and add:
      DATA: lr_tview   TYPE REF TO cl_htmlb_tableview.
      FIELD-SYMBOLS: <fs_row> LIKE LINE OF table.
      ASSIGN p_row_data_ref->* TO <fs_row>.
      CASE p_column_key.
        WHEN 'TAB1'.
          CREATE OBJECT lr_tview.
          lr_tview->id = p_cell_id.
          GET REFERENCE OF <fs_row>-tab1 INTO lr_tview->table.
          lr_tview->footervisible = ''.
          lr_tview->width = '100%'.
          p_replacement_bee = lr_tview.
        WHEN 'TAB2'.
          CREATE OBJECT lr_tview.
          lr_tview->id = p_cell_id.
          GET REFERENCE OF <fs_row>-tab2 INTO lr_tview->table.
          lr_tview->footervisible = ''.
          lr_tview->width = '100%'.
          p_replacement_bee = lr_tview.
      ENDCASE.
    With this you get a table in a table. Now if you create a second iterator you'll be able to adjust the apperance of the inner table, as well as you can add column headers.
    Hope that helps.
    Best Regards
    Michael

  • Structure & Internal Tables

    What is the difference between Structure & Internal Tables,
    Regards.

    Hi chidambar,
    to say simply the internal table can have data within it but a structure is that which can be used by an internal table to define its columns ,it cannot have data on its own
    coming to thoery this may help you,but dont confuse more with the theory
    Structures
    A structure is a sequence of any elementary types, reference types, or complex data types.
    You use structures in ABAP programs to group work areas that logically belong together. Since the elements of a structure can have any data type, structures can have a large range of uses. For example, you can use a structure with elementary data types to display lines from a database table within a program. You can also use structures containing aggregated elements to include all of the attributes of a screen or control in a single data object.
    The following terms are important when we talk about structures:
    Nested and non-nested structures
    Flat and deep structures
    A nested structure is a structure that contains one or more other structures as components. Flat structures contain only elementary data types with a fixed length (no internal tables, reference types, or strings). The term deep structure can apply regardless of whether the structure is nested or not. Nested structures are flat so long as none of the above types is contained in any nesting level.
    Any structure that contains at least one internal table, reference type, or string as a component (regardless of nesting) is a deep structure. Accordingly, internal tables, references, and strings are also known as deep data types. The technical difference between deep structures and all others is as follows. When you create a deep structure, the system creates a pointer in memory that points to the real field contents or other administrative information. When you create a flat data type, the actual field contents are stored with the type in memory. Since the field contents are not stored with the field descriptions in the case of deep structures, assignments, offset and length specifications and other operations are handled differently from flat structures.
    Internal Tables
    Internal tables consists of a series of lines that all have the same data type. Internal tables are characterized by:
    The line type, which can be any elementary type, reference type, or complex data type.
    The key identifies table rows. It is made up of the elementary fields in the line. The key can be unique or non-unique.
    The access method determines how ABAP will access individual table entries. There are three access types, namely unsorted tables, sorted index tables and hash tables. For index tables, the system maintains a linear index, so you can access the table either by specifying the index or the key.
    Hashed tables have no linear index. You can only access hashed tables by specifying the key. The system has its own hash algorithm for managing the table.
    You should use internal tables whenever you need to use structured data within a program. One imprint use is to store data from the database within a program.
    plz reward if helpful,
    plz get back to me for further queries.
    thanks and regards,
    srikanth tulasi.

  • A data table in one column of a dynamic data table

    Hi , I have to design a dynamic data table(with dynamic columns and data) which looks as the following
    DETAILS      NAME      ROLE NUMBER     CLASS     SECTION
    15     MATHS     SURESH     15     10     A
    20     SCIENCE                    
    25     ENGLISH     
    15     MATHS     SURESH     15     10     A
    20     SCIENCE                    
    25     ENGLISH          
    The data in the column 'DETAILS' should have inner table. The data in this inner table should have hyper links. If there is no inner table infor mation there shold be an image with hyperlink. This data table should also have pagination and sorting features. Please send me some example code for this. Please help me out as i have client demo on monday

    You may find this example useful: [http://balusc.blogspot.com/2006/06/using-datatables.html#NestingDatatables].
    To toggle between a nested datatable and a hyperlink with image just use the rendered attribute. E.g.
        <h:column>
            <h:dataTable rendered="#{!empty dataItem.innerList}">
            </h:dataTable>
            <h:commandLink rendered="#{empty dataItem.innerList}">
            </h:commandLink>
        </h:column>
    ...

  • How to add a column at the end of table in already designed document..?

    Hi,
    I am writing a javascript for adding a column at the end of table in Indesign document. using our plug-in we have created the Indesign document.
    Each table i want to add one extra column at the end. Is it possible..? please help me if anyone has idea regarding this.
    Thanks,
    Vimala L

    Hi Vimala,
    Please try the below JS code, This code will add the new column in every table last column after.
    var myTable = app.activeDocument.stories.everyItem().tables.everyItem().getElements();
    for(i=0; i<myTable.length; i++){
       myTable[i].columns.add(LocationOptions.after, myTable[i].columns[-1]);
    thx,
    csm_phil

  • LOV columns in read only adf:table problem

    Hello
    Adf 11, ADF BC
    I've create a table Test with a column called BranchNr, the value of the column comes from the BranchList table.
    I've created an EO and a VO for both tables.
    On the Test table attriute Branch I've create a list of values to the BranchList table which displays the BranchTable.BranchDesig based on the
    linke Test.BranchNr - BranchList.BranchNr
    Testing in the application module works fine, the BranchDeisg is displayed correctly and a new value can be selected from the list.
    However when I put the Test table as a read only table on a page the BranchNr column display the BranchNr number instead of looking up the corresponding BranchDesig value.
    If I change the column on the table to an ADF Select One Choice then the BranchNr is looked up and the BranchDesig is displayed but the column
    can be modified - on a read only table !
    How can I have a read only table that looks up and displays a value from a lov without having to create a new VO with a join query (Test-BranchList))
    Regards
    Paul

    Ok, I going to my glasses tomorrow
    - all that was needed was to change the column type to selctOneChoice
    and set the column to read only....
    Regards
    Paul

  • Setting the header of a Column group in a Advanced table dynamically

    Hi All,
    There is a requirement to set the Header of a column group in a Advanced table dynamically by fetching the values from a view attribute.
    Code :
    OAAdvancedTableBean spiderTbl1 ;
    Problem:
    It is not able to set the value for the header inspite of getting the handle of the bean.
    Analysis:
    the same piece of code works for
    1) Setting the text of the advanced table
    2) Setting the header of a column in a column group
    Please let me know if there is anything more that needs to be done for setting the prompt of a column group header.
    Thanks in advance!

    I have posted it without giving the complete code by mistake. Below is the code:
    OAAdvancedTableBean spiderTbl1 ;
    OASortableHeaderBean spiderHdr1;
    spiderTbl1 = (OAAdvancedTableBean)webBean.findChildRecursive("SpiderCatTbl1RN");
    if (spiderTbl1!=null){
    spiderHdr1= (OASortableHeaderBean)spiderTbl1.findChildRecursive("AnalogHdr");
    if (spiderHdr1!=null) {
    spiderHdr1.setAttributeValue(OAWebBeanConstants.PROMPT_ATTR,
    new OADataBoundValueViewObject(spiderHdr1,
    "SpiderCategory1",
    "ProjRegPVO1"));
    }

  • Differrences between structure and table in data dictionary in ABAP?

    What is the differrences between structure and table in data dictionary in ABAP?
    are they same?

    Tables :
    1. The place where the data is stored so that you can retrieve at any time.
    2. There can be more than one record stored
    Structures :
    1. The data / info stays only during the runtime of the application and will not get stored at all during the run time ....
    2. Only one record can be stored at the runtime .....
    A structure forms the skeleton of the table.
    A structure comprises components i.e., fields. Types are defined for the components A component can refer to an elementary type (via a data element or by directly specifying the data type and length in the structure definition), another structure or a table type. A structure can therefore be nested to any depth
    Tables can be defined independently of the database in the ABAP Dictionary. The fields of the table are defined with their (database-independent) data types and lengths.
    When the table is activated, a physical table definition is created in the database for the table definition stored in the ABAP Dictionary. The table definition is translated from the ABAP Dictionary to a definition of the particular database.

  • I want a count of distinct rows in a table

    I want a count of distinct rows in a table through a single query -- is it possible?
    eg.
    table-
    create table ch1 (a int, b int, c int, d int)
    insert ch1 values (1,1,1,1)
    insert ch1 values (2,2,2,2)
    insert ch1 values (1,1,1,1)
    insert ch1 values (2,2,2,2)
    insert ch1 values (1,3,4,5)

    hi,
    create table ch1 (a int, b int, c int, d int) ;
    insert into  ch1 values (1,1,1,1);
    insert into  ch1 values (2,2,2,2);
    insert  into  ch1 values (1,1,1,1);
    insert into  ch1 values (2,2,2,2);
    insert into  ch1 values (1,3,4,5);
    SQL> select * from ch1;
             A          B          C          D
             1          1          1          1
             2          2          2          2
             1          1          1          1
             2          2          2          2
             1          3          4          5
    SQL> select distinct * from ch1;
             A          B          C          D
             1          1          1          1
             1          3          4          5
             2          2          2          2
    SQL>
      1* select count(*) from( select distinct * from ch1)
    SQL> /
      COUNT(*)
             3
    SQL> ed
    Wrote file afiedt.buf
      1   select count(*) from (select a,b,c,d  from ch1
      2* group by a,b,c,d)
    SQL> /
      COUNT(*)
             3
    SQL> Thanks,
    P Prakash

  • "The Dictionary structure or table "*C865" is either not active or does"

    Hello experts,
    I have a transaction - VKOA. I get the following error on executing this t-code. The program used by this t code is SAPL089C.
    The error is
    Runtime errors         SYNTAX_ERROR
    Occurred on     11/23/2009 at   05:12:58                                                                               
    Syntax error in program "SAPL089C ".                                                                               
    What happened?                                                                               
    The following syntax error occurred in the program SAPL089C :                                  
    "The Dictionary structure or table "*C865" is either not active or does not exist."                       
    Error in ABAP application program.                                                                               
    The current ABAP program "SAPLSVIM" had to be terminated because one of the                    
    statements could not be executed.                                                                               
    This is probably due to an error in the ABAP program.          
    Error analysis             
    The following syntax error was found in the program SAPL089C :                       
    The Dictionary structure or table *C865 is either not active or does not exist.
    Please suggest a suitable solution to this problem...
    Many Thanks in adv.
    Kunal
    Edited by: kunal kotak on Nov 23, 2009 6:53 PM

    Hi ,
    I will try the solution propesed by Max.
    In the meantime, I would like to confirm if there is something related to SAP Note # SAP Note 72121. Refer the following details from the note.
    Symptom
    When you maintain account determination (FI or SD), you get the error
    message:
    The DDIC structure or table "*C400" is not active or does not exist.
    OR
    The system writes a dump with DBIF_NTAB_TABLE_NOT_FOUND, C400 was not
    found.
    C401 can also appear instead of C400.
    Additional key words
    Tables C400, C401.
    Program: SAPL089C, L089CT00
    Transaction: VKOA
    Solution as per the note
    1. Execute the program RV12A002. On the selection screen, enter Usage C,
    Tables 400 to 401.
    WARNING: Make sure that you only delete C400 and C401!
    Execute the program.
    2. Execute program RV12A001. On the selection screen, enter Usage C and
    mark 'Reports & Screens'.
    Can there be sometihing similar to this for C865 table as well. Just a thought.

  • Maximum Number Of Columns For A OBIEE Pivot Table?

    Hi All ,
    What is the Maximum Number of Columns for a OBIEE Pivot Table? Also what is default size of columns set for Pivot view in OBIEE 11g?
    Thanks In Advance.
    Qujes

    Hi,
    You can increase the maximum columns in a view by add some tags to instanceconfig.xml file.
    check this...http://obiee101.blogspot.com/2008/02/obiee-controling-pivot-view-behavior.html
    Regards,
    Srikanth
    Edited by: Srikanth Mandadi on Oct 15, 2010 10:04 AM

Maybe you are looking for

  • Dynamic text doubt

    HI all I have created alert catagory in alrtcatdef for sales order, and i configured swe2 for event. Whenever user create a sales order i have to trigger alert to users. I have configured in alrtcatdef.  I mentioned long text. Working file. but i wan

  • Equivalent WD method for file_open_dialog

    Hello, What is the equivalent method in WD ABAP for cl_gui_frontend_services=>file_open_dialog (to specify the path of a file in a pop-up)? I have a requirement wherein i want to specify the path in which a file will be saved in the local system. I c

  • Buttons not working on curve 8900

    hi guys im new to this. i have a bbcurve 8900 and all of the buttons have just stopped working the device loads and the screen comes on when i insert the battery. I can recieve calls txts bbms but cannot answer any of them as the buttons rent working

  • Camera Raw CS6: WHere is it?

    I have just noticed that I do not have Camera Raw in CS6 either that or it has changed locations from where it used to be in CS5.5

  • Interval variable for Calendar Day

    Hi Experts, Please help! We are working with CE VC 7.2, our model has an input form to a variable on calendar day (data source: BI Query).  We would like to input a date range using a from and to date picker.  How do we populate the values from the d