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

upload flat file

Former Member
0 Likes
592

hello experts,

how will i upload flat file structure with header and line items?

i will upload this both from application server and file from PC.

please help me with this.

thank you very much.

-march-

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
574

Hi,

For uploading file from ur PC (presentation server) u can use FM "GUI_UPLOAD"

For uploading file from application server u can use

syntax: OPEN DATASET

**Reward useful answers

Regards,

Vaibhav

4 REPLIES 4
Read only

Former Member
0 Likes
575

Hi,

For uploading file from ur PC (presentation server) u can use FM "GUI_UPLOAD"

For uploading file from application server u can use

syntax: OPEN DATASET

**Reward useful answers

Regards,

Vaibhav

Read only

Former Member
0 Likes
574

Hi March,

Use CG3Z Transaction , This transaction is used for upload files.

Plzz reward if it is useful,

Mahi.

Read only

Former Member
0 Likes
574

do you have sample code for this?

how will i define the internal tables to be used in storing the uploaded file?

thank you.

Read only

0 Likes
574

Hi,

To upload file from PC :

**Internal table matching columns in XLS

DATA: BEGIN OF itab OCCURS 0,

field1(10) TYPE c,

field2(10) TYPE c,

END OF itab.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = 'E:\Vaibhav\PivotTableEg.xls'

  • FILETYPE = 'ASC'

  • HAS_FIELD_SEPARATOR = ' '

  • HEADER_LENGTH = 0

  • READ_BY_LINE = 'X'

  • DAT_MODE = ' '

  • CODEPAGE = ' '

  • IGNORE_CERR = ABAP_TRUE

  • REPLACEMENT = '#'

  • CHECK_BOM = ' '

  • 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.