Filling Dyanamic Internal table with data

Hi All
I have a following requirement.
1.. I have internal table with 1 text field of length 1000, this is field with data uploaded from text file having data tab seprated
2. I have a dyanamic table in which i have to fill the using the above internal table  splited by tab seprated into the corresponding fields of dyanamic table.
please suggest some solution for the above.
thanks
bobby

Hi Martin,
But How to assign to dyanmic table fields if we are using
split t_intab at CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB into .
where t_intab has 1 field of lenth say 1000 in which data stored is tab seprated.
please find below my code, please check loop at t_intab
FUNCTION Z_TEXT.
""Local Interface:
*"  IMPORTING
*"     VALUE(I_EXPTABLE) TYPE  LVC_T_FCAT
*"     VALUE(I_DELIMETER) TYPE  C DEFAULT 'T'
*"  TABLES
*"      T_INTAB
*"      T_OUTTAB
Data declarations
DATA:
  dtab           TYPE REF TO data,
  newstr2        TYPE REF TO cl_abap_typedescr,
  tab_type1      TYPE REF TO cl_abap_tabledescr,
  lref_ditab     TYPE REF TO data,
  lref_new_line  TYPE REF TO data.
Field-Symbols declarations
FIELD-SYMBOLS:
<fs_dyn_tab1> TYPE  ANY TABLE,
<fs_dyn_wa>   TYPE ANY,
<fs>          type any.
Create dynamic table
  CALL METHOD cl_alv_table_create=>create_dynamic_table
    EXPORTING
      it_fieldcatalog           = i_exptable
    IMPORTING
      ep_table                  = lref_ditab
    EXCEPTIONS
      generate_subpool_dir_full = 1
      OTHERS                    = 2.
   IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
               WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.
Assign the dynamic table reference to a field-symbol
  ASSIGN lref_ditab->* TO <fs_dyn_tab1>.
Create a structure similar to the dynamic table created
  CREATE DATA lref_new_line LIKE LINE OF <fs_dyn_tab1>.
  ASSIGN lref_new_line->* TO <fs_dyn_wa>.
loop at t_intab.
if I_DELIMETER = 'T'.
split t_intab at CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB into .
endif.
endloop.
ENDFUNCTION.
thanks
bobby

Similar Messages

  • Fill dynamic internal table with data from another dynamic table

    Hi,
    I have a huge dynamic table with a few columns and need to fill another dynamic table with some of the columns, that are also existing in the other one. I first know at runtime, which fields the smaller table contains.
    Until now, I did it that way:
      LOOP AT <it_tab_structure> ASSIGNING <wa_tab_structure>.
        LOOP AT lt_comp_full INTO ls_comp_full.
          ASSIGN COMPONENT ls_comp_full-name OF STRUCTURE <structure> TO <column>.
          ASSIGN COMPONENT ls_comp_full-name OF STRUCTURE <wa_tab_structure> TO <value>.
          <column> = <value>.
        ENDLOOP.
        APPEND <structure> TO <table>.
      ENDLOOP.
    lt_comp_full contains the columns of the second table, that have to be filled.
    This is taking a very long time, as there can be a lot of columns in the source table and the source table contains at least 100000 records.
    Is there therefore any way to fill the other table faster?
    Thank you & best regards,
    Michael

    Hey Sharath,
    thank you for your answer! Unfortunately I don't have a 7.4 system here, but your example pointed out, that I can also use move-corresponding from one structure to the other, which I thought, was not possible. I'm trying out, if this makes it faster now.
    I'll let you all know, if this made the deal.
    Thank you & best regards,
    Michael & Arne

  • Filling dynamic internal table with data from other internal table

    Hi Friends,
    My problem is that i have already built a dynamic internal table
    (class int_table->create) but now i want to fill it with data from other internal table.
    The dynamic table column name and the field value of the data filled internal table are same, but how to access that column name, since i cant hard code it anyway.
    Like if my werks field value is '8001'. I want to place it under the column 8001 of dynamic table, Can anybody help me in this regard?
    Awarding points is not a problem for even giving a slight hint.
    Best Regards

    Hi
    See this
    Dynamic internal table is internal table that we create on the fly with flexible column numbers.
    For sample code, please look at this code tutorial. Hopefully it can help you
    Check this link:
    http://www.****************/Tutorials/ABAP/DynamicInternaltable/DynamicInternalTable.htm
    Sample code:
    DATA: l_cnt(2) TYPE n,
    l_cnt1(3) TYPE n,
    l_nam(12),
    l_con(18) TYPE c,
    l_con1(18) TYPE c,
    lf_mat TYPE matnr.
    SORT it_bom_expl BY bom_comp bom_mat level.
    CLEAR: l_cnt1, <fs_dyn_wa>.
    Looping the component internal table
    LOOP AT it_bom_expl INTO gf_it_bom_expl.
    CLEAR: l_cnt1.
    AT NEW bom_comp.
    CLEAR: l_cnt, <fs_dyn_wa>, lf_mat.
    For every new bom component the material data is moved to
    temp material table which will be used for assigning the levels
    checking the count
    it_mat_temp[] = it_mat[].
    Component data is been assigned to the field symbol which is checked
    against the field of dynamic internal table and the value of the
    component number is been passed to the dynamic internal table field
    value.
    ASSIGN COMPONENT c_comp_list OF STRUCTURE <fs_dyn_wa> TO
    <fs_check>.
    <fs_check> = gf_it_bom_expl-bom_comp.
    ENDAT.
    AT NEW bom_mat.
    CLEAR l_con.
    ENDAT.
    lf_mat = gf_it_bom_expl-bom_mat.
    Looping the temp internal table and looping the dynamic internal table
    *by reading line by line into workarea, the materialxxn is been assigned
    to field symbol which will be checked and used.
    LOOP AT it_mat_temp.
    l_nam = c_mat.
    l_cnt1 = l_cnt1 + 1.
    CONCATENATE l_nam l_cnt1 INTO l_nam.
    LOOP AT <fs_dyn_table2> ASSIGNING <fs_dyn_wa2>.
    ASSIGN COMPONENT l_nam OF STRUCTURE <fs_dyn_wa2> TO <fs_xy>.
    ENDLOOP.
    IF <fs_xy> = lf_mat.
    CLEAR lf_mat.
    l_con1 = l_con.
    ENDIF.
    Checking whether the material exists for a component and if so it is
    been assigned to the field symbol which is checked against the field
    of dynamic internal table and the level of the component number
    against material is been passed to the dynamic internal table field
    value.
    IF <fs_xy> = gf_it_bom_expl-bom_mat.
    ASSIGN COMPONENT l_nam OF STRUCTURE <fs_dyn_wa> TO <fs_check>.
    CLEAR l_con.
    MOVE gf_it_bom_expl-level TO l_con.
    CONCATENATE c_val_l l_con INTO l_con.
    CONDENSE l_con NO-GAPS.
    IF l_con1 NE space.
    CONCATENATE l_con1 l_con INTO l_con SEPARATED BY c_comma.
    CLEAR l_con1.
    l_cnt = l_cnt - 1.
    ENDIF.
    <fs_check> = l_con.
    l_cnt = l_cnt + 1.
    ENDIF.
    ENDLOOP.
    AT END OF bom_comp.
    At end of every new bom component the count is moved to the field
    symbol which is checked against the field of dynamic internal table
    and the count is been passed to the dynamic internal table field
    value.
    ASSIGN COMPONENT c_count OF STRUCTURE <fs_dyn_wa> TO <fs_check>.
    <fs_check> = l_cnt.
    INSERT <fs_dyn_wa> INTO TABLE <fs_dyn_table>.
    ENDAT.
    ENDLOOP.
    Reward if useful
    Anji

  • How to pass internal table with data in ABAP OO

    Hi experts ,
    Here is the problem...
    I create a screen 100 and use the internal table to get data from database, and then press the button on screen 100 , it will call screen 200.
    I use ABAP OO code in screen 200, and i want to keep the internal table with data that i get from the sceen 100 parts, but it seems that it just supports to create a new internal table and get data from database in ABAP OO. That means i need to create a new table to save the data in internal table ? Or there is any other solution something like exporting or memory id ...
    ps . the internal table in screen 100 is declared in global area, the beginning of the code.
    Please give me some advice, thanks a lot!
    Regards ,
    Claire

    I have already know how to do, here is my code:
    METHODS fill_tree importing itab2 like itab1.
    CALL METHOD: me->fill_tree exporting itab2 = itab1.
    In METHOD fill_tree,
    declare
    data: itab3 TYPE STANDARD TABLE OF itab,
    itab3[] = itab1[].
    It is useful to me, thanks a lot.

  • Populating dynamic internal table with data

    Hi,
    I have an internal table with the data like the below
          profit  lineId  amount
          center
           s21     70     1000
           s21     80     1200
           s22     70      800
    In the above internal table the number of distinct lineIDs will be vary based on selection-screen creiteria.
    So for this I build a fieldcatalog and dynamic internal table like the following
    The data available in the above internal table should be placed into the dynamic internal table like the following.
         profit
         center  LineID70 LineID80 .....etc
          S21      1000     1200
          S22       800
    Can any one suggest how to proceed?
    Thanks in advance
    Nanda.

    Hi
    This is my first ever reply so I hope this works or gives you some ideas.
    DATA: l_idcount TYPE i,
                l_idvalue LIKE itab2-amount.
    *loop through the source internal table
    LOOP AT itab1.
    * increment count of id numbers in current profit center
      l_idcount = l_idcount + 1. 
    * run through the amount fields in target internal table
      DO ID_number TIMES VARYING l_idvalue
          FROM itab2-LineID70 NEXT itab2-LineID80.
        IF sy-index EQ l_idcount.
    *   change field value if id count same as field position
          l_idvalue = itab1-amount.
        ENDIF.
      ENDDO.
      AT END OF profit_center.
        itab2-profit_center = itab1-profit_center.
        APPEND itab2.
        CLEAR l_idcount.
      ENDAT.
    ENDLOOP.
    ID_number is the number of ids as a result of selection-screen criteria.

  • Dynamically fill the internal table with new fileds

    Hi Friends,
    I have the internal table like
    Data:begin of i_data occurs 0,
               a(60),
                b(60),
                c(60),
                d(60),
                 e(60),
            end of i_data.
    I need to fill the internal table dynamically like
    Data:begin of i_data occurs 0,
               a(60),
                b(60),
                c(60),
                 c1(60),  "new filed dynamically
                 c2(60),  "new field dynamically
                d(60),
                 e(60),
            end of i_data.
    Please suggest me how to do this.
    Regards,
    Sunny.
    Code Formatted by: Alvaro Tejada Galindo on Jan 8, 2009 1:55 PM

    You can not add new fields to a statically defined internal table, instead you must create the entrie internal table at runtime.
    Search this forum for Dynamic Internal tables, you will get a lot of example programs.
    Regards,
    Rich Heilman

  • Fastest way to fill an InDesign table with data

    Hello,
    I have to fill several InDesign tables with the content of my database.
    I have the database in memory and fill the cells in two Loops (For Each row..., For Each col...).
    But it is so slow! Is there a faster way?
    Here a code snippet of the solution today:
                For Each row In tableRecord
                    Dim inDRow = table.Rows.AsEnumerable().ElementAt(intRow)
                    For Each content In row
                        Dim cell = inDRow.Cells.AsEnumerable().ElementAt(content.Index)
                        cell.Contents = content.Value
                    Next
                    intRow+=1
                Next
    Thank you for help!
    Best regards
    Harald

    Hi, Harald!
    "This should be faster: table.Contents=Array. Or not?"
    Surprisingly is was not. It was slower. A lot slower.
    The array was gathered by (here ExtendScript(JavaScript) dummy code) :
    myArray = myTable.contents;
    Then I did operate on the array. Not on the table object or its cell objects. No direct access to InDesign's DOM objects. Just the built array.
    My text file was written by populating it with a string of the array:
    myString = myArray.join("separatorString");
    separatorString was something that was never used as contents in the table.
    Something like "§§§"…
    After importing the text file I used the convertToTable() method providing the separatorString as separator for the first and second argument with the number of columns as third argument. The number of columns was known from my original table.
    var myNewTable = myText.convertToTable("separatorString", "separatorString", myNumberOfColumns);
    Alternatively you could also remove the table after building the array and assign "myString" as contents for the insertionPoint of the removed table in the story. I think I tested that as well, but do not know, if there is a difference in speed opposed to placing a text file with the same contents (I think it was, but not I'm not sure anymore). So I ended up with:
    1. Contents of table to Array
    2. Array manipulation
    3. Array to String
    4. Write String as file
    5. Remove table
    6. Place file at InsertionPoint of (now removed) table
    Also to note: This was in InDesign CS5 with a very large table.
    Things could have changed in InDesign versions with 64-Bit support.
    But I did not test that yet. The customer I wrote this script for is still on CS5.
    Uwe

  • Filling an access table with data put in a form

    Hello everybody and in particular to Jeffrey Bardzell, if
    he's there...
    I'm reading the guide "Dreamweaver MX 2004 with ASP,
    COLDFUSION and PHP written by J.Bardzell" aiming at learning how to
    create asp dynamic pages. Thanks to J.Bardzell for his very good
    book. BUT I'M HAVING PROBLEMS!
    I'm using Dreamweaver 8.
    I'm trying to create an application for users' registration.
    In simple words this is what I want to happen:
    1)the user fills a form with his personal data,including
    email and password and then he presses the submit button - this
    implies:
    a)the data go into the data base within a table prepared in
    advance to store them and so he's REGISTERED;
    b)the browser shows the page I made for login. There's a
    second form where he has to insert his email address and password
    to be recognised as a registered user.
    In order to get this result I set the connection to the
    database and appearently all seems well done .
    But unfortunately:
    when I try pressing "submit" either nothing happens or
    there's an error page saying:
    type of error:
    Microsoft OLE DB Provider for ODBC Drivers (0X80004005)
    [Microsoft][Driver ODBC Microsoft Access]
    An updatable query is required for the operation
    /newland/register.asp, line 141
    (the last line is referred to the ficticious site used by the
    Bardzell book.)
    Bardzell says that when defining the connection to the
    database (in the "data source name" window) it must be specified
    that Dreamweaver should connect "using dsn on testing server". When
    I do so the data base appears not to be on the testing server.
    Instead it shows if I use the local dsn. But still data are not
    sent to the data base table.
    Please help, I'm desperate, I need to solve this!
    Thank you,
    Giuseppe, Rome.

    The error is related to permissions setting on the database.
    Have a look at
    the article on www.charon.co.uk on how to set the
    permissions.
    Paul Whitham
    Certified Dreamweaver MX2004 Professional
    Adobe Community Expert - Dreamweaver
    Valleybiz Internet Design
    www.valleybiz.net
    "giuseppe craparotta" <[email protected]>
    wrote in message
    news:[email protected]...
    > Hello everybody and in particular to Jeffrey Bardzell,
    if he's there...
    > I'm reading the guide "Dreamweaver MX 2004 with ASP,
    COLDFUSION and PHP
    > written by J.Bardzell" aiming at learning how to create
    asp dynamic pages.
    > Thanks to J.Bardzell for his very good book. BUT I'M
    HAVING PROBLEMS!
    >
    > I'm using Dreamweaver 8.
    > I'm trying to create an application for users'
    registration. In simple
    > words
    > this is what I want to happen:
    > 1)the user fills a form with his personal data,including
    email and
    > password
    > and then he presses the submit button - this implies:
    > a)the data go into the data base within a table prepared
    in advance to
    > store
    > them and so he's REGISTERED;
    > b)the browser shows the page I made for login. There's a
    second form
    > where he
    > has to insert his email address and password to be
    recognised as a
    > registered
    > user.
    > In order to get this result I set the connection to the
    database and
    > appearently all seems well done .
    > But unfortunately:
    > when I try pressing "submit" either nothing happens or
    there's an error
    > page
    > saying:
    >
    > type of error:
    > Microsoft OLE DB Provider for ODBC Drivers (0X80004005)
    > [Microsoft][Driver ODBC Microsoft Access]
    > An updatable query is required for the operation
    > /newland/register.asp, line 141
    >
    > (the last line is referred to the ficticious site used
    by the Bardzell
    > book.)
    >
    > Bardzell says that when defining the connection to the
    database (in the
    > "data
    > source name" window) it must be specified that
    Dreamweaver should connect
    > "using dsn on testing server". When I do so the data
    base appears not to
    > be on
    > the testing server. Instead it shows if I use the local
    dsn. But still
    > data are
    > not sent to the data base table.
    >
    > Please help, I'm desperate, I need to solve this!
    > Thank you,
    > Giuseppe, Rome.
    >

  • Internal table with data reference variable as component

    Hi
    i have a below structure and itab in my program and i have the issue mentioned below..
    Data: begin of wa,
              col1 type i,
              col2 type ref to data,
            end of wa.
    data itab like table of wa.
    create data wa-col2 type p decimals 2.
    Now my requirement is to fill the work area wa and append it to the table.
    i have used field symbols and references but i am not sucessful as the value of wa-col2 is getting overwritten  by the field symbol and it is not accomodating distinct values.
    kindly help me out.
    thanks
    abdul hakim

    hi clemens,
    thanks for the help.
    my complete code:
    data: begin of wa,
              col1 type i,
              col2  type ref to data,
            end of wa.
    data itab like table of wa.
    field-symbols <fs> type any.
    create data wa-col2 type p decimals 2.
    assign wa-col2->* to <fs>.
    <fs> = '123.45'.
    append wa to itab.
    <fs> = '456.78'.
    append wa to itab.
    when i loop through itab the colum wa-col2 only contains 456.78 for both the records. the value 123.45 that i have passed for the first record is lost. how can get the values 123.45 for first record and 456.78 for the second record using this technique.
    thanks
    abdul hakim
    Edited by: Abdul Hakim on Feb 19, 2011 4:02 AM

  • How to fill internal table with no data in debugging mode

    Hi all,
             I modified one existing program.Now I want to test it.I am not given test data.So in the middle of my debugging, I found that one internal table with no data.My problem is how to fill that internal table with few records in that debugging mode just as we change contents in debugging mode.If I want to proceed further means that internal table must have some records.
    Please I dont know how to create test data so I am trying to create values temporarily in debugging mode only.
    Thanks,
    Balaji

    Hi,
    In the debugging do the following..
    Click the Table button..
    Double click on the internal table name..
    Then in the bottom of the screen you will get the buttons like CHANGE, INSERT, APPEND, DELETE..
    Use the APPEND button to insert records to the internal table..
    Thanks,
    Naren

  • 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

  • Fill internal table with mutliple entries for nested structure

    Dear ABAP Experts,
    I have a question related to fill internal tables with nested structures.
    I have a structure like this:
    BEGIN OF proto,
              sicht TYPE ysicht,
              version TYPE FAGLFLEXA-RVERS,
              BEGIN OF kons,
    kon TYPE YKONSEINHEIT,
              END OF kons,
              jahr TYPE CHAR04,
    END OF proto.
    Now I need to fill this structure with values (over an internal table), but how can I achieve that I save multiple datas für element "kon" für one single entry of structure "proto"?
    An example could be:
    sicht = '01'
    version = '100'
    kon = 1001 (first entry)
    kon = 1002 (second entry)
    usw... (n entry)
    jahr = '2008'
    Thanks in advance for every helpful answer.
    Regards
    Thomas

    BEGIN OF proto,
               sicht TYPE ysicht,
               version TYPE FAGLFLEXA-RVERS,
               kons TYPE STANDARD TABLE OF YKONSEINHEIT WITH NON-UNIQUE KEY TABLE_LINE,
               jahr TYPE CHAR04,
    END OF proto.
    DATA: ls_proto TYPE proto,
          lt_proto TYPE STANDARD TABLE OF proto,
          ls_kon
    ls_proto-sicht = '01'.
    ls_proto-version = '100'
    INSERT '1001' INTO TABLE ls_proto-kons.
    INSERT '1002' INTO TABLE ls_proto-kons.
    ls_proto-jahr = '2008'.
    INSERT ls_proto INTO TABLE lt_proto
    If you're going to use a more complicated inner table with several components, then you need to define a type for those components. 
    matt

  • How to fill internal table with selection screen field.

    Hi all,
    i am new to sap . pls tell me how to fill internal table with selection screen field.

    Hi,
    Please see the example below:-
    I have used both select-options and parameter on the selection-screen.
    Understand the same.
    * type declaration
    TYPES: BEGIN OF t_matnr,
            matnr TYPE matnr,
           END OF t_matnr,
           BEGIN OF t_vbeln,
             vbeln TYPE vbeln,
           END OF t_vbeln.
    * internal table declaration
    DATA : it_mara  TYPE STANDARD TABLE OF t_matnr,
           it_vbeln TYPE STANDARD TABLE OF t_vbeln.
    * workarea declaration
    DATA : wa_mara  TYPE t_matnr,
           wa_vbeln TYPE t_vbeln.
    * selection-screen field
    SELECTION-SCREEN: BEGIN OF BLOCK b1.
    PARAMETERS : p_matnr TYPE matnr.
    SELECT-OPTIONS : s_vbeln FOR wa_vbeln-vbeln.
    SELECTION-SCREEN: END OF BLOCK b1.
    START-OF-SELECTION.
    * I am adding parameter value to my internal table
      wa_mara-matnr = p_matnr.
      APPEND wa_mara TO it_mara.
    * I am adding select-options value to an internal table
      LOOP AT s_vbeln.
        wa_vbeln-vbeln =  s_vbeln-low.
        APPEND  wa_vbeln TO  it_vbeln.
      ENDLOOP.
    Regards,
    Ankur Parab

  • Excel data transfer into SAP internal table with GUI_UPLOAD

    hi all,
      i m using SRM4 system and i wanted to develop one report which will upload data from excel and convert it into IT.
    i know that many threads are posted on this topic.
    but my requirement is slight different. in the system only one function module is available that is "GUI_UPLOAD" and we want that user shd not save file as tab delimited before calling this fm. instead, program shd take care of all these things...
    please suggest something asap..
    helpful ans will be rewarded..
    thanks,
    jigs.

    Dear Jigs,
    Please go though the following lines of code:
    D A T A D E C L A R A T I O N *
    TABLES: ANEP,
    BKPF.
    TYPES: BEGIN OF TY_TABDATA,
    MANDT LIKE SY-MANDT, " Client
    ZSLNUM LIKE ZSHIFTDEPN-ZSLNUM, " Serial Number
    ZASSET LIKE ZSHIFTDEPN-ZASSET, " Original asset that was transferred
    ZYEAR LIKE ZSHIFTDEPN-ZYEAR, " Fiscal Year
    ZPERIOD LIKE ZSHIFTDEPN-ZPERIOD, " Fiscal Period
    ZSHIFT1 LIKE ZSHIFTDEPN-ZSHIFT1, " Shift No. 1
    ZSHIFT2 LIKE ZSHIFTDEPN-ZSHIFT1, " Shift No. 2
    ZSHIFT3 LIKE ZSHIFTDEPN-ZSHIFT1, " Shift No. 3
    END OF TY_TABDATA.
    Declaration of the Internal Table with Header Line comprising of the uploaded data.
    DATA: BEGIN OF IT_FILE_UPLOAD OCCURS 0.
    INCLUDE STRUCTURE ALSMEX_TABLINE. " Rows for Table with Excel Data
    DATA: END OF IT_FILE_UPLOAD.
    S E L E C T I O N - S C R E E N *
    SELECTION-SCREEN: BEGIN OF BLOCK B1 WITH FRAME,
    BEGIN OF BLOCK B2 WITH FRAME.
    PARAMETERS: P_FNAME LIKE RLGRAP-FILENAME OBLIGATORY.
    SELECTION-SCREEN: END OF BLOCK B2,
    END OF BLOCK B1.
    E V E N T : AT S E L E C T I O N - S C R E E N *
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FNAME.
    CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
    EXPORTING
    PROGRAM_NAME = SYST-REPID
    DYNPRO_NUMBER = SYST-DYNNR
    FIELD_NAME = ' '
    STATIC = 'X'
    MASK = '.'
    CHANGING
    FILE_NAME = P_FNAME
    EXCEPTIONS
    MASK_TOO_LONG = 1
    OTHERS = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    E V E N T : S T A R T - O F - S E L E C T I O N *
    START-OF-SELECTION.
    Upload Excel file into Internal Table.
    PERFORM UPLOAD_EXCEL_FILE.
    Organize the uploaded data into another Internal Table.
    PERFORM ORGANIZE_UPLOADED_DATA.
    E V E N T : E N D - O F - S E L E C T I O N *
    END-OF-SELECTION.
    *& Form UPLOAD_EXCEL_FILE
    text
    --> p1 text
    <-- p2 text
    FORM UPLOAD_EXCEL_FILE .
    CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
    EXPORTING
    FILENAME = P_FNAME
    I_BEGIN_COL = 1
    I_BEGIN_ROW = 3
    I_END_COL = 7
    I_END_ROW = 32000
    TABLES
    INTERN = IT_FILE_UPLOAD
    EXCEPTIONS
    INCONSISTENT_PARAMETERS = 1
    UPLOAD_OLE = 2
    OTHERS = 3
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDFORM. " UPLOAD_EXCEL_FILE
    *& Form ORGANIZE_UPLOADED_DATA
    text
    --> p1 text
    <-- p2 text
    FORM ORGANIZE_UPLOADED_DATA .
    SORT IT_FILE_UPLOAD BY ROW
    COL.
    LOOP AT IT_FILE_UPLOAD.
    CASE IT_FILE_UPLOAD-COL.
    WHEN 1.
    WA_TABDATA-ZSLNUM = IT_FILE_UPLOAD-VALUE.
    WHEN 2.
    WA_TABDATA-ZASSET = IT_FILE_UPLOAD-VALUE.
    WHEN 3.
    WA_TABDATA-ZYEAR = IT_FILE_UPLOAD-VALUE.
    WHEN 4.
    WA_TABDATA-ZPERIOD = IT_FILE_UPLOAD-VALUE.
    WHEN 5.
    WA_TABDATA-ZSHIFT1 = IT_FILE_UPLOAD-VALUE.
    WHEN 6.
    WA_TABDATA-ZSHIFT2 = IT_FILE_UPLOAD-VALUE.
    WHEN 7.
    WA_TABDATA-ZSHIFT3 = IT_FILE_UPLOAD-VALUE.
    ENDCASE.
    AT END OF ROW.
    WA_TABDATA-MANDT = SY-MANDT.
    APPEND WA_TABDATA TO IT_TABDATA.
    CLEAR: WA_TABDATA.
    ENDAT.
    ENDLOOP.
    ENDFORM. " ORGANIZE_UPLOADED_DATA
    In the subroutine --> ORGANIZE_UPLOADED_DATA, data are organized as per the structure declared above.
    Regards,
    Abir
    Don't forget to award points *

  • Fill a table with data coming from an RFC

    Hello everyone:
    I've followed the Weblog "How many lines of java code did i write for a simple Web Dynpro?"
    /people/durairaj.athavanraja/blog/2004/10/17/how-many-lines-of-java-code-did-i-write-for-a-simple-web-dynpro
    I've called an RFC and created a table with data coming from it (which is also a table). My question is, if in this table there's a field named "UserType" there are two possible values for this field:
    "userA"
    "userB"
    How can I get the table only show me the "userA" registers? The RFC does return all of the users, but when filling the table, can I put an if-else somewhere on my code?
    Thanks a lot
    Alejandro

    Hi Alejandro,
    Referring to the link provided "The logic of the filter process is not implemented in Web Dynpro. The application developer must implement the action to be executed."
    We would have to implement the action onFilter in the controller implementation. Ideally, we fill the data retrieved from backend into a List (java.util.List) (this could be done on init of view) and then subset the list after meeting the criteria in the action handler(say
    onActionFilterData(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent).
    Having done this, you may bind the output list back to the node (shown in table)
    Regards,
    Chaitanya

Maybe you are looking for