Why using workarea for internal table is better in performance

Please tell me
why using workarea for internal table is better in performance

Hi Vineet ,
  Why would we choose to use an internal table without a header line when it is easier to code one  with a header line?
it has following reason.
1)Separate Internal Table Work Area:
     The work area (staging area) defined for the internal table   is not limited to use with just one internal table.
take ex-
Suppose you want two internal tables for EMPLOYEE – one to contain all records and one to contain only those records where country = ‘USA’.  You could create both of these internal tables without header lines and use only one work area to load data into both of them. You would append all records from the work area into the first internal table.  You would conditionally append the ‘USA’ records from the same work area into the second internal table.
2)  Performance Issues:  Using an internal table without a header line is more efficient than one  with a header line
3) Nested Internal Tables:  If you want to include an internal table within a structure or another   internal table, you must use one without a header line.
If this one is helpful ,then rewards me
Regards
Shambhu

Similar Messages

  • USING SUM IN INTERNAL TABLE

    plz give me a simple example for using SUM in internal table and do some calculations in the same internal table.

    HI
    CHECK WITH THIS
    Syntax
    SUM.
    Effect
    The statement SUM can only be specified within a loop starting with LOOP, and is only considered within a AT- ENDAT control structure. Prerequisites for using the statement SUM include using the addition INTO in the LOOP statement, and that the specified work area wa is compatible with the row type of the internal table. In addition, SUM cannot be used when the row type of the internal table itab contains components that are tables.
    The statement SUM calculates the component total with the numeric data type (i, p, f) of all rows in the current control level and assigns these to the components of the work area wa. In the control levels FIRST, LAST, and outside of an AT-ENDAT control structure, the system calculates the sum of numeric components of all rows in the internal table.
    Example
    Control level processing for creating a list. At the end of line groups, the total of reserved places is calculated and issued.
    DATA: sflight_tab TYPE SORTED TABLE OF sflight
                      WITH UNIQUE KEY carrid connid fldate,
          sflight_wa  LIKE LINE OF sflight_tab.
    SELECT *
           FROM sflight
           INTO TABLE sflight_tab.
    LOOP AT sflight_tab INTO sflight_wa.
      AT NEW connid.
        WRITE: / sflight_wa-carrid,
                 sflight_wa-connid.
        ULINE.
      ENDAT.
      WRITE: / sflight_wa-fldate,
               sflight_wa-seatsocc.
      AT END OF connid.
        SUM.
        ULINE.
        WRITE: / 'Sum',
                  sflight_wa-seatsocc UNDER sflight_wa-seatsocc.
        SKIP.
      ENDAT.
      AT END OF carrid.
        SUM.
        ULINE.
        WRITE: / 'Carrier Sum',
                  sflight_wa-seatsocc UNDER sflight_wa-seatsocc.
        NEW-PAGE.
      ENDAT.
      AT LAST.
        SUM.
        WRITE: / 'Overall Sum',
                  sflight_wa-seatsocc UNDER sflight_wa-seatsocc.
      ENDAT.
    ENDLOOP.
    Hope this solves ur problem....
    <b>do reward if useful....</b>
    regards
    dinesh

  • System Variable For Internal table count

    Can anybody tell me what the system variable for internal table count?
    I just wants to know how many recoreds are there in my internal table ?
    Regards,
    pandu.

    Hi ,
    DESCRIBE TABLE <itab> [LINES <l>] [OCCURS <n>] [KIND <k>].
    If you use the LINES parameter, the number of filled lines is written to the variable <lin>. If parameter, the you use the OCCURS value of the INITIAL SIZE of the table is returned to the variable <n>. If you use the KIND parameter, the table type is returned to the variable <k>: ‘T’ for standard table, ‘S’ for sorted table, and ‘H’ for hashed table.
    using variable
    SY-TFILL
    After the statements DESCRIBE TABLE, LOOP AT, and READ TABLE, SY-TFILL contains the number of lines in the relevant internal table.
    http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3798358411d1829f0000e829fbfe/content.htm
    <REMOVED BY MODERATOR>
    Edited by: Alvaro Tejada Galindo on Feb 21, 2008 4:53 PM

  • Aggregate functions for internal table.

    Hi Gurus,
    I'm just wondering whether we can use aggregate functions for internal table. I wanted to know the max value for a particular column in my internal table. How can I achieve this easily and quickly.
    Thanks,
    David.

    sort the table on which you want the maximum value and read it. Please find below example code.
    TYPES : BEGIN OF ty_mvke,
            matnr TYPE mvke-matnr,
            vkorg TYPE mvke-vkorg,
            vtweg TYPE mvke-vtweg,
           AUMNG type mvke-AUMNG,
            END OF ty_mvke.
    DATA : wa_mvke TYPE ty_mvke,
           it_mvke TYPE STANDARD TABLE OF ty_mvke.
    data : temp_AUMNG type AUMNG.
    START-OF-SELECTION.
      SELECT matnr vkorg vtweg AUMNG FROM mvke INTO
            table it_mvke.
    sort it_mvke by AUMNG.
    read TABLE it_mvke into wa_mvke INDEX 1.
    if sy-subrc = 0.
    move wa_mvke-AUMNG to temp_AUMNG.
    write : temp_AUMNG.
    endif.
    Thanks,
    Sreekala.

  • Why use Dreamweaver for create web pages

    Hi I am new in Dreamweaver and I want to know why use Dreamweaver for create web pages?

    Twitter
    http://twitter.com/altweb
    Blog
    http://alt-web.blogspot.com/
    Site
    http://alt-web.com/

  • Is xmlgen.insertxml used only for single table

    Is xmlgen.insertxml used only for single table or can be used to insert the xmldata into xle tables
    Thanks,
    Sudheer

    Hi Sudeesh,
    I am fetching data for PO details, GR details along with condition types of PO.
    All data is collected in ALV OUTPUT itab, after this I am trying to assign the values of VAT from another itab in ALV OUTPUT LOOP using READ TABLE with reference to PO-PO_ITEM-CONDITION_TYPE.
    Now, when the alv loop is getting executed and in that I am fetching data for VAT using READ statement, the program is assigning VAT to all records of output alv with comparison of PO-PO_ITEM-CONDITION_TYPE.
    see:
    LOOP AT it_alv ASSIGNING <fs-alv>.
         READ TABLE it_vat ASSIGNING <fs-vat>
              WITH KEY ebeln = <fs-alv>-ebeln
                               posnr = <fs-alv>-posnr
                                kschl = 'JVCS'.
         IF sy-subrc = 0.
              <fs-alv>-vat = <fs-vat>-kbetr / 10.
      <fs-alv>-vat_val = <<fs-alv>-vat * it_alv-menge.
         END IF.
    END LOOP.
    Please refer above.
    Thanks.
    Ritesh

  • Using aggregation in ABAP code for internal table

    I have written following code to get cumulative amount on a date but i have to hit database for each record.
    Can't I use some function similar to SUM for doing the same thing on internal table??It would increase my performance.
    code is:
        SELECT SUM( DEB_CRE_LC ) FROM /BIC/AZFIAR_O500
         INTO LV_BALMONTH   WHERE   DEBITOR = LV_DEBITOR AND
        CALMONTH GE LV_STARTMONTH AND CALMONTH  LE LV_LASTCALMON.
    I want to put  ZFIAR data to internal table and read and do SUM thing..is it possible?? withotut usiong loop.
    regards,
    rakesh

    Hi Rajesh,
    types : begin of ty_tab,
                date type dats,
                DEB_CRE_LC   type .....     " delare type & is the filed need to summerized
                end of ty_tab,
    data: itab type standard table of ty_tab.
    SELECT date
                  SUM( DEB_CRE_LC )  as DEB_CRE_LC  FROM /BIC/AZFIAR_O500
                  INTO corresponding fields of itab
                  where CALMONTH GE LV_STARTMONTH AND CALMONTH LE LV_LASTCALMON
                  group by date.   " date is the field available in your ODS/transparent table
    simulate the above code in your program...
    Hope this will work..

  • Date conversion for internal table

    Hi experts,
    I have an issue with Date conversion.
    i have declared my internal table with type same as that of standard table from which im fetching data.
    The date is coming in YYYYMMDD format and i have to change it to MM/DD/YYYY format.
    I tried using a function Module and used Mask as well . It is working but wen im putting the value back into my internal table it is truncating my conver sion .
    For eg : 20110530 after conversion and wen im putting it back to internal table value is : 05/30/20
    bacuse of length issue "11" disappeared.
    I tried changing the type declaration of my internal table to : date(10) type c.
    But wen im executing the code, the place were im putting the values from my standard table to internal, it is giving run time error.
    can anyonenhelp me with this?

    Hi,
    Why not have the date in MMDDYYYY format truncating the '/' part. Doing this would reduce the size to 8. Which can later be added in any field level rotine.
    Regards
    Raj Rai
    Edited by: Raj Rai on Jun 1, 2011 5:48 AM

  • Difference between Field symbols and work area for Internal tables

    Hi,
    In ECC versions we all know that we need to declare the internal tables without headerline, and for handling the internal tables we need to use exclusive work areas.
    Currently i have an issue that we have been asked to use field symbols instead of work areas...can any one help me how to use the field symbols and also let me know how it will improve the performance of the program..
    Thanks and Regards,
    Kathir

    Hi
    DATA: WA TYPE ITAB.
    LOOP AT ITAB INTO WA.
    IF WA-FIELD = .....
    ENDIF.
    ENDLOOP.[(code]
    FIELD-SYMBOLS <WA> TYPE ANY.
    LOOP AT ITAB ASSIGNING <WA>.
    ENDLOOP.
    Now the problem is you can't know the name of the fields of the table at runtime, so you can't write:
    IF <WA>-FIELD = .....
    ENDIF.
    Anyway you can create a field-symbols strcturated like the table:
    [code]FIELD-SYMBOLS <WA> TYPE ITAB.
    LOOP AT ITAB ASSIGNING <WA>.
      IF <WA>-FIELD = .....
      ENDIF.
    ENDLOOP.
    I don't know which are the differences for the performance between to use a field-symbol and to use a structure as work-area.
    The differnce between the field-symbols and work-area is the field-symbol is assigned directly to the record, so u don't need to do a MODIFY statament to change something:
    LOOP AT ITAB INTO WA.
      WA-FIELD =
      MODIFY ITAB FROM WA.
    ENDLOOP.
    LOOP AT ITAB ASSIGNING <WA>.
      <WA>-FIELD =
    ENDLOOP.
    These two pieces of abap code do the same action, so probably the field-symbol improve the performance because it do an access directly to the record without to use an external structure as workarea.
    Max

  • How to create our own fields in workarea in internal tables

    hai
    can u help me out in creating our own fields in workarea in an internal table (without header line..................)

    what kinda theory do u want???
    * Internal table with HEADER LINE
    DATA : BEGIN OF it_output occurs 0 with header line,
              c_icon  TYPE icon-id,
              bukrs   TYPE anla-bukrs,
              anln1   TYPE anla-anln1,
              anln2   TYPE anla-anln2,
              grufl   TYPE anla-grufl,
              grufl_n TYPE anla-grufl,
              leabg   TYPE sy-datum,
              leabg_n TYPE sy-datum,
              message TYPE bapiret2-message,
            END OF it_output.
    The above declaration is same as the below declaration in relation to the previous thread.
    * Data declarations for ty_output
    DATA : it_output TYPE STANDARD TABLE OF ty_output INITIAL SIZE 0, " Internal table declaration
           is_output TYPE ty_output." Work Area declaration
    Please reward for useful answers with appropriate points
    Regards
    Gopi
    "  Internal table without HEADER LINE
    DATA : BEGIN OF it_output occurs 0,
              c_icon  TYPE icon-id,
              bukrs   TYPE anla-bukrs,
              anln1   TYPE anla-anln1,
              anln2   TYPE anla-anln2,
              grufl   TYPE anla-grufl,
              grufl_n TYPE anla-grufl,
              leabg   TYPE sy-datum,
              leabg_n TYPE sy-datum,
              message TYPE bapiret2-message,
            END OF it_output.
    Message was edited by:
            Gopi Narendra

  • Sy-tabix for internal table in smartform

    Hi friends,
    How to capture the sy-tabix value for the entries in an internal table which has been looped into the loop of table node of a smartform?? I need to print something immedaitely after the end of the table
    For every record the value of sy-tabix is showing 1 !!
    Advance Thanks
    Aadarsh

    Hi Aadarsh,
    Give ur sy-tabix at the end of the loop.
    loop at itab.
    //table node populations.
    endloop.
    give a seperate loop for this.
    loop at itab.
    sy-tabix.
    endloop
    get the total no and print it after the table.
    If u r using do loop then give sy-index.
    Hope tihs helps u,
    Regards,
    Nagarajan.
    Message was edited by: Nagarajan Kumarappan

  • Field catalog for internal table in ALV

    In my program the internal table consists many fields from various tables and structure doesn't belong to a single data table.
    In order to get output in ALV grid following FM has been used
    REUSE_ALV_GRID_DISPLAY
    for field catalog the fields are defined specifically.
      l_fieldcat-fieldname  = 'VBELN'.
      l_fieldcat-outputlen  = 10.
      l_fieldcat-seltext_l  = 'Billing doc'.
      l_fieldcat-no_zero = 'X'.
      l_fieldcat-hotspot = 'X'.
      append l_fieldcat to p_fieldtab.
    ..............and so on for all the fields.
    Just wanted to know is there any other method to display all the fields of this internal table automatically so each field is not specified specifically.
    anya

    Hi
    Try this instead:
    *& Form  create_fieldcatalog
    * Create a field catalogue from any internal table
    *      -->PT_TABLE     Internal table
    *      -->PT_FIELDCAT  Field Catalogue
    FORM  create_fieldcatalog
           USING     pt_table     TYPE ANY TABLE
           CHANGING  pt_fieldcat  TYPE lvc_t_fcat.
      DATA:
        lr_tabdescr TYPE REF TO cl_abap_structdescr
      , lr_data     TYPE REF TO data
      , lt_dfies    TYPE ddfields
      , ls_dfies    TYPE dfies
      , ls_fieldcat TYPE lvc_s_fcat
      CLEAR pt_fieldcat.
      CREATE DATA lr_data LIKE LINE OF pt_table.
      lr_tabdescr ?= cl_abap_structdescr=>describe_by_data_ref( lr_data ).
      lt_dfies = cl_salv_data_descr=>read_structdescr( lr_tabdescr ).
      LOOP AT lt_dfies
      INTO    ls_dfies.
        CLEAR ls_fieldcat.
        MOVE-CORRESPONDING ls_dfies TO ls_fieldcat.
        APPEND ls_fieldcat TO pt_fieldcat.
      ENDLOOP.
    ENDFORM.                    "create_fieldcatalog

  • Is anyone set up to use anycast for internal DNS?

    Good Afternoon,
    I've been considering using Anycast to provide some redundancy for internal DNS lookups. Configuring DNS and subsequent slave zones in Leopard is easy enough and as I understand it, Anycast is just a way of configuring routers so that one IP address can resolve to many different machines.
    I see some of the benefits of using Anycast in that we can have the same 2 dns ip addresses in perpetuity and that as long as one node is up, people will be able to get out.
    So my question to you guys: Has anyone done this? If so, is there anything I need to look out for before I start? Is there something you wish you'd known before you started down this path.
    I'd love to hear your experiences and read any documentation you might have kept. I thought Mr Hoffman's write up on his DNS services was really excellent btw.
    Cheers,
    dave

    Do you have a particularly large infrastructure?
    IP Anycast is usually implemented via BGP announcements from your router(s), with each router using the BGP tables to determine the 'best' server to use. If you're doing this for internal DNS then that assumes you're already running IBGP.
    Even then, BGP is a pretty dumb protocol - all it does is say 'hey, here's how to get to a.b.c.d IP address'. It has no idea whether the specific server/service you're after is available at that address.
    In other words, even if you setup IP Anycast via IBGP you'll still have clients routing to a dead server unless you can somehow update your BGP tables when a server goes down. Not a trivial task for most routers.
    It sounds like what you really want is more load balancing than IP Anycast. There are numerous load balancers than can do this. Another option (if your DNS servers are physically close) is to use some kind of failover process so that the second server assumes the role (and IP address) of the first server should it fail (and vice versa). That option is built-in to Mac OS X Server (although it takes a little command-line jiggling to get it working).
    Then again, the whole point of defining multiple DNS servers on the client is that the client will automatically fail over to alternate servers if it doesn't get a response from the first - in other words, the clients already have built-in failover for DNS (although the user will notice lookup delays when the primary server is offline).

  • Xml to abap internal table by using a dynamic internal table at runtime

    Hi ,
          I have a requirement to convert xml to abap internal table . But the requirement is that i need to create internal table according to the XML .
    Ex : If my XML is :
    <?xml version="1.0" ?>
    - <flights>
    - <airline code="AA" name="American Airlines">
    - <flight number="0017">
      <from airport="JFK">NEW YORK,US</from>
      <to airport="SFO">SAN FRANCISCO,US</to>
      <departure>110000</departure>
      <arrival>140100</arrival>
      <type>Scheduled</type>
      </flight>
    - <flight number="0064">
      <from airport="SFO">SAN FRANCISCO,US</from>
      <to airport="JFK">NEW YORK,US</to>
      <departure>090000</departure>
      <arrival>172100</arrival>
      <type>Scheduled</type>
      </flight>
      </airline>
    So after conversion my abap internal table shoul have fields as :
    airline_code     Name      flight_number   from_airport    to_airport      departure         arrival      type
    and the field values should be corresponding field values .
    Thanks in advance .
    Regards .

    Hi Ujjwal,
    use
    CALL TRANSFORMATION
    Study the online documentation and if required do some search for CALL TRANSFORMATION and/or XML PARSER
    And, when coming back here with next question, tell us what searches you did with what results - please always follow the 'search before post' rule, thank you.
    Regards,
    Clemens

  • Query statement for internal table

    is it possible to use a select statement to select data from an internal table? if yes, can anyone show me the codes to it? thx

    Hi Daphne,
    You use SELECT statement to read data from database table but not from Internal table.
    For reading data from Internal table, you have to use READ statement.
    Syntax:
    READ TABLE itab { table_key
                    | free_key
                    | index } result.
    Effect of using read statement:
    This statement reads a row from internal table itab. You have to specify the row by either naming values table_key for the table key, a free condition free_key or an index index. The latter choice is possible only for index tables. The output result result determines when and where the row contents are read.
    If the row to be read is not uniquely specified, the first suitable row is read. In the case of index tables, this row has the lowest table index of all matching rows.
    Reward if usefull
    thanks
    swaroop

Maybe you are looking for

  • How to pass the entry via HR to FI when the recovery is made in cash from employee for full and final settlement

    Hello Team, Here is a scenario am stuck with--> Employee has been terminated effective 28th April 2014 after the payroll run. We are deducting (28-30th) 3 days salary( say 500 USD) He is getting sm amount say USD1000 as business trip allowance After

  • Seeking a CRT, 1024/768 Monitor...

    I have an aging 9 yr. old Sony Trinitron 17 inch which works great on my new MacMini; however the monitor needs to be replaced due to white dimming and contrast is slipping so letters are not as crisp. I have tried twice to get new monitors but they

  • SNMP Get router bandwidth utilisation

    I've got some problems trying to locate a particular counter using the Mib explorer. My Cisco router is 2801 Software (C2801-IPBASE-M), IOS Version 12.4(1a) I'm trying in vain to locate the input/output rate (in bits/sec) for two of my interfaces. I'

  • CVS update "Create New Folders" unavailable

    Summary: The Create New Folders checkbox in the Update from CVS options selection window is always inactive. I am using JDeveloper 10g v9.0.5.0.0.1375 Preview with "CVS Client Version: (CVSNT) 2.0.11 (client/server)". Detail: After having checked out

  • Losing Broadband Connection

    Hi, New too the forum. Over the past 4 days I have been experiencing a lose of broadband connection, flashing orange light comes on the hub. Tried resetting, switching off the hub etc, this doesn't work. When I open up my main telephone socket and pl