‎2008 Jan 24 9:48 AM
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-
‎2008 Jan 24 10:03 AM
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
‎2008 Jan 24 10:03 AM
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
‎2008 Jan 24 10:03 AM
Hi March,
Use CG3Z Transaction , This transaction is used for upload files.
Plzz reward if it is useful,
Mahi.
‎2008 Jan 24 10:08 AM
do you have sample code for this?
how will i define the internal tables to be used in storing the uploaded file?
thank you.
‎2008 Jan 24 12:19 PM
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.