Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Uploading a file from application server into internal table

Former Member
0 Likes
1,426

Hi friends,

I want to upload a file from application layer into an internal table.Can anyone tell me, is there any funtion module to do this rather than programming?

Thanks

Kiran

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,217

Hi,

Use the OPEN DATASET, READ DATASET and CLOSE DATASET statements (See documentation for this keywords) to read a file on application server and move into an internal table.

Fm GUI_UPLOAD is to upload the data from a file on presentation server into an internal table.

Regards,

Dwaraka.S

Edited by: Dwarakanath Sankarayogi on Feb 5, 2009 10:47 AM

Hi friends,

I want to upload a file from application layer into an internal table.Can anyone tell me, is there any funtion module to do this rather than programming?

Thanks

Kiran

8 REPLIES 8
Read only

Former Member
0 Likes
1,217

Hi,



CALL FUNCTION 'GUI_UPLOAD'
  EXPORTING
    filename                      =   C:\test.txt   " file path
   FILETYPE                      = 'DAT'
*   HAS_FIELD_SEPARATOR           = ' '
*   HEADER_LENGTH                 = 0
*   READ_BY_LINE                  = 'X'
*   DAT_MODE                      = ' '
*   CODEPAGE                      = ' '
*   IGNORE_CERR                   = ABAP_TRUE
*   REPLACEMENT                   = '#'
*   CHECK_BOM                     = ' '
*   VIRUS_SCAN_PROFILE            =
*   NO_AUTH_CHECK                 = ' '
* IMPORTING
*   FILELENGTH                    =
*   HEADER                        =
  tables
    data_tab                      = ITAB
* EXCEPTIONS
*   FILE_OPEN_ERROR               = 1
*   FILE_READ_ERROR               = 2
*   NO_BATCH                      = 3
*   GUI_REFUSE_FILETRANSFER       = 4
*   INVALID_TYPE                  = 5
*   NO_AUTHORITY                  = 6
*   UNKNOWN_ERROR                 = 7
*   BAD_DATA_FORMAT               = 8
*   HEADER_NOT_ALLOWED            = 9
*   SEPARATOR_NOT_ALLOWED         = 10
*   HEADER_TOO_LONG               = 11
*   UNKNOWN_DP_ERROR              = 12
*   ACCESS_DENIED                 = 13
*   DP_OUT_OF_MEMORY              = 14
*   DISK_FULL                     = 15
*   DP_TIMEOUT                    = 16
*   OTHERS                        = 17
          .
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

Thanks

Arun Kayal

Edited by: Arun Kayal on Feb 5, 2009 10:43 AM

Read only

Former Member
0 Likes
1,217

Hi Kiran

use cl_gui_frontend_services=>gui_upload

Read only

Former Member
0 Likes
1,217

hi,

use open dataset..

close dataset..

u can get more examples in SCN.. search on above strings...

Rgds.,

subash

Read only

Former Member
0 Likes
1,218

Hi,

Use the OPEN DATASET, READ DATASET and CLOSE DATASET statements (See documentation for this keywords) to read a file on application server and move into an internal table.

Fm GUI_UPLOAD is to upload the data from a file on presentation server into an internal table.

Regards,

Dwaraka.S

Edited by: Dwarakanath Sankarayogi on Feb 5, 2009 10:47 AM

Read only

Former Member
0 Likes
1,217

Hi.

Just go through this link.

Regards:

Alok

Read only

Former Member
0 Likes
1,217

Hi,

Try like this...



v_path = <file path>.

  open dataset v_path  for input in text mode encoding default.
  if sy-subrc = 0.
    do.
      read dataset v_path  into w_input-wa_string.
      if sy-subrc <> 0.
        exit.
      endif.
      append w_input to t_input.
    enddo.
    close dataset v_path.
  endif.


Hope it will helps

Read only

Former Member
0 Likes
1,217

Hi Kiran,

You first have to call function module GUI_UPLOAD for uploading the file into your internal table,

then to download it to the application server,you have to use statement

OPEN DATASET CLOSE DATASET.

Regrds

Mansi

Read only

Former Member
0 Likes
1,217

Thank You