Divide the internal table for months

How to divide the internal table itab for the months?
I have a field data in internal table itab and now i have need to divide itab in n table for months.
The data interval is max 4 months.
Sorry for my english.
ex. itab.
data: begin of itab occurs 0,
             data LIKE vbak-erdat,
             num_ord LIKE vbap-vbeln,
             gruppo LIKE mara-labor,
        end of itab.

I have solved in this method:
SORT tab_gia DESCENDING BY data.
  tmp_mese = tab_gia-data+4(2).
  LOOP AT tab_gia.
    IF tmp_mese EQ tab_gia-data+4(2).
      IF flag1 = 'TRUE'.
        MOVE tab_gia-data     TO mese1-data.
        MOVE tab_gia-gruppo   TO mese1-gruppo.
        MOVE tab_gia-tipo     TO mese1-tipo.
        MOVE tab_gia-matnr    TO mese1-matnr.
        MOVE tab_gia-giacenza TO mese1-giacenza.
        APPEND mese1.
      ENDIF.
      IF flag2 EQ 'TRUE'.
        MOVE tab_gia-data     TO mese2-data.
        MOVE tab_gia-gruppo   TO mese2-gruppo.
        MOVE tab_gia-tipo     TO mese2-tipo.
        MOVE tab_gia-matnr    TO mese2-matnr.
        MOVE tab_gia-giacenza TO mese2-giacenza.
        APPEND mese2.
      ENDIF.
      IF flag3 EQ 'TRUE'.
        MOVE tab_gia-data     TO mese3-data.
        MOVE tab_gia-gruppo   TO mese3-gruppo.
        MOVE tab_gia-tipo     TO mese3-tipo.
        MOVE tab_gia-matnr    TO mese3-matnr.
        MOVE tab_gia-giacenza TO mese3-giacenza.
        APPEND mese3.
      ENDIF.
      IF flag4 EQ 'TRUE'.
        MOVE tab_gia-data     TO mese4-data.
        MOVE tab_gia-gruppo   TO mese4-gruppo.
        MOVE tab_gia-tipo     TO mese4-tipo.
        MOVE tab_gia-matnr    TO mese4-matnr.
        MOVE tab_gia-giacenza TO mese4-giacenza.
        APPEND mese4.
      ENDIF.
    ELSE.
* trovato un altro mese.
      cnt = cnt + 1.
      tmp_mese = tab_gia-data+4(2).
      CASE cnt.
        WHEN 2.
          flag1 = 'FALSE'.
          flag2 = 'TRUE'.
        WHEN 3.
          flag2 = 'FALSE'.
          flag3 = 'TRUE'.
        WHEN 4.
          flag3 = 'FALSE'.
          flag4 = 'TRUE'.
      ENDCASE.
    ENDIF.
  ENDLOOP.
thanks!!!
Edited by: Alfonso Manzo on May 28, 2008 1:51 PM
Edited by: Alfonso Manzo on May 28, 2008 1:52 PM

Similar Messages

  • Number of entries in the internal table for perticular field value

    hi All,
    Is this possible to get the count of records from the internal table for a perticular field value.
    currently my requirement is to get the entries from the internal table which does not have two records for perticular field value (say a = 123) whose status is active (say b = 'X').
    also suggets should use LOOP or DELETE or DESCRIBE for a internal table to ful fill this requirement.
    Thanks in advance.
    Pradeep

    Try like this..
    Create another table itab2 with same structure as itab1 & move the contents of itab1 to itab2
    ITAB2[] = ITAB1[].
    Then delete entries from itab2
    Delete itab2 whete a = '123' and b = 'X'
    Then use Describe statement to get the no of entries
    Describe table itab2 lines v_lines.
    Hope this helps...

  • How to Read the internal table for the data download from the spool

    HI all,
    I have one issue regarding the spool ,we are getting the correct output as per requirement of  user but when we send the same to the user in pdf format they did notget the same.
    they are telling that the due date is missing from the pdf.
    Please advice me how to track the internal  table for the spool data converted intopdf in a readable format.
    the FM used for the above task is : 
    call function 'CONVERT_OTFSPOOLJOB_2_PDF'
    Please reply if any one worked on the same.
    Thanks in advance.
    Gaurav,

    Hi Wang,
    Please let me know how you solved your question.
    Points will be rewarded.
    Thanks,
    Arun.

  • Creating MS- Access data base from the Internal tables data of an ABAP Prog

    Hi,
    I have a requirement where I have to create Access tables from the Internal tables of ABAP program.
    The tables are like Project systems Header data, WBS elements data, Netwrok data, Activity data, Milestone data and Project revunes. I will have the internal tables for these. I want to transfer these tables data into MS-Access tables onto Users desktop.
    Please adivce me how to do this.
    Thanks,
    Prabhakar

    HI,
    I am trying to create a DB table in the access but I am not successful. The following is the format of the table needs to be created from the ABAP program.
    I have created a table with the following format in MS-Access with the name tblHeader. Is it neccessary to create a DB table ( MS-Access) in advance or by using the FM  STRUCTURE_EXPORT_ TO_MSACCESS  we need to create a structure in MS-Access?
    False tblHeader
    Field Name Type Length
    ProjectDef Text 255
    ProjectDes Text 255
    Created Text 50
    Change Text 50
    RespPerson Text 255
    Profile Text 255
    Plant Text 255
    ObjNo Text 255
    OverheadKey Text 255
    I have created a Z table ZTAB1 with the same format from the SAP fields.
    MS-Access Table name : tblHeader
    ABAP program Internal table : t_tblheader
    Z table Name : ZTAB1.
    First I am trying to create a structure in MS-Access with the following FM.
    CALL FUNCTION 'STRUCTURE_EXPORT_ TO_MSACCESS'
    EXPORTING
    dbname = 'D:\test\db2'
    LANGU = SY-LANGU
    dest = 'PS_ACCESS_1'
    TABLES
    tabname = ttblheader
    EXCEPTIONS
    system_failure = 1
    comm_failure = 2
    OTHERS = 3
    Table ttblheader type is DFIES and I am filling the table with only one record and one field i.e TABNAME and the value is ZTAB1.
    The source code of the FM is using another FM
    CALL FUNCTION 'MSACCESS_STRUCT_ EXPORT_RFC' DESTINATION DEST
    Here I am getting the Error message Object required. I can't able to create a table structure in MS-Access.
    Next I am going to Use the FM
    'TABLE_EXPORT_ TO_MSACCESS'
    and it will create the records in the MS-access table.
    CALL FUNCTION 'TABLE_EXPORT_ TO_MSACCESS'
    EXPORTING
    dbname = 'D:\test\db2'
    langu = sy-langu
    dest = 'PS_ACCESS_2'
    tabname = 'ZTAB1'
    reftable = 'tblheader'
    FLG_NO_DOWNLOAD = ' '
    FLG_APPEND = ' '
    FLG_POPUP = ' '
    TABLES
    dtab = t_tblheader
    here t_tblheader is the internal table.
    Reftable = tblheader is the table which i have created in advance. ( not by using the First FM)
    In this FM i am getting a error message : Unable to connect to Database D:\test\db2.
    Please help me how to create the MS-Access database.

  • Checkbox as one of the field in the internal table in the list

    Hi,
    I have a requirement of processing the certain records of the internal table for which checkboxes are selected in the list.
    The selected records need to be updated in the custom table and the unselected records need to be ignored.
    I have created the PF status and the application tool bar and a button on the tool bar.
    Then when the report is executed the list is displayed with the records with one of the field as a checkbox.
    At user-command.
    Then in the at user-command handling the button click event.
    I want to know which records are been selected and which are not.
    If some one knows please let me know.
    Thanks
    S Patel

    This is exactly what you need to do:-
    PBO
    CREATE OBJECT g_custom_container
             EXPORTING container_name = g_container.
      CREATE OBJECT g_grid
             EXPORTING i_parent = g_custom_container.
    Select data from your table
      PERFORM select_data CHANGING pt_outtab[].
    Build fieldcat
      PERFORM build_fieldcat CHANGING pt_fieldcat.
    Exclude standard buttons from the Toolbar
      PERFORM exclude_tb_functions CHANGING lt_exclude.
    Display output in ALV grid
      CALL METHOD g_grid->set_table_for_first_display
        EXPORTING
          it_toolbar_excluding = lt_exclude
        CHANGING
          it_fieldcatalog      = pt_fieldcat
          it_outtab            = pt_outtab[].
    PAI
    Get modified data
      CALL METHOD gv_grid->check_changed_data.
      LOOP AT gt_output INTO wa_output WHERE zzchkbox EQ c_x.
        MOVE-CORRESPONDING wa_output TO wa_selblk.
        APPEND wa_selblk TO lt_selblk.
      ENDLOOP.
    This method will give you all the records which are selected in the list output. Collect them and modify your custom table.
    Edited by: Rudresh Chand on Feb 28, 2010 8:26 AM

  • Totals for the internal table field in alv

    Hi Gurus,
    I have an issue in displaying the totals in alv.
    I have an internal table with the three fields like below.
    scrap_code_001 like afru-xmnga, " Scrap Reason Qty.
    scrap_code_002 like afru-xmnga, " Scrap Reason Qty.
    scrap_code_003 like afru-xmnga, " Scrap Reason Qty.
    In the output table which i am passing to the fieldcatlog is having the three above fields with values 10,3,4 respectively.
    I am looping at the internal table
    loop at gt_grund.
    gv_tabix = sy-tabix.
    i_fieldcat-no_zero = gc_x.
    i_fieldcat-do_sum = gc_x.
    perform assign_alv_qty_format.
    if gt_grund-grund is initial.
    gt_grund = 'NONE'.
    gv_text = gt_grund.
    else.
    gv_text = gt_grund-grdtx.
    endif.
    gv_tabixn = gv_tabix.
    gv_scrap_code+11(03) = gv_tabixn.
    gv_fieldname = gv_scrap_code.
    translate gv_fieldname to upper case.
    perform bild_fieldcat using
    gv_fieldname 'GT_REPORT' 'AFRU' gv_text 'QUAN' '12' ' ' .
    endif.
    endloop.
    But in the output I am getting the totals but it displays totals for all the three columns as 17,17,17 (summing 10,3,4).
    How do I display total as 10,3,4 for each column separately.
    I appreciate you help and award points for the answer

    Hi,
    Please check if value fields i_fieldcat-ref_fieldname and i_fieldcat-ref_tabname regard to numc or curr type.
    EX: i_fieldcat-ref_fieldname = 'WRBTR'
           I_fieldcat-ref_tabname = 'BSEG'.
    Regards,
    Fernando

  • No extended memory for the internal table

    Hi all,  I created one filed in the selection screen with f4 help, this is the code i writtenAT SELECTION-SCREEN ON VALUE-REQUEST FOR PA_BKTXT.
    SELECT  BKTXT  INTO TABLE T_BKTXT from mkpf.
    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
      EXPORTING
      DDIC_STRUCTURE         = ' '
        RETFIELD               =  'BKTXT'
      PVALKEY                = ' '
       DYNPPROG               = SY-CPROG
       DYNPNR                 = SY-DYNNR
       DYNPROFIELD            = 'PA_BKTXT'
      STEPL                  = 0
    WINDOW_TITLE           = ' '
      VALUE                  = ' '
       VALUE_ORG              = 'S'
      MULTIPLE_CHOICE        = ' '
      DISPLAY                = ' '
      CALLBACK_PROGRAM       = ' '
      CALLBACK_FORM          = ' '
      MARK_TAB               =
    IMPORTING
      USER_RESET             =
      TABLES
        VALUE_TAB              = T_BKTXT
      FIELD_TAB              =
      RETURN_TAB             =
      DYNPFLD_MAPPING        =
    EXCEPTIONS
      PARAMETER_ERROR        = 1
      NO_VALUES_FOUND        = 2
       OTHERS                 = 3.
    IF SY-SUBRC <> 0.
    REFRESH T_BKTXT.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    <b>and the internal table i declared is</b>  DATA: BEGIN OF T_BKTXT OCCURS 0,
      PA_BKTXT type MKPF-BKTXT,
      END OF T_BKTXT. please let me know how to solve this issue.

    Hi  friend  ... please see this 
    Here is the example program for the F4 impelemting to the Selection Parameter ..
    REPORT demo_dynpro_f4_help_module .
    TYPES: BEGIN OF values,
             carrid TYPE spfli-carrid,
             connid TYPE spfli-connid,
           END OF values.
    DATA: carrier(3) TYPE c,
          connection(4) TYPE c.
    DATA: progname TYPE sy-repid,
          dynnum   TYPE sy-dynnr,
          dynpro_values TYPE TABLE OF dynpread,
          field_value LIKE LINE OF dynpro_values,
          values_tab TYPE TABLE OF values.
    CALL SCREEN 100.
    MODULE init OUTPUT.
      progname = sy-repid.
      dynnum   = sy-dynnr.
      CLEAR: field_value, dynpro_values.
      field_value-fieldname = 'CARRIER'.
      APPEND field_value TO dynpro_values.
    ENDMODULE.
    MODULE cancel INPUT.
      LEAVE PROGRAM.
    ENDMODULE.
    MODULE value_carrier INPUT.
      CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'
           EXPORTING
                tabname     = 'DEMOF4HELP'
                fieldname   = 'CARRIER1'
                dynpprog    = progname
                dynpnr      = dynnum
                dynprofield = 'CARRIER'.
    ENDMODULE.
    MODULE value_connection INPUT.
      CALL FUNCTION 'DYNP_VALUES_READ'
           EXPORTING
                dyname             = progname
                dynumb             = dynnum
                translate_to_upper = 'X'
           TABLES
                dynpfields         = dynpro_values.
      READ TABLE dynpro_values INDEX 1 INTO field_value.
      SELECT  carrid connid
        FROM  spfli
        INTO  CORRESPONDING FIELDS OF TABLE values_tab
        WHERE carrid = field_value-fieldvalue.
      CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
           EXPORTING
                retfield    = 'CONNID'
                dynpprog    = progname
                dynpnr      = dynnum
                dynprofield = 'CONNECTION'
                value_org   = 'S'
           TABLES
                value_tab   = values_tab.
    ENDMODULE.
    reward points if it is usefull ...
    Girish

  • INSERT works for only last record of the Internal table ...??

    I am trying to insert data from an internal table JTAB to a Databse Table
    in CRM. The name of the databse table in CRM is CRMD_PARTNER
    For this i first declared an internal table JTAB with same structure as that of
    the databse table CRMD_PARTNER
    DATA: BEGIN OF JTAB OCCURS 0,
         INCLUDE STRUCTURE CRMD_PARTNER,
          END OF JTAB.
    Then I filled my JTAB with the required entries. For filling the JTAB i am
    getting data from couple of other tables and filling the internal table JTAB
         loop at ktab.
    here i am filling values in JTAB and then i say APPEND JTAB.
            endloop.
         Till here every thing works well and my internal table JTAB has all values that
    I need to insert to the CRMD_PARTNER table. Also my JTAB has vales for all primary key fields.
    Now I write a condition like below.
    if not jtab[] inital.
    MODIFY CRMD_PARTNER from TABLE JTAB.
    COMMIT WORK.
    endif.
    Here comes the problem...once this code is executed and once program totally executes...
    i always see that only last record in JTAB is being inserted to the databse table CRMD_PARTNER.
    When i check in the debugger ..i see that the loop is being executed only once
    and the SY-TABIX of JTAB is being always set to the length of JTAB and
    that is why only last  record is being inseretd to the table CRMD_PARTNER.
    Now what should i do ..to insert all records of JTAB to CRMD_PARTNER table?
    is there a way i can restet the SY-TABIX and make the modify statement work for all records of JTAB?
    Finally i hardcoded the values in JTAB then i dont have any problem and all records of JTAB are being
    inserted into the database table.
    only if i am dynamically fetching the values into JTAB(by Putting in loop..endloop statements and
    pushing values to JTAB and APPENDING JTAB ) i have a problem .
    in this case also my JTAB is being correctly filled with values ..but when i try to
    insert theses values to CRMD_PARTNER with MODIFY stmt ..only always last record is being inserted.
    i tried with INSERT instead of MODIFY and i am getting runtime error.
    kindly pease help.
    Regards,
    Jessica Sam

    yes a@s i am really struggling from last 3 days.
    I actually want to create a sales order in CRM and want to
    assign ship to party for each line item in a sales order in CRM
    for that i used the standard bapi BAPI_BUSPROCESSND_CREATEMULTI and i am able
    to create an order successfully, but i see that the ship toparty
    that i give at header is being copied to each line item.
    but this is not what is expected.
    So finally i tracked in which table the ship to party gets stored in each line item
    and then tried to insert the records directly into databse. and it worked
    but only if i am hardcoding..but not when i am dynamically fecthing the values into JTAB for insertion,
    Can yoy help ..if you have any idea why insert/modify is processing only last record?
    any help will be highly appreciated.
    Regards,
    Jessica Sam

  • Internal table for the result area

    hey
    where do the result area data stored in after the search? is it in internal table??. If so is there any possibility of finding the internal table?
    thanks in advance

    Hi Shailaja,
    You can check as pointed by Vijay, which is at the Framework Level.
    For Application Level (specific to your PCUI Appl), the QEURY method of your class (assigned to Search Area screen) returns the list of found object keys (based on the search query) to the READ method. The READ method now queries the backend, for the supplied object keys and stores all the result data in export parameter ET_SCREEN_SRTUCTURE.
    Now the Framework with the help of One Order Interaction Layer, pumps the data to the Data Context Layer as pointed by Vijay.
    So in order to do any data massaging, you can do it at internal table et_screen_structure.
    But whatever changes you do in et_screen_structure, will not be commited to backend, without touching the MODIFY method.
    Thanks
    Harsh

  • Creating the spool request for the internal table data

    Hi..
    I am little confused with the function module used for creating the spool request.
    well...I am practicing the ALV report and sending the that report to the spool.
    I  ve used the FM SLVC_TABLE_PS_TO_SPOOL.
    this is the way i defined the internal table.
    Data:
    begin of imat occurs 0,
    matnr like marav-matnr,
    maktx like marav-maktx,
    matkl like marav-matkl,                     
    ntgew like marav-ntgew,
    gewei like marav-gewei,
    end of imat.
    data i_lines type sy-tfill
    and i declared..
    describe table imat lines i_lines.
    then i given the value for i_file_length as i_lines in the export paramet of the FM SLVC_TABLE_PS_TO_SPOOL.
    CALL FUNCTION 'SLVC_TABLE_PS_TO_SPOOL'
        EXPORTING
          i_file_length            = i_lines
       IMPORTING
         E_SPOOLID                = spoolid
        tables
          it_textdata              = imat
    when i executed it shows the list and wen going back it shows the runtime error as
    CALL_FUNCTION_CONFLICT_LENG  - Type conflict when calling a function module (field length).
    please provide me some solutions.
    thanks in advance.
    etienne.

    Hi satyajit,
    Thanks for your response....but the fields in my internal table "IMAT" is not compatible with the structure LVC_S_1022 as it has it componenrt - LINE.
    so how can i define my internal table IMAT as type lvc_s_1022 as you suggested.
    thanks in advance.
    etienne.

  • With in the internal table can I READ the same internal table for a record?

    With in the internal table can I READ the same internal table?
    For Suppose
    LOOP AT itab.
    can I do as below
    READ TABLE itab with key bukrs = itab-bukrs
                       belnr = itab-belnr.
    *and I have to compare
    IF itab-shkzg = itab-shkzg_ia.
    ENDIF.
    ENDLOOP.

    Hi,
    Yes..But use work area to differentiate..
    EX.
    DATA: WA LIKE ITAB.
    DATA: WA_READ LIKE ITAB.
    LOOP AT itab <b>INTO WA</b>.
    can I do as below
    READ TABLE itab <b>INTO WA_READ</b>
               with key bukrs = itab-bukrs
    belnr = itab-belnr.
    *and I have to compare
    IF <b>WA</b>-shkzg = <b>WA_READ</b>-shkzg_ia.
    ENDIF.
    ENDLOOP.
    Please reward for helpful answers.
    Thanks,
    Naren

  • Need to delete Table Contents for the list of tables in the internal table.

    Hi All,
    I have req where in I have the list of table in an internal table and delete the contents of the tables which are in the internal table.
    I need to delete the contents of the table using Native SQL statements. Else I can use function modules to delte the contents of table.
    Thanks in advance. Appriciable if you can revert as soon as possible at all.
    Thanks and Regards,
    Raj.
    Edited by: Thomas Zloch on Mar 11, 2010 1:56 PM

    Hi,
    You can try using truncate statement in native sql.
    EXEC SQL.
    TRUNCATE TABLE ABC.
    ENDEXEC.

  • Dynamic Internal Table for reading data from external file

    Hello All,
    The task was to create a internal table with dynamic columns,
    Actually this is my first task in the WebAS 6.20, my program is based on input file provided by user with certain effort. this file can have different effort for a one yr to five year frame..
    I needed to read the raw data from file, based on months create a internal table to hold the data, after this i need to validate the data...
    I have browsed thru dynamic internal table topic, but couldn't find any dynamic appending structure, the dynamic structure would contains 12 month fileds.
    can any one help me in getting my task completed..
    Thanks
    Kumar

    Hi,
    I see that you posted the same question a couple of days ago at Dynamic Internal Table for reading data from external file Didn't Charles's response address your problem?
    Regards

  • Difference betwen the internal tables

    Hai friends,
               Pls give me the types  of internal tables and their   differences .and its usage by example.
      regrds,
    Prashanth.

    Internal tables
    Definition
    Data structure that exists only at program runtime.
    An internal table is one of two structured data types in ABAP. It can contain any number of identically structured rows, with or without a header line.
    The header line is similar to a structure and serves as the work area of the internal table. The data type of individual rows can be either elementary or structured.
    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.
    Internal Tables as Data Types
    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.
    Line type
    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.
    Key
    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.
    Table type
    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 not. 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.
    Generic Internal Tables
    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.
    Internal Tables as Dynamic Data Objects
    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.
    Choosing a Table Type
    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.
    Standard tables
    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.
    Sorted tables
    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.
    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.
    Special Features of Standard Tables
    Unlike sorted tables, hashed tables, and key access to internal tables, which were only introduced in Release 4.0, standard tables already existed several releases previously. Defining a line type, table type, and tables without a header line have only been possible since Release 3.0. For this reason, there are certain features of standard tables that still exist for compatibility reasons.
    Standard Tables Before Release 3.0
    Before Release 3.0, internal tables all had header lines and a flat-structured line type. There were no independent table types. You could only create a table object using the OCCURS addition in the DATA statement, followed by a declaration of a flat structure:
    DATA: BEGIN OF  .
    The effect of the OCCURS addition is to construct a standard table with the data type
    They can also be replaced by the following statements:
    Standard Tables From Release 4.0
    When you create a standard table, you can use the following forms of the TYPES and DATA statements. The addition INITIAL SIZE is also possible in all of the statements. The addition WITH HEADER LINE is possible in the DATA statement.
    Standard Table Types
    Generic Standard Table Type:
    TYPES  TYPE|LIKE TABLE OF  TYPE|LIKE TABLE OF 
                           WITH   TYPE|LIKE TABLE OF  TYPE|LIKE TABLE OF  TYPE|LIKE TABLE OF 
                           WITH   .
    Here, the LIKE addition refers to an existing table object in the same program. The TYPE addition can refer to an internal type in the program declared using the TYPES statement, or a table type in the ABAP Dictionary.
    You must ensure that you only refer to tables that are fully typed. Referring to generic table types (ANY TABLE, INDEX TABLE) or not specifying the key fully is not allowed (for exceptions, refer to Special Features of Standard Tables).
    The optional addition WITH HEADER line declares an extra data object with the same name and line type as the internal table. This data object is known as the header line of the internal table. You use it as a work area when working with the internal table (see Using the Header Line as a Work Area). When you use internal tables with header lines, you must remember that the header line and the body of the table have the same name. If you have an internal table with header line and you want to address the body of the table, you must indicate this by placing brackets after the table name ([]). Otherwise, ABAP interprets the name as the name of the header line and not of the body of the table. You can avoid this potential confusion by using internal tables without header lines. In particular, internal tables nested in structures or other internal tables must not have a header line, since this can lead to ambiguous expressions.
                      TYPES VECTOR TYPE SORTED TABLE OF I WITH UNIQUE KEY TABLE LINE.
    DATA: ITAB TYPE VECTOR,
          JTAB LIKE ITAB WITH HEADER LINE.
    MOVE ITAB TO JTAB.   <-  Syntax error!
    MOVE ITAB TO JTAB[].
    The table object ITAB is created with reference to the table type VECTOR. The table object JTAB has the same data type as ITAB. JTAB also has a header line. In the first MOVE statement, JTAB addresses the header line. Since this has the data type I, and the table type of ITAB cannot be converted into an elementary type, the MOVE statement causes a syntax error. The second MOVE statement is correct, since both operands are table objects.
    Declaring New Internal Tables
    You can use the DATA statement to construct new internal tables as well as using the LIKE or TYPE addition to refer to existing types or objects. The table type that you construct does not exist in its own right; instead, it is only an attribute of the table object. You can refer to it using the LIKE addition, but not using TYPE. The syntax for constructing a table object in the DATA statement is similar to that for defining a table type in the TYPES statement.
    DATA ]
    As when you define a table type, the type constructor
    of an internal table as follows:
    UNIQUE KEY  belong to the key as long as they are not internal tables or references, and do not contain internal tables or references. Key fields can be nested structures. The substructures are expanded component by component when you access the table using the key. The system follows the sequence of the key fields.
    UNIQUE KEY TABLE LINE
    If a table has an elementary line type (C, D, F, I, N, P, T, X), you can define the entire line as the key. If you try this for a table whose line type is itself a table, a syntax error occurs. If a table has a structured line type, it is possible to specify the entire line as the key. However, you should remember that this is often not suitable.
    UNIQUE DEFAULT KEY
    This declares the fields of the default key as the key fields. If the table has a structured line type, the default key contains all non-numeric columns of the internal table that are not and do not contain references or internal tables. If the 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.
    Specifying a key is optional. If you do not specify a key, the system defines a table type with an arbitrary key. You can only use this to define the types of field symbols and the interface parameters of procedures. For exceptions, refer to Special Features of Standard Tables.
    The optional additions UNIQUE or NON-UNIQUE determine whether the key is to be unique or non-unique, that is, whether the table can accept duplicate entries. If you do not specify UNIQUE or NON-UNIQUE for the key, the table type is generic in this respect. As such, it can only be used for specifying types. When you specify the table type simultaneously, you must note the following restrictions:
    ·     You cannot use the UNIQUE addition for standard tables. The system always generates the NON-UNIQUE addition automatically.
    ·     You must always specify the UNIQUE option when you create a hashed table.
    Initial Memory Requirement
    You can specify the initial amount of main memory assigned to an internal table object when you define the data type using the following addition:
    INITIAL SIZE , the system calculates a new value so that n times the line width is around 12KB.
    Examples
    TYPES: BEGIN OF LINE,
      COLUMN1 TYPE I,
      COLUMN2 TYPE I,
      COLUMN3 TYPE I,
    END OF LINE.
    1. TYPES ITAB TYPE SORTED TABLE OF LINE WITH UNIQUE KEY COLUMN1.
    The program defines a table type ITAB. It is a sorted table, with line type of the structure LINE and a unique key of the component COLUMN1.
    2. 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.
    TYPES ITAB TYPE SORTED TABLE OF LINE WITH UNIQUE KEY COLUMN1.
    TYPES: BEGIN OF DEEPLINE,
    FIELD TYPE C,
    TABLE1 TYPE VECTOR,
    TABLE2 TYPE ITAB,
    END OF DEEPLINE.
    TYPES DEEPTABLE TYPE STANDARD TABLE OF DEEPLINE
    WITH DEFAULT KEY.
    The program defines a table type VECTOR with type hashed table, the elementary line type I and a unique key of the entire table line. The second table type is the same as in the previous example. The structure DEEPLINE contains the internal table as a component. The table type DEEPTABLE has the line type DEEPLINE. Therefore, the elements of this internal table are themselves internal tables. The key is the default key - in this case the column FIELD. The key is non-unique, since the table is a standard table.
    Specifying the Type of Formal Parameters
    Formal parameters can have any valid ABAP data type. You can specify the type of a formal parameter, either generically or fully, using the TYPE or LIKE addition. If you specify a generic type, the type of the formal parameter is either partially specified or not specified at all. Any attributes that are not specified are inherited from the corresponding actual parameter when the subroutine is called. If you specify the type fully, all of the technical attributes of the formal parameter are defined with the subroutine definition.
    The following remarks about specifying the types of parameters also apply to the parameters of other procedures (function modules and methods).
    If you have specified the type of the formal parameters, the system checks that the corresponding actual parameters are compatible when the subroutine is called. For internal subroutines, the system checks this in the syntax check. For external subroutines, the check cannot occur until runtime.
    By specifying the type, you ensure that a subroutine always works with the correct data type. Generic formal parameters allow a large degree of freedom when you call subroutines, since you can pass data of any type. This restricts accordingly the options for processing data in the subroutine, since the operations must be valid for all data types. For example, assigning one data object to another may not even be possible for all data types. If you specify the types of subroutine parameters, you can perform a much wider range of operations, since only the data appropriate to those operations can be passed in the call. If you want to process structured data objects component by component in a subroutine, you must specify the type of the parameter.
    Specifying Generic Types
    The following types allow you more freedom when using actual parameters. The actual parameter need only have the selection of attributes possessed by the formal parameter. The formal parameter adopts its remaining unnamed attributes from the actual parameter.
         Check for actual parameters
    No type specificationTYPE ANY     The subroutine accepts actual parameters of any type. The formal parameter inherits all of the technical attributes of the actual parameter.
    TYPE C, N, P, or X     The subroutine only accepts actual parameters with the type C, N, P, or X. The formal parameter inherits the field length and DECIMALS specification (for type P) from the actual parameter.
    TYPE TABLE     The system checks whether the actual parameter is a standard internal table. This is a shortened form of TYPE STANDARD TABLE (see below).
    TYPE ANY TABLE     The system checks whether the actual parameter is an internal table. The formal parameter inherits all of the attributes (line type, table type, key) from the actual parameter.
    TYPE INDEX TABLE     The system checks whether the actual parameter is an index table (standard or sorted table). The formal parameter inherits all of the attributes (line type, table type, key) from the actual parameter.
    TYPE STANDARD TABLE     The system checks whether the actual parameter is a standard internal table. The formal parameter inherits all of the attributes (line type, key) from the actual parameter.
    TYPE SORTED TABLE     The system checks whether the actual parameter is a sorted table. The formal parameter inherits all of the attributes (line type, key) from the actual parameter.
    TYPE HASHED TABLE     The system checks whether the actual parameter is a hashed table. The formal parameter inherits all of the attributes (line type, key) from the actual parameter.
    Note that formal parameters inherit the attributes of their corresponding actual parameters dynamically at runtime, and so they cannot be identified in the program code. For example, you cannot address an inherited table key statically in a subroutine, but you probably can dynamically.
    TYPES: BEGIN OF LINE,
            COL1,
            COL2,
          END OF LINE.
    DATA: WA TYPE LINE,
          ITAB TYPE HASHED TABLE OF LINE WITH UNIQUE KEY COL1,
          KEY(4) VALUE 'COL1'.
    WA-COL1 = 'X'. INSERT WA INTO TABLE ITAB.
    WA-COL1 = 'Y'. INSERT WA INTO TABLE ITAB.
    PERFORM DEMO USING ITAB.
    FORM DEMO USING P TYPE ANY TABLE.
      READ TABLE P WITH TABLE KEY (KEY) = 'X' INTO WA.
    ENDFORM.
    The table key is addressed dynamically in the subroutine. However, the static address
    READ TABLE P WITH TABLE KEY COL1 = 'X' INTO WA.
    is syntactically incorrect, since the formal parameter P does not adopt the key of table ITAB until runtime.
    Assigning Internal Tables :
    Like other data objects, you can use internal tables as operands in a MOVE statement
    MOVE , including the data in any nested internal tables. The original contents of the target table are overwritten.
    If you are using internal tables with header lines, remember that the header line and the body of the table have the same name. If you want to address the body of the table in an assignment, you must place two brackets () after the table name.
    DATA: BEGIN OF line,
            col1(1) TYPE c,
            col2(1) TYPE c,
          END OF line.
    DATA: etab LIKE TABLE OF line WITH HEADER LINE,
          ftab LIKE TABLE OF line.
    line-col1 = 'A'. line-col2 = 'B'.
    APPEND line TO etab.
    MOVE etab[] TO ftab.
    LOOP AT ftab INTO line.
      WRITE: / line-col1, line-col2.
    ENDLOOP.
    The output is:
    A B
    The example creates two standard tables ETAB and FTAB with the line type of the structure LINE. ETAB has a header line. After filling ETAB line by line using the APPEND statement, its entire contents are assigned to FTAB. Note the brackets in the statement.
    DATA: ftab TYPE SORTED TABLE OF f
               WITH NON-UNIQUE KEY table_line,
          itab TYPE HASHED TABLE OF i
               WITH UNIQUE KEY table_line,
          fl   TYPE f.
    DO 3 TIMES.
      INSERT sy-index INTO TABLE itab.
    ENDDO.
    ftab = itab.
    LOOP AT ftab INTO fl.
      WRITE: / fl.
    ENDLOOP.
    The output is:
    1.000000000000000E+00
    2.000000000000000E+00
    3.000000000000000E+00
    FTAB is a sorted table with line type F and a non-unique key. ITAB is a hashed table with line type I and a unique key. The line types, and therefore the entire tables, are convertible. It is therefore possible to assign the contents of ITAB to FTAB. When you assign the unsorted table ITAB to the sorted table FTAB, the contents are automatically sorted by the key of FTAB.
    In Unicode systems, the following conversion is not allowed:
    DATA: BEGIN OF iline,
            num TYPE i,
          END OF iline,
          BEGIN OF fline,
            num TYPE f,
          END OF fline,
          itab LIKE TABLE OF iline,
          ftab LIKE TABLE OF fline.
    DO 3 TIMES.
      iline-num = sy-index.
      APPEND iline-num TO itab.
    ENDDO.
    ftab = itab.
    loop AT ftab INTO fline.
      WRITE: / fline-num.
    ENDLOOP.
    In a non-Unicode system, the output may look something like this:
            6.03823403895813E-154
            6.03969074613219E-154
            6.04114745330626E-154
    Here, the line types of the internal tables ITAB and FTAB are structures each with one component of type I or F. The line types are convertible, but not compatible. Therefore, when assigning ITAB to FTAB, the contents of Table ITAB are converted to type C fields and then written to FTAB. The system interprets the transferred data as type F fields, so that the results are meaningless. In Unicode systems, you are not allowed to convert numeric fields to fields of type C.
    Initializing Internal Tables
    Like all data objects, you can initialize internal tables with the
    CLEAR .
    statement. This statement restores an internal table to the state it was in immediately after you declared it. This means that the table contains no lines. However, the memory already occupied by the memory up until you cleared it remains allocated to the table.
    If you are using internal tables with header lines, remember that the header line and the body of the table have the same name. If you want to address the body of the table in a comparison, you must place two brackets () after the table name.
    CLEAR , LT, <).
    If you are using internal tables with header lines, remember that the header line and the body of the table have the same name. If you want to address the body of the table in a comparison, you must place two brackets () after the table name.
    The first criterion for comparing internal tables is the number of lines they contain. The more lines an internal table contains, the larger it is. If two internal tables contain the same number of lines, they are compared line by line, component by component. If components of the table lines are themselves internal tables, they are compared recursively. If you are testing internal tables for anything other than equality, the comparison stops when it reaches the first pair of components that are unequal, and returns the corresponding result.
    DATA: BEGIN OF LINE,
    COL1 TYPE I,
    COL2 TYPE I,
    END OF LINE.
    DATA: ITAB LIKE TABLE OF LINE,
                 JTAB LIKE TABLE OF LINE.
    DO 3 TIMES.
    LINE-COL1 = SY-INDEX.
    LINE-COL2 = SY-INDEX ** 2.
      APPEND LINE TO ITAB.
    ENDDO.
    MOVE ITAB TO JTAB.
    LINE-COL1 = 10. LINE-COL2 = 20.
    APPEND LINE TO ITAB.
    IF ITAB GT JTAB.
    WRITE / 'ITAB GT JTAB'.
    ENDIF.
    APPEND LINE TO JTAB.
    IF ITAB EQ JTAB.
    WRITE / 'ITAB EQ JTAB'.
    ENDIF.
    LINE-COL1 = 30. LINE-COL2 = 80.
    APPEND LINE TO ITAB.
    IF JTAB LE ITAB.
    WRITE / 'JTAB LE ITAB'.
    ENDIF.
    LINE-COL1 = 50. LINE-COL2 = 60.
    APPEND LINE TO JTAB.
    IF ITAB NE JTAB.
    WRITE / 'ITAB NE JTAB'.
    ENDIF.
    IF ITAB LT JTAB.
    WRITE / 'ITAB LT JTAB'.
    ENDIF.
    The output is:
    ITAB GT JTAB
    ITAB EQ JTAB
    JTAB LE ITAB
    ITAB NE JTAB
    ITAB LT JTAB
    This example creates two standard tables, ITAB and JTAB. ITAB is filled with 3 lines and copied to JTAB. Then, another line is appended to ITAB and the first logical expression tests whether ITAB is greater than JTAB. After appending the same line to JTAB, the second logical expression tests whether both tables are equal. Then, another line is appended to ITAB and the third logical expressions tests whether JTAB is less than or equal to ITAB. Next, another line is appended to JTAB. Its contents are unequal to the contents of the last line of ITAB. The next logical expressions test whether ITAB is not equal to JTAB. The first table field whose contents are different in ITAB and JTAB is COL1 in the last line of the table: 30 in ITAB and 50 in JTAB. Therefore, in the last logical expression, ITAB is less than JTAB.
    Sorting Internal Tables
    You can sort a standard or hashed table in a program. To sort a table by its key, use the statement
    SORT  ASCENDING .
    The statement sorts the internal table  ASCENDING
                 BY  ASCENDING
                     ASCENDING .
    The table is now sorted by the specified components : ‘T’ for standard table, ‘S’ for sorted table, and ‘H’ for hashed table.
    DATA: BEGIN OF LINE,
             COL1 TYPE I,
             COL2 TYPE I,
          END OF LINE.
    DATA ITAB LIKE HASHED TABLE OF LINE WITH UNIQUE KEY COL1
                                        INITIAL SIZE 10.
    DATA: LIN TYPE I,
          INI TYPE I,
          KND TYPE C.
    DESCRIBE TABLE ITAB LINES LIN OCCURS INI KIND KND.
    WRITE: / LIN, INI, KND.
    DO 1000 TIMES.
      LINE-COL1 = SY-INDEX.
      LINE-COL2 = SY-INDEX ** 2.
    INSERT LINE INTO TABLE ITAB.
    ENDDO.
    DESCRIBE TABLE ITAB LINES LIN OCCURS INI KIND KND.
    WRITE: / LIN, INI, KND.
    The output is:
             0         10  H
         1,000         10  H
    Here, a hashed table ITAB is created and filled. The DESCRIBE TABLE statement is processed before and after the table is filled. The current number of lines changes, but the number of initial lines cannot change.
    INSERT LINE INTO TABLE ITAB.
    LINE-TEXT = 'Moller'.
    CONVERT TEXT LINE-TEXT INTO SORTABLE CODE LINE-XTEXT.
    INSERT LINE INTO TABLE ITAB.
    LINE-TEXT = 'Miller'.
    CONVERT TEXT LINE-TEXT INTO SORTABLE CODE LINE-XTEXT.
    INSERT LINE INTO TABLE ITAB.
    SORT ITAB.
    PERFORM LOOP_AT_ITAB.
    SORT ITAB BY XTEXT.
    PERFORM LOOP_AT_ITAB.
    SORT ITAB AS TEXT.
    PERFORM LOOP_AT_ITAB.
    FORM LOOP_AT_ITAB.
      LOOP AT ITAB INTO LINE.
        WRITE / LINE-TEXT.
      ENDLOOP.
      SKIP.
    ENDFORM.
    This example demonstrates alphabetical sorting of character fields. The internal table ITAB contains a column with character fields and a column with corresponding binary codes that are alphabetically sortable. The binary codes are created with the CONVERT statement (see Converting to a Sortable Format). The table is sorted three times. First, it is sorted binarily by the TEXT field. Second, it is sorted binarily by the XTEXT field. Third, it is sorted alphabetically by the TEXT field. Since there is no directly corresponding case in English, we have taken the results from a German text environment:
    Miller
    Moller
    Muller
    Möller
    Miller
    Moller
    Möller
    Muller
    Miller
    Moller
    Möller
    Muller
    After the first sorting, 'Möller' follows behind 'Muller' since the internal code for the letter 'ö' comes after the code for 'u'. The other two sorts are alphabetical
    The binary sort by XTEXT has the same result as the alphabetical sorting by the field TEXT.
    Regards,
    Amit
    Reward all helpful replies.

  • How to Down load Data in Application server into the Internal Table

    hi freinds,
    iam having a file in the application server.
    now i need to send the data in the file to the internal table.
    is there any Function Module?
    i need with out using the OPEN DATA SET and CLOSE DATA SET Keywords.
    is there any possible?
    Regard's,
    Ranjith.

    Hi,
    There is no other option for uploading the data from the application server to the internal table without using OPEN DATASET and CLOSE DATASET. Even if you find the FM internal logic in FM uses these keywords to read the data from Application server.

Maybe you are looking for