10-11-2007 8:52 AM
Hi all,
i have a problem i.e am uploading flat file using gui_upload, in my file field seperator is pipe symbal, after uploading am getting values into internaltab with pipe symbal, here i want to do calclations on that values, so i dont want pipe symbal, how to avoid,
my FM is.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = l_str_upload
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = ''
DAT_MODE = 'X'
TABLES
DATA_TAB = it_input
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.
call function '/MSG/R_BAPI_CREATE_ERRORMSG'
exporting
p_msgtype = sy-msgty
p_msgid = sy-msgid
p_msgno = sy-msgno
p_msgpar1 = sy-msgv1
p_msgpar2 = sy-msgv2
p_msgpar3 = sy-msgv3
p_msgpar4 = sy-msgv4
tables
p_t_return = lt_return.
ENDIF.
if not ( lt_return[] is initial ).
loop at lt_return into ls_return.
append ls_return to lt_return_all.
endloop.
clear lt_return.
endif.
**************
here 1st few fields of my input file. is.
BRANCH|XRE_TTY|ORIG_CURR|ORIG_AMT
S|S-FFF-P-96-0193-96|AED|314319.53
S|S-FNM-P-96-0194-96|USD|8031.79
S|S-EEB-P-92-0365-92|PKR|2048.80
S|S-EEB-P-92-0365-93|PKR|78992.77
so how get values without pipe.
thanks in advance.
murali.
10-11-2007 8:57 AM
1) upload all file data into internal table of type string .it store all the value line by line .
2) now declare internal table with field which u want.
3)loop at itab_string into wa_string..
split wa_string into itab-field1 itab-field2 seprated by '!'.
append itab.
endloop.
10-11-2007 8:57 AM
1) upload all file data into internal table of type string .it store all the value line by line .
2) now declare internal table with field which u want.
3)loop at itab_string into wa_string..
split wa_string into itab-field1 itab-field2 seprated by '!'.
append itab.
endloop.
10-11-2007 10:04 AM
Hi ..
Try this way.
<b>DATA : REC(200).
DATA : ITAB LIKE TABLE OF REC .</b>
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = l_str_upload
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = ''
DAT_MODE = 'X'
TABLES
<b>DATA_TAB = itab </b>
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 into rec.
SPLIT REC AT '|' INTO IT_INPUT-FIELD1 IT_INPUT-FIELD2 .....
APPEND IT_INPUT.
endloop.
<b>reward if Helpful.</b>
10-11-2007 10:43 AM
hi all thanks for ur quickly,
i ve resolved my problem.
i ve given gd rewards.
Regards,
murali.