Solve this :about internal tables

hi experts,
could u pls solve this query asap.
i have 7 internal tables,
in  one internal table i've field
orgunits
1
2
3
4
in other internal tables i have fields like this
orgunits       personalnumbers
1                     11
2                     12
1                     13
1                     14
3                     15
1                     16
now i want how many personalnumbers in each orgunit.
i want the count.
so, how can i solve this in short coding.
example :for orgunit 1----
the count is 4.(11,13,14,15).
pls explain with coding as soon as possible.
thanks all.
Message was edited by:
        devender reddy

REPORT  ZTEST_00000 message-id zmsg.
data : cnt type i.
data : begin of itab1 occurs 0, "internal table with all org units
org type i, "change data type
end of itab1.
data : begin of itab2 occurs 0, "internal table with org units and pernrs
org type i, "change data type
per type i, "change data type
end of itab2.
data : begin of itab3 occurs 0, "internal table with org units and count of pernrs
org type i,
count type i,
end of itab3.
itab1-org = 1.
append itab1.
clear itab1.
itab1-org = 2.
append itab1.
clear itab1.
itab1-org = 3.
append itab1.
clear itab1.
itab1-org = 4.
append itab1.
clear itab1.
itab2-org = 1.
itab2-per = 10.
append itab2.
clear itab2.
itab2-org = 1.
itab2-per = 11.
append itab2.
clear itab2.
itab2-org = 2.
itab2-per = 9.
append itab2.
clear itab2.
itab2-org = 2.
itab2-per = 4.
append itab2.
clear itab2.
itab2-org = 2.
itab2-per = 7.
append itab2.
clear itab2.
itab2-org = 3.
itab2-per = 11.
append itab2.
clear itab2.
itab2-org = 4.
itab2-per = 14.
append itab2.
clear itab2.
sort itab2 by org per.
sort itab1 by org.
loop at itab2.
at new org.
clear cnt.
endat.
cnt = cnt + 1.
at end of org.
itab3-org = itab2-org.
itab3-count = cnt.
append itab3.
clear itab3.
endat.
endloop.
loop at itab1.
read table itab3 with key org = itab1-org.
if sy-subrc <> 0.
itab3-org = itab1-org.
itab3-count = 0.
append itab3.
clear itab3.
endif.
endloop.
sort itab3 by org count.
loop at itab3.
write :/ itab3-org , itab3-count.
endloop.
Regards
vasu

Similar Messages

  • Need information about Internal Tables

    Hi Every one!
    I Need some information about Internal tables. Pls help be above the same.
    Thanks & with Regards,
    Chandra.

    Hi..,
    <b>
    Internal tables </b>
    Internal tables provide a means of taking data from a fixed structure and storing it in working memory in ABAP. The data is stored line by line in memory, and each line has the same structure. In ABAP, internal tables fulfill the function of arrays. Since they are dynamic data objects, they save the programmer the task of dynamic memory management in his or her programs. You should use internal tables whenever you want to process a dataset with a fixed structure within a program. A particularly important use for internal tables is for storing and formatting data from a database table within a program. They are also a good way of including very complicated data structures in an ABAP program.
    Like all elements in the ABAP type concept, internal tables can exist both as data types and as data objects A data type is the abstract description of an internal table, either in a program or centrally in the ABAP Dictionary, that you use to create a concrete data object. The data type is also an attribute of an existing data object.
    <b>Internal Tables as Data Types</b>
    Internal tables and structures are the two structured data types in ABAP. The data type of an internal table is fully specified by its line type, key, and table type.
    <b>Line type</b>
    The line type of an internal table can be any data type. The data type of an internal table is normally a structure. Each component of the structure is a column in the internal table. However, the line type may also be elementary or another internal table.
    <b>Key</b>
    The key identifies table rows. There are two kinds of key for internal tables - the standard key and a user-defined key. You can specify whether the key should be UNIQUE or NON-UNIQUE. Internal tables with a unique key cannot contain duplicate entries. The uniqueness depends on the table access method.
    If a table has a structured line type, its default key consists of all of its non-numerical columns that are not references or themselves internal tables. If a table has an elementary line type, the default key is the entire line. The default key of an internal table whose line type is an internal table, the default key is empty.
    The user-defined key can contain any columns of the internal table that are not references or themselves internal tables. Internal tables with a user-defined key are called key tables. When you define the key, the sequence of the key fields is significant. You should remember this, for example, if you intend to sort the table according to the key.
    <b>
    Table type</b>
    The table type determines how ABAP will access individual table entries. Internal tables can be divided into three types:
    <u>Standard tables</u> have an internal linear index. From a particular size upwards, the indexes of internal tables are administered as trees. In this case, the index administration overhead increases in logarithmic and not linear relation to the number of lines. The system can access records either by using the table index or the key. The response time for key access is proportional to the number of entries in the table. The key of a standard table is always non-unique. You cannot specify a unique key. This means that standard tables can always be filled very quickly, since the system does not have to check whether there are already existing entries.
    <u>
    Sorted tables</u> are always saved sorted by the key. They also have an internal index. The system can access records either by using the table index or the key. The response time for key access is logarithmically proportional to the number of table entries, since the system uses a binary search. The key of a sorted table can be either unique or non-unique. When you define the table, you must specify whether the key is to be unique or not. Standard tables and sorted tables are known generically as index tables.
    <u>
    Hashed tables</u> have no linear index. You can only access a hashed table using its key. The response time is independent of the number of table entries, and is constant, since the system access the table entries using a hash algorithm. The key of a hashed table must be unique. When you define the table, you must specify the key as UNIQUE.
    <b>
    Generic Internal Tables</b>
    Unlike other local data types in programs, you do not have to specify the data type of an internal table fully. Instead, you can specify a generic construction, that is, the key or key and line type of an internal table data type may remain unspecified. You can use generic internal tables to specify the types of field symbols and the interface parameters of procedures . You cannot use them to declare data objects.
    <b>Internal Tables as Dynamic Data Objects</b>
    Data objects that are defined either with the data type of an internal table, or directly as an internal table, are always fully defined in respect of their line type, key and access method. However, the number of lines is not fixed. Thus internal tables are dynamic data objects, since they can contain any number of lines of a particular type. The only restriction on the number of lines an internal table may contain are the limits of your system installation. The maximum memory that can be occupied by an internal table (including its internal administration) is 2 gigabytes. A more realistic figure is up to 500 megabytes. An additional restriction for hashed tables is that they may not contain more than 2 million entries. The line types of internal tables can be any ABAP data types - elementary, structured, or internal tables. The individual lines of an internal table are called table lines or table entries. Each component of a structured line is called a column in the internal table.
    <b>
    Choosing a Table Type</b>
    The table type (and particularly the access method) that you will use depends on how the typical internal table operations will be most frequently executed.
    <b>
    Standard tables</b>
    This is the most appropriate type if you are going to address the individual table entries using the index. Index access is the quickest possible access. You should fill a standard table by appending lines (ABAP APPEND statement), and read, modify and delete entries by specifying the index (INDEX option with the relevant ABAP command). The access time for a standard table increases in a linear relationship with the number of table entries. If you need key access, standard tables are particularly useful if you can fill and process the table in separate steps. For example, you could fill the table by appending entries, and then sort it. If you use the binary search option with key access, the response time is logarithmically proportional to the number of table entries.
    <b>Sorted tables</b>
    This is the most appropriate type if you need a table which is sorted as you fill it. You fill sorted tables using the INSERT statement. Entries are inserted according to the sort sequence defined through the table key. Any illegal entries are recognized as soon as you try to add them to the table. The response time for key access is logarithmically proportional to the number of table entries, since the system always uses a binary search. Sorted tables are particularly useful for partially sequential processing in a LOOP if you specify the beginning of the table key in the WHERE condition.
    <b>
    Hashed tables</b>
    This is the most appropriate type for any table where the main operation is key access. You cannot access a hashed table using its index. The response time for key access remains constant, regardless of the number of table entries. Like database tables, hashed tables always have a unique key. Hashed tables are useful if you want to construct and use an internal table which resembles a database table or for processing large amounts of data.
    regards,
    sai ramesh

  • Briefly about internal tables

    briefly about internal tables
    standerd internal tables
    hash internal tables
    sorted internal tables
    index internal tables

    Hi,
    Internal tables : Internal tables provide a means of taking data from a fixed structure and storing it in working memory in ABAP. The data is stored line by line in memory, and each line has the same structure. In ABAP, internal tables fulfill the function of arrays. Since they are dynamic data objects, they save the programmer the task of dynamic memory management in his or her programs.
    Types of internal tables :
    The table type determines how ABAP will access individual table entries. Internal tables can be divided into three types:
    Standard tables have an internal linear index. From a particular size upwards, the indexes of internal tables are administered as trees. In this case, the index administration overhead increases in logarithmic and not linear relation to the number of lines. The system can access records either by using the table index or the key. The response time for key access is proportional to the number of entries in the table. The key of a standard table is always non-unique. You cannot specify a unique key. This means that standard tables can always be filled very quickly, since the system does not have to check whether there are already existing entries.
    Sorted tables are always saved sorted by the key. They also have an internal index. The system can access records either by using the table index or the key. The response time for key access is logarithmically proportional to the number of table entries, since the system uses a binary search. The key of a sorted table can be either unique or non-unique. When you define the table, you must specify whether the key is to be UNIQUE or NON-UNIQUE. Standard tables and sorted tables are known generically as index tables.
    Hashed tables have no linear index. You can only access a hashed table using its key. The response time is independent of the number of table entries, and is constant, since the system access the table entries using a hash algorithm. The key of a hashed table must be unique. When you define the table, you must specify the key as UNIQUE.
    Creating Internal Tables
    You define internal tables first as an abstract data type in the program or ABAP Dictionary, and then as a data object based on that, or they are declared directly as a fully specified data object. When you create an internal table as a data object, you should ensure that only the administration entry which belongs to an internal table is declared statically. The size of table headers for initial tables is currently 8 bytes. This should be heeded whenever internal tables occur as components of complex data objects. Also, empty tables can use up a relatively high amount of storage space as components of tables. The size of the entire storage space required for an internal table is not defined in the declaration – as is the case for data objects of the type string or xstring. Table rows are added to and deleted from the table dynamically at runtime by the various statements for adding and deleting records.
    Structure of internal tables :
    STRUCTURE OF INTERNAL TABLE
    TYPES : BEGIN OF ITAB,
                    PERNR TYPE PERSNO,
                    WERKS TYPE WERKS,
                   END OF ITAB.
    INTERNAL TABLE DECLARATION FOR THE ABOVE STRUCTURE
    DATA : INT_TAB TYPE STANDARD TABLE OF ITAB,
                WA_TAB TYPE ITAB.        "WORK AREA OF THE INTERNAL TABLE
    Thanks,
    Sakthi C
    Rewards if useful *

  • Details About Internal tables

    Hi Friends,
    Tell me diffrent type of iT with significance
    Thanks,
    Prasad

    Hi,
    I assume you are asking about the Internal Tables in ABAP.
    Types of IT:
    1.Standard Tables: Commonly used  ,here the search is made by Index.
    This is the most appropriate type if you are going to address the individual table entries using the index. Index access is the quickest possible access. You should fill a standard table by appending lines (APPEND statement), and read, modify and delete entries by specifying the index). The response time is proportional to the number of records.
    2.Sorted tables: search is  based on table key.
    You fill sorted tables using the INSERT statement. Entries are inserted according to the sort sequence defined through the table key.
    3.Hashed Tables:
    You cannot access a hashed table using its index. The response time for key access remains constant.
    Thanks,
    Felix

  • Clear idea about internal table.

    I'm new in sap. i need a clear idea about what is  table type , line type and  type groups   in internal table. and why we are using this ?  and give me an idea about work area also.. theses terms are confusing me. if possible please explain me with example. thanks in advance.
    Welcome to SCN - but please do not duplicate post or ask basic questions.
    Edited by: Rob Burbank on Apr 19, 2009 4:20 P

    I'm new in sap. i need a clear idea about what is  table type , line type and  type groups   in internal table. and why we are using this ?  and give me an idea about work area also.. theses terms are confusing me. if possible please explain me with example. thanks in advance.
    Welcome to SCN - but please do not duplicate post or ask basic questions.
    Edited by: Rob Burbank on Apr 19, 2009 4:20 P

  • About internal tables

    can anybody please tell me
    1. Please tell me How to retrieve data into INPUT/OUTPUT field.
    For example.When u display a particular row from emp table.I want to display the row number ie SY-TFILL in the INPUT/OUTPUT field.i need it very urgently.?
    2. 1. i have two internal tables. both tables which is having 5 records.
    itab1 itab2
    1 1
    3 3
    5 7
    6 9
    8 10.
    i want to develop an report which is used to print the same data (1,3) in both tables.
    in this only one time we are supposed to compare both internal tables?
    tell me logic how we will do that?
    2. in selection screen only one parameter field is there. in that i entered data and press enter?at that time what are all the events are supposed to trigger?
    3.can we delete data in one internal table with help of another internal table data?
    like let us consider this scenerio
    itab1 itab2
    material no description material no material type
    100 some 100 10
    101 thing 101 10
    103 line 103 13
    104 row type 104 15
    106 linetype 106 16
    can i delete material no (100,101)in itab1 with the help of record material type (10) of itab2

    To delete records with the help of other itab..
    have a look at following code...
    REPORT  zprax_try2.
    data:  begin of itab1 occurs 0,
            fld1(3),
           end of itab1,
           begin of itab2 occurs 0,
            fld1(3),
            fld2(2),
           end of itab2.
    initialization.
    append '100' to itab1.
    append '101' to itab1.
    append '102' to itab1.
    append '103' to itab1.
    append '104' to itab1.
    append '10010' to itab2.
    append '10110' to itab2.
    append '10011' to itab2.
    append '10111' to itab2.
    append '10210' to itab2.
    start-of-selection.
    loop at itab1.
    write:/ itab1-fld1.
    endloop.
    skip.
    loop at itab2.
    write:/ itab2-fld1, itab2-fld2.
    endloop.
    loop at itab2.
    check itab2-fld2 eq '10'.
    delete itab1 where fld1 = itab2-fld1.
    endloop.
    skip.
    loop at itab1.
    write:/ itab1-fld1.
    endloop.
    skip.
    loop at itab2.
    write:/ itab2-fld1, itab2-fld2.
    endloop.
    reward if useful
    regards
    Prax

  • How to update database table with this new internal table

    hi
    i have a internal table having 8 records and it contains one record which was modified by user
    not i want this new record to be updated to the database table which was modified by the user
    how to do it pls suggest?
    i want to use index for comarision as using index will not have any problems like promary key etc
    like i want to capture the index for this table which was modified thr recoed index and use thi record indext to modify the database table
    or any other suggestion
    regards
    nishant

    Hi Nishant,
    Have an additional field in a table to indicate a change with which you avoid in updating the record modified by user.
    Regards,
    Madhu.

  • SET_TABLE_FOR_DISPLAY - Edited value from dynamic internal table need to be captured

    Hi all,
    I have created  2 tabstrip screns which contain ALV GRID DISPLAY  in a container with dynamic internal table and editable columns .I want to capture the edited value from this ALV GRID display.I have used SET_TABLE_FOR_DISPLAY  and for this dynamc internal table is passed which is Field symbol and editable columns have to be captured for further updation into another ztable.
    When i used check_changed_data  i am getting dump as field symbol not assigned.
    Below is the code :  How can i get edited column value from below code
    call method alv_list->set_table_for_first_display
        exporting
                is_layout                     = gs_layout
        changing
          it_outtab                     = <fs_dynamic_table>
          it_fieldcatalog               = it_fieldcat[]
        exceptions
          invalid_parameter_combination = 1
          program_error                 = 2
          too_many_lines                = 3
          others                        = 4.
      if sy-subrc <> 0.
    * Implement suitable error handling here
      endif.
    Kindly help me to solve this.
    With Thanks,
    Dina.

    please provide more info about the dump to try to help you
    as max said, it could be because the field symbol is not global and if its global maybe you are not refering well to the column
    i assume that you are using "ASSIGN COMPONENT comp OF STRUCTURE struc TO <fs>" to capture the value changed
    validate always the sy-subrc after the assignment.
    but the check changed data have parameters that have the old and new values
    please provide more info...
    Regards

  • Internal table and work area

    Hi,
           can anybody explain the concepts of Internal table and work area.Thanks in advance.

    hai,
    This may help u.
    WORKAREA is a structure that can hold only one record at a time. It is a collection of fields. We use workarea as we cannot directly read from a table. In order to interact with a table we need workarea. When a Select Statement is executed on a table then the first record is read and put into the header of the table and from there put into the header or the workarea(of the same structure as that of the table)of the internal table and then transferred top the body of the internal table or directly displayed from the workarea.
    Each row in a table is a record and each column is a field.
    While adding or retrieving records to / from internal table we have to keep the record temporarily.
    The area where this record is kept is called as work area for the internal table. The area must have the same structure as that of internal table. An internal table consists of a body and an optional header line.
    Header line is a implicit work area for the internal table. It depends on how the internal table is declared that the itab will have the header line or not.
    e.g.
    data: begin of itab occurs 10,
    ab type c,
    cd type i,
    end of itab. " this table will have the header line.
    data: wa_itab like itab. " explicit work area for itab
    data: itab1 like itab occurs 10. " table is without header line.
    Internal tables are used for storing records which are obtained as a result when we use select statement on database. internal tables are run time entities and doesn't occupy any memory. they are dynamic.
    internal tables are of types.
    1. internal tables with header line. [header and body]
    2. internal tables with out header line. [only body]
    Workarea is the concept which is mainly useful when working with internal tables with out header line.
    at any point of time we can access only one record through header of a internal table. every thing should be done [inserting,modifying, reading ] through header only.
    ex: data: itab like standard table of mara with header line.
    for internal tables with out header line we will create a work area [explicit header] as type of table for storing data into internal table.
    ex: data: itab like mara,
    wa like mara.
    more about internal table types:
    Standard table:
    The key access to a standard table uses a sequential search. The time required for an access is linearly dependent on the number of entries in the internal table.
    You should usually access a standard table with index operations.
    Sorted table:
    The table is always stored internally sorted by its key. Key access to a sorted table can therefore use a binary search. If the key is not unique, the entry with the lowest index is accessed. The time required for an access is logarithmically dependent on the number of entries in the internal table.
    Index accesses to sorted tables are also allowed. You should usually access a sorted table using its key.
    Hash table:
    The table is internally managed with a hash procedure. All the entries must have a unique key. The time required for a key access is constant, that is it does not depend on the number of entries in the internal table.
    You cannot access a hash table with an index. Accesses must use generic key operations (SORT, LOOP, etc.).
    Hashed tables
    This is the most appropriate type for any table where the main operation is key access. You cannot access a hashed table using its index.
    The response time for key access remains constant, regardless of the number of table entries. Like database tables, hashed tables always
    have a unique key. Hashed tables are useful if you want to construct and use an internal table which resembles a database table or for
    processing large amounts of data.
    TYPES VECTOR TYPE HASHED TABLE OF I WITH UNIQUE KEY TABLE LINE.
    TYPES: BEGIN OF LINE,
    COLUMN1 TYPE I,
    COLUMN2 TYPE I,
    COLUMN3 TYPE I,
    END OF LINE.
    DATA ITAB TYPE HASHED TABLE OF SPFLI
    WITH UNIQUE KEY CARRID CONNID.
    with regards,
    B.Sowjanya,
    reward points if helpful.

  • Memory released after delete in internal tables ?

    hi friends,
    i have one quick question about internal tables and memory consumption.
    if i have an internal table of say 100 entries and that does occupy memory for 100 entries. now if i delete 20 lines of this table...is the memory occupied by those 20 also released/freed or will the table size be 100 also and just the 20 deleted lines empty ?

    Hi!
    If you defined you table with the OCCURS 100 statement, then it will allocate always at least 100 records.
    The other tables will occupy only the memory size of their actual record length * record number bytes (plus some header information).
    Use REFRESH / FREE statement to delete the contents of unneccessary internal tables.
    Regards
    Tamá

  • How internal tables are physicaly located in memory?

    Array, chained list, or else? Plese provide any opinion or documentation.
    Sincerely yours, Long Nguyen.

    A data model is an abstraction of a part of the real world which is represented using formal structures. A relational database basically uses one formal structure known as a table.
    A table can be defined as a two-dimensional matrix made of rows and columns. It can also be described as a group of records of the same type.Records are groups of fields based on existing data types. These data types are previously defined in the datadictionary. A table is a similar concept to a conventional indexed file; the difference is that in the relational model the main index is known as the primary key, which is made of one or more fields of the record. A record is also known as tuple or simply a row. The most significant feature of the primary key is that it identifies univocally one and only one record of the table: a table does not permit records with duplicated primary keys.
    Structures. The object structure refers to the definition of a compound object that does not have any content. It's like a table or a view, but it never has entries: it's only a structure. These types of objects are used in programs for defining data structures or for defining data in the interfaces from the module pools and the screens. The basic difference between structures and tables (or views) is that the
    structure does not exist at the underlying database system level; however, both tables and views do exist in the database. Structures only exist as definitions in the dictionary. As a result, structures do not need to be activated.
    Table. As previously explained, a table is a two-dimensional data matrix. A table can contain zero or many rows, corresponding to the predefined table structure (entity type). This is, at the same time, a complex structure, which can be made up of one or several fields (attributes). Every row that makes up the database table has the same structure and properties. The fields that make up the structure of the table records, as well as its attributes, permitted value range, and so on, are set when defining the table.
    Some general recommendations for internal tables:
    •     As long as all that you need from an internal table is to append lines to it and perhaps to sort it after filling it, standard tables are still the best choice. The other table kinds are too expen-sive for these simple tasks. Keep in mind that when inserting or deleting lines in index tables containing many lines, the administration of the logical index that manages the lines of the ta-ble internally can become expensive, with regard to performance and additional memory space. Only for standard tables that are filled with APPEND only, and where no lines are de-leted except for the last line, is there no need for a logical index, and hence
    no additional costs are incurred.
    •If memory space is an issue, for very large internal tables (> 500000 lines) with a
    small line size, sorted tables might be preferable to hashed tables, since for internal administration, they need only 6 bytes per line compared to 18 bytes for hashed tables.
    •When declaring internal tables, use the addition INITIAL SIZE only for inner tables in nested tables. For outer tables, the automatic allocation of initial memory size is appropriate. For inner tables, though, it may result in saving a large amount of memory.
    •When reading internal tables with READ TABLE or LOOP AT, choose the appropriate output behavior. Writing into a work area wa with the addition INTO wa is only necessary if you want to change the work area without influencing the internal table. For pure reading purposes or for modifying the contents of the internal table, the additions ASSIGNING <fs> for assigning internal table lines to a field symbol <fs> and REFERENCE INTO dref for setting a refer-ence in a data reference variable dref to internal table lines are the better choices by far.
    •Use CLEAR instead of REFRESH for internal tables. The reason is that for internal tables with-out header lines, the general statement CLEAR does exactly the same as the special state-ment REFRESH. Since internal tables with header lines should no longer be used, the state-ment REFRESH is effectively obsolete. In order to free more memory, you can consider the use of FREE.
    •The statement COLLECT should no longer be used for standard tables — use COLLECT mainly for hashed tables. The reason is that COLLECT is based on a hash algorithm. While the hash administration of a hashed table is always available and robust, for standard tables a temporary hash administration must be created when the COLLECT statement is used. This temporary hash administration is invalidated when the table is accessed for changing. If fur-ther COLLECT statements are entered after an invalidation, a linear search of all table rows must be performed. Furthermore, COLLECT only works properly on internal tables with unique lines, while a unique table key is guaranteed for hashed tables only. Therefore, for standard tables it cannot be guaranteed that the contents will always be suitable for editing using COLLECT.
    •Don’t use APPEND SORTED BY — use SORT instead. The reason is that creating a ranked list with APPEND SORTED BY is based on several assumptions about the internal table and how it is filled. Using SORT is the general method that can be applied to all kinds of table and inde-pendent from the mode of filling.
    Chk these links for more information about internal tables
    internal tables
    Regards,
    Balaji Reddy G
    **Rewards for helpful answers

  • Column names of a dynamic internal table

    Hi Friends,
    I have a dynamic internal table flowing in my ABAP program and I want to list down the column names of the this dynamic internal table.
    The declaration of this dynamic internal table :
       FIELD-SYMBOLS:
        <l_t_data>         TYPE STANDARD TABLE.
    Can you please tell me how to get the column names?
    Thanks,
    Gaurav

    Hi,
         You can use ABAP Runtime Type Identification to get the column names of the internal table.
    e.g >
    >lo_itab holds reference to description object of internal table whose column names i have to extract.
    >Using method describe_by_data of class cl_abap_typedescr export the field symbol assigned to the table and import the object reference into lo_itab.
    >Then using method get_table_line_type of lo_itab import line type description object reference into lo_line.
    >Check if lo_line is referring to a structure, if yes , downcast it to a object reference lo_struct of type cl_abap_structdescr.
    >The column description of all columns in the structure is stored in 'components' table of cl_abap_structdescr.
         So loop at the table to get all the column names stored in column 'name' of table 'components'.
    Thank You.

  • Problem to upload the data into internal table record length more than 6000

    Hi all
            I stuck with this problem from past 3 days. I have to upload the data from excel sheet. iam making it tab delimited and trying to upload from gui_upload. but in the structure of file, we have, one field of 4000 characters, and other fields of 255 characters.
    how can i upload this into internal table . From excel sheet or from tab delimeted or any other format? or any special function module is there?  while iam doing this its truncating the datat 255 characters and not uploading the other fields also...
    can any one of you help me out. ASAP
    thnks in advance

    from one of the forum iam just pasting code which it is used in lsmw, try the same logic in ur code hope it can work.
    you have to create multiple lines with do...enddo loop., like this:
    (assuming excel_long_text-text is 924 characters long, 7 lines X 132 char)
    __GLOBAL_DATA__
    data: offset type i,
    text_132(132) type c.
    __BEGIN_OF_RECORD__ Before Using Conversion Rules
    Rule : Default Settings Modified
    Code: /sapdmc/ltxtl = init_/sapdmc/ltxtl.
    CLEAR offset.
    DO 7 TIMES.
    text_132 = excel_long_text-text+offset(132).
    offset = offset + 132.
    __END_OF_RECORD__ After Using Conversion Rules
    Rule : Default Settings Modified
    Code: transfer_record.
    ENDDO.
    also check this
    COMMIT_TEXT
    To load long text into SAP
    READ_TEXT
    To load long text into SAP

  • Get the fieldnames of a generic internal table or work area

    Hi All,
           I have one generic work area which I have created in the below manner...
    * ET_DATA itself is a generic table of type ANY...can have any internal table data in it.
    * Create dynamic internal table
      CREATE DATA lv_new_table LIKE et_data.
      ASSIGN lv_new_table->* TO <fs_dyn_table>.
    * Create dynamic work area and assign to fieldsymbol.
      CREATE DATA lv_new_line LIKE LINE OF <fs_dyn_table>.
      ASSIGN lv_new_line->*   TO <fs_dyn_wa>.
    Now...I need to get the field names of this dynamic internal table or work area..
    I have already searched in forum...got many answers..but none them gives me the output.
    Please note that I require the field names and not field position..
    Awaiting your suggestions on how to get field names of this dynamic work area...

      create data wa_ref like line of it_data.
      assign wa_ref->* to <p_data>.
      desc_table ?= cl_abap_tabledescr=>describe_by_data( it_data ).
      desc_struc ?= desc_table->get_table_line_type( ).
      describe field <p_data> type rtty components ncom.
    This one is working in our environment without any error. it_data is an importing parameter in the signature of a method of type any table.

  • Search in Internal Table Utility -- Need Pointers

    Hi Experts,
    As per my requirement i need to search for words in internal table and arrange internal table based on ranking i.e record which has maximum no. of hits should come first.
    Example: search for a string 'media rent'.
    Incoming internal table records.
    row1------>   col1: rent                    col::xyz 
    row2 -
    >   col1:media rent          col2:media
    row3 -
    >  col1: rent                     col2:media  media
    I need to compare each word in col1 and col2 and arrange the rows based on ranking like this:
    final internal table
    row2 because it has maximum no. of search term
    row3
    row1
    I found out 2 ways to do the above but facing some issues and need your suggestions:
    Solution 1:
    By using regualr expression i am searching as OR expression on itab.
    and using FIND ALL OCCURRENCES OF REGEX command on each column of internal table
    Issue: when row3 is scanned for 'media rent' it will give 3 counts i which will lead to move row3  on top in final table due to maximum no of counts.
    Is there a way to neglect 2nd occurence in the word ? I cn't use find first occurence here.
    Solution 2:
    Split search sting 'media rent' into internal table
    itab1
    media
    rent
    and search for each word in each row of internal table and make use of counter something like this.i am unable to proceed further here
    I am stucked with what kind of logic should be here ?
    Looking for your suggestions here.

    Hi fried,
    Try the code below it works fine.
    TYPES : BEGIN OF ty_text,
            text1 type char11,
            text2 TYPE char11,
            count TYPE i,
            END OF ty_text.
    data : t_text TYPE TABLE OF ty_text,
           x_text TYPE ty_text.
    DATA : v_count TYPE i.
    x_text-text1 = 'rent'.
    x_text-text2 = 'xyz'.
    append x_text to t_text.
    x_text-text1 = 'media'.
    x_text-text2 = 'media'.
    append x_text to t_text.
    x_text-text1 = 'rent'.
    x_text-text2 = 'media media'.
    append x_text to t_text.
    loop at t_text INTO x_text.
    if x_text-text1 eq 'media' or x_text-text1 eq 'rent'.
      v_count = v_count + 1.
    endif.
    if x_text-text2 eq 'media' or x_text-text2 eq 'rent'.
      v_count = v_count + 1.
    endif.
    x_text-count = v_count.
    MODIFY t_text INDEX sy-tabix FROM x_text.
    clear v_count.
    ENDLOOP.
    SORT t_text DESCENDING by count.
    If you face any issues please revert back to me i will help you.
    Thanks,
    Sri Hari

Maybe you are looking for

  • Shipping Question

    I just ordered a new laptop computer. Currently, on the bestbuy.com website is the following wording: "Free express shipping on computers with Windows 7 preloaded. Pre-order by 11 am ET on October 21, and it will arrive at your door on October 22." W

  • Can I use an external hard drive for my ipad mini?

    Can I use an external hard drive for my ipad mini?

  • Flex 3 Issues - case noise, heat, fan

    Just got the Flex 3 15.6" (i7, 1 TB HDD + 8 GB SSD), and I am noticing a few issues: 1) When I push down with a finger on the base underneath the hard drive area, it gives in and makes a clicking noise (the case, not the hard drive). Kind of annoying

  • How to go to preceding page of the safari

    Dear sir I am user from Taiwan I have  a small trouble about safari Sometime the safari can not going to preceding page It was shown that line FB Google+  Mail on the page lower So how to preceding page From Odon

  • My daughter forgot her passcode to her iphone?

    she cant remeber her passcode what can we do to gain access of the phone once again?