To Transfer data from internal table to a table control

Hi All,
I have selected some data to be displayed on a screen into an internal table ...............my problem is how to transfer the data from the internal table to this table control so that when screen is displayed the data is also displayed.
Regards,
Shweta

Hi Shweta,
<b>Please see if the below demo program is helpful...
DEMO_DYNPRO_TABCONT_LOOP</b>
==============================
controls flights type tableview using screen 100.
select * from spfli into corresponding fields of table itab.
call screen 100.
module status_0100 output.
  set pf-status 'SCREEN_100'.
  describe table itab lines fill.
  flights-lines = fill.
endmodule.
module fill_table_control output.
  read table itab into demo_conn index flights-current_line.
endmodule.
module cancel input.
  leave program.
endmodule.
module read_table_control input.
  lines = sy-loopc.
  modify itab from demo_conn index flights-current_line.
endmodule.
module user_command_0100 input.
  save_ok = ok_code.
  clear ok_code.
  case save_ok.
    when 'NEXT_LINE'.
      flights-top_line = flights-top_line + 1.
      limit = fill - lines + 1.
      if flights-top_line > limit.
        flights-top_line = limit.
      endif.
    when 'PREV_LINE'.
      flights-top_line = flights-top_line - 1.
      if flights-top_line < 0.
        flights-top_line = 0.
      endif.
    when 'NEXT_PAGE'.
      flights-top_line = flights-top_line + lines.
      limit = fill - lines + 1.
      if flights-top_line > limit.
        flights-top_line = limit.
      endif.
    when 'PREV_PAGE'.
      flights-top_line = flights-top_line - lines.
      if flights-top_line < 0.
        flights-top_line = 0.
      endif.
    when 'LAST_PAGE'.
      flights-top_line =  fill - lines + 1.
    when 'FIRST_PAGE'.
      flights-top_line = 0.
  endcase.
endmodule.
Thanks, ABY

Similar Messages

  • Transfer data from MS Excel to Oracle table

    Hello,
    hope someone can help: What is the easiest way to transfer data from Excel sheet to a Oracle table and how ?
    An example of a row to transfer is given below
    Date Time Value 1 Value 2
    2004-02-02     03:47:39     9,62     3,62     
    Thanks in advance
    Regards
    Roar

    From Microsoft access , import data from Excel to an Access table.
    Format that Access Table properly in Design mode.
    Create a table as per your specification in oracle Database.
    Then export to oracle from access using approppriate ODBC driver.
    --Sayan                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • How to transfer data from excel files into z-tables

    Please help me with a code which transfers data from excel file to z-table.
    Thanks in advance
    Shuvir

    Hi Daniel,
    Export Data
    Purpose
    Use this procedure to export SAP data to a local file such as Microsoft Excel.
    Menu Path
    Use the following menu path to begin this process:
    ·         SystemèListèSaveèLocal File
    Helpful Hints
    When reviewing fields, R = Required,  O = Optional and C = Conditional.
    Procedure
    1.       Start the transaction using the menu path or transaction code.
          Whatever Data You Want to Export
    2.       Select SystemèListèSaveèLocal File.  This works well for any data in SAP.  This is the only option for the top-level (first page) of a report. 
    In a drill-down view within a report the Local File button  on the toolbar may be used and has the same options.
          Choose File Format
    3.       Click  .
    4.       Click  to continue.  If prompted for a format after choosing Spreadsheet, select Excel Table to get an Excel file that can be modified more easily.
          Choose File Save Location Step 1
    5.       Click  to the right of the Directory field to choose a different location.
          Choose File Save Location Step 2
    6.       Click  or browse your computer to locate the directory where you want to save your file.
    7.       Complete the following field:
    ·         File name:
        You must add the proper file extension to the name of your file (.xls for Excel, .rtf for Rich Text, .html for HTML).  The file extension tells your computer what program to open the file with.  If you do not have the file extension at the end, you may not be able to open it.
    8.       Click  to continue.
          Generate File in Location and Format Selected
    9.       Click  to create the file in the location and format selected.  In this example the file was named "example.xls" and saved on the desktop.
    Result
    You have completed the export process.
    thanks
    karthik

  • Transfer Data from a JTable to the table model

    Hi
    I' looking for a simple method to transfer the last user input in a table to the table model.
    For example:
    In a Dialog the user insert in a JTable a few values and leaves with OK. But the last input is not saved in the model. It is just saved after selecting a new field in the JTable before leaving the Dialog.
    Is there a call to transfer all input to the model?
    Thanks
    Guido

    class MyJTable extends JTable (
    public boolean validateInput() {
    if(isEditing()) {
    return cellEditor.stopCellEditing();
    return true;
    Call this method whenever you want the input value to be stored in the table model. The return value can be false if the input isn't valid, this will depend on the cell editor.
    The idea is:
    Ask if the table has an editor activated. (isEditing())
    If so, request the editor to store the value in the model.
    I haven't prouved the code, sorry, but I hope you get the idea and helps.

  • How to transfer data from a dynamic internal table

    Hi All
    I want to transfer data from a dynamic internal table<dyn_table>
    to a non dynamic internal table itab which should have the same structure as <dyn_table>.
    How can this be done?
    Regards,
    Harshit Rungta

    As stated earlier this can be done only through field symbols...
    You cannot create an non dynamic internal table with ANY structure...using DATA statement
    If the strucutre is defined well and good...you can create an non-dynamic internal table...
    If you do not know the structure then the internal table has to be dynamic...and to be generated using field symbols
    DATA: lv_ref TYPE REF TO data.
    FIELD-SYMBOLS: <fs_dyn_table> TYPE STANDARD TABLE.
    * You create a dynamic internal table...
    CREATE DATA lv_ref LIKE (your_dynamic_internal_table).
    ASSIGN lv_ref->* TO <fs_dyn_table>.
    Now...do the transfer.
    <fs_dyn_table> = "your_dynamic_internal_Table
    Hope it helps!

  • How to Transfer Data from editable ALV grid control to internal table?

    Hi,
    Can anyone give me a simple example by which I can transfer data from editable alv grid control back to the internal table. The ALV has been created by OO approach.
    I would appreciate if the solution is provided without handling any events.
    Regards,
    Auro

    Hello Auro
    You simply need to call method <b>go_grid->check_changed_data</b> at PAI of the dynpro displaying the ALV grid. If data have been changed on the editable ALV grid then this method will raise event DATA_CHANGED. If you do not want or need to handle this event (e.g. for validating the edited values) then you do not define any event handler method.
    Regards
      Uwe

  • HOW TO TRANSFER DATA FROM ONE INTERNAL TABLE TO ANOTHER

    FOR PERTICULAR OBJECT ID ONE INT TABLE JTAB CONTAINS ONE RECORD(ROW) AND ANOTHER INT TABLE KTAB CONTAINS 3 RECORDS(ROWS). THEN HOW I SHOULD TRANSFER DATA FROM KTAB TO JTAB? WHAT R THE VARIOUS WAYS TO DO THAT. PLS HELP ME OUT. THANKS IN ADVANCE

    Try something like
    If you want one record per ktab :
    LOOP AT jtab.
      MOVE-CORRESPONDING jtab TO itab.
      LOOP AT ktab WHERE id = jtab-id.
        MOVE-CORRESPONDING ktab TO itab.
        APPEND itab.
      ENDLOOP.
    ENDLOOP.
    or
    LOOP AT ktab.
      READ TABLE jtab WITH KEY id = ktab-id. " binary implicit if sorted type
      MOVE-CORRESPONDING jtab TO itab.
      MOVE-CORRESPONDING ktab TO itab.
      APPEND itab.
    ENDLOOP. 
    If you want to sum ktab ratio into itab for each jtab
    LOOP AT jtab.
      MOVE-CORRESPONDING jtab TO itab.
      LOOP AT ktab WHERE id = jtab-id.
        ADD-CORRESPONDING ktab TO itab.
        APPEND itab.
      ENDLOOP.
    ENDLOOP.
    Use sorted type table when LOOP AT WHERE, else SORT table is enough.
    Regards

  • How do i transfer data from one internal tabe to another.

    Hi All,
             How do i transfer data from one internal tabe to another.
             Can i do it ebven if he tables are different in structure.
    Please Advice.
    Thanks in advance.

    Hi Saket Tiwari,
    I hope the earlier post by kashyap is good enough an answer. anywas in addition to it let me give a detailed
    explanation of how you can populate an internal table.
    1) Append data line by line.
         Syntax :  APPEND [<wa> TO / INITIAL LINE TO] <itab>.
    this appends new line to internal table <itab>.
    2) Using COLLECT statement.
                 COLLECT is another form of statement used for populating the internal tables.  Generally COLLECT is used while inserting lines into an internal table with unique standard key. The syntax for COLLECT statement is as shown
         Syntax : COLLECT [<wa> INTO] <itab>.
    3) Using INSERT statement
         Syntax  INSERT [<wa> INTO / INITIAL LINE INTO] <itab> [index <idx>].
    INSERT statement adds a line/work area to the internal table. You can specify the position at which the new line is to be added by using the INDEX clause with the INSERT statement.
    Now coming to your request..
    To append part or all of an internal table
         Syntax
                  APPEND LINES OF <itab1> [FROM <n1>] [TO <n2>] TO <itab2>.
    *     Note:
    Without the FROM and TO options, this statement appends the entire table <itab1> to <itab2>.*
    b) To insert part or all of an internal table into another internal table
         Syntax
              INSERT LINES OF <itab1> [FROM <n1>] [TO <n2>]
              INTO <itab2> [INDEX <idx>].
    c) Using Move statement.
    To copy entire contents of one table into another in one execution
         Syntax MOVE  <itab1> To <itab2>.
                   OR
              <itab1> = <itab2>.
    but u hav to be careful because he contents of itab2 will eb overwritten on the execution of this statement.
    These copy the contents of ITAB1 to ITAB2. Incase of internal tables with header line we have to use [] inorder to distinguish from work area. So, to copy contents of internal tables with header line  the syntax becomes,
    ITAB1[] = ITAB2[].
    Coming to the letter part of your question, Yes, we can copy values between tables having different structures.
    for this we use    
                                MOVE-CORRESPONDING <itab1> TO <itab2>
        this executes the statement for their header lines. Searches for the sub-fields which occur both in itab1 and itab2 and then generates, for all relevant field pairs which correspond to the
            sub-fields ni , statements of the form MOVE itab1-ni TO itab2-ni. The other fields remain unchanged.
    I hope the information provided has been of your help.
    Reward if useful.
    Regards,
    Jose

  • How to send data from internal table to the shared folder in ABAP

    Hi experts,
             My requirement is to transfer data from a file to shared folder. i just did reading data from a file to a internal table. Now i want to send this internal table data into a shared folder which is  "
    xxx\y\z....".
    I do not have any idea on how to send data from internal table to the shared folder path.
    can anybody please help me out how to do this?
    Thanks & Regards
    Sireesha.

    Where that folder is located, its on presentation server i.e. desktop or application server.
    If its on presentation server, use FM GUI_UPLOAD.
    If its on application server, then use DATASET functions. Have a look at below link.
    [File Handling in ABAP|http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3ca6358411d1829f0000e829fbfe/frameset.htm]
    I hope it helps.
    Thanks,
    Vibha
    Please mark all the useful answers

  • Transfer data from ALV to Z table

    Hi,
    I need to confirm the exact procedure to transfer data from ALV into z table.I am entering few values at runtime in the ALV & need to populate the z table with the same.
    I created a z table,it has been assigned a internal table & work area.A loop is there on the internal table passed to fieldcatalog.
    LOOP AT GIT_EKPO INTO GS_EKPO.
        LS_ZPS005-EBELN = GS_EKPO-EBELN.
        LS_ZPS005-EBELP = GS_EKPO-EBELP.
        LS_ZPS005-ERECDAT = GS_EKPO-ERDAT. "this field is not passing value into z table
        LS_ZPS005-LINEID = SY-TABIX.
        LS_ZPS005-POQTY = GS_EKPO-POQTY.
        LS_ZPS005-EREQTY = GS_EKPO-EREQTY. "this field is not passing value into z table
    ENDLOOP.
      INSERT INTO ZPS005 VALUES LS_ZPS005.
    When I assign the values from Internal table into internal table of z table,the values in fields populated at runtime does not come.
    Please help me with your suggestions on the same.
    Thanks.

    Hi,
    I tried the procedure,but do I need to include this before method set_table_for_first_display?
    You can have a look at the whole code.Please let me know of a possible solution.Looking forward to an early reply.
    Thanks.
    TABLES: EKKO,
            EKPO,
            ZPS005.
    INITIALIZATION.
    PERFORM CREATE_FIELD_CATLOG.
                               Types Declaration                          *
    *Structure for EKPO table
      TYPES: BEGIN OF TYPE_EKPO,
              EBELN TYPE EKPO-EBELN, "PURCHSE ORDER NUMBER
              EBELP TYPE EKPO-EBELP, "Item Number of Purchasing Document
              POQTY TYPE EKPO-MENGE, "Purchase Order Quantity
              ERDAT TYPE SY-DATUM, "Date on Which Record Was Created
             LINEID TYPE ZPS005-LINEID, "Unique identification of document line
              EREQTY TYPE ZPS005-EREQTY, "Erection Quantity
         END OF TYPE_EKPO.
                                        Data                              *
               Data Declaration for Internal Table & Work Area            *
    *INTERNAL TABLE FOR EKPO TABLE
      DATA:LIT_EKPO TYPE TABLE OF EKPO,
           LS_EKPO TYPE EKPO.
    *SECOND INTERNAL TABLE FOR EKPO TABLE
      DATA: GIT_EKPO TYPE TABLE OF TYPE_EKPO.
      DATA: GS_EKPO TYPE TYPE_EKPO.
    *INTERNAL TABLE FOR FIELD CATALOG
      DATA: LIT_FIELDCAT TYPE lvc_t_fcat,
            LS_FIELDCAT LIKE LINE OF LIT_FIELDCAT. "WORK AREA FOR FIELD CATALOG
    *INTERNAL TABLE FOR Z TABLE ZPS005
      DATA: LIT_ZPS005 TYPE TABLE OF ZPS005,
            LS_ZPS005 TYPE ZPS005.
                            ALV GRID Data Declaration                     *
      DATA: V_CONTAINER TYPE REF TO cl_gui_custom_CONTAINER.
      data: grid TYPE REF TO cl_gui_alv_grid.
      data: ok_code type sy-ucomm.
      DATA: V_LAYOUT TYPE lvc_s_layo.  " FOR LAYOUT
      DATA: V_LINE TYPE I,
            LINEID TYPE I.
      DATA: V_INDEX TYPE SY-TABIX.
                                   PARAMETER                              *
      parameter : p_ebeln like ekko-ebeln.
                                  START OF SELECTION                      *
    START-OF-SELECTION.
                                   SELECTION OF DATA                      *
      CALL FUNCTION 'ME_PURCHASE_DOCUMENT_DATA_READ'
        EXPORTING
          I_EBELN                    = P_EBELN
          I_TCODE                    = 'ME23'
      I_NO_COMMIT                = ' '
          I_TRTYP                    = 'A'
      I_NO_MESSAGING             =
      I_NO_MESSAGE_REQ           =
      I_NO_AUTHORITY_CHECK       =
      I_VORGA                    =
    IMPORTING
      E_EKKO                     =
       TABLES
         T_EKPO                     = LIT_EKPO
      T_EKET                     =
      T_EKKN                     =
      T_KOMV                     =
       EXCEPTIONS
         NO_EBLNR                   = 1
         EBLNR_NOT_FOUND            = 2
         NO_TCODE                   = 3
         TCODE_NOT_ALLOWED          = 4
         NO_TRTYP                   = 5
         INVALID_CALL_OF_FB         = 6
         OTHERS                     = 7
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      LOOP AT LIT_EKPO INTO LS_EKPO.
        MOVE : LS_EKPO-EBELN TO GS_EKPO-EBELN,
               LS_EKPO-EBELP TO GS_EKPO-EBELP,
               LS_EKPO-MENGE TO GS_EKPO-POQTY.
        APPEND GS_EKPO TO GIT_EKPO.
      ENDLOOP.
    End-of-selection.
      perform field_catalog.
      call screen 100.
                                   END-OF-SELECTION                       *
                                MODULES FOR ALV DISPLAY                   *
    *&      Module  STATUS_0100  OUTPUT
          text
    MODULE STATUS_0100 OUTPUT.
      SET PF-STATUS 'PF-STAT'.
      SET TITLEBAR 'TITLE'.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    **&      Module  USER_COMMAND_0100  INPUT
          text
    MODULE USER_COMMAND_0100 INPUT.
      CASE OK_CODE.
        WHEN 'BACK'.
          LEAVE PROGRAM.
        WHEN 'EXIT'.
          LEAVE TO SCREEN 0.
       WHEN 'SWITCH'.
         PERFORM switch_edit_mode.
        WHEN 'SAVE'.
          PERFORM FILL_TABLE.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    **&      Module  layout_0100  OUTPUT
          text
    MODULE layout_0100 OUTPUT.
      V_LAYOUT-grid_title = 'Purchase Order Erection Details'.
    ENDMODULE.                 " layout_0100  OUTPUT
    **&      Module  data_retrivaL  OUTPUT
          text
    MODULE data_retrivaL OUTPUT.
      IF V_CONTAINER IS INITIAL.
        CREATE OBJECT V_CONTAINER
          EXPORTING container_name = 'GRID'.
        CREATE OBJECT grid
        EXPORTING i_parent = V_CONTAINER.
      ENDIF.
      CALL METHOD GRID->SET_TABLE_FOR_FIRST_DISPLAY
        EXPORTING
          IS_LAYOUT                     = V_LAYOUT
        CHANGING
          IT_OUTTAB                     = GIT_EKPO
          IT_FIELDCATALOG               = LIT_FIELDCAT
        EXCEPTIONS
          INVALID_PARAMETER_COMBINATION = 1
          PROGRAM_ERROR                 = 2
          TOO_MANY_LINES                = 3
          others                        = 4.
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDMODULE.                 " data_retrivaL  OUTPUT
    *&      Module  field_catalog  OUTPUT
          text
    FORM field_catalog.
      CLEAR LS_fieldcat.
      LS_fieldcat-fieldname = 'EBELN'.
      LS_fieldcat-ref_table = 'GIT_EKPO'.
      LS_FIELDCAT-coltext  = 'PURCHSE ORDER NUMBER'.
      LS_FIELDCAT-col_pos   = 0.
      LS_FIELDCAT-EDIT = ' '.
    ls_FIELDCAT-style = cl_gui_alv_grid=>mc_style_disabled.
    INSERT LS_FIELDCAT INTO TABLE LIT_FIELDCAT.
      APPEND LS_fieldcat TO LIT_fieldcat.
      CLEAR LS_fieldcat.
      LS_fieldcat-fieldname = 'EBELP'.
      LS_fieldcat-ref_table = 'GIT_EKPO'.
      LS_FIELDCAT-coltext  = 'ITEM NUMBER'.
      LS_FIELDCAT-col_pos   = 1.
      LS_FIELDCAT-EDIT = ' '.
    ls_FIELDCAT-style = cl_gui_alv_grid=>mc_style_disabled.
    INSERT LS_FIELDCAT INTO TABLE LIT_FIELDCAT.
      APPEND LS_fieldcat TO LIT_fieldcat.
      CLEAR LS_fieldcat.
      LS_fieldcat-fieldname = 'POQTY'.
      LS_fieldcat-ref_table = 'GIT_EKPO'.
      LS_FIELDCAT-coltext  = 'PURCHASE ORDER QUANTITY'.
      LS_FIELDCAT-col_pos   = 2.
      LS_FIELDCAT-EDIT = ' '.
    ls_FIELDCAT-style = cl_gui_alv_grid=>mc_style_disabled.
    INSERT LS_FIELDCAT INTO TABLE LIT_FIELDCAT.
      APPEND LS_fieldcat TO LIT_fieldcat.
      CLEAR LS_fieldcat.
      LS_fieldcat-fieldname = 'ERDAT'.
      LS_fieldcat-ref_table = 'GIT_EKPO'.
      LS_FIELDCAT-coltext  = 'DATE OF ERECTION'.
      LS_FIELDCAT-col_pos   = 3.
      LS_FIELDCAT-EDIT = 'X'.
    ls_fieldcat-style = cl_gui_alv_grid=>mc_style_enabled.
    INSERT LS_FIELDCAT INTO TABLE LIT_FIELDCAT.
      APPEND LS_fieldcat TO LIT_fieldcat.
      CLEAR LS_fieldcat.
      LS_fieldcat-fieldname = 'EREQTY'.
      LS_fieldcat-ref_table = 'GIT_EKPO'.
      LS_FIELDCAT-coltext  = 'ERECTION QUANTITY'.
      LS_FIELDCAT-col_pos   = 4.
      LS_FIELDCAT-EDIT = 'X'.
    ls_fieldcat-style = cl_gui_alv_grid=>mc_style_enabled.
    INSERT LS_FIELDCAT INTO TABLE LIT_FIELDCAT.
      APPEND LS_fieldcat TO LIT_fieldcat.
    ENDFORM.                 " field_catalog  OUTPUT
    *&      Form  SWITCH_EDIT_MODE
          text
    -->  p1        text
    <--  p2        text
    *FORM switch_edit_mode.
    IF GRID->is_ready_for_input( ) eq 0.
    set edit enabled cells ready for input
       CALL METHOD GRID->set_ready_for_input
         EXPORTING
           i_ready_for_input = 1.
    ELSE.
    lock edit enabled cells against input
       CALL METHOD GRID->set_ready_for_input
         EXPORTING
           i_ready_for_input = 0.
    ENDIF.
    *ENDFORM.                               " SWITCH_EDIT_MODE
    *&      Form  FILL_TABLE
          text
    -->  p1        text
    <--  p2        text
    FORM FILL_TABLE .
      LOOP AT GIT_EKPO INTO GS_EKPO.
        LS_ZPS005-EBELN = GS_EKPO-EBELN.
        LS_ZPS005-EBELP = GS_EKPO-EBELP.
        LS_ZPS005-POQTY = GS_EKPO-POQTY.
        LS_ZPS005-ERECDAT = GS_EKPO-ERDAT.
        LS_ZPS005-EREQTY = GS_EKPO-EREQTY.
      ENDLOOP.
      MODIFY ZPS005 FROM LS_ZPS005.
    ENDFORM.                    " FILL_TABLE

  • Transfer data from SAP TABLES to a SQL table

    Hi,
    I need to transfer data from SAP tables to a SQL table. Please suggest the best way as well as the steps please.
    Regards,
    Kamlesh

    Hi
    Step 1: Create an entry for the External database in DBCON table using Trxn: DBCA.
    Field Name Description Value (For: E.g.:)
    CON_NAME Logical name
    for database con RAJ
    DBMS Database system MSS
    USER_NAME Database user <username>
    PASSWORD Password for setting up
    the connection
    to the database <pwd>/<pwd>
    CON_ENV Database-specific MSSQL_SERVER=depotserver MSSQL_DBNAME=HOF_INDORE
    DB_RECO Availability type for an open database connect
    Then, you can define internal table and code the following way:
    DATA: BEGIN OF wa,
    c_locid(3),
    c_locname(50),
    c_locstate(5),
    END OF wa.
    EXEC SQL.
    CONNECT TO 'RAJ' AS 'V'
    ENDEXEC.
    EXEC SQL.
    SET CONNECTION 'V'
    ENDEXEC.
    < Populate SAP data into an internal table >
    Loop on itab.
    EXEC SQL.
    < code here for populating data into MS-SQL Server table>
    ENDEXEC.
    Endloop.
    Regards,
    Raj

  • Transfer data from a table to another table

    Hello
    I want to transfer data from a table in one server to another table in a different server, I want to do this on a nightly job, what will be the best way, please advise, thank you.

    Multiple options
    1. Create linked server  and use INSERT..SELECT * FROM [Server].[DB].dbo.Table
    2. Use OPENROWSET
    http://searchsqlserver.techtarget.com/tip/Using-the-OPENROWSET-function-in-SQL-Server
    3. Use export import wizard
    http://www.leniel.net/2011/07/import-export-data-sql-server-database.html#sthash.l4fgNNdV.dpbs
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Gui_download for transferring the data from internal table to excel sheet.

    hi all,
    i am using gui_download for transferring the data from internal table to excel sheet.
    I have a internal table with 3 columns col1,col2,col3 and I am getting the file at the specified path,but my problem is that,in the excel sheet(path specified) all the 3 columns values are printed in one column.Please help me.
    Thanks in advance.

    Hi Venkata,
    plz use FM 'SAP_CONVERT_TO_XLS_FORMAT' :
      call function 'SAP_CONVERT_TO_XLS_FORMAT'
        exporting
    *   I_FIELD_SEPERATOR          =
    *   I_LINE_HEADER              =
          i_filename                 = p_file
    *   I_APPL_KEEP                = ' '
        tables
          i_tab_sap_data             = t_mbew
    * CHANGING
    *   I_TAB_CONVERTED_DATA       =
    * EXCEPTIONS
    *   CONVERSION_FAILED          = 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.
    Hope this helps,
    Erwan

  • Downloading data from internal table to xls file leading zeros are not disp

    Hai abap gurus,
    when i am downloading data from internal table to excle file. some field values in a column are with leading zeros and some others dont have leading zeros.but in the output it is showing without leading zeros. then how to get with exact values.
    Ex:
    <b>ECC Code.</b>
    045234
      88567
    098456 
    but output is giving like this:
    45234
    88567
    98456
    how to get the actual values.....
    plz help me in this matter.

    Dear Kiran,
    Those field in the internal table having Leading Zeroes, make those fields' datatype as character.
    Then use the function module to download the content of the internal table to the excel file.
    Regards,
    Abir
    Don't forget to Reward Points  *

  • Download data from internal table to flat file.

    I need to download the data from Internal table to Flat file. can any one suggest how to do it? i suppose WS_Download OR GUI_DOWNLOAD.
    but if it is please guide me how to use this.
    is thre any other F.M. please provide the information.
    Thanks in advance

    Hi,
    Try this,
    * File download, uses older techniques but achieves a perfectly
    * acceptable solution which also allows the user to append data to
    * an existing file.
      PARAMETERS: p_file like rlgrap-filename.
    * Internal table to store export data  
      DATA: begin of it_excelfile occurs 0,
       row(500) type c,
       end of it_excelfile.
      DATA: rc TYPE sy-ucomm,
            ld_answer TYPE c.
      CALL FUNCTION 'WS_QUERY'
           EXPORTING
                query    = 'FE'  "File Exist?
                filename = p_file
           IMPORTING
                return   = rc.
      IF rc NE 0.                       "If File alread exists
        CALL FUNCTION 'POPUP_TO_CONFIRM'
          EXPORTING
    *          TITLEBAR              = ' '
    *          DIAGNOSE_OBJECT       = ' '
               text_question         = 'File Already exists!!'
               text_button_1         = 'Replace'
    *          ICON_BUTTON_1         = ' '
               text_button_2         = 'New name'
    *          ICON_BUTTON_2         = ' '
    *          DEFAULT_BUTTON        = '1'
    *          DISPLAY_CANCEL_BUTTON = 'X'
    *          USERDEFINED_F1_HELP   = ' '
    *          START_COLUMN          = 25
    *          START_ROW             = 6
    *          POPUP_TYPE            =
          IMPORTING
               answer                = ld_answer
    *     TABLES
    *         PARAMETER              =
          EXCEPTIONS
              text_not_found         = 1
              OTHERS                 = 2.
    * Option 1: Overwrite
        IF ld_answer EQ '1'.
          CALL FUNCTION 'GUI_DOWNLOAD'
            EXPORTING
    *            BIN_FILESIZE            =
                 filename                = p_file        "File Name
                 filetype                = 'ASC'
    *       IMPORTING
    *            FILELENGTH              =
            TABLES
                data_tab                = it_excelfile   "Data table
            EXCEPTIONS
                file_write_error        = 1
                no_batch                = 2
                gui_refuse_filetransfer = 3
                invalid_type            = 4
                OTHERS                  = 5.
          IF sy-subrc <> 0.
            MESSAGE i003(zp) WITH
                     'There was an error during Excel file creation'(200).
            exit. "Causes short dump if removed and excel document was open 
          ENDIF.
    * Option 2: New name.
        ELSEIF ld_answer EQ '2'.
          CALL FUNCTION 'DOWNLOAD'
            EXPORTING
                 filename            = p_file          "File name
                 filetype            = 'ASC'           "File type
    *             col_select          = 'X'            "COL_SELECT
    *             col_selectmask      = 'XXXXXXXXXXXXXXXXXXXXXXXXXX'
    *                                                   "COL_SELECTMASK
                 filetype_no_show    = 'X'     "Show file type selection?
    *       IMPORTING
    *             act_filename        = filename_dat
            TABLES
                 data_tab            = it_excelfile    "Data table
    *            fieldnames          =
            EXCEPTIONS
                 file_open_error     = 01
                 file_write_error    = 02
                 invalid_filesize    = 03
                 invalid_table_width = 04
                 invalid_type        = 05
                 no_batch            = 06
                 unknown_error       = 07.
        ENDIF.
      ELSE.                               "File does not alread exist.
        CALL FUNCTION 'GUI_DOWNLOAD'
          EXPORTING
    *          BIN_FILESIZE            =
               filename                = p_file         "File name
               filetype                = 'ASC'          "File type
    *     IMPORTING
    *          FILELENGTH              =
          TABLES
               data_tab                = it_excelfile   "Data table
          EXCEPTIONS
               file_write_error        = 1
               no_batch                = 2
               gui_refuse_filetransfer = 3
               invalid_type            = 4
               OTHERS                  = 5.
        IF sy-subrc <> 0.
          MESSAGE i003(zp) WITH
                   'There was an error during Excel file creation'(200).
          exit. "Causes short dump if removed and excel document was open 
        ENDIF.
      ENDIF.
    Regards,
    Raghav

Maybe you are looking for