‎2009 Sep 09 10:19 AM
Hi frends, I have used function "F4_FILENAME" and "GUI_UPLOAD" to upload a text file in notepad on my desktop to an internal table in SAP.after that i used the folowing code line to copy data from one table to other:
" insert tab2 from table itab accepting duplicate keys. "
But my problem is that in tab2 i have total 5 fields.In notepad file i have written following two words:
achal
mehra
now when i copy the data from itab to tab2 , it shows word "achal" in the field 1 of 1st row and "mehra" in field 1 of 2nd row only.
what i want is to store "a" in field1 "c" in field2 and so on in row 1.
similarly "m" in the second row and field1.
PLZ guide me.I am new to ABAP.
‎2009 Sep 09 10:20 AM
am using following code as a part of my program :
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = d_file
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = ''
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
TABLES
DATA_TAB = itab
LOOP AT gt_file2 INTO lwa.
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.
ENDIF.
loop at itab.
Write:/ ITAB.
endloop.
insert zlfa4 from table itab .
plz guide me where i shud change the code and plz write the exact syntax for me if u can.
‎2009 Sep 09 10:20 AM
am using following code as a part of my program :
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = d_file
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = ''
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
TABLES
DATA_TAB = itab
LOOP AT gt_file2 INTO lwa.
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.
ENDIF.
loop at itab.
Write:/ ITAB.
endloop.
insert zlfa4 from table itab .
plz guide me where i shud change the code and plz write the exact syntax for me if u can.
‎2009 Sep 09 10:20 AM
Hi,
Can you please write correct code ? How can a loop statement come inside the function call ?
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = d_file
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = ''
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
TABLES
DATA_TAB = itab
LOOP AT gt_file2 INTO lwa.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.
LOOP AT itab.
WRITE:/ itab.
ENDLOOP.
KR Jaideep,
‎2009 Sep 09 10:30 AM
sorry friend that loop code is not there.it was copied by mistake.just ignre it.
‎2009 Sep 21 10:19 AM