2008 Jul 01 8:26 AM
Hello Everybody
I want to upload a file but file structure can be dynamically change , so my problem is how to define ITAB structure according to file .
for uploading i am using Gui_upload
ASAP
Hello Everybody
I want to upload a file but file structure can be dynamically change , so my problem is how to define ITAB structure according to file .
for uploading i am using Gui_upload
ASAP
2008 Jul 01 8:32 AM
Hi,
you can you a generic table, use this code:
data: ref TYPE REF TO data,
<table> TYPE table.
CREATE DATA ref TYPE STANDARD TABLE OF (table_name).
ASSIGN ref->* TO <table>.
Now the field-symbol <table> have the structure of the table that you want.
Use <table> in the FM GUI_UPLOAD.
regards,
Leo
2008 Jul 01 8:50 AM
Not working , infact it's pickuping only first field
i want completed data ( line ) of that file
2008 Jul 01 8:36 AM
Hi,
Take the ITAB with one field of type STRING.
Begin of ITAB occurs 0,
field1 type string,
End of ITAB.
If STRING creates the problem take CHAR of maximum length.
Reward points if helpful.
2008 Jul 01 8:40 AM
Define a table like this:
data:
i_tab type standard table of string initial size 0, "Internal table, use this for GUI_UPLOAD
wa_tab type string. " Work area for the table
2008 Jul 01 10:18 AM
hi,
DATA : FILE_STR TYPE STRING.
PARAMETERS : P_FLNME LIKE RLGRAP-FILENAME. "File Name
FILE_STR = P_FLNME.
*UPLOADING FILE INTO INTERNAL TABLE
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = FILE_STR
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
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.
try this ..all the records in the flat file to be moved to the internal table.
Thanks & regards,
Y.R.Prem Kumar
2008 Jul 04 6:52 AM
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |