"table" is a table without a header line & therefore has no component"fiel"

Hi Experts,
     In Smartforms, I have used internal table "it_tab" in my table.. and i declared type for that internal table in TYPES tab.
& i declared work area for that in global definitions. But i am getting this error.
"table" is a table without a header line & therefore has no component"fieldname"
will you please help me. please provide me an example code for this
thanks in Advance
Edited by: sreelakshmi.B on Jun 24, 2010 4:39 PM

Hi,
    In Global Definitions under "Types" tab, declare as below
TYPES: BEGIN OF type_split,
         SPLIT1(20) TYPE C,    "Day of week
         SPLIT2(20) TYPE C,    "year
         SPLIT3(20) TYPE C,    "month
         SPLIT4(20) TYPE C,    "day of month
       END OF type_split.
TYPES : t_date TYPE type_split OCCURS 0.
Now in "Global Data" tab, declare as below
it_itab     TYPE     t_date
wa_itab     TYPE     type_split
Regards
Bala Krishna

Similar Messages

  • I want to create an internal table without using header line and occurs 0?

    hi experts,
    Can anybody help me to declare an internal table without using headerline and occurs 0 options but still i have to use the functionalities that occurs 0 and header line options provide.

    Hi Saisri,
    You can use the internal table without headerline and create a header for then internal table with the same structure. We need to use the header while manipulating with the data of the internal table.
    example:
    types: begin of ty_afpo,
                 kdauf type kdauf,
                 kdpos type kdpos,
                 ltrmp   type ltrmp,
               end   of ty_afpo.
    data : t_afpo type standard table of ty_afpo,  " internal table declaration
             wa_afpo type ty_afpo.                        " work area declaration
    <after populating the data into the internal table>
    loop at t_afpo into wa_afpo.
    write:/ wa_afpo-kdauf, wa_afpo-kdpos, wa_afpo-ltrmp.
    endloop.
    This I think shall give you a basic understanding of how things work.
    <b>Reward points if this helps,</b>
    Kiran

  • Lt_item_type is a table with out header line and therefore has no component

    Dear frnds,
    I am new to webdynpro i got this error while creating a tree .can any body tell me what is the mistake i have done.
    Regards.
    siva

    Hi,
    As you are new to the tree concepts.Try to do this tutorial.It will give a idea.
    [Tree|http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/d075dbc5-3b33-2c10-5f9f-99bf2738fe6a?QuickLink=index&overridelayout=true]
    Regards,
    Karthik.R

  • Error: itab is a table without a header....

    Hi everybody,
    i get the following error after activation:
    "ITAB" is a table without a header line and therefore has no component called "NUM"..
    How can i solve this problem?
      TYPES: BEGIN OF i_itab,
               NUM TYPE I,
             END OF i_itab.
      DATA: itab TYPE TABLE OF i_tab.
      LOOP AT myTable INTO ls_mytable.
        itab-num = ls_mytable-nr.
        APPEND itab.
      ENDLOOP.
    regards,
    Sid
    Edited by: Sid on Jul 7, 2009 7:39 PM

    Sid wrote:>
    > Hi everybody,
    >
    > i get the following error after activation:
    >
    >  "ITAB" is a table without a header line and therefore has no component called "NUM"..
    >
    > How can i solve this problem?
    >
    >
    >   TYPES: BEGIN OF i_itab,
    >            NUM TYPE I,
    >          END OF i_itab.
    >         
    >   DATA: itab TYPE TABLE OF i_tab.

    >   LOOP AT myTable INTO ls_mytable.
    >
    >     itab-num = ls_mytable-nr.
    >     APPEND itab.
    >
    >   ENDLOOP.
    >
    Have a work area for the internal table itab. Code modified below :
       TYPES: BEGIN OF i_itab,
                NUM TYPE I,
              END OF i_itab.
       DATA: itab TYPE TABLE OF i_tab,
                  wa TYPE i_tab.
       LOOP AT myTable INTO ls_mytable.
         wa-num = ls_mytable-nr.
         APPEND wa to itab.
       ENDLOOP.
    Hope this helps.
    Regards,
    Anand Patil

  • BADI cant use an internal table with header line

    hi,
         In BADI, we cant use an internal table with header line, and I am calling a function module which requires internal table as import parameter, now, the table I am passing is without a header line, So how to solve this problem ?

    You can use a type and then create an internal table of that type.
    types :
    begin of t_<example>
    *field list
    end of t_<example>
    data :
    gt_<table> type standard table of t_<example>
    pass this to the FM

  • With header line & with out header line ?

    what is difference between with header line & without header line ?

    When you create an internal table object you can also declare a header line with the same name. You can use the header line as a work area when you process the internal table. The ABAP statements that you use with internal tables have short forms that you can use if your internal table has a header line. These statements automatically assume the header line as an implicit work area. The following table shows the statements that you must use for internal tables without a header line, and the equivalent statements that you can use for internal tables with a header line:
    Operations without header line
    Operations with header line
    Operations for all Table Types
    INSERT <wa> INTO TABLE <itab>.
    INSERT TABLE ITAB.
    COLLECT <wa> INTO <itab>.
    COLLECT <itab>.
    READ TABLE <itab> ... INTO <wa>.
    READ TABLE <itab> ...
    MODIFY TABLE <itab> FROM <wa> ...
    MODIFY TABLE <itab> ...
    MODIFY <itab> FROM <wa> ...WHERE ...
    MODIFY <itab> ... WHERE ...
    DELETE TABLE <itab> FROM <wa>.
    DELETE TABLE <itab>.
    LOOP AT ITAB INTO <wa> ...
    LOOP AT ITAB ...
    Operations for Index Tables
    APPEND <wa> TO <itab>.
    APPEND <itab>.
    INSERT <wa> INTO <itab> ...
    INSERT <itab> ...
    MODIFY <itab> FROM <wa> ...
    MODIFY <itab> ...
    Using the header line as a work area means that you can use shorter statements; however, they are not necessarily easier to understand, since you cannot immediately recognize the origin and target of the assignment. Furthermore, the fact that the table and its header line have the same name can cause confusion in operations with entire internal tables. To avoid confusion, you should use internal tables with differently-named work areas.
    The following example shows two programs with the same function. One uses a header line, the other does not.
    With header line:
    TYPES: BEGIN OF LINE,
    COL1 TYPE I,
    COL2 TYPE I,
    END OF LINE.
    DATA ITAB TYPE HASHED TABLE OF LINE WITH UNIQUE KEY COL1
    WITH HEADER LINE.
    DO 4 TIMES.
    ITAB-COL1 = SY-INDEX.
    ITAB-COL2 = SY-INDEX ** 2.
    INSERT TABLE ITAB.
    ENDDO.
    ITAB-COL1 = 2.
    READ TABLE ITAB FROM ITAB.
    ITAB-COL2 = 100.
    MODIFY TABLE ITAB.
    ITAB-COL1 = 4.
    DELETE TABLE ITAB.
    LOOP AT ITAB.
    WRITE: / ITAB-COL1, ITAB-COL2.
    ENDLOOP.
    Without header line:
    TYPES: BEGIN OF LINE,
    COL1 TYPE I,
    COL2 TYPE I,
    END OF LINE.
    DATA: ITAB TYPE HASHED TABLE OF LINE WITH UNIQUE KEY COL1,
    WA LIKE LINE OF ITAB.
    DO 4 TIMES.
    WA-COL1 = SY-INDEX.
    WA-COL2 = SY-INDEX ** 2.
    INSERT WA INTO TABLE ITAB.
    ENDDO.
    WA-COL1 = 2.
    READ TABLE ITAB FROM WA INTO WA.
    WA-COL2 = 100.
    MODIFY TABLE ITAB FROM WA.
    WA-COL1 = 4.
    DELETE TABLE ITAB FROM WA.
    LOOP AT ITAB INTO WA.
    WRITE: / WA-COL1, WA-COL2.
    ENDLOOP.
    The list, in both cases, appears as follows:
    1 1
    2 100
    3 9
    The statements in the program that does not use a header line are easier to understand. As a further measure, you could have a further work area just to specify the key of the internal table, but to which no other values from the table are assigned.
    Internal table with header line
    you can use anywhere except obkect oriented concept.
    Internal table without header line :
    You should use in Object oriented concept..
    Always try to use without header line,performance point of view it is best..
    Example :
    Without header line.
    Structure
    types : begin of ty_itab ,
    matnr type mara-matnr,
    end of ty_itab.
    Internal table
    data i_itab type standard table of ty_itab .
    Work area
    data wa_itab like line of i_itab
    With header line
    data : begin of i_itab occurs 0,
    matnr like mara-matnr,
    end of i_itab
    itab with header lines are obsolete, anyway it will work but not recommended. instead use work area or more effiecient is field symbols. so donot use itab with header line.
    i will explain use of itab w/o header line.
    Data: itab1 type standard table of mara with header line occurs 0,
            itab2 type standard table of mara,
            wa_itab2 type mara.
    loop at itab1.
    "This will work fine.
    endloop.
    loop at itab2.
    "This will give erro that itabd does not hav workarea
    endloop.
    "so write
    loop at itab2 into wa_itab2.
    "This will work
    endloop.
    <b>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</b>
    regards,
    srinivas
    <b>*reward for useful answers*</b>

  • Header line and work area

    Hi,
    can anyone please explain me wht is the difference between header line and work area???

    Hi,
    INTERNAL TABLES
    - Internal tables are used to obtain data from a fixed structure for
    dynamic use in ABAP.
    - Each line in the internal table has the same field structure.
    - The main use for internal tables is for storing and formatting data from
    a database table within a program.
    WORK AREAS
    - Work areas are single rows of data.
    - It should have the same format as any of the internal tables.
    - It is used to process the data in an internal table one line at a time.
    Internal Tables with Header Line : Here the system automatically creates the work area. The work area has the same data type as internal table. This work area is called the HEADER line. It is here that all the changes or any of the action on the contents of the table are done. As a result of this, records can be directly inserted into the table or accessed from the internal table directly.
    Internal Tables without Header Line : Here there is no work area associated with the table. Work area is to be explicitly specified when we need to access such tables. Hence these tables cannot be accessed directly.
    HEADER LINE----
    CREATED EXPLICITLY------
    1.Internal table created by referring to another table
    Syntax: Data <f> <type> with header line.
    <type> refers to a table data type or table data objects using type or like.
    Here internal table <f> is created of the type <type>.
    Example:
    DATA t_line TYPE line OCCURS 10 with header line.
    2. Internal table created by referring to existing structure
    Syntax: Data<f> <type> occurs n with header line.
    The lines of the internal table <f> have the data type specified in <type> (Can use either like or type).
    Example:
    DATA flight_tab LIKE sflight OCCURS 10.
    CREATED BY DEFAULT---
    3. Internal table created With a new structure
    Syntax: Data : Begin of <f> occurs <n>,
    <component declaration>,
    End of <f>.
    Work area is created by default.
    Example:
    Data : Begin of itab occurs 10,
    column1 type I,
    column2(4) type C,
    column3 like mara-ernam,
    End of itab.
    reward if useful
    Regards

  • HEader Line Issue

    Hi All,
    Previously i have declared a data as
    DATA: BEGIN OF t_temp OCCURS 10,
          vbeln TYPE char10,
          END OF t_temp.
    <code continues>
    LOOP AT t_data INTO fs_data.
        IF NOT fs_data-del_no IS INITIAL.
          CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
            EXPORTING
              input  = fs_data-del_no
            IMPORTING
              output = t_temp-vbeln.
          COLLECT t_temp.
        ENDIF.
    APPEND LINES OF t_TYPE_temp TO T_ty_vbeln
    With the above  i am able to fetch the data in in t_temp.
    I have changed the data declarations as
    TYPES: BEGIN OF tYPE_temp,
          vbeln TYPE char10,
          END OF tYPE_temp.
    DATA: FS_TYPE_TEMP TYPE TYPE_TEMP,
          T_TYPE_TEMP TYPE STANDARD TABLE OF TYPE_TEMP.
    And the same loop i am using as shown below.
    LOOP AT t_data INTO fs_data.
        IF NOT fs_data-del_no IS INITIAL.
          CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
            EXPORTING
              input  = fs_data-del_no
            IMPORTING
              output = t_type_temp-vbeln.
          COLLECT t_type_temp.
        ENDIF.
    APPEND LINES OF t_TYPE_temp TO T_ty_vbeln
    In the above case i am getting error as t_type_temp is a table without header line and
    therefore has no component called "VBELN". What changes has to be done.
    Regards
    VEnk@
    Edited by: Venkat Reddy on Nov 13, 2009 11:30 AM

    HI ,
      you write the code as like this..
    TYPES: BEGIN OF type_temp,
                      vbeln TYPE char10,
               END OF type_temp.
    DATA: FS_TYPE_TEMP TYPE TYPE_TEMP,
    T_TYPE_TEMP TYPE STANDARD TABLE OF TYPE_TEMP.
    And the same loop i am using as shown below.
    LOOP AT t_data INTO fs_data..
    IF NOT fs_data-del_no IS INITIAL.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
    input = fs_data-del_no
    IMPORTING
    output = FS_TYPE_TEMP-vbeln.
    APPEND FS_TYPE_TEMP TO T_TYPE_TEMP
    ENDIF.
    endloop.

  • Work area VS header line

    guyz!
    why do we hafta create WORK AREA ??? cant we make use of the header line.
    what if we make use of int tabs wid header lines.???
    dont say dat performance issue....plzz explain me dat..
    Regards
    zid.

    Hi
    When you define an internal table the system arranges a part of memory area in two parts:
    - The first one is to stores all records loaded in the table;
    - The second one is to store the single record is elaborated,
    So when you loop an internal table, the system picks up the record from the first area and puts it to the second one;
    The part of memory to store all records is obligatory, so the system'll always create it when an internal table is defined.
    The part of memory to store the single record is not necessary, you have to use it only if it needs to read the table: this one is called HEADER LINE or WORK AREA.
    So you can decide to declare a table with or without an header line in according to what you need to do.
    A) If you need to read the table you need to have a table with header line or work area:
    - WITH HEADER LINE
    DATA: BEGIN OF ITAB OCCURS 0,
                  FIELD1,
                  FIELD2,
                  FIELD3,
               END    OF ITAB. 
    LOOP AT ITAB.
      WRITE ITAB.
    ENDLOOP.
    While looping the table the system automatically fills the header line;
    - WITH WORK AREA:
    DATA: BEGIN OF WA_ITAB,
                  FIELD1,
                  FIELD2,
                  FIELD3,
               END    OF WA_ITAB. 
    DATA: ITAB LIKE STANDARD TABLE OF WA_ITAB.
    LOOP AT ITAB INTO WA_ITAB.
      WRITE WA_ITAB.
    ENDLOOP.
    While looping the table the system automatically fills the work area.
    So it can say the header line is a work area the system automatically creates by internal table defination.
    It's the same to use the header line or work area, because you need them when you have to read the records of an internal table.
    A) If you don't need to read the table, you can define a table without header line:
    SELECT-OPTIONS: SO_ERDAT FOR SY-DATUM.
    DATA: IT_MATERIAL LIKE MARA-MATNR OCCURS 0.
    DATA: IT_MARC LIKE STANDARD TABLE OF MARC WITH HEADER LINE.
    SELECT MATNR FROM MARA INTO TABLE IT_MATERIAL WHERE ERDAT IN SO_ERDAT.
    IF SY-SUBRC = 0.
      SELECT * FROM MARC
            FOR ALL ENTRIES IN IT_MATERIAL WHERE MATNR = IT_MATERIAL.
    ENDIF.
    LOOP AT IT_MARC.
      WRITE IT_MARC.
    ENDLOOP.
    In this example the internal table IT_MATERIAL is used only to select the data from MARC using the option FOR ALL ENTRIES. This options doesn't use the header line of the table, so it's useless to define a table with an heaader line.
    Max

  • Add header line to excel sheet when using FM RH_START_EXCEL_WITH_DATA

    Hi
    I'm using FM RH_START_EXCEL_WITH_DATA to download an internal table to EXCEL. But when excel is started it's without a header line.
    What I would like to do, is to take the field-names/field-text from the abap dictionary, and use them as the header line. How do I achieve this ?
    Regards
    Morten Nielsen

    Hi ,
    See this sample code.
    Tables : zacg_cca,zacg_exsh.
    data: P_file like RLGRAP-FILENAME.
    Data: Begin of it_header occurs 0,
          Header(15) ,
          end of it_header.
    Data : begin of it_final occurs 0,
           ccode type zacg_cca-ccode,
           mat_cd type zacg_cca-mat_cd,
           ingr_desc type zacg_cca-ingr_desc,
           conc type  zacg_cca-conc,
           quantity type zacg_cca-quantity,
           percqty type zacg_cca-percqty,
           flag ,
           APP_DATE type zacg_cca-app_date,
           rsamnos type zacg_cca-rsamnos,
           end of it_final.
           SELECTION-SCREEN : BEGIN OF BLOCK blk WITH FRAME TITLE text-000.
           select-options : s_Date for zacg_cca-app_date.
           SELECTION-SCREEN  : END OF BLOCK blk.
           it_header-Header = 'Samp_code'.
           Append it_header.
           it_header-Header = 'Mat_code'.
           Append it_header.
           it_header-Header = 'Ingr_Desc'.
           Append it_header.
           it_header-Header = 'Conc'.
           Append it_header.
           it_header-Header = 'Quan'.
           Append it_header.
           it_header-Header = 'Perc'.
           Append it_header.
           it_header-Header = 'Flag'.
           Append it_header.
           it_header-Header = 'Date'.
           Append it_header.
           it_header-Header = 'Rsamnos'.
           Append it_header.
             it_header-Header = 'Mat_code'.
           Append it_header.
           select ccode
                  mat_cd
                  ingr_desc
                  conc
                  quantity
                  percqty
                  app_date
                  rsamnos
                  from zacg_cca  into corresponding
            fields of table
           it_final where  zacg_cca~app_date in s_date.
           loop at it_final.
           it_final-flag = 'T'.
           modify it_final.
           it_final-quantity = it_final-quantity * 2 .
           Modify it_final.
           endloop.
           CALL FUNCTION 'MS_EXCEL_OLE_STANDARD_DAT'
             EXPORTING
               FILE_NAME                       = 'E:\IT\P_FILE'
             CREATE_PIVOT                    = 0
             DATA_SHEET_NAME                 = ' '
             PIVOT_SHEET_NAME                = ' '
             PASSWORD                        = ' '
             PASSWORD_OPTION                 = 0
            TABLES
             PIVOT_FIELD_TAB                 =
              DATA_TAB                        = it_final[]
              FIELDNAMES                      = it_header[]
            EXCEPTIONS
              FILE_NOT_EXIST                  = 1
              FILENAME_EXPECTED               = 2
              COMMUNICATION_ERROR             = 3
              OLE_OBJECT_METHOD_ERROR         = 4
              OLE_OBJECT_PROPERTY_ERROR       = 5
              INVALID_PIVOT_FIELDS            = 6
              DOWNLOAD_PROBLEM                = 7
              OTHERS                          = 8
           IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    Regards
    ABG

  • About Header Line

    what the different between the data between with header line and without header line.
    Like
    Data: itab type table of spfli with header line.
    Data: itab type table of spfil.
    Thanks.

    Hi,
    1) Data: itab type table of spfli with header line.
            The optional addition WITH HEADER LINE declares an extra data object with the same name and line type as the internal table “Itab”. This data object is known as the header line of the internal table. We can use it as a work area when working with the internal table.
          You can use the header line as a work area when you process the internal table. The ABAP statements that you use with internal tables have short forms that you can use if your internal table has a header line. These statements automatically assume the header line as an implicit work area.
    2) Data: itab type table of spfil.
            Here we are declaring an Internal table without a HEADER LINE.So while LOOP opertions or table operation we need to Declare a WORK AREA Seperatly of the table (itab).
    DATA: wa_itab    LIKE  itab.
    Operations without header line
    Data: itab type table of spfil.
    +++++++++++++++++++++++++++++++++++++++
    INSERT wa INTO TABLE itab.
    COLLECT wa INTO itab.
    READ TABLE itab... INTO wa.
    MODIFY TABLE itab FROM wa...
    MODIFY itab FROM wa...WHERE...
    DELETE TABLE itab FROM wa.
    LOOP AT ITAB INTO wa...
    APPEND wa TO itab.
    INSERT wa INTO itab...
    MODIFY itab FROM wa...
    Operations with header line
    Data: itab type table of spfli with header line.
    ++++++++++++++++++++++++++++++++++++++++++++++++++
    INSERT TABLE ITAB.
    COLLECT itab.
    READ TABLE itab...
    MODIFY TABLE itab...
    MODIFY itab... WHERE...
    DELETE TABLE itab.
    LOOP AT ITAB...
    APPEND itab.
    INSERT itab...
    MODIFY itab...
    Hope this will be helpful.
    Regards Avi...

  • Insert or Modify statement from internal table to database table

    Hi All,
    I have three tables wakh, wrf and wakp. I have an internal table with 5 columns col1, col2, col3, col4 and col5.
    The value in Col1 is my article no and the articleno. is in the table wakh. The value in col2 is my ccode and it is in the table wrf. The rest three columns col3, col4 and col5 are unit, qty and price and they are in the wakp table. Now when my articleno is equal to ccode I need to update the col3, col4 and col5 values  in the wakp. wakp has around 20 columns.
    Can anyone of you guys please give me the code for this issue. Your help is highly appreciated and thanks for all for your time.
    Cheers,
    Cheng

    Hi Rob,
    let me explain you the whole process what i am trying to do. I have a screen where there are 3 fields. In my first field I have a promoiton no. As soon as the user enters the promotion no. its description will be populated in my second field. If the promotion is not maintained then it will throw an error. In my third field User will upload an excel sheet which has 5 columns articleno, colorcode, salesunit, qty, mdprice. Here articleno is coming from wakh and colorcode is in wrf_charval table and the rest three fields are coming from wakp table. So for the article no. which is in col1. and for its corresponding colorcode which is in col3 i need to update col3, col4, col5 values.
    With my below code I am able to upload the excel into internal table and display it. So instead of displaying I need to update in the database. Can you please let me know how I need to attach the function module within my code and update accordingly.
    REPORT  ZTest.
    tables : wakh, wakt.
    Parameter: PromoID type wakh-aktnr, PromoDec type wakt-aktkt, p_file LIKE rlgrap-filename
                   DEFAULT 'c:\test.xls' OBLIGATORY.   " File Name
    *FileName type string.
    *file_nm type localfile.
    TYPES:   BEGIN OF t_datatab,
             col1(25)  TYPE c,
             col2(30)  TYPE c,
             col3(30)  TYPE c,
             col4(30)  TYPE c,
             col5(30)  TYPE c,
             END OF t_datatab.
    DATA: it_datatab TYPE STANDARD TABLE OF t_datatab INITIAL SIZE 0,
          wa_datatab TYPE t_datatab.
    Data : p_table type t_datatab occurs 0 with header line.
    DATA : gd_scol   TYPE i VALUE '1',
           gd_srow   TYPE i VALUE '2',
           gd_ecol   TYPE i VALUE '5',
           gd_erow   TYPE i VALUE '65536'.
    DATA: it_tab TYPE filetable,
          gd_subrc TYPE i.
    field-symbols : <fs>.
    AT selection-screen on PromoID.
    select single * from wakh where aktnr = PromoID.
      if sy-subrc EQ 0.
    select aktkt from wakt into PromoDec where aktnr eq PromoID.
    endselect.
    else.
    message A000(ZI) with 'Promotion ID is not Maintained.'.
    endif.
    *Title : Excel Uploading
    *Selection screen definition
    *SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    *PARAMETERS:  p_file LIKE rlgrap-filename
                  DEFAULT 'c:\test.xls' OBLIGATORY.   " File Name
    *SELECTION-SCREEN END OF BLOCK b1.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
      REFRESH: it_tab.
      CALL METHOD cl_gui_frontend_services=>file_open_dialog
        EXPORTING
          window_title     = 'Select File'
          default_filename = '*.xls'
          multiselection   = ' '
        CHANGING
          file_table       = it_tab
          rc               = gd_subrc.
      LOOP AT it_tab INTO p_file.
       so_fpath-sign = 'I'.
       so_fpath-option = 'EQ'.
       append so_fpath.
      ENDLOOP.
    START-OF-SELECTION.
      PERFORM upload_excel_file TABLES   it_datatab
                                 USING   p_file
                                         gd_scol
                                         gd_srow
                                         gd_ecol
                                         gd_erow.
    END-OF-SELECTION.
    END-OF-SELECTION.
      LOOP AT it_datatab INTO wa_datatab.
        WRITE:/ wa_datatab-col1,
                wa_datatab-col2,
                wa_datatab-col3,
                wa_datatab-col4,
                wa_datatab-col5.
      ENDLOOP.
    *&      Form  UPLOAD_EXCEL_FILE
          upload excel spreadsheet into internal table
         -->P_TABLE    Table to return excel data into
         -->P_FILE     file name and path
         -->P_SCOL     start column
         -->P_SROW     start row
         -->P_ECOL     end column
         -->P_EROW     end row
    FORM upload_excel_file TABLES   p_table
                           USING    p_file
                                    p_scol
                                    p_srow
                                    p_ecol
                                    p_erow.
      DATA : lt_intern TYPE  kcde_cells OCCURS 0 WITH HEADER LINE.
    Has the following format:
                Row number   | Colum Number   |   Value
         i.e.     1                 1             Name1
                  2                 1             Joe
      DATA : ld_index TYPE i.
    Note: Alternative function module - 'ALSM_EXCEL_TO_INTERNAL_TABLE'
      CALL FUNCTION 'KCD_EXCEL_OLE_TO_INT_CONVERT'
        EXPORTING
          filename                = p_file
          i_begin_col             = p_scol
          i_begin_row             = p_srow
          i_end_col               = p_ecol
          i_end_row               = p_erow
        TABLES
          intern                  = LT_INTERN
        EXCEPTIONS
          inconsistent_parameters = 1
          upload_ole              = 2
          OTHERS                  = 3.
      IF sy-subrc <> 0.
        FORMAT COLOR COL_BACKGROUND INTENSIFIED.
        WRITE:/ 'Error Uploading file'.
        EXIT.
      ENDIF.
      IF lt_intern[] IS INITIAL.
        FORMAT COLOR COL_BACKGROUND INTENSIFIED.
        WRITE:/ 'No Data Uploaded'.
        EXIT.
      ELSE.
        SORT lt_intern BY row col.
        LOOP AT lt_intern.
         MOVE lt_intern-col TO ld_index.
         assign component ld_index of structure
         p_table to <fs>.
    move : lt_intern-value to <fs>.
        MOVE lt_intern-value TO p_table.
          AT END OF row.
            APPEND p_table.
            CLEAR p_table.
          ENDAT.
        ENDLOOP.
      ENDIF.
      ENDFORM.
    Thanks for your valuable time.
    Cheng

  • WD4A Dynamic ALV Table with dynamic tables

    Hi all,
    first I want give you the information what I try to do.
    I have an another WD4A application for administrative use in which I can assign certain tablefields to a certain user. You can say it's something like a customizing application.
    In the next application (with my issues) I will display the tables for the user, but these tables are not the complete table.
    I have a node in my context of the component controller which is bound to my ALV. I add during the runtime attributes to my node.
    * .... coding ....declaration
    * get the node
      lr_node = wd_context->get_child_node( 'M_TABLE' ).
      lr_node_info ?= lr_node->get_node_info( ).
    * remove the attributes, if exists
      lr_node_info->remove_dynamic_attributes( ).
    * .... coding ....
    *   add attributes
        LOOP AT l_t_m_table INTO l_s_m_table.
          CLEAR ls_attribute.
    *     name of the attribute
          MOVE l_s_m_table-NAME TO ls_attribute-NAME.
    *     DDIC type of the attribute
          MOVE l_s_m_table-TYPE_NAME TO ls_attribute-TYPE_NAME.
    *     If the DDIC has a gen namespace like /B135/ replace the / with _
          REPLACE ALL OCCURRENCES OF '/' IN ls_attribute-NAME WITH '_'.
    *     add the attribute
          lr_node_info->add_attribute( EXPORTING
                                         attribute_info = ls_attribute ).
        ENDLOOP.
    This coding works fine I get the columns in my ALV. Then I tried to fill my ALV table with data from a database table.
    I created dynamicly an internal table with the following coding:
    *   Create dynamic table
        CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
          EXPORTING
            IT_FIELDCATALOG = l_t_FLDCAT
          IMPORTING
            EP_TABLE = l_t_NEW_M_TABLE.
    *   assign the table
        ASSIGN l_t_NEW_M_TABLE->* TO <M_TABLE>.
    *   structure of table
        CREATE DATA l_s_NEW_M_TABLE LIKE LINE OF <M_TABLE>.
        ASSIGN l_s_NEW_M_TABLE->* TO <l_s_m_table>.
    * get data from database
    SELECT * FROM (l_m_table) INTO CORRESPONDING FIELDS OF TABLE <M_table> WHERE OBJVERS = 'A'.
    With this coding I get the data from the database and only the required fields that means I have e.g. an itab with columns1, columns3, columns4 from the database.
    I also added e.g. these columns  (columns1, columns3, columns4 from the database) to the node as attribute. Now it should be possible to bind the table to the structure with this coding:
    lr_comp_usage_m = wd_this->wd_cpuse_usage_alv_M_table( ).
    *   create component if not active
        IF lr_comp_usage_m->has_active_component( ) IS INITIAL.
          lr_comp_usage_m->create_component( ).
        else.
    * set data if node exists
          l_ref_interfacecontroller = wd_this->wd_cpifc_usage_alv_M_table( ).
          l_ref_interfacecontroller->set_data( lr_node ).
        endif.
    *   bind table
        lr_node->bind_table( <M_TABLE> ).
    Now, I get an error, which is caused by the table binding.
    In ST22 I get:
    Short text
        Line types of an internal table and a work area not compatible.
    What happened?
        Error in the ABAP Application Program
        The current ABAP program "CL_WDR_CONTEXT_NODE_VAL=======CP" had to be
         terminated because it has
        come across a statement that unfortunately cannot be executed.
    Error analysis
        The statement
           "INSERT wa INTO TABLE itab"
        requires the lines of the internal table "TABLE" and the
        work area " wa" to be compatible. Compatibility means
        equivalence in the context of ABAP/4 type checking.
        In this case, the condition is not satisfied because the internal table
        "TABLE" has the line type "u" and the length 28, but the work area " wa"
        has the type "C" and the length 2.
        (If the work area " wa" is the header line of the internal
        table "TABLE", the above inconsistency can arise if an internal
        table t with the line type T1 is passed to a subroutine (FORM or
        FUNCTION) as an actual parameter and the corresponding formal
        parameter p is declared in the subroutine by "TABLES p STRUCTURE T2".
        If then T1 and T2 are incompatible, the header line p
        has the type T2 (specifed by STRUCTURE), but the internal
        table p has the line type T1 (passed from the actual parameter)).
    Source Code Extract
    Line  SourceCde
        1 method if_wd_context_node~get_static_attributes_table .
        2
        3   field-symbols:
        4     <element> like line of me->collection,
        5     <static_attributes> type data,
        6     <table> type index table.
        7
        8 * check whether elements are supllied or not
        9   if me->elements_supplied = abap_false.
       10     me->supply_elements( ).
       11   endif.
       12
       13   clear table.
       14
       15   if me->table_ref is not initial.
       16     assign me->table_ref->* to <table>.
       17     table = <table>.
       18   else.
       19     loop at me->collection assigning <element> from from to to.
       20       assign <element>->static_attributes->* to <static_attributes>.
    error in line 21       insert <static_attributes> into table table.
       22     endloop.
       23   endif.
       24
       25 endmethod.
    Any suggestions? Is it allowed to use bind_table() with a field symbol?
    Another strange thing is that if I try the same with static itab and attributes during runtime it works, but only if the fields of the itab has the same name as the attributes, which means that I can not use itabs with fieldnames like /BI0/S_CUSTOMER and if I can not use them it's difficult to read data from database with SELECT * FROM ... INTO CORRESPONDING FIELDS OF TABLE itab.
    Thanks in advance for your suggestions!
    Best Regards,
    Marcel

    Hi Francois,
    I solve it with the RTTI and the method    
    lr_node_info = lr_node_info->add_new_child_node(
                          name = 'Dynamic_TABLE'
                          IS_MANDATORY = ABAP_false
                          IS_MULTIPLE = ABAP_true
                          STATIC_ELEMENT_RTTI = lr_struct_descr
                          IS_STATIC = ABAP_false
    I don't know why it doesn't work with adding attributes and binding the table after adding the attributes.
    Anyway thanks for your help.
    Best Regards,
    Marcel

  • Pb with header line in my report

    hi,
    I have a problem with the alignment of the header line of my table in my report
    Indeed the header line is centered on the first page but not on the second one.
    I attach the code and a pdf which shows the problem.
    If someone can help me,please.
    Best regards
    Attachments:
    test pb array.vi ‏20 KB
    Document.pdf ‏24 KB

    Hi,
    Your VIs doesn't work on my computer. Is it really running on yours? Did you try with a word report and if so, do you have the same phenomena?
    Regards
    Manuel R
    AE dans une autre vie

  • Moving data into internal table without header line

    Hello experts.
    i have two internal tables . itab1 without headerline and itab2 with headerline. itab1 has 10 fields and itab2 has 2 fields.
    BEGIN OF itab,
            lifnr LIKE lfa1-lifnr,
            ktokk LIKE lfa1-ktokk,
            name1 LIKE lfa1-name1,
            sortl LIKE lfa1-sortl,
            pstlz LIKE lfa1-pstlz,
            ort01 LIKE lfa1-ort01,
            land1 LIKE lfa1-land1,
           j_1ipanno LIKE j_1imovend,
    end of itab.
    DATA: itab1 TYPE STANDARD TABLE OF itab.
    data: begin of itab2 occurs 0,                             
          lifnr like j_1imovend-lifnr,
          j_1ipanno like j_1imovend-j_1ipanno,
      end of itab2.
    now i want to move the data from itab2-j_1ipanno into itab1-j_1ipanno. so pls tell me how to do that. lifnr in both the tables are the same.
    thanks for all the replies.

    Hi Shiva,
    In with out header line,
    You declare header line & body separately like
    data: IT_MARA type standard table of MARA,
    WA_MARA like line of IT_MARA.
    Advantages:
    1. Clear differentiation of header line over body
    2. It is must in the ABAP Objects to have separate header line & body
    3. Use ful in Nested Internal tables
    Disadvantages:
    1. Long syntax
    for example: Loop at IT_MARA into WA_MARA.
    In with header line
    Data ITAB like MARA occurs 0 with header line.
    Advantages:
    1. Simple to use & declare over without header line.
    Also,
    With Header line:
    codedata : itab like <dbtable> occurs 0 with header line.
    Data: begin of itab occurs 0,
    f1 type f1,
    f2 type f2,
    end of itab.[/code]
    Without Header line.
    codeTypes: begin of ty_tab,
    f1 type f1,
    f2 type f2,
    end of ty_tab.
    Data: itab type table of ty_tab, " Internal Table
    wa type ty_tab. " Work Area[/code]
    at any point of time use internal table without header line,it will be good performance as well OO ABAP will allow only internal table without header line.
    Just use one simple example :
    create one simple program with header line,use get run time field.
    create one simple program without header line,use get run time field.
    see the results ,here time will be micro seconds,so take 1000 records to internal table and do calculate the time.
    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.
    kindly reward if found helpful.
    cheers,
    Hema.

Maybe you are looking for

  • Jabber for Windows 10.5 and global redundancy

    Hi All, I implement J4W 10.5 in a full redundant environment, that contains: - 3 x CUCM 10.5 - 2 x Unity Connection 10.5 - 2 x IM&P 10.5 - 2 x Expressway-C 8.2.2 - 2 x Expressway-E 8.2.2 After testing, I notice that the redundancy/failover does not a

  • Image Capture won't scan: Canon MP 610

    Hello, I experience a strange bug in Image Capture which I use together with my Canon MP610. When I put a document on the scanner Image Capture will show a preview and then scan the document. This works fine. Sometimes I need to make some manual corr

  • Spry Content Slideshow malfunctioning in IE

    can't get content slideshow to work with any version of internet explorer: http://www.chipandlaura.com i can't even get the sample html to work that comes with the css and js files: http://chipandlaura.com/spry_default.html save me?

  • Re: Be Safe Online: 'Rover' Doesn't Bark Loud Enough to Keep You Safe

    hi, for the last  eight years i have tried everything and every security measure to secure  my computer. i am not a dummy and know what can cause security problems. i have used every available method and had only been able to have a secure computer f

  • HT3802 "The system cannot find the path specified."

    When I type in the command, the response I get is: "The system cannot find the path specified." I just installed Windows 7 with bootcamp but cannot access the Windows Support software now. When I reboot, it boots in Windows. I want Lion to boot to bu