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

Reading many files

Former Member
0 Likes
763

Hi,

I'm using gui_download to read a file and then make an idoc. What i want is to know is it´s possible to read many files. for example i have a folder with some files and i want to read them and create a idoc for each one.

thanks,

Ricardo

Hi,

I'm using gui_download to read a file and then make an idoc. What i want is to know is it´s possible to read many files. for example i have a folder with some files and i want to read them and create a idoc for each one.

thanks,

Ricardo

5 REPLIES 5
Read only

Former Member
0 Likes
724

Iits possible, You can use the CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG for selecting multiple files. Then loop at the file table and open the file using GUI_UPLOAD one by one.

Regards,

Ravi

Note : Please mark the helpful answers

Read only

0 Likes
724

how can i use that can you tell me?

thanks

Read only

0 Likes
724

Hi,

At the Process on value request of the file parameter on the selection screen call the method CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG where the user will be able to select multiple files and these will be returned to FILETABLE parameter.

Now in the program



loop at file table

 call method CL_GUI_FRONTEND_SERVICES=>GUI_UPLOAD
              PASS THE FILE NAME FROM THE FILE TABLE
 PROCESS THE FILE DATA
 CREATE THE IDOC.

ENDLOOP.

.

This would create one idoc per file.

Regards,

Ravi

Note : Please mark the helpful answers

Read only

0 Likes
724

hi,

use CL_GUI_FRONTEND_SERVICES=>GUI_UPLOAD in this way..

loop at it_file

CALL METHOD <b>CL_GUI_FRONTEND_SERVICES=>GUI_UPLOAD</b>

EXPORTING

FILENAME = it_file-file1

FILETYPE = 'ASC'

HAS_FIELD_SEPARATOR = 'X'

  • HEADER_LENGTH = 0

  • DAT_MODE = SPACE

  • CODEPAGE = SPACE

  • IGNORE_CERR = ABAP_TRUE

  • REPLACEMENT = '#'

  • READ_BY_LINE = 'X'

  • IMPORTING

  • FILELENGTH =

  • HEADER =

CHANGING

DATA_TAB = ITAB1

  • 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

  • NOT_SUPPORTED_BY_GUI = 17

  • ERROR_NO_GUI = 18

  • others = 19

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Process the data.

Create the new IDOC...

Endloop.

Regards,

Santosh

Read only

Former Member
0 Likes
724

Hi,

Yes it is possible Just check this code in the below thread..

Regards

vijay