Internal table with and with out work area.

Hi all,
in performance terms which one is better 1) internal table with header line or 2) itab w/o header line and explicit work area for that itab.
which one is better and how?
Thanks in advance.
SAI

Hai Sai Ram
Internal Table with header Line Improves the Performence
1)
TABLES CUSTOMERS.
Defining an internal table with header line
DATA ALL_CUSTOMERS LIKE CUSTOMERS OCCURS 100
                   WITH HEADER LINE.
Reading all entries of the database table into the internal table
SELECT * FROM CUSTOMERS INTO TABLE ALL_CUSTOMERS.
2)
Check the following code for the Difference
REPORT ZWRITEDOC LINE-SIZE 124 NO STANDARD PAGE HEADING.
   TABLES: DD03L, "
           DD04T, "R/3-DD: Textos de los elementos de datos
           DD02T. "R/3-DD: Textos de tablas SAP
Tabla temporal con las lineas de cada tabla
   DATA: BEGIN OF I_LINEAS OCCURS 100,
            LINEA(80),
         END OF I_LINEAS.
Tabla con las caracteristicas de la tabla
   DATA: BEGIN OF I_TABLA OCCURS 100,
            CAMPO(12),
            TIPO(4),
            LONG(5) TYPE I,
            REF(20),
            DESCR(40),
         END OF I_TABLA.
   DATA: D_NOMBRE(80),
         D_DESCRIPCION(80).
   DATA :  BEGIN OF SOURCE OCCURS 1000,
        LINE(72),
   END OF SOURCE.
   PARAMETERS: PROGRAM LIKE SY-REPID DEFAULT SY-REPID.
   AT USER-COMMAND.
     CASE SY-UCOMM.
       WHEN 'GRAB'.
         PERFORM GRABAR.
     ENDCASE.
   START-OF-SELECTION.
     SET PF-STATUS  'ZSTATUS1'.
     READ REPORT PROGRAM INTO SOURCE.
     DATA L_GRAB.
     CLEAR L_GRAB.
LOOP AT SOURCE.
   translate source to upper case.
       IF L_GRAB IS INITIAL.
         D_DESCRIPCION = I_LINEAS-LINEA.
       ENDIF.
       I_LINEAS = SOURCE.
       SEARCH I_LINEAS-LINEA FOR 'BEGIN OF'.
       IF SY-SUBRC = 0.
         SEARCH I_LINEAS-LINEA FOR 'DATA'.
         IF SY-SUBRC = 0.
           L_GRAB = 'X'.
           FREE I_LINEAS.
         ENDIF.
       ENDIF.
       IF L_GRAB = 'X'.
         I_LINEAS = SOURCE.
         APPEND I_LINEAS.
         SEARCH I_LINEAS-LINEA FOR 'END OF'.
         IF SY-SUBRC = 0.
           CLEAR L_GRAB.
           PERFORM PROCESAR_FICHERO.
           PERFORM IMPRIMIR.
           FREE I_LINEAS.
           CLEAR D_DESCRIPCION.
         ENDIF.
       ENDIF.
       SEARCH I_LINEAS-LINEA FOR 'WITH HEADER LINE'.
       IF SY-SUBRC = 0.
         APPEND I_LINEAS.
         PERFORM PROCESAR_FICHERO.
         PERFORM IMPRIMIR.
       ENDIF.
     ENDLOOP.
*&      Form  GRABAR
      Graba el fichero en c:\temp\p.rtf y lo abre con word.
   FORM GRABAR.
     CALL FUNCTION 'LIST_DOWNLOAD'
         EXPORTING
        LIST_INDEX = SLIST_INDEX_DEFAULT
              METHOD     = 'RTF'
          EXCEPTIONS
               OTHERS     = 1.
     CALL FUNCTION 'EXECUTE_WINWORD'
          EXPORTING
               I_FILE = 'C:\TEMP\P.RTF'
          EXCEPTIONS
               OTHERS = 1.
   ENDFORM.                               " GRABAR
*&      Form  PROCESAR_FICHERO
   FORM PROCESAR_FICHERO.
     DATA: L_AUX1(80),
          L_AUX2(80).
     FREE I_TABLA.
     LOOP AT I_LINEAS.
       CLEAR I_TABLA.
   translate i_lineas-linea to upper case.
       SEARCH I_LINEAS-LINEA FOR 'BEGIN OF'.
       IF SY-SUBRC = 0.
         SPLIT I_LINEAS-LINEA AT 'BEGIN OF' INTO L_AUX1 D_NOMBRE.
         SPLIT D_NOMBRE AT 'OCCURS' INTO D_NOMBRE L_AUX1.
       ENDIF.
       SEARCH I_LINEAS-LINEA FOR '('.
       IF SY-SUBRC = 0.
          SPLIT I_LINEAS-LINEA AT '(' INTO L_AUX1 L_AUX2.
         CONDENSE L_AUX1.
         I_TABLA-CAMPO = L_AUX1.
         SPLIT L_AUX2 AT ')' INTO L_AUX1 L_AUX2.
         CONDENSE L_AUX1.
         IF L_AUX1 CO '0123456789 '.
           I_TABLA-LONG = L_AUX1.
         ENDIF.
         I_TABLA-TIPO = 'CHAR'.
       ENDIF.
       SEARCH I_LINEAS-LINEA FOR 'LIKE'.
       IF SY-SUBRC = 0.
         SPLIT I_LINEAS-LINEA AT 'LIKE' INTO L_AUX1 L_AUX2.
         CONDENSE L_AUX1.
         I_TABLA-CAMPO = L_AUX1.
           SPLIT L_AUX2 AT ',' INTO L_AUX1 L_AUX2.
         CONDENSE L_AUX1.
         I_TABLA-REF = L_AUX1.
       ENDIF.
       SEARCH I_LINEAS-LINEA FOR 'TYPE'.
       IF SY-SUBRC = 0.
         SPLIT I_LINEAS-LINEA AT 'TYPE' INTO L_AUX1 L_AUX2.
         IF I_TABLA-CAMPO IS INITIAL.
           CONDENSE L_AUX1.
           I_TABLA-CAMPO = L_AUX1.
         ENDIF.
             SPLIT L_AUX2 AT ',' INTO L_AUX1 L_AUX2.
        CONDENSE L_AUX1.
         CASE L_AUX1.
           WHEN 'I'.
             I_TABLA-TIPO = 'INT'.
             I_TABLA-LONG = 4.
           WHEN 'C'.
             I_TABLA-TIPO = 'CHAR'.
           WHEN 'N'.
             I_TABLA-TIPO = 'NUMC'.
           WHEN 'T'.
             I_TABLA-TIPO = 'TIME'.
             I_TABLA-LONG = 8.
           WHEN OTHERS.
             I_TABLA-TIPO = L_AUX1.
         ENDCASE.
       ENDIF.
       SEARCH I_LINEAS-LINEA FOR '"'.
       IF SY-SUBRC = 0.
         SPLIT I_LINEAS-LINEA AT '"' INTO L_AUX1 L_AUX2.
         CONDENSE L_AUX2.
         I_TABLA-DESCR = L_AUX2.
       ENDIF.
       SEARCH I_LINEAS-LINEA FOR 'INCLUDE STRUCTURE'.
       IF SY-SUBRC = 0.
         SPLIT I_LINEAS-LINEA AT 'INCLUDE STRUCTURE' INTO L_AUX1 L_AUX2.
         SPLIT L_AUX2 AT '.' INTO L_AUX1 L_AUX2.
         CONDENSE L_AUX1.
         I_TABLA-CAMPO = 'INCLUDE STR'.
         I_TABLA-REF   = L_AUX1.
       ENDIF.
       SEARCH I_LINEAS-LINEA FOR 'WITH HEADER LINE'.
         IF SY-SUBRC = 0.
           IF NOT I_LINEAS-LINEA CA '"'.
             SPLIT I_LINEAS-LINEA AT 'OCCURS' INTO L_AUX1 L_AUX2.
             IF SY-SUBRC = 0.
               SPLIT L_AUX1 AT 'LIKE' INTO L_AUX1 L_AUX2.
               IF SY-SUBRC = 0.
                 CONDENSE L_AUX2.
                 IF NOT L_AUX2 IS INITIAL.
                   I_TABLA-CAMPO = '...'.
                   I_TABLA-TIPO  = 'TABI'.
                   I_TABLA-REF   = L_AUX2.
                   SELECT SINGLE * FROM DD02T
                    WHERE TABNAME = L_AUX2
                      AND DDLANGUAGE = SY-LANGU.
                   IF SY-SUBRC = 0.
                   I_TABLA-TIPO  = 'TABE'.
                   I_TABLA-DESCR   = DD02T-DDTEXT.
                   ENDIF.
                   IF L_AUX1 CA ':'.
                     SPLIT L_AUX1 AT 'DATA:' INTO L_AUX1 L_AUX2.
                   ELSE.
                     SPLIT L_AUX1 AT 'DATA' INTO L_AUX1 L_AUX2.
                   ENDIF.
                   D_NOMBRE = L_AUX2.
                 ENDIF.
               ENDIF.
             ENDIF.
           ENDIF.
         ENDIF.
       IF NOT I_TABLA-CAMPO IS INITIAL.
         APPEND I_TABLA.
       ENDIF.
     ENDLOOP.
     LOOP AT I_TABLA WHERE NOT REF IS INITIAL.
        SPLIT I_TABLA-REF AT '-' INTO L_AUX1 L_AUX2.
       SELECT SINGLE * FROM DD03L
        WHERE TABNAME = L_AUX1
          AND FIELDNAME = L_AUX2.
       IF SY-SUBRC = 0.
         I_TABLA-TIPO = DD03L-DATATYPE.
         I_TABLA-LONG = DD03L-INTLEN.
         IF I_TABLA-DESCR IS INITIAL.
           SELECT SINGLE * FROM DD04T
            WHERE ROLLNAME = DD03L-ROLLNAME
              AND DDLANGUAGE = SY-LANGU.
           IF SY-SUBRC = 0.
             I_TABLA-DESCR = DD04T-DDTEXT.
           ENDIF.
         ENDIF.
         MODIFY I_TABLA.
       ENDIF.
     ENDLOOP.
   ENDFORM.                               " PROCESAR_FICHERO
*&      Form  IMPRIMIR
   FORM IMPRIMIR.
   DATA L_AUX(80).
     FORMAT COLOR COL_NORMAL INTENSIFIED ON.
     ULINE AT 1(80).
     WRITE: / SY-VLINE,
             (76)     D_NOMBRE CENTERED,
              SY-VLINE.
     SPLIT D_DESCRIPCION AT '*' INTO L_AUX D_DESCRIPCION.
     WRITE: / SY-VLINE,
             (76)     D_DESCRIPCION CENTERED,
              SY-VLINE.
     NEW-LINE.
     ULINE AT 1(80).
     DETAIL.
     FORMAT COLOR OFF.
     WRITE: /
           SY-VLINE,
         (10) 'CAMPO',
           SY-VLINE,
         (4)  'TIPO',
           SY-VLINE,
         (4) 'LONG',
           SY-VLINE,
         (16)  'REFERENCIA',
           SY-VLINE,
         (30)  'DESCRIPCION',
           SY-VLINE.
     NEW-LINE.
     ULINE AT 1(80).
     DETAIL.
     LOOP AT I_TABLA.
       WRITE: /
             SY-VLINE,
          (10)   I_TABLA-CAMPO,
             SY-VLINE,
             I_TABLA-TIPO,
             SY-VLINE,
          (4)   I_TABLA-LONG,
             SY-VLINE,
          (16)   I_TABLA-REF,
             SY-VLINE,
          (30)   I_TABLA-DESCR,
             SY-VLINE.
     ENDLOOP.
     NEW-LINE.
     ULINE AT 1(80).
     SKIP 2.
   ENDFORM.                               " IMPRIMIR
Thanks & regards
Sreeni

Similar Messages

  • Internal table with out header line

    Hi friends,
    Can u send me code for internal table with out header line : how to declare ,how to populate data and how to access the data
    Regards,
    vijay

    Hi Vijay
    There are several ways to declare an internal table without header line:
    A) You can define a type table
    TYPES: BEGIN OF TY_ITAB OCCURS 0,
            INCLUDE STRUCTURE ZTABLE.
    TYPES: END   OF TY_ITAB.
    and then your intrnal table:
    DATA: ITAB TYPE TY_ITAB.
    B) DATA: ITAB TYPE/LIKE STANDARD TABLE OF ZTABLE.
    C) DATA: ITAB TYPE/LIKE ZTABLE OCCURS 0.
    All these ways create a STANDARD TABLE
    You can create other types of internal table, for example SORTED TABLE or HASHED TABLE.
    These kinds of table can allow to improve the performance because they use different rules to read the data.
    When it wants to manage a table without header line, it need a work area, it has to have the same structure of table.
    DATA: WA LIKE ZTABLE.
    DATA: T_ZTABLE LIKE STANDARD TABLE OF ZTABLE.
    A) To insert the record:
    If you use INTO TABLE option you don't need workarea
    SELECT * FROM ZTABLE INTO TABLE T_ZTABLE
                                      WHERE FIELD1 = 'Z001'
                                        AND FIELD2 = '2006'.
    but if you want to append a single record:
    SELECT * FROM ZTABLE INTO wa WHERE FIELD1 = 'Z001'
                                   AND FIELD2 = '2006'.
    APPEND WA TO T_ZTABLE.
    ENDSELECT.
    Now you need workarea.
    B) To read data: you need always a workarea:
    LOOP AT T_ZTABLE INTO WA WHERE ....
      WRITE: / WA-FIELD1, WA-FIELD2, WA-FIELD3.
    ENDLOOP.
    or
    READ T_ZTABLE INTO WA WITH KEY FIELD3 = '0000000001'.
    IF SY-SUBRC = 0.
    WRITE: / WA-FIELD1, WA-FIELD2, WA-FIELD3.
    ENDIF.
    Anyway if you want to know only if a record exists, you can use the TRANSPORTING NO FIELDS option, in this case it doesn't need a workarea.
    READ T_ZTABLE WITH KEY FIELD3 = '0000000001'
                                      TRANSPORTING NO FIELDS.
    IF SY-SUBRC = 0.
    WRITE 'OK'.
    ENDIF.
    C) To update the data: it always needs a workarea
    LOOP AT T_ZTABLE INTO WA WHERE FIELD3 = '0000000001'.
    WA-FIELD3 = '0000000002'.
    MODIF T_ZTABLE FROM WA.
    ENDLOOP.
    or
    READ T_ZTABLE INTO WA WITH KEY FIELD3 = '0000000001'.
    IF SY-SUBRC = 0.
    WA-FIELD3 = '0000000002'.
    MODIF T_ZTABLE FROM WA INDEX SY-TABIX
    ENDIF.
    AT the end you can use the internal table to update database:
    MODIFY/UPDATE/INSERT ZTABLE FROM T_ZTABLE.
    See Help online for key words DATA, you can find out more details.
    Max
    Message was edited by: max bianchi

  • How to fetch the data to the internal table with out using mandt

    Hi all,
    Iam giving my code please observer... and give me the reasonable solution.
      t_mar LIKE STANDARD TABLE OF z_mar.
    SELECT  mandt
             werks                         " Plant
             lifnr                         " Vendor
        FROM z_mar
        INTO TABLE t_mar
    where sal = 2000.
    By removing MANDT from select query, it is going to dump.
    ex:
       SELECT 
              werks                         " Plant
              lifnr                         " Vendor
         FROM z_mar
         INTO TABLE t_mar
    where sal = 2000.
    > Now it is going to dump ( here i removed the mandt field ).
    Please give me a solution to fetch the data by removing mandt in select statement, with out chaning the internal table structure.
    Thanks,
    Ravi

    hi Ravi,
    i also had to avoid move-corresponding and the following is what i did...its extra work and goes around but it will
    do the needed work..............
    t_mar LIKE STANDARD TABLE OF z_mar.
    SELECT *
    FROM z_mar
    INTO TABLE t_mar
    where sal = 2000.
    the above gets you all the fields ...but if you still want to narrow it down to just two fields
    *****Declaring structure with 2 fields
    data:begin of fs_data.
    data:werks type z_mar-werks,
         lifnr type z_mar-lifnr ,
    data:end of fs_data.
    *******internal table of above
    data:int_data like fs_data occurs 0 with headerline.
    *****moving the only 2 required fields
    loop at t_mar.
    t_mar-werks  = int_data-werks.
    t_mar-lifnr  = int_data-lifnr.
    append int_data.
    endloop.
    Hope you found it useful...
    Regards
    Bx

  • Intenal table with out headerline

    hi,
    i have a doubt,please clarify.
    data:itab like <databse table> occurs 0 with header line.
    or
    data:itab like <databse table>occurs 0,
            wa like line type of itab.
    in above two cases , in my view  no difference.
    in first case there will be one workarea will be created with same name itab,
    in second case we are explicitly creating work area.
    ok.
    here my doubt is in what cases it is madatory to create  internal table with  explicitly work area?
    thanks in advance.
    venu

    hi,
        abap object oriented programming in higher versions doesn't allow internal table with header line, so we can create internal table with out header line.
    for that one we follow two approches...
    1)
    TYPES: BEGIN OF LINE,
             COL1 TYPE I,
             COL2 TYPE I,
           END OF LINE.
    DATA :  ITAB TYPE STANDARD TABLE OF LINE,
                 WA TYPE LINE.
    2) In second case create line type(structure) and row type by using  SE11.
    SE11->select DATA ELEMENT object> here select STRUCTURE object and provide required fields>now select ROW TYPE object here provide LINE TYPE( STRCTURE which is created in previous)-> SAVE and activate.
    IN the above case STRCTURE acts as WORK-AREA AND ROW TYPE acts as body.
    object oriented programming doesn't support to using LIKE key word.
    regards,
    Ashok

  • WHEN DO U NEED CREATE AN INTERNAL TABLE WITH HEADERLINE AND WITH OUT HEADER

    HI
    EXPERTS CAN U HELP ME FOR THIS

    Hi,
    PLEASE CHECK OUT THE LINK BELOW FOR INTERNAL TABLE WITH HEADER LINE IT MIGHT HELP YOU
    http://sap.mis.cmich.edu/sap-abap/abap04/sld012.htm
    PLEASE CHECK OUT THE LINK BELOW FOR INTERNAL TABLE WITHOUT HEADER LINE IT MIGHT HELP YOU
    http://sap.mis.cmich.edu/sap-abap/abap04/sld013.htm
    DIFFERENCES BEWTEEN WORK AREA AND HEADER LINE PLEASE CHECK OUT THE LINK BELOW IT MIGHT HELP YOU
    http://www.sap-img.com/abap/difference-between-work-area-and-header-line.htm
    *************please reward points if the information is helpful to you***********

  • What are the advantages of using an internal table with workarea

    Hi,
    can anyone tell me
    What are the advantages of using an internal table with workarea
    over an internal table with header line?
    thnks in adv
    regards
    nagi

    HI,
    Internal tables are a standard data type object which exists only during the runtime of the program. They are used to perform table calculations on subsets of database tables and for re-organising the contents of database tables according to users need.
    http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb35de358411d1829f0000e829fbfe/content.htm
    <b>Difference between Work Area and Header Line</b>
    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.
    The header line is a field string with the same structure as a row of the body, but it can only hold a single row.
    It is a buffer used to hold each record before it is added or each record as it is retrieved from the internal table. It is the default work area for the internal table
    1) The difference between
    whih header line and with out heater line of internal table.
    ex:-
    a) Data : itab like mara occurs 0 with header line.
    b) Data: itab like mara occurs 0.
    -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.
    a) Data : itab like mara occurs 0 with header line.
    table is with header line
    b) Data: itab like mara occurs 0.
    table is without header line
    2)work area / field string and internal table
    which one is prefarable for good performance any why ?
    -The header line is a field string with the same structure as a row of the body, but it can only hold a single row , whereas internal table can have more than one record.
    In short u can define a workarea of an internal table which means that area must have the same structure as that of internal table and can have one record only.
    Example code:
    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.
    Regards,
    Padmam.

  • Internal table with Dynamic and Non dynamic fileds

    Hi Experts,
    How to get the internal table with Dynamic and Non-Dynamic Fields.
    Could u please help me.
    Thanks,
    Varun

    Hi,
       Execute the below sample code or analyze it there is appropriate description provided.
    *& Report  ZTEST_PRM_DYN_ALV
    REPORT  ZTEST_PRM_DYN_ALV.
    type-pools: slis.
    field-symbols: <dyn_table> type standard table,
    <dyn_wa>.
    data: alv_fldcat type slis_t_fieldcat_alv,
    it_fldcat type lvc_t_fcat.
    selection-screen begin of block b1 with frame title text-001.
    parameters: p_flds(5) type c.
    selection-screen end of block b1.
    start-of-selection.
    *build the dynamic internal table
    perform build_dyn_itab.
    *write 5 records to the alv grid
    do 5 times.
    perform build_report.
    enddo.
    *call the alv grid.
    perform call_alv.
    *Build_dyn_itab
    form build_dyn_itab.
    data: new_table type ref to data,
    new_line type ref to data,
    wa_it_fldcat type lvc_s_fcat.
    *Create fields .
    clear wa_it_fldcat.
    wa_it_fldcat-fieldname = 'name1'.
    wa_it_fldcat-datatype = 'mara-matnr'.
    wa_it_fldcat-intlen = 5.
    append wa_it_fldcat to it_fldcat .
    *clear wa_it_fldcat.
    wa_it_fldcat-fieldname = sy-index.
    wa_it_fldcat-datatype = 'CHAR'.
    wa_it_fldcat-intlen = 5.
    append wa_it_fldcat to it_fldcat .
    do p_flds times.
    clear wa_it_fldcat.
    wa_it_fldcat-fieldname = sy-index.
    wa_it_fldcat-datatype = 'CHAR'.
    wa_it_fldcat-intlen = 6.
    append wa_it_fldcat to it_fldcat .
    enddo.
    *Create dynamic internal table and assign to FS
    call method cl_alv_table_create=>create_dynamic_table
    exporting
    it_fieldcatalog = it_fldcat
    importing
    ep_table = new_table.
    assign new_table->* to <dyn_table>.
    *Create dynamic work area and assign to FS
    create data new_line like line of <dyn_table>.
    assign new_line->* to <dyn_wa>.
    endform.
    *Form build_report
    form build_report.
    data: fieldname(20) type c.
    data: fieldvalue(5) type c.
    data: index(3) type c.
    field-symbols: <fs1>.
    do p_flds times.
    index = sy-index.
    *Set up fieldvalue
    concatenate 'FLD' index into
    fieldvalue.
    condense fieldvalue no-gaps.
    assign component index of structure <dyn_wa> to <fs1>.
    <fs1> = fieldvalue.
    enddo.
    *Append to the dynamic internal table
    append <dyn_wa> to <dyn_table>.
    endform.
    *CALL_ALV
    form call_alv.
    data: wa_cat like line of alv_fldcat.
    *clear wa_cat.
    wa_cat-fieldname = 'matnr'.
    wa_cat-seltext_s = sy-index.
    wa_cat-outputlen = '10'.
    append wa_cat to alv_fldcat.
    do p_flds times.
    clear wa_cat.
    wa_cat-fieldname = sy-index.
    wa_cat-seltext_s = sy-index.
    wa_cat-outputlen = '6'.
    append wa_cat to alv_fldcat.
    enddo.
    *Call ABAP List Viewer (ALV)
    call function 'REUSE_ALV_GRID_DISPLAY'
    exporting
    it_fieldcat = alv_fldcat
    tables
    t_outtab = <dyn_table>.
    endform.
    Hope this will help, reward if found usefull.
    Cheers,
    Ram.

  • Differences between Internal table with Occurs 0 and Field-Groups?

    Is there really any difference between just using an internal table with an OCCURS 0 statement-- which would write the entire table to paging space-- and using field-groups? How is Field-Groups is more effective than Internal tables with occurs 0 when it comes to performance?
    Could anybody please give some information regarding above question?
    Thanks,
    Surya.

    hi,
    occurs 0 means it wont create any extra memory. based on the records only the memory is allocated to internal tables at run time. but when an internal table is created it can hold data of type to which it is declared.
    i.e data: itab like mara occurs 0 with header line.
    can take data only from mara table
    we can also do in another way as using types keyword we can declare a standard structure and create a internal table of that type. its also not that useful as we have to change the structure depending on changes for storing data.
    for this purpose field symbols are used. field symbols can hold any data means that they can point to tables, fields, any standard or user-defined types. field symbols actually points to respective types by which we can directly access to that types using field symbols.
    filed symbols works more faster than internal tables.
    if helpful reward some points.
    with regards,
    Suresh.A

  • Internal table with Import and Export

    Hi All,
    Hi all
    Please let me know the use of <b>Internal table with Import and Export parameters and SET/GET parameters</b>, on what type of cases we can use these? Plese give me the syntax with some examples.
    Please give me detailed analysis on the above.
    Regards,
    Prabhu

    Hi Prabhakar,
    There are three types of memories.
    1. ABAP MEMORY
    2. SAP MEMORY
    3. EXTERNAL MEMORY.
    1.we will use EXPORT/ IMPORT TO/ FROM MEMORY-ID when we want to transfer between ABAP memory
    2. we will use GET PARAMETER ID/ SET PARAMETER ID to transfer between SAP MEMORY
    3. we will use EXPORT/IMPORT TO/FROM SHARED BUFFER to transfer between external memory.
    ABAP MEMORY : we can say that two reports in the same session will be in ABAP MEMORY
    SAP MEMORY: TWO DIFFERENT SESSIONS WILL BE IN SAP MEMORY.
    for ex: IF WE CALL TWO DIFFERENT TRANSACTIONS SE38, SE11
    then they both are in SAP MEMORY.
    EXTERNAL MEMORY: TWO different logons will be in EXTERNAL MEMORY.
    <b>Syntax</b>
    To fill the input fields of a called transaction with data from the calling program, you can use the SPA/GPA technique. SPA/GPA parameters are values that the system stores in the global, user-specific SAP memory. SAP memory allows you to pass values between programs. A user can access the values stored in the SAP memory during one terminal session for all parallel sessions. Each SPA/GPA parameter is identified by a 20-character code. You can maintain them in the Repository Browser in the ABAP Workbench. The values in SPA/GPA parameters are user-specific.
    ABAP programs can access the parameters using the SET PARAMETER and GET PARAMETER statements.
    To fill one, use:
    SET PARAMETER ID <pid> FIELD <f>.
    This statement saves the contents of field <f> under the ID <pid> in the SAP memory. The code <pid> can be up to 20 characters long. If there was already a value stored under <pid>, this statement overwrites it. If the ID <pid> does not exist, double-click <pid> in the ABAP Editor to create a new parameter object.
    To read an SPA/GPA parameter, use:
    GET PARAMETER ID <pid> FIELD <f>.
    This statement fills the value stored under the ID <pid> into the variable <f>. If the system does not find a value for <pid> in the SAP memory, it sets SY-SUBRC to 4, otherwise to 0.
    To fill the initial screen of a program using SPA/GPA parameters, you normally only need the SET PARAMETER statement.
    The relevant fields must each be linked to an SPA/GPA parameter.
    On a selection screen, you link fields to parameters using the MEMORY ID addition in the PARAMETERS or SELECT-OPTIONS statement. If you specify an SPA/GPA parameter ID when you declare a parameter or selection option, the corresponding input field is linked to that input field.
    On a screen, you link fields to parameters in the Screen Painter. When you define the field attributes of an input field, you can enter the name of an SPA/GPA parameter in the Parameter ID field in the screen attributes. The SET parameter and GET parameter checkboxes allow you to specify whether the field should be filled from the corresponding SPA/GPA parameter in the PBO event, and whether the SPA/GPA parameter should be filled with the value from the screen in the PAI event.
    When an input field is linked to an SPA/GPA parameter, it is initialized with the current value of the parameter each time the screen is displayed. This is the reason why fields on screens in the R/3 System often already contain values when you call them more than once.
    When you call programs, you can use SPA/GPA parameters with no additional programming overhead if, for example, you need to fill obligatory fields on the initial screen of the called program. The system simply transfers the values from the parameters into the input fields of the called program.
    However, you can control the contents of the parameters from your program by using the SET PARAMETER statement before the actual program call. This technique is particularly useful if you want to skip the initial screen of the called program and that screen contains obligatory fields.
    Reading Data Objects from Memory
    To read data objects from ABAP memory into an ABAP program, use the following statement:
    Syntax
    IMPORT <f1> [TO <g 1>] <f 2> [TO <g 2>] ... FROM MEMORY ID <key>.
    This statement reads the data objects specified in the list from a cluster in memory. If you do not use the TO <g i > option, the data object <f i > in memory is assigned to the data object in the program with the same name. If you do use the option, the data object <f i > is read from memory into the field <g i >. The name <key> identifies the cluster in memory. It may be up to 32 characters long.
    You do not have to read all of the objects stored under a particular name <key>. You can restrict the number of objects by specifying their names. If the memory does not contain any objects under the name <key>, SY-SUBRC is set to 4. If, on the other hand, there is a data cluster in memory with the name <key>, SY-SUBRC is always 0, regardless of whether it contained the data object <f i >. If the cluster does not contain the data object <f i >, the target field remains unchanged.
    Saving Data Objects in Memory
    To read data objects from an ABAP program into ABAP memory, use the following statement:
    Syntax
    EXPORT <f1> [FROM <g 1>] <f 2> [FROM <g 2>] ... TO MEMORY ID <key>.
    This statement stores the data objects specified in the list as a cluster in memory. If you do not use the option FROM <f i >, the data object <f i > is saved under its own name. If you use the FROM <g i > option, the data objet <g i > is saved under the name <f i >. The name <key> identifies the cluster in memory. It may be up to 32 characters long.
    Check this link.
    http://www.sap-img.com/abap/difference-between-sap-and-abap-memory.htm
    Thanks,
    Susmitha.
    Reward points for helpful answers.

  • XI ALERTS with out BPM Are not working.

    Hi All,
      We are on XI 3.0 sp14. Alerts with out BPM are not working. I want to apply notes 906044, 876546. It says i need to make some changes to the following functions. I could not able to find these Function modules in the first place. Can some one help me out?
    <b>Note -
    Object -
         Name</b>
    906044  -
    function---- SXMS_ALERT_ERROR_RECEIVE
    906044  -
    function --- SXMS_ALERT_ERROR_SEND
    906044&876546--method ---CL_XI_ALERT HAS_ACTIVE_RULE
    906044  -
    method -
      CL_XI_ALERT_UTIL GET_MDT_URL
    905896   -
    method  -
    CL_XI_ALERT CREATE_ALERT
    Thank you
    Ganges Leaves.

    Ganges
    Login into XI Developement and give SE37 Transaction. Then you give SXMS_ALERT_ERROR_RECEIVE and click 'display'.
    Then you check for the methods CL_XI_ALERT HAS_ACTIVE_RULE, CL_XI_ALERT_UTIL GET_MDT_URL, CL_XI_ALERT CREATE_ALERT and make the changes according to service notes. If you dont find this methods in this function then you can try in SXMS_ALERT_ERROR_SEND.
    Regards,
    ---Mohan

  • Collect in an internal table with keys plant and material

    Hi ,
    I have an output internal table with material , plant and var quantitites .
    I would like to use Collect statement and sum the quantities but do it by plant and material .
    How do I specify that i want to do it on plant or material ?
    Thanks !

    hi here is an example like urs..
    DATA: BEGIN OF seats,
            carrid TYPE sflight-carrid,
            connid TYPE sflight-connid,
            seatsocc TYPE sflight-seatsocc,
          END OF seats.
    DATA seats_tab LIKE HASHED TABLE OF seats
                   WITH UNIQUE KEY carrid connid.
    SELECT carrid connid seatsocc
           FROM sflight
           INTO seats.
      COLLECT seats INTO seats_tab.
    ENDSELECT.
    check for help..
    http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/collect.htm
    regards,
    venkat

  • Declare the internal table with only one 10 character  field and use

    Hi,
    I want to declare the internal table with only one 10 character  field and use.
    Jaya

    Hi,
    Go ahead. U can declare IT with only one field
    Example:
    data: begin of zcustlist occurs 1000,
                   custmer(10)  type c,
             end of zcustlist.
    Narendra Reddy.
    Edited by: Narendra Reddy C on Aug 8, 2008 11:39 AM

  • How to create an dynamic internal table with the structure of a ddic table

    Hi all,
    I want to fill ddic-tables (which I already created) in my abap dictionary with data out of CSV-files (which are located on the CRM-Server).  The ddic tables have different amount of fields.
    I started with creating a table which contains the name of the tables and the path to the matching CSV-file.
    At the beginning I'm filling an internal table with part of this data (the name of the ddic-tables) - after that I am looping at this internal table.
    LOOP AT lt_struc ASSIGNING <lfs_struc>.
         LOOP AT lv_itab1 INTO lv_wa1 WHERE ztab_name = <lfs_struc>.
         lv_feld = lv_wa1-zdat_name.
        ENDLOOP.
        CONCATENATE 'C:\-tmp\Exportierte Tabellen\' lv_feld INTO lv_pfad.
        Do.
        OPEN DATASET lv_pfad FOR INPUT IN TEXT MODE ENCODING NON-UNICODE IGNORING CONVERSION ERRORS.
        READ DATASET lv_pfad INTO lv_rec.
        IF sy-subrc NE 0.
          EXIT.
        ENDIF.
        enddo.
        REPLACE ALL OCCURRENCES OF '"' IN lv_rec WITH ''.
        SPLIT lv_rec AT ';' INTO TABLE lt_str_values.
        INSERT into (<lfs_struc>) values lr_str_value.
        CLOSE DATASET lv_pfad.
    endloop.
    This is not the whole code, but it's working until
    SPLIT lv_rec AT ';' INTO TABLE lt_str_values.
    I want to split all the data of lv_rec into an internal table which has the structure of the current ddic-table, but I didn't find out how to do give the internal table the structure of the ddic-table. In the code I used an internal tyble type string but I should be the structure of the matching tabel.
    If I try to create an internal table by using a fiel symbol, I am told, that the data types are not matching.
    Has anyone an idea?

    Hi Mayari,
    though you were successfull with
    METHOD cl_alv_table_create=>create_dynamic_table
    I must warn you not to use it. The reason is that the number of tables created is limited, the method uses GENERATE SUBROUTINE statement and this triggers an unwanted database commit.
    If you know the DDIC structure, it is (starting with ECC6.0) much easier:
    field-symbols:
      <table> type standard table.
    data:
      lr_data type ref to data.
    Create data lr_data type table of (<DDIC structure>).
    assign lr_data->* to <table>.
    The split code can be simplified gaining speed loosing complexity not loosing functionality.
    field-symbols:<fs_s> type any.
    field-symbols:<fs_t> type any.
    SPLIT lv_rec AT ';' INTO table it_string.
    loop at it_string assigning <fs_s>.
      assign component sy-tabix of wa_string to <fs_t>.
    if sy-subrc = 0.
      <fs_t> = <fs_s>.
    endif.
    at last.
      append <fs_itwa3> to <ft_itab3>.
    endat.
    endloop.
    Though it may work as Keshav.T suggested, there is no need to do that way.     
    Regards,
    Clemens

  • Sorting internal table with line types

    Hi,
    I have internal table juts for an example with four entries as below:
    A[]
    Line.....Line Types
    444001.....P
    New York...C 
    Evershine..B
    Mary.......N
    I want to sort the internal table with line types in order of lin types NBCP.
    How can i do this ?
    Please help.
    Note: Above example is just with four entries, there might be internal table with ten entries and ten defined sorting order for line types.

    Hi Tushar,
    Please note that we can't changes the mandatory sequence of the address format as defined in the country specif address format. We can change the sequence of others fields by line_priority.
    Try to change the address type :
    ADDRESS_TYPE - Address type (from 3.0C)
    There are three types of address:
    Address type '1': addresses of firms or organizations; the address structure which is used in most SAP applications as 'Address'.
    Address type '2': address of a person
    Address type '3': work address, usually the address of a contact person in a company
    Please use T/code "OY01"> Select Country> Example :AU"--> Display --> Select address key and press F1. You will find SAP 's Address format configuration .
    sap help:
    Formatting Routine Key for Printing Addresses
    For printing addresses, there are country-specific routines which in each case copy the correct postal formatting of the address.
    The three-character "Address Layout Key" for the recipient country controls which of the routines available for formatting addresses in the relevant country is used.
    These routines are programmed into the ADDRESS_INTO_PRINTFORM function module.
    They are based on different national and international guidelines and norms, including:
    ISO 11180,
    contracts of the World Postal Union (Seoul 1994),
    international address samples from the World Postal Union
    as well as the available rules of the individual countries.
    Below you will find an overview of the country-specific formats currently implemented.
    Customers can program their own formatting routines using a customer exit. The SZAD0001 SAP enhancement has been defined in the package SZAD for this (-> transaction CMOD).
    General formatting rules
    The following parameters are used depending on the transaction:
    whether the company address (street/house number) or the P.O. Box address is printed if both exist,
    how many lines are available for printing,
    which is the sender country.
    If there are not enough lines, then lines are left out according to a standard sequence.
    The address format depends on whether the sender country is the same as, or different from, the recipient country. The country is always specified from abroad, either as a text name, or as an identification code of up to three characters (license plate code or country key).
    Where the country name is written out in full, it is written in the language of the sender country. If a language is not specified for the sender country, or the sender country itself is not specified, the logon language is used instead.
    Exception: the language for the country code can be explicitly overwritten by a parameter in the print program (e.g. when the country code for customs transit papers is always to be specified in a particular language, such as English). if the "Print country name in recipient language" flag is set in the print program, the recipient language is used.
    Other language-dependent components such as the title and the word 'PO Box' are printed in the recipient language or the recipient country language. If this cannot be determined, the logon language is again used.
    For all formats except Great Britain (006), Japan (013), and South Korea (017), the core of the address is formatted as follows (without empty lines, except for the compulsory empty line:)
    title line (if applicable)
    name block (differs depending on the address type, see below)
    street address or PO Box
                            (compulsory empty line, if applicable)
    city line with postal code
    country code (if applicable)
    The city line and the country name are always printed in upper case for foreign addresses (only for the complete address, not for short forms).
    The name block generally consists of the following:
    "Normal" addresses (address type SPACE and address type 1):
    NAME1
    NAME2
    NAME3
    NAME4
    Personal addresses (address type 2):
    Title of person and name of person
    Business address with department and contact person (address type 3):
    NAME1
    NAME2
    NAME3
    NAME4
    department
    title of person and name of person
    In addresses entered using Business Address Services (central address management) (see Release notes Central Address Management for Release 4.0 and Central Address Management for Release 4.5 ), the street address can comprise several lines (see Print street address), otherwise street and house number are maintained in the Street field.
    Some countries do not have a compulsory empty line (see notes below). The city and district are printed in the city line, connected by a hyphen (exceptions: 004 USA, 006 Great Britain/Ireland, 013 Japan, 015 Germany, 017 South Korea, 019 Denmark), provided that the total length does not exceed 35 characters. If a different city is specified for the PO Box (PFORT), this is used in the PO Box address.
    In all formats which use a country code (currently 001 European standard format 002 Italy, 011 Switzerland and 014 Austria ), the license plate code for that country is used. If this is not maintained, the country key in table T005 is used.
    If the "Print country name in foreign addresses" flag is set for the sender country in table 005, the country code is not used; the country name is printed in the last line of the address.
    Formats 004 (USA), 005 (Canada) and 008 (Singapore) contain a line ('F') for the function of the contact person in the company (if address type = '3'). This line comes immediately after the line 'N' (Name (and title) of the natural person).
    In formats 002 (Italy), 004 (USA), 005 (Canada), 006 (Great Britain), 007 (Brazil) and Australia (009), the REGIO field (Region, State, Province, County) is formatted. For the USA, Canada, Brazil and Australia, the key from table T005S is used; for Great Britain the text name from table T005U.
    In all countries for which no "Address structure key" is maintained, a standard format is used which corresponds to format "010".
    Hope this may help you.
    Lanka

  • How to create an internal table with fields from different sources

    Hi.
    I need to create an internal table where some of the fields are from a database table, and the other fields are user specified. How do i do that?
    Example:
    DB table ZTAB with fields ZTAB-FIELD1, ZTAB-FIELD2.
    I want to create an internal table ITAB with the fields ZTAB-FIELD1, ZTAB-FIELD2 from ZTAB. In addition, I also want to have one more field RECORD_NO, which is not from ZTAB. How do I do it? Could I do something like below?
    DATA BEGIN OF ITAB.
            INCLUDE STRUCTURE ZTAB.
    DATA RECORD_NO TYPE I.
    DATA END OF UPLINE.
    Or, are there more efficient way of doing it? Thanks.

    hi KIan,
    go:
    general type
    TYPE : BEGIN OF ty_itab,
               field1 TYPE ztab-field1,
               field2 TYPE ztab-field2,
    *your own fields here:
               field TYPE i,
               field(30) TYPE c,
               END OF ty_itab.
    work area
    DATA : gw_itab TYPE ty_itab.
    internal table
    DATA : gt_itab TYPE TABLE OF ty_itab.
    hope this helps
    ec

Maybe you are looking for

  • Is there a way to put the bluetooth icon on the homepage?

    I pair my iphone with my car when I'm driving. Is there a way to put the bluetooth icon on the homepage so I don't have to go through settings to turn the bluetooth on and off? I don't like to leave the bluetooth on all the time because it drains the

  • Can i buy a macbook pro retina display in US with portuguese keyboard?

    Can Apple or someone else tell me if is possible to buy in Apple Retail Store in U.S. a Macbook Pro retina Display  with portuguese keyboard?

  • Payments terms in Vendor Master(XK01)

    Hi Everyone, I want to know, at the time of Creation of Vendor master-Two times we will got Payment terms.In Two TAB i)     In Purchasing data and ii)     Payment transaction Accounting. Please tell me what is meaning giving Two times in different pl

  • What is default maxdb port

    Hi    can you please tell me what is the default MaxDB port on which WAS connects. is it same for DQE DB on MaxDB or DQE service connects on different port. actually I need that port while tring to unistalling EP6.0 sneak preview sp9 on maxdb. Regard

  • VI for measuring FRF having data writing problem

    Respected Sir/Mam,                                     I have created a Vi for measuring the signal during modal analysis. The Vi is giving a very good signal but the problem is in writing the data. The no of samples is given as 10K and rate is 100k