Downloading an internal table to presentation server from WebUI

Hi All,
We have a requirement to download an internal table as a CSV file from CRM 7.0 WebUI to the presentation server. The file path is fixed, so the user need not choose the download location. The data to be downloaded is not part of any view on the WebUI and is being collected through code from several context nodes.
We have looked at CL_BSP_UTILITY, which is not solving our purpose, as the prepared data stream gets over written by CRM 7.0 framework during execution.
Any suggestions on how we can achieve the functionality?
Regards,
Mugdha

Hi,
     If you need to provide download window via the browser, check out this wiki - [http://wiki.sdn.sap.com/wiki/pages/pointstab/viewpageversion.action?pageId=187336093&version=6] . If you want to directly write to the presentation server, you have th efollowing ways. If you submit a report in background, you have the option of using CL_GUI_FRONTEND_SERVICES. Otherwise you can check out using a combination of javascript and activex objects ( [http://www.codingforums.com/showthread.php?t=136906] ).
Regards,
Arun Prakash

Similar Messages

  • Download internal table to presentation server in UTF-8 format

    Hello everyone.
    We are trying to use function module GUI_DOWNLOAD to download data from internal table to a text file (filetype ASCII). The defualt encoding for the text file is ANSI but we need to download it with the encoding UTF-8.
    We have already used codepage 4110 but that did not solve the problem.
    We are using SAP ECC 5.0 system.
    Can anyone please provide us with a solution? We need to solve this as early as possible.

    Hi Saurav.
    Try this
    1.Go to SAP GUI Logon
    2. Change your icon logon on Tabstrib "Code Page" at "Upload/Download"  to encod whatever language
    do you want.
    Hope it helps.
    Sayan.

  • Re: How to download an internal table to application server.. Unicode

    Hi..
    i have populated an internal table of a big structure (custom table) which has more than 100 fields.
    i wanted to download it into the application server.. as a tab de-limited file..
    Can anyone guide me how to proceed with
    Thanks In Advance
    Guhapriyan..

    HI
    this program will convert the internal table to the xml document
    Report ZPRUEBA_MML_13 *
    Export an internal table to XML document *
    NO BORRAR ESTE CODIGO *
    REPORT Z_table_xml.
    PARAMETERS: GK_RUTA TYPE RLGRAP-FILENAME.
    TYPES: BEGIN OF TURNOS,
    LU LIKE T552A-TPR01,
    MA LIKE T552A-TPR01,
    MI LIKE T552A-TPR01,
    JU LIKE T552A-TPR01,
    VI LIKE T552A-TPR01,
    SA LIKE T552A-TPR01,
    DO LIKE T552A-TPR01,
    END OF TURNOS.
    TYPE SOCIO *
    TYPES: BEGIN OF SOCIO,
    NUMERO LIKE PERNR-PERNR,
    REPOSICION LIKE PA0050-ZAUVE,
    NOMBRE LIKE PA0002-VORNA,
    TURNOS TYPE TURNOS,
    END OF SOCIO.
    TYPE SOCIO *
    ESTRUCTURA ACCESOS *
    DATA: BEGIN OF ACCESOS OCCURS 0,
    SOCIO TYPE SOCIO,
    END OF ACCESOS.
    ESTRUCTURA ACCESOS *
    START OF SELECTION *
    START-OF-SELECTION.
    PERFORM LLENA_ACCESOS.
    PERFORM DESCARGA_XML.
    END-OF-SELECTION.
    END OF SELECTION *
    FORM LLENA_ACCESOS *
    FORM LLENA_ACCESOS.
    REFRESH ACCESOS.
    CLEAR ACCESOS.
    MOVE: '45050' TO ACCESOS-SOCIO-NUMERO,
    'MOISES MORENO' TO ACCESOS-SOCIO-NOMBRE,
    '0' TO ACCESOS-SOCIO-REPOSICION,
    'T1' TO ACCESOS-SOCIO-TURNOS-LU,
    'T2' TO ACCESOS-SOCIO-TURNOS-MA,
    'T3' TO ACCESOS-SOCIO-TURNOS-MI,
    'T4' TO ACCESOS-SOCIO-TURNOS-JU,
    'T5' TO ACCESOS-SOCIO-TURNOS-VI,
    'T6' TO ACCESOS-SOCIO-TURNOS-SA,
    'T7' TO ACCESOS-SOCIO-TURNOS-DO.
    APPEND ACCESOS.
    CLEAR ACCESOS.
    MOVE: '45051' TO ACCESOS-SOCIO-NUMERO,
    'RUTH PEÑA' TO ACCESOS-SOCIO-NOMBRE,
    '0' TO ACCESOS-SOCIO-REPOSICION,
    'T1' TO ACCESOS-SOCIO-TURNOS-LU,
    'T2' TO ACCESOS-SOCIO-TURNOS-MA,
    'T3' TO ACCESOS-SOCIO-TURNOS-MI,
    'T4' TO ACCESOS-SOCIO-TURNOS-JU,
    'T5' TO ACCESOS-SOCIO-TURNOS-VI,
    'T6' TO ACCESOS-SOCIO-TURNOS-SA,
    'T7' TO ACCESOS-SOCIO-TURNOS-DO.
    APPEND ACCESOS.
    ENDFORM.
    FORM LLENA_ACCESOS *
    FORM DESCARGA_XML *
    FORM DESCARGA_XML.
    DATA: L_DOM TYPE REF TO IF_IXML_ELEMENT,
    M_DOCUMENT TYPE REF TO IF_IXML_DOCUMENT,
    G_IXML TYPE REF TO IF_IXML,
    W_STRING TYPE XSTRING,
    W_SIZE TYPE I,
    W_RESULT TYPE I,
    W_LINE TYPE STRING,
    IT_XML TYPE DCXMLLINES,
    S_XML LIKE LINE OF IT_XML,
    W_RC LIKE SY-SUBRC.
    DATA: XML TYPE DCXMLLINES.
    DATA: RC TYPE SY-SUBRC,
    BEGIN OF XML_TAB OCCURS 0,
    D LIKE LINE OF XML,
    END OF XML_TAB.
    CLASS CL_IXML DEFINITION LOAD.
    G_IXML = CL_IXML=>CREATE( ).
    CHECK NOT G_IXML IS INITIAL.
    M_DOCUMENT = G_IXML->CREATE_DOCUMENT( ).
    CHECK NOT M_DOCUMENT IS INITIAL.
    WRITE: / 'Converting DATA TO DOM 1:'.
    CALL FUNCTION 'SDIXML_DATA_TO_DOM'
    EXPORTING
    NAME = 'ACCESOS'
    DATAOBJECT = ACCESOS[]
    IMPORTING
    DATA_AS_DOM = L_DOM
    CHANGING
    DOCUMENT = M_DOCUMENT
    EXCEPTIONS
    ILLEGAL_NAME = 1
    OTHERS = 2.
    IF SY-SUBRC = 0.
    WRITE 'Ok'.
    ELSE.
    WRITE: 'Err =',
    SY-SUBRC.
    ENDIF.
    CHECK NOT L_DOM IS INITIAL.
    W_RC = M_DOCUMENT->APPEND_CHILD( NEW_CHILD = L_DOM ).
    IF W_RC IS INITIAL.
    WRITE 'Ok'.
    ELSE.
    WRITE: 'Err =',
    W_RC.
    ENDIF.
    CALL FUNCTION 'SDIXML_DOM_TO_XML'
    EXPORTING
    DOCUMENT = M_DOCUMENT
    IMPORTING
    XML_AS_STRING = W_STRING
    SIZE = W_SIZE
    TABLES
    XML_AS_TABLE = IT_XML
    EXCEPTIONS
    NO_DOCUMENT = 1
    OTHERS = 2.
    IF SY-SUBRC = 0.
    WRITE 'Ok'.
    ELSE.
    WRITE: 'Err =',
    SY-SUBRC.
    ENDIF.
    LOOP AT IT_XML INTO XML_TAB-D.
    APPEND XML_TAB.
    ENDLOOP.
    CALL FUNCTION 'WS_DOWNLOAD'
    EXPORTING
    BIN_FILESIZE = W_SIZE
    FILENAME = GK_RUTA
    FILETYPE = 'BIN'
    TABLES
    DATA_TAB = XML_TAB
    EXCEPTIONS
    OTHERS = 10.
    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.
    FORM DESCARGA_XML *
    u can check the link
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/abap/abap-code-samples/conversion  of abap data to xml.doc
    Regards,
    Naveen

  • Problem with downloading the internal table onto the presentation server.

    Hey folks,
    I have a problem where in i am downloading one year of sales done by the company. I wrote a program to download the file onto the presentation server . The error occurs in the FM GUI_DOWNLOAD where if the file exceeds 105843504 bytes its giving me a dump saying that
    When the program was running , it was established that more memory was needed than the operating system is able to safely to provide.
    The current program has to be terminted because of the program already requested 105843504 bytes from the operating system with malloc when the operating system reported after further memory request that there was no more memory space available.
    Could somebody provide an alternative soltuion for this.
    Its really urgent as i can download the file with 70,000,000 bytes
    Regards
    Rock

    Hi Rock,
    Please download the files on to Application Server, else as suggested by Ashish download into 2 or 3 files and merge them manually.
    Declare same internal tables may be 5 times.
    When you fill the internal table check for a counter and when you hit a certain number stop appending to it and start appending to the next.
    After you are done so download all the internal tables.
    I guess this would be a good way. I am not sure if there are any ther alternative good methods.
    Hope this helps.
    Shreekant

  • Sending data from final internal table  to application server in xml format

    hi to all ,
    can anyone send details about send data from final internal table to application server in xml format.right now i am able to download data to presentation server in xml format . love to here soon from all the abap gigs.

    welcome to SDN.
    are you using call transformation to convert itab to XML? the XML string is in which format?
    convert it to xstring and then use the following code to store it in application server.
    OPEN DATASET fname FOR OUTPUT IN BINARY MODE.
    TRANSFER XML_content TO FNAME.
    CLOSE DATASET FNAME.
    where fname is the path to the file name.
    Regards
    Raja

  • Downloading two internal tables in same text file

    I have one internal table as like below.
    Data:begin of itab1 occurs 0,
         rec(5),
         end of itab1.
    Itab1 is getting updated from input text file(Continuous text).
    Here Itab1 contains one record with Indicator '01 and n number of records with indicator '02'.
    This needs to be seperated in to two internal tables.
    data:Begin of Itab_Head occurs 0,
         Rec_ind(2) type C,
         Name(3) type C,
         end of itab_Head.
    data:Begin of Itab_Item occurs 0,
         Rec_ind(2) type C,
         Id(3) type C,
         Status(10,
         end of itab_Item.
    loop at itab1.
    If itab1-Rec+0(2) = '01'.
       Itab_Head-Rec_Ind = itab1-rec+0(2).
       Itab_Head-Name = itab1-rec+2(3).
       Append Itab_Head.
    elseif itab1-rec+0(2) = '02'.
       Itab_Item-Rec_Ind = itab1-rec+0(2).
       Itab_Item-Id = itab1-rec+2(3).
       Append Itab_Item.
    endif.
    endloop.
    After moving to the internal tables I am doing some processing and updating the status of Itab_item.
    After all these again I have to download the internal table as a text file.Now my question is.
    I have values in 2 diff internal tables.How to download the two in same file.

    See this sample code.
    data: itab1 type string occurs 0 with header line,
          itab2 type string occurs 0 with header line.
    itab1 = 'itab1_text'.
    append itab1.
    itab2 = 'itab2_text'.
    append itab2.
    CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD
        exporting
          FILENAME = 'C:\ftext.txt'
        APPEND = 'X'
        changing
         DATA_TAB = itab1[].
    CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD
        exporting
          FILENAME = 'C:\ftext.txt'
          APPEND = 'X'
        changing
         DATA_TAB = itab2[].
    Svetlin

  • Downloading .xml/.tx data to presentation server while running background.

    Hi experts,
    I have a requiremnt to downloading .xml/.txt data to presentation server while running background.
    when i run the program in foreground with use of GUI_upload/ Gui_download its working fine but not working in background.
    i can't use email/data download to database file and than get it  option as data can be huge.
    Can anybody help me out regarding this.
    Thanks
    Anuj jain

    Hi anjui,
    it'snt possible to download a file in background using gui_download.
    You could try to create a Shell Command (transaction SM69) to transfer data in a shared directory.
    You can execute Os Commands using function module SXPG_COMMAND_EXECUTE
    Alessandro

  • I am using GUI_DOWNLOAD FM to download my internal table entries into .xls

    Hi
    I am using GUI_DOWNLOAD FM to download my internal table entries into .xls file. but it's not download total records in final table.
    in debugging it showing total records.
    exporting:
    filename
    filetype
    field-suprater
    header
    tables
    data_tab
    fieldnames
    plz help me.
    thanks
    Sankar

    Hi
    Use as below:
    CALL FUNCTION 'MS_EXCEL_OLE_STANDARD_DAT'
    EXPORTING
    file_name = p_file " path offile where u need to download
    CREATE_PIVOT = 0
    DATA_SHEET_NAME = ' '
    PIVOT_SHEET_NAME = ' '
    PASSWORD = ' '
    PASSWORD_OPTION = 0
    TABLES
    PIVOT_FIELD_TAB =
    data_tab = int_data "internal table with data
    fieldnames = int_head "internal table with header
    EXCEPTIONS
    file_not_exist = 1
    filename_expected = 2
    communication_error = 3
    ole_object_method_error = 4
    ole_object_property_error = 5
    invalid_filename = 6
    invalid_pivot_fields = 7
    download_problem = 8
    OTHERS = 9
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Regards,
    Sreeram

  • Downloading the internal table with header to FTP folder

    Hi All,
    I have one requirement in downloading the internal table details with the fixed header line to FTP folder. The header line having the fixed text of 425 characters length.
    Note: We are not suppose to use WS_DOWNLOAD and GUI_DOWNLOAD function modules.
    Thanks in advance for your reply.
    Regards
    Kamini.

    Hi,
    I can download the internal table details successfully to FTP folder using the FTP function modules like(FTP_CONNECT, FTP_COMMAND , FTP_R/3_TO_SERVER and FTP_DISCONNECT). Here my problem is I am unable to download the internation table with some header text.
    You can see the format (example) of file to be download.
    Here I can successfully download the below details without the header. But I am unable to download with header line. Could you please suggest me.
    seq_no|record_action|trans_date|sku|description|
    1|N|2008-01-03 07:52:31|TTASA5025CBO     
    2|N|2008-01-03 10:28:33|411014        
    3|N|2008-01-03 10:01:03|TTASA6030CBO  
    4|N|2008-01-03 10:01:15|TTASA6630CBO
    5|N|2008-01-03 10:01:25|TTASA7035CBO 
    6|N|2008-01-08 16:57:39|TT6G       
    Regards
    Kamini.

  • Problem in uploading the file of internal table into appliaction server

    i want to send the data of internal table to application server through selection screen and in selection screen and in selection screen parameter it should show the path of application server and through that path internal table data should go to application server , if possible give the code

    Hi,
    form download_file_appl_server.
      open dataset p_dlf2 for output
              in text mode encoding default .
      if sy-subrc ne 0.
        message:i005 with text-415 text-407.
      endif.
      loop at i_final into wa_final.
        transfer wa_final to p_dlf2.
      endloop.
      close dataset p_dlf2.
    endform.                    " OPENDATA_CLOSE
    where p_dlf2 is the seelction screen parameter which give the application server file path
    You can use this code for ur purpose.
    Reward if useful.
    Regards
    Shibin

  • Export internal table to application server

    hello all!
    i would like to export the contents of an internal table to the appliation server. i tried via OPEN DATASET, but my itab contains not only character type data.
    i do not want to copy all content into a parallel structure with all character type colums
    do you know a way to export an internal table on application server, in a way that it is readable by ms excel?
    thanks!

    Hi Matthias, i think that the only solution is using a parallel structure with all character type colums.  Also use 'SAP_CONVERT_TO_CSV_FORMAT' to convert the internal table to csv format in order to be readable by ms excel.
    Regards,
    Andrez

  • Dynamic Internal Table for reading data from external file

    Hello All,
    The task was to create a internal table with dynamic columns,
    Actually this is my first task in the WebAS 6.20, my program is based on input file provided by user with certain effort. this file can have different effort for a one yr to five year frame..
    I needed to read the raw data from file, based on months create a internal table to hold the data, after this i need to validate the data...
    I have browsed thru dynamic internal table topic, but couldn't find any dynamic appending structure, the dynamic structure would contains 12 month fileds.
    can any one help me in getting my task completed..
    Thanks
    Kumar

    Hi,
    I see that you posted the same question a couple of days ago at Dynamic Internal Table for reading data from external file Didn't Charles's response address your problem?
    Regards

  • Downloading different internal table data in a single excel with diff tabs.

    Hi gurs,
    I have 4 internal tables  with me i can able to display in 4 different excel sheets using   CALL FUNCTION 'EXCEL_OLE_STANDARD_DAT'
    But my requirement is i want to download 4 internal table in single excel sheets with different tabs. please send the code if u have.
    Thanks and regards.

    Hi,
    If you want to display the content of 4 internal table in different sheets of same workbook then go through below code,
    DATA : EXCEL         TYPE OLE2_OBJECT,
           WORKBOOKS     TYPE OLE2_OBJECT,
           WORKBOOK      TYPE OLE2_OBJECT,
           CELLS         TYPE OLE2_OBJECT,
           SHEET         TYPE OLE2_OBJECT,
           FONT          TYPE OLE2_OBJECT,
           H_COM1        TYPE OLE2_OBJECT,
           F             TYPE RLGRAP-FILENAME,
           FILEP         TYPE DRAW-FILEP,
           G_FILE_DEST   TYPE STRING,
           G_FILE_TEMP   TYPE STRING,
           G_SYSUBRC     TYPE SY-SUBRC,
           G_FILE_SRC    TYPE DRAW-FILEP.
    START THE EXCEL APPLICATION
      CREATE OBJECT excel 'EXCEL.APPLICATION'.
      CALL METHOD OF excel 'WORKBOOKS' = workbooks.
      SET PROPERTY OF excel  'VISIBLE' = 0.
      CALL METHOD OF workbooks 'OPEN' EXPORTING
                #1 = filep.
    For Sheet1
      CALL METHOD OF excel 'Worksheets' = sheet
       EXPORTING #1 = 1.
      CALL METHOD OF sheet 'Activate'.
      FREE  OBJECT sheet.
      CALL METHOD OF excel 'CELLS' = cells
          EXPORTING #1 = 1
                    #2 = 15.
      SET PROPERTY OF cells 'VALUE' = <value>
    CALL METHOD OF cells 'FONT' = font.
    SET PROPERTY OF font 'SIZE' = '20'.
      FREE OBJECT cells.
    For Sheet2
      CALL METHOD OF excel 'Worksheets' = sheet
       EXPORTING #1 = 2.
      CALL METHOD OF sheet 'Activate'.
      FREE  OBJECT sheet.
      CALL METHOD OF excel 'CELLS' = cells
          EXPORTING #1 = 1
                    #2 = 6.
      SET PROPERTY OF cells 'VALUE' = 'XYZ'.
      CALL METHOD OF cells 'FONT' = font.
      SET PROPERTY OF font 'SIZE' = '20'.
      GET PROPERTY OF excel 'ACTIVESHEET' = sheet.
      CALL METHOD OF sheet 'SAVEAS' EXPORTING
                      #1 = <destination file path where you want to store>
                      #2 = 1.
      CALL METHOD OF workbooks 'CLOSE'.
      CALL METHOD OF excel 'QUIT'.
      FREE OBJECT excel.
    Thanks!
    Brunda
    'Reward if useful'.

  • Downloading the internal table contents into presentation server

    Hi
    I have a requirement like i need to download the contetns of my internal table into an excel sheet in the presemtation server and i am using GUI_DOWNLOAD.
    I would like to place my header also in the excel sheet can any one suggest me how to do that?
    thanks

    Hi,
    U can see the following example,
    TYPES:
    BEGIN OF TYPE_S_FLIGHT,
       MANDT(15) TYPE C,
       CARRID(15) TYPE C,
       CONNID(15) TYPE C,
       FLDATE(15) TYPE C,
    END OF TYPE_S_FLIGHT.
    data:
    T_HEADER TYPE TABLE OF TYPE_S_FLIGHT WITH HEADER LINE,
    t_sflight type table of SFLIGHT.
    T_HEADER-MANDT = 'MANDT'.
    T_HEADER-CARRID = 'CARRID'.
    T_HEADER-CONNID = 'CONNID'.
    T_HEADER-FLDATE = 'FLDATE'.
    APPEND T_HEADER.
    PERFORM GUI_DOWNLOAD TABLES T_HEADER USING ' '.
    select MANDT
            CARRID
            CONNID
            FLDATE
    from sflight into CORRESPONDING FIELDS OF table t_sflight.
    PERFORM GUI_DOWNLOAD TABLES T_SFLIGHT  USING 'X'.
    form GUI_DOWNLOAD  TABLES P_TABLE USING VALUE(P_APPEND).
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
        filename                      = 'C:\TEMP1\FLIGHT.XLS'
       APPEND                        = P_APPEND
       WRITE_FIELD_SEPARATOR         = 'X'
      tables
        data_tab                      = P_TABLE
    In this case u have to populate the one table for header. The other one is for data.
    Thanks,
    Nithya.
    Edited by: Nithya Murugesan on Feb 8, 2009 1:00 PM

  • Download and upload ABAP database table to presentation server and R/3

    Hi experts,
    I want to download ABAP database table (Ztable) to presentation server and again want to upload this to another R/3 server but i dont want to use any transport request. is there any possible sollution for this.
    Thanks in advance

    Hi,
    Look at this code hope this will help you to solve your problem
    REPORT y_test_559.
    Program for
    1. Downloading Data of any DB table to a tab delimited ASCII file
    2. Checking if a tab delimited ASCII file has the structure of a
       DB table and showing its contents
    3. Uploading a tab delimited ASCII file to a DB table with the same
       structure
    4. Showing the data of any DB table
    ======================================================================
    ======================================================================
    DATA DECLARATIONS
    ======================================================================
    TYPES : data_object  TYPE REF TO data.
    DATA  : itab TYPE REF TO data .
    TYPE-POOLS : slis .
    DATA  : it_fieldcat TYPE STANDARD TABLE OF slis_fieldcat_alv
            WITH HEADER LINE .
    DATA : it_fieldcatalog TYPE lvc_t_fcat .
    DATA : wa_fieldcatalog TYPE lvc_s_fcat .
    DATA : i_structure_name LIKE dd02l-tabname .
    DATA : i_callback_program LIKE sy-repid .
    DATA  : dyn_line TYPE data_object .
    FIELD-SYMBOLS : <fs_itab> TYPE  STANDARD  TABLE .
    DATA : table_name_is_valid TYPE c .
    DATA : dynamic_it_instantiated TYPE c .
    CONSTANTS buttonselected TYPE c VALUE 'X' .
    ======================================================================
    SELECTION SCREEN DEFAULT
    ======================================================================
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 5(29) t_tabl.
    PARAMETERS : tabl_nam LIKE rsrd1-tbma_val
                 MATCHCODE OBJECT dd_dbtb_16 OBLIGATORY .
                                   "Search for Database Tables is dd_dbtb_16
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 5(29) t_file.
    PARAMETERS : file_nam LIKE rlgrap-filename .
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 5(29) t_down.
    PARAMETERS : p_downld RADIOBUTTON GROUP grp1
                 USER-COMMAND m_ucomm .
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 5(29) t_chkf.
    PARAMETERS : p_chkfil RADIOBUTTON GROUP grp1 .
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 5(29) t_upld.
    PARAMETERS : p_upload RADIOBUTTON GROUP grp1 .
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 5(29) t_show.
    PARAMETERS : p_show_t RADIOBUTTON GROUP grp1 ."show table data
    SELECTION-SCREEN END OF LINE.
    ======================================================================
    AT SELECTION SCREEN OUTPUT
    ======================================================================
    AT SELECTION-SCREEN OUTPUT .
      PERFORM check_filename .
    ======================================================================
    AT SELECTION SCREEN ON VALUE REQUEST FOR FILENAME
    ======================================================================
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR file_nam .
      PERFORM f4_for_filename .
    ======================================================================
    Initialization .
    ======================================================================
    INITIALIZATION .
      t_tabl = 'Table Name' .
      t_file = 'File Name' .
      t_down = 'Download Table' .
      t_chkf = 'Check File to Upload' .
      t_upld = 'Upload File' .
      t_show = 'Show Table Contents' .
    ======================================================================
    START OF SELECTION
    ======================================================================
    START-OF-SELECTION .
      PERFORM check_table_name_is_valid .
    ======================================================================
    END OF SELECTION
    ======================================================================
    END-OF-SELECTION .
      IF table_name_is_valid EQ ' ' .
        MESSAGE i398(00) WITH 'INVALID TABLE NAME' .
      ELSE .
        PERFORM instantiate_dynamic_internal_t  .
        CHECK  dynamic_it_instantiated = 'X' .
        CASE buttonselected .
          WHEN p_downld .
            PERFORM select_and_download .
          WHEN p_chkfil .
            PERFORM check_file_to_upload .
          WHEN p_upload .
            PERFORM upload_from_file .
          WHEN p_show_t .
            PERFORM show_contents .
        ENDCASE .
      ENDIF .
    *&      Form  CHECK_TABLE_NAME_IS_VALID
          text
    -->  p1        text
    <--  p2        text
    FORM check_table_name_is_valid.
      DATA l_count TYPE i .
      TABLES dd02l .
      CLEAR table_name_is_valid .
      SELECT COUNT(*) INTO l_count FROM tadir
      WHERE  pgmid = 'R3TR'
      AND    object = 'TABL'
      AND    obj_name = tabl_nam .
      IF l_count EQ 1 .
        CLEAR dd02l .
        SELECT SINGLE * FROM dd02l WHERE tabname  = tabl_nam .
        IF sy-subrc EQ 0.
          IF dd02l-tabclass = 'TRANSP' .
            table_name_is_valid = 'X' .
          ENDIF .
        ENDIF.
      ENDIF .
    ENDFORM.                    " CHECK_TABLE_NAME_IS_VALID
    *&      Form  SELECT_AND_DOWNLOAD
          text
    -->  p1        text
    <--  p2        text
    FORM select_and_download.
      CLEAR : <fs_itab> .
      SELECT * FROM (tabl_nam)
      INTO CORRESPONDING FIELDS OF TABLE <fs_itab>   .
      PERFORM check_filename.
      CALL FUNCTION 'WS_DOWNLOAD'
        EXPORTING
          filename                = file_nam
          filetype                = 'DAT'
        TABLES
          data_tab                = <fs_itab>
        EXCEPTIONS
          file_open_error         = 1
          file_write_error        = 2
          invalid_filesize        = 3
          invalid_type            = 4
          no_batch                = 5
          unknown_error           = 6
          invalid_table_width     = 7
          gui_refuse_filetransfer = 8
          customer_error          = 9
          OTHERS                  = 10.
      IF sy-subrc EQ 0.
        MESSAGE i398(00) WITH 'Table' tabl_nam
                              'successfully downloaded to '
                              file_nam .
      ENDIF.
    ENDFORM.                    " SELECT_AND_DOWNLOAD
    *&      Form  UPLOAD_FROM_FILE
          text
    -->  p1        text
    <--  p2        text
    FORM upload_from_file.
      DATA : ans TYPE c .
      DATA : lines_of_itab TYPE i .
      DATA : l_subrc TYPE i .
      CALL FUNCTION 'POPUP_TO_CONFIRM_STEP'
        EXPORTING
          textline1 = 'Are you sure you wish to upload'
          textline2 = 'data from ASCII File to DB table '
          titel     = 'Confirmation of Data Upload'
        IMPORTING
          answer    = ans.
      IF ans = 'J' .
        PERFORM check_filename.
        CLEAR l_subrc .
        CALL FUNCTION 'WS_UPLOAD'
          EXPORTING
            filename                = file_nam
            filetype                = 'DAT'
          TABLES
            data_tab                = <fs_itab>
          EXCEPTIONS
            conversion_error        = 1
            file_open_error         = 2
            file_read_error         = 3
            invalid_type            = 4
            no_batch                = 5
            unknown_error           = 6
            invalid_table_width     = 7
            gui_refuse_filetransfer = 8
            customer_error          = 9
            OTHERS                  = 10.
        l_subrc = l_subrc  + sy-subrc .
        IF sy-subrc EQ 0.
          DESCRIBE TABLE <fs_itab> LINES lines_of_itab .
          IF lines_of_itab GT 0 .
            DELETE (tabl_nam) FROM TABLE <fs_itab> .
            COMMIT WORK .
            INSERT (tabl_nam) FROM TABLE <fs_itab> .
            l_subrc = l_subrc  + sy-subrc .
          ENDIF .
        ENDIF.
        IF  l_subrc EQ 0  .
          MESSAGE i398(00) WITH lines_of_itab
                               'Record(s) inserted in table'
                                tabl_nam .
        ELSE .
          MESSAGE i398(00) WITH
                          'Errors occurred No Records inserted in table'
                           tabl_nam .
        ENDIF .
      ENDIF .
    ENDFORM.                    " UPLOAD_FROM_FILE
    *&      Form  F4_FOR_FILENAME
          text
    -->  p1        text
    <--  p2        text
    FORM f4_for_filename.
      CALL FUNCTION 'WS_FILENAME_GET'
        EXPORTING
          def_path         = 'C:\'
          mask             = ',.,..'
          mode             = '0'
        IMPORTING
          filename         = file_nam
        EXCEPTIONS
          inv_winsys       = 1
          no_batch         = 2
          selection_cancel = 3
          selection_error  = 4
          OTHERS           = 5.
    ENDFORM.                    " F4_FOR_FILENAME
    *&      Form  CHECK_FILENAME
          text
    -->  p1        text
    <--  p2        text
    FORM check_filename.
      IF file_nam IS INITIAL
      AND NOT ( tabl_nam IS INITIAL  )
      AND p_show_t NE buttonselected.
        CONCATENATE 'C:\' tabl_nam  '.TXT'  INTO file_nam.
      ENDIF .
    ENDFORM.                    " CHECK_FILENAME
    *&      Form  INSTANTIATE_DYNAMIC_INTERNAL_T
          text
    -->  p1        text
    <--  p2        text
    FORM instantiate_dynamic_internal_t.
      CLEAR dynamic_it_instantiated .
    -----> Step 1 - Finding Field Names and ALV GRID Fieldcatalog
      i_structure_name =  tabl_nam .
      CLEAR it_fieldcat[] .
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
        EXPORTING
          i_structure_name       = i_structure_name
        CHANGING
          ct_fieldcat            = it_fieldcat[]
        EXCEPTIONS
          inconsistent_interface = 1
          program_error          = 2
          OTHERS                 = 3.
      IF sy-subrc EQ 0.
    -----> Step 2 - Creating Field Catalog of the Object
                                                  cl_alv_table_create
        LOOP AT it_fieldcat .
          CLEAR wa_fieldcatalog .
          MOVE-CORRESPONDING it_fieldcat TO  wa_fieldcatalog .
          wa_fieldcatalog-ref_field = it_fieldcat-fieldname .
          wa_fieldcatalog-ref_table = tabl_nam .
          APPEND  wa_fieldcatalog  TO it_fieldcatalog .
        ENDLOOP .
    -----> Step 3 - Creating Internal Table Dynamicaly
        CALL METHOD cl_alv_table_create=>create_dynamic_table
          EXPORTING
            it_fieldcatalog = it_fieldcatalog
          IMPORTING
            ep_table        = itab.
        ASSIGN itab->* TO <fs_itab> .
        dynamic_it_instantiated = 'X' .
      ENDIF.
    ENDFORM.                    " INSTANTIATE_DYNAMIC_INTERNAL_T
    *&      Form  SHOW_CONTENTS
          text
    -->  p1        text
    <--  p2        text
    FORM show_contents.
      CLEAR : <fs_itab> .
      SELECT * FROM (tabl_nam)
      INTO CORRESPONDING FIELDS OF TABLE <fs_itab>   .
      i_callback_program = sy-repid .
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
        EXPORTING
          i_callback_program = i_callback_program
          it_fieldcat        = it_fieldcat[]
        TABLES
          t_outtab           = <fs_itab>
        EXCEPTIONS
          program_error      = 1
          OTHERS             = 2.
    ENDFORM.                    " SHOW_CONTENTS
    *&      Form  CHECK_FILE_TO_UPLOAD
          text
    -->  p1        text
    <--  p2        text
    FORM check_file_to_upload.
      PERFORM check_filename.
    CLEAR l_subrc .
      CALL FUNCTION 'WS_UPLOAD'
        EXPORTING
          filename                = file_nam
          filetype                = 'DAT'
        TABLES
          data_tab                = <fs_itab>
        EXCEPTIONS
          conversion_error        = 1
          file_open_error         = 2
          file_read_error         = 3
          invalid_type            = 4
          no_batch                = 5
          unknown_error           = 6
          invalid_table_width     = 7
          gui_refuse_filetransfer = 8
          customer_error          = 9
          OTHERS                  = 10.
    l_subrc = l_subrc  + SY-SUBRC .
      IF sy-subrc EQ 0.
        i_callback_program = sy-repid .
        CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
          EXPORTING
            i_callback_program = i_callback_program
            it_fieldcat        = it_fieldcat[]
          TABLES
            t_outtab           = <fs_itab>
          EXCEPTIONS
            program_error      = 1
            OTHERS             = 2.
      ENDIF .
    ENDFORM.                    " CHECK_FILE_TO_UPLOAD
    Thanks,
    Pramod

Maybe you are looking for