Export as Tab Delimited File
Is there any methodology whereby a file can be exported, or saved, as a Tab Delimited File?
Thanks
Select All
Copy
Paste in a Pages document
Export as text.
Other way (my preffered one) :
Select All
Copy
run this Script :
--[SCRIPT clipboard2textFile]
Enregistrer le script en tant que Script :clipboard2textFile.scpt
déplacer le fichier créé dans le dossier
<VolumeDeDémarrage>:Users:<votreCompte>:Library:Scripts:
Copiez la table à exporter dans le Presse-papiers.
menu Scripts > clipboard2textFile
Le script créera un fichier TSV (valeurs séparées par TAB).
--=====
L'aide du Finder explique:
L'Utilitaire AppleScript permet d'activer le Menu des scripts :
Ouvrez l'Utilitaire AppleScript situé dans le dossier Applications/AppleScript.
Cochez la case "Afficher le menu des scripts dans la barre de menus".
+++++++
Save the script as a Script :clipboard2textFile.scpt
Move the newly created file into the folder:
<startup Volume>:Users:<yourAccount>:Library:Scripts:
Copy the table to export into the clipboard
menu Scripts > clipboard2textFile
The script will create a TSV file (Tab separated values).
--=====
The Finder's Help explains:
To make the Script menu appear:
Open the AppleScript utility located in Applications/AppleScript.
Select the "Show Script Menu in menu bar" checkbox.
+++++++
Yvan KOENIG (VALLAURIS, France))
2009/07/07
2010/01/10 : Corrigé quelques coquilles dans les explications
--=====
on run
try
set enTexte to the clipboard as text
set fName to (do shell script "date " & quote & "+_%Y%m%d-%H%M%S" & quote) & "." & "txt"
set p2d to path to desktop
tell application "System Events" to make new file at end of p2d with properties {name:fName}
write enTexte to file ((p2d as text) & fName)
on error
if my parleAnglais() then
error "The clipboard doesn’t contain text data. Maybe you selected a Numbers sheet !"
else
error "Le presse-papiers ne contient pas de données texte. Vous avez peut-être copié une feuille de Numbers !"
end if
end try
end run
--=====
on parleAnglais()
local z
try
tell application "Numbers" to set z to localized string "Cancel"
on error
set z to "Cancel"
end try
return (z is not "Annuler")
end parleAnglais
--=====
--[/SCRIPT]
Yvan KOENIG (VALLAURIS, France) mardi 16 février 2010 21:57:42
Similar Messages
-
Is there a way to import/export tab delimited files to a table in Pages 2?
It seems like Pages is starting to get funtionality that might help wean me off of Excel. In this vein, is it possible to import or export tab delimited files to a table in Pages 2?
I had some success in Pages 1, but I've only tried a couple of times so far in Pages 2 without success. The trick was to make sure the table is the exact number of columns wide. It's very "klunky" but I've ended up converting the tab-delimited text to a table in AppleWorks, saving the AppleWorks file with the table as a "floating" object (fixed objects don't translate) & opening the file in Pages. It's quicker & easier for most of what I do to just drag & drop in Pages.
Peggy -
To import addresses, need format of tab delimited file
I am trying to import addresses from my G3 PB Mozilla App. I exported addresses on G3 to both ldif and tab-delimited files and then attached to an email message which I sent to myself. I received email on Mac mini, but the 2 files showed up inline, not as attachments. I copied the ldif portion to a text file; ditto for tab-delimited. I tried importing into Address Book, but got message that format was not valid.
Can't I just edit the tab-delimited file in TextEdit, save as RTF, and get Address Book to recognize the data?
Thanks,
OwenHi, Did you get solution for this? Please let me know as I'm looking for the same solution. The Bank requirement is to generate a Tab delimited file but the RFFOGB_T with Format GB_BACS issues the output as below...
Required by Bank:
692532 73855963 RRS P R BACKLEY 169.91 GSLV
294518 99855581 CETS PRITECTIIN 799.72 GSLV
The output I get from SAP/DMEE:
........1........2........3........4........5........6....
VOL1000004 ....953312
1 <CR/LF>
HDR1A953312S 195331200000400010001 10040 100420000000
<CR/LF>
HDR2F0200000100 00
<CR/LF>
UHL1 10041999999 000000001 DAILY 000
<CR/LF>
6010392865540009960062063474662 00000115000ABC UK Ltd. 0
1465 <CR/LF>
6006206347466201760062063474662 00000115000SAPBACS0000003306 C
ONTRA ABC UK LTD. <CR/LF>
EOF1A953312S 195331200000400010001 10040 100420000000
<CR/LF>
EOF2F0200000100 00
<CR/LF>
UTL10000000115000000000011500000000010000001
<CR/LF>
END
<CR/LF>
<END>
Rgds,
Stan -
GUI_Download problem in tab delimited file
Hi,
I am trying to download tab delimited file using F.M GUI_DOWNLOAD.We have
4.6C version.I have declared internal table with 5 columns.The file created using F.M is very strange.Column 1 and 2 and 3 and 4 are seaprated by tab but column 2
and 3 and column 4 and 5 are not seaprated by tab but have fixed length.
I am not getting where I am doing mistake.Any help is appericiated.
Below is the structure of internal table.
DATA:BEGIN OF IT_FINAL OCCURS 0,
Company(3) type c,
County(30) type c,
FId(35) type c,
Wellno(15) type c,
Welldesc(35) type c,
END OF IT_FINAL.
Data populated in table it_final.
it_final-Company = '300'.
it_final-County = 'Greenwood'.
it_final-fid = 'testts'.
it_final-wellno = '10000000'.
it_final-welldesc = 'tebsbvd'.
append it_final.
F.M GUI_DOWNLOAD
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
filename = l_path
FILETYPE = 'ASC'
APPEND = ' '
write_field_separator = 'X'
HEADER = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
IMPORTING
FILELENGTH =
TABLES
data_tab = it_final
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
OTHERS = 22
Thanks,
Rekha.Hi,
i think it is because tou need to uncomment:
FILETYPE = 'ASC'
try it.
Best regards. -
Hi all,
we have noticed unproper value modification during export in tab delimited format.
Please find example below:
The proper value is 24150170000011615 (it is state register number of enterprise).
The wrong value is 24150170000011600.
Correct value:
http://s12.postimg.org/v2gpqqzgd/obiee_1.png
How do we export data from obiee:
http://s23.postimg.org/6k7dwiezf/obiee_2.png
Wrong value after export:
http://s22.postimg.org/qdgqgogn5/obiee_3.png
What should we do to fix it?The bigger picture is as follows:
I have a button on my report that essentially should download the output of report to tab delimited text file. This button is integrated with a custom built class which has a main method. When I click on the button, the logic written in the main method gets executed.
In this method I generate my internal table and pass to cl_gui_frontend_services=>gui_download method with parameters mention above.
I try debugging but every thing seems to be working correct when sy-subrc = 0 through executable program and it does not enter into the download method logic when i do it through main method, instead sy-subrc is straight set to 6 (unknown error).
Regards,
Pankaj. -
UPLOADING tab delimited file onto FTP server
Hello all
Can i upload a tab delimited file onto the FTP server. If yes then how
points guranteed if answered!!Hi,
Yes you can do this one .. you can have a look at the standard program 'RSEPSFTP'.
REPORT ZFTPSAP LINE-SIZE 132.
DATA: BEGIN OF MTAB_DATA OCCURS 0,
LINE(132) TYPE C,
END OF MTAB_DATA.
DATA: MC_PASSWORD(20) TYPE C,
MI_KEY TYPE I VALUE 26101957,
MI_PWD_LEN TYPE I,
MI_HANDLE TYPE I.
START-OF-SELECTION.
*-- Your SAP-UNIX FTP password (case sensitive)
MC_PASSWORD = 'password'.
DESCRIBE FIELD MC_PASSWORD LENGTH MI_PWD_LEN.
*-- FTP_CONNECT requires an encrypted password to work
CALL 'AB_RFC_X_SCRAMBLE_STRING'
ID 'SOURCE' FIELD MC_PASSWORD ID 'KEY' FIELD MI_KEY
ID 'SCR' FIELD 'X' ID 'DESTINATION' FIELD MC_PASSWORD
ID 'DSTLEN' FIELD MI_PWD_LEN.
CALL FUNCTION 'FTP_CONNECT'
EXPORTING
*-- Your SAP-UNIX FTP user name (case sensitive)
USER = 'userid'
PASSWORD = MC_PASSWORD
*-- Your SAP-UNIX server host name (case sensitive)
HOST = 'unix-host'
RFC_DESTINATION = 'SAPFTP'
IMPORTING
HANDLE = MI_HANDLE
EXCEPTIONS
NOT_CONNECTED = 1
OTHERS = 2.
CHECK SY-SUBRC = 0.
CALL FUNCTION 'FTP_COMMAND'
EXPORTING
HANDLE = MI_HANDLE
COMMAND = 'dir'
TABLES
DATA = MTAB_DATA
EXCEPTIONS
TCPIP_ERROR = 1
COMMAND_ERROR = 2
DATA_ERROR = 3
OTHERS = 4.
IF SY-SUBRC = 0.
LOOP AT MTAB_DATA.
WRITE: / MTAB_DATA.
ENDLOOP.
ELSE.
* do some error checking.
WRITE: / 'Error in FTP Command'.
ENDIF.
CALL FUNCTION 'FTP_DISCONNECT'
EXPORTING
HANDLE = MI_HANDLE
EXCEPTIONS
OTHERS = 1.
Regards
Sudheer -
Generating tab delimited file on presentation server
Hi All,
I have to generate a tab delimited file on presentation server. The file shouldn't have '#' as separator. Instead it should be separated by TAB (when you press TAB button, some spaces will come naa... like that) ' '. Please advice me how to do this...
Thanks in Advance,
Regards,
PhaniHi,
Check this example..
DATA: BEGIN OF itab OCCURS 0,
matnr TYPE matnr,
werks TYPE werks_d,
END OF itab.
itab-matnr = 'ABC'.
itab-werks = 'ASDF'.
APPEND itab.
itab-matnr = 'EFG'.
itab-werks = 'DHIS'.
APPEND itab.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = 'C:\test.txt'
write_field_separator = 'X'
TABLES
data_tab = itab
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
OTHERS = 22.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
MESSAGE s208(00) WITH 'File downloaded'.
ENDIF.
Thanks,
Naren -
Hi,
I want to produce a TAB-Delimited File using the FM, Gui_Download. Could anyone help how to do this?Use this <b>METHOD cl_gui_frontend_services=>gui_download</b>
Download the output file to presentation server
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
filename = filename "filename to be generated
filetype = 'ASC' "File type ASCII for tab delimited
write_field_separator = 'X' "X for tab delimiter
CHANGING
data_tab = itab_download "internal table with data
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
Please check and close your thread if its resolved.
Reward points if useful. -
Hi,
Can anybody tell me how to create tab delimited file using ABAP. I am using 4.6C ( so I cant use cl_gui_char_utilities ) and I want to download the file to application server ( GUI_DOWNLOAD cant be used ).
Thanks,
SameejHi,
-> here's an example to separate the fields by tab:
DATA: BEGIN OF tabulator,
x(1) TYPE x VALUE '09',
END OF tabulator.
data tabilator_c.
CALL FUNCTION 'SYSTEM_CODEPAGE'
IMPORTING
codepage = c_to.
tabulator_c = tabulator.
TRANSLATE tabulator_c FROM CODE PAGE c_from TO CODE PAGE c_to.
*for int. table
loop at itab.
clear string.
do.
assign component sy-index of structure itab to <f>.
IF SY-SUBRC <> 0.
EXIT.
ENDIF.
concatenate string <f> tabulator_c into string.
enddo.
append string to tab_download.
endloop.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILETYPE = 'ASC'
FILENAME = FILE
TABLES
DATA_TAB = tab_download.
Grx Andreas -
I am using OWB to read data from a bunch of oracle tables and putting the results in a flat file. I've defined is as a tab delimited file and everything works fine except for one thing. What I need is to include double quotes for only those fields that are of character type. Currently, all the fields are being enclosed with double quotes. Where can I specify double quotes as enclosures for character fields only? Any feedback would be greatly appreciated.
Thanks.the best option that i would suggest is:
create a staging table with columns datatype as varchar2 or have one single large column with carchar2(4000)
put all values from the source table to the staging table by concatenating all the columns
have a logic to add " " to the required fields, this can be easily done using expression builder by concatenating the "" before and end of the string
export the table as tab delimited so at the end of it you will ahve the required fields enclosed by strings. -
Attaching a tab delimited file to mail
Hi,
I have to attach a tab delimited file to a mail and sent it using Function Module 'SO_DOCUMENT_SEND_API1'.
I have filled in the following details but i am not sure about what should be given for 'lt_packing_list-doc_type'. Should it be a 'TXT 'or any other file format. Some one has suggested me a 'CSV' but i guess for that the data should be separated by a comma and i need a tab delimited file.
Please suggest me what needs to be done.
Thank you,
Taher
DATA:
con_tab TYPE c VALUE cl_abap_char_utilities=>horizontal_tab,
con_cret TYPE c VALUE cl_abap_char_utilities=>cr_lf.
LOOP AT gt_output INTO ls_output.
CONCATENATE ls_output-email
ls_output-pos
ls_output-txt
ls_output-func
ls_output-mail
INTO gt_attach SEPARATED BY con_tab.
CONCATENATE con_cret gt_attach INTO gt_attach.
CONDENSE gt_attach.
APPEND gt_attach.
* Fill the document data.
lv_xdocdata-doc_size = 1.
* Populate the subject/generic message attributes
lv_xdocdata-obj_langu = sy-langu.
lv_xdocdata-obj_name = 'SAPRPT'.
lv_xdocdata-obj_descr = 'Report' .
* Fill the document data and get size of attachment
CLEAR lv_xdocdata.
READ TABLE gt_attach INDEX lv_xcnt.
lv_xdocdata-doc_size =
( lv_xcnt - 1 ) * 255 + STRLEN( gt_attach ).
lv_xdocdata-obj_langu = sy-langu.
lv_xdocdata-obj_name = 'SAPRPT'.
lv_xdocdata-obj_descr = ' Report'.
CLEAR lt_attachment. REFRESH lt_attachment.
lt_attachment[] = gt_attach[].
* Describe the body of the message
CLEAR lt_packing_list. REFRESH lt_packing_list.
lt_packing_list-transf_bin = space.
lt_packing_list-head_start = 1.
lt_packing_list-head_num = 0. lt_packing_list-body_start = 1.
DESCRIBE TABLE lt_message LINES lt_packing_list-body_num.
lt_packing_list-doc_type = 'RAW'.
APPEND lt_packing_list.
* Create attachment notification
lt_packing_list-transf_bin = 'X'.
lt_packing_list-head_start = 1.
lt_packing_list-head_num = 1.
lt_packing_list-body_start = 1.
DESCRIBE TABLE lt_attachment LINES lt_packing_list-body_num.
lt_packing_list-doc_type = ?????. "TXT or any other format
lt_packing_list-obj_descr = 'Report'.
lt_packing_list-obj_name = 'Report'.
lt_packing_list-doc_size = lt_packing_list-body_num * 255.
APPEND lt_packing_list.
* Add the recipients email address
LOOP AT gt_receivers INTO ls_receivers.
CLEAR lt_receivers.
lt_receivers-receiver = ls_receivers.
lt_receivers-rec_type = 'U'.
lt_receivers-com_type = 'INT'.
APPEND lt_receivers.
ENDLOOP.Hi Taher,
Which table you populate your data to (CONTENTS_BIN,CONTENTS_TXT,CONTENTS_HEX) ?.
As both the message and attachment reside one table (contents_txt) in it_packing_list body of message should start with 1 line, but of an attachment when body of message ends. This is:
* Describe the body of the message
CLEAR lt_packing_list. REFRESH lt_packing_list.
lt_packing_list-transf_bin = space.
lt_packing_list-head_start = 1.
lt_packing_list-head_num = 0. lt_packing_list-body_start = 1.
DESCRIBE TABLE lt_message LINES lt_packing_list-body_num.
lt_packing_list-doc_type = 'RAW'.
APPEND lt_packing_list.
* Create attachment notification
lt_packing_list-transf_bin = 'X'.
lt_packing_list-head_start = 1.
lt_packing_list-head_num = 1.
lt_packing_list-body_start = "start of attachemnt with next line after body of message
Next thing is what I appointed before. Both should be passed as ASCII so in both lt_packing_list-transf_bin = space.
Please see my code.
CONSTANTS: con_cret(2) type c VALUE cl_abap_char_utilities=>cr_lf,
con_tab(2) TYPE c VALUE cl_abap_char_utilities=>horizontal_tab.
DATA: doc_attr TYPE sodocchgi1,
it_packing_list TYPE TABLE OF sopcklsti1 WITH HEADER LINE,
it_message TYPE TABLE OF solisti1 WITH HEADER LINE,
it_attachment TYPE TABLE OF solisti1 WITH HEADER LINE,
it_txt TYPE TABLE OF solisti1 WITH HEADER LINE,
it_receivers TYPE TABLE OF somlreci1 WITH HEADER LINE.
"Document attributes
doc_attr-obj_name = 'EXT_MAIL'.
doc_attr-obj_descr = 'External test mail'. "title
doc_attr-obj_langu = sy-langu.
doc_attr-sensitivty = 'F'. "functional message
"Message in ASCII (txt) format
APPEND 'This is body message' TO it_message. "message is from 1 to 2
APPEND 'and second line for message.' TO it_message.
APPEND LINES OF it_message TO it_txt.
"Determine how data are distrtibuted to document and attachment
"First line in it_packing describes message body
it_packing_list-transf_bin = space. "ASCII format
it_packing_list-body_start = 1. "message body starts from 1st line
DESCRIBE TABLE it_message LINES it_packing_list-body_num. "lines in it_txt table for message body
it_packing_list-doc_type = 'RAW'.
APPEND it_packing_list.
"Attachment in ASCII (txt) format
CONCATENATE '1first' 'second' 'third' 'fourth' into it_attachment SEPARATED BY con_tab. "first line
CONCATENATE con_cret it_attachment.
APPEND it_attachment.
CONCATENATE '2first' 'second' 'third' 'fourth' into it_attachment SEPARATED BY con_tab. "second line
CONCATENATE it_attachment con_cret into it_attachment.
APPEND it_attachment.
APPEND LINES OF it_attachment TO it_txt.
"Further lines in it_packing describe attachment
CLEAR it_packing_list.
it_packing_list-transf_bin = space. "ASCII format
it_packing_list-body_start = 3.
DESCRIBE TABLE it_attachment LINES it_packing_list-body_num.
it_packing_list-doc_type = 'txt'.
it_packing_list-obj_name = 'Test attachment'.
it_packing_list-obj_descr = 'Title of an attachment'.
it_packing_list-obj_langu = sy-langu.
"size od attachment = length of last line + all remaining lines * 255
READ TABLE it_attachment INDEX it_packing_list-body_num.
it_packing_list-doc_size = STRLEN( it_attachment ) + 255 * ( it_packing_list-body_num - 1 ).
APPEND it_packing_list.
"Receivers
it_receivers-receiver = "some mail address.
it_receivers-rec_type = 'U'. "internet address
it_receivers-com_type = 'INT'. "send via internet
APPEND it_receivers.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = doc_attr
put_in_outbox = 'X'
commit_work = 'X'
* IMPORTING
* SENT_TO_ALL =
* NEW_OBJECT_ID =
TABLES
packing_list = it_packing_list
* OBJECT_HEADER =
* CONTENTS_BIN =
contents_txt = it_txt
* CONTENTS_HEX =
* OBJECT_PARA =
* OBJECT_PARB =
receivers = it_receivers.
* EXCEPTIONS
* TOO_MANY_RECEIVERS = 1
* DOCUMENT_NOT_SENT = 2
* DOCUMENT_TYPE_NOT_EXIST = 3
* OPERATION_NO_AUTHORIZATION = 4
* PARAMETER_ERROR = 5
* X_ERROR = 6
* ENQUEUE_ERROR = 7
* OTHERS = 8
IF sy-subrc = 0.
WAIT UP TO 2 SECONDS.
SUBMIT rsconn01 WITH mode = 'INT'
* WITH ouput = 'X'
AND RETURN.
ENDIF.
I am using SO01 t-code to see the document and attachemnt.
I am sure when you get rid of the differences with the codes you will get desired result.
Regards
Marcin -
anybody knws wats the fm to upload a tab delimited file?
I tried the fm gui_upload but its not workingI have used the HAS_FIELD_SEPARATOR = 'X', but only the first column is being transferred
data : p_file2 type string.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = p_file2
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
VIRUS_SCAN_PROFILE =
NO_AUTH_CHECK = ' '
IMPORTING
FILELENGTH =
HEADER =
TABLES
DATA_TAB = gi_linepost
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. -
Program to upload data from a tab-delimited file ...
I have to upload data from a tab-delimited file with following fields into database table(ZCBU) with same fields:
CBU (parent)
KUNNR (child)
ERDAT (effective from)
MANDT (client)
SFID (salesforce ID)
AEDAT (effective to)
AENAM (assigned by).
This file can be of type PC(txt) or UNIX.
plz tell me how to do this in both type of filesHi,
DATA: bdcdata LIKE bdcdata OCCURS 0 WITH HEADER LINE.
DATA: xfile TYPE string.
DATA: BEGIN OF itab OCCURS 0,
empno TYPE zmemp-empno,
name TYPE zmemp-first_name,
last TYPE zmemp-last_name,
comp TYPE zmemp-comp,
place TYPE zmemp-place,
END OF itab.
PARAMETER : p_file TYPE rlgrap-filename OBLIGATORY.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
Form to get the file path of legacy data stored on presentation server
PERFORM get_file_path.
START-OF-SELECTION.
MOVE p_file TO xfile.
to get the data from excel sheet data into an internal table
PERFORM get_data.
LOOP AT itab .
REFRESH bdcdata.
PERFORM bdc_dynpro USING 'ZM_EMPLOYEE' '9001'.
PERFORM bdc_field USING 'BDC_CURSOR'
'S9001_EMPNO'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=CREA'.
PERFORM bdc_field USING 'S9001_EMPNO'
itab-empno.
PERFORM bdc_dynpro USING 'ZM_EMPLOYEE' '9002'.
PERFORM bdc_field USING 'BDC_CURSOR'
'S9002_PLACE'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=SAVE'.
PERFORM bdc_field USING 'S9002_EMPNO'
itab-empno.
PERFORM bdc_field USING 'S9002_FIRST_NAME'
itab-name.
PERFORM bdc_field USING 'S9002_LAST_NAME'
itab-last.
PERFORM bdc_field USING 'S9002_COMP'
itab-comp.
PERFORM bdc_field USING 'S9002_PLACE'
itab-place.
PERFORM bdc_dynpro USING 'ZM_EMPLOYEE' '9001'.
PERFORM bdc_field USING 'BDC_CURSOR'
'S9001_EMPNO'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=BACK'.
CALL TRANSACTION 'ZMEMP'
USING bdcdata
UPDATE 'A'
MODE 'N'.
ENDLOOP.
Start new screen *
FORM bdc_dynpro USING program dynpro.
CLEAR bdcdata.
bdcdata-program = program.
bdcdata-dynpro = dynpro.
bdcdata-dynbegin = 'X'.
APPEND bdcdata.
ENDFORM. "BDC_DYNPRO
Insert field *
FORM bdc_field USING fnam fval.
CLEAR bdcdata.
bdcdata-fnam = fnam.
bdcdata-fval = fval.
APPEND bdcdata.
ENDFORM. "BDC_FIELD
*& Form get_file_path
FORM get_file_path .
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
CHANGING
file_name = p_file.
ENDFORM. " get_file_path
*& Form get_data
FORM get_data .
DATA : lines1 TYPE i.
MOVE p_file TO xfile.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = xfile
filetype = 'ASC'
has_field_separator = 'X'
TABLES
data_tab = itab.
DESCRIBE TABLE itab LINES lines1.
WRITE : / lines1 , 'REcords uploaded' .
ENDFORM. " get_data
Regards,
Nihar Swain, -
The selected file does not appear to be a valid comma separated values (csv) file or a valid tab delimited file. Choose a different file.
I guess your question is, "what's wrong with the file?"
You're going to have to figure that out yourself, as we cannot see the file.
Importing into Address book requires either a tab-delimited or a comma-delimited file. You can export out of most spreadsheets into a csv file. However, you need to make sure you clean up the file first. If you have a field that has commas in the field, they will create new fields at the comma. So, some lines will have more fields than the others, causing issues like the error you saw. -
Upload tab-delimited file from the application server to an internal table
Hello SAPients.
I'm using OPEN DATASET..., READ DATASET..., CLOSE DATASET to upload a file from the application server (SunOS). I'm working with SAP 4.6C. I'm trying to upload a tab-delimited file to an internal table but when I try load it the fields are not correctly separated, in fact, they are all misplaced and the table shows '#' where supposedly there was a tab.
I tried to SPLIT the line using as separator a variable with reference to CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB but for some reason that class doesn't exist in my system.
Do you know what I'm doing wrong? or Do you know a better method to upload a tab-delimited file into an internal table?
Thank you in advance for your help.Try:
REPORT ztest MESSAGE-ID 00.
PARAMETER: p_file LIKE rlgrap-filename OBLIGATORY.
DATA: BEGIN OF data_tab OCCURS 0,
data(4096),
END OF data_tab.
DATA: BEGIN OF vendor_file_x OCCURS 0.
* LFA1 Data
DATA: mandt LIKE bgr00-mandt,
lifnr LIKE blf00-lifnr,
anred LIKE blfa1-anred,
bahns LIKE blfa1-bahns,
bbbnr LIKE blfa1-bbbnr,
bbsnr LIKE blfa1-bbsnr,
begru LIKE blfa1-begru,
brsch LIKE blfa1-brsch,
bubkz LIKE blfa1-bubkz,
datlt LIKE blfa1-datlt,
dtams LIKE blfa1-dtams,
dtaws LIKE blfa1-dtaws,
erdat LIKE lfa1-erdat,
ernam LIKE lfa1-ernam,
esrnr LIKE blfa1-esrnr,
konzs LIKE blfa1-konzs,
ktokk LIKE lfa1-ktokk,
kunnr LIKE blfa1-kunnr,
land1 LIKE blfa1-land1,
lnrza LIKE blfa1-lnrza,
loevm LIKE blfa1-loevm,
name1 LIKE blfa1-name1,
name2 LIKE blfa1-name2,
name3 LIKE blfa1-name3,
name4 LIKE blfa1-name4,
ort01 LIKE blfa1-ort01,
ort02 LIKE blfa1-ort02,
pfach LIKE blfa1-pfach,
pstl2 LIKE blfa1-pstl2,
pstlz LIKE blfa1-pstlz,
regio LIKE blfa1-regio,
sortl LIKE blfa1-sortl,
sperr LIKE blfa1-sperr,
sperm LIKE blfa1-sperm,
spras LIKE blfa1-spras,
stcd1 LIKE blfa1-stcd1,
stcd2 LIKE blfa1-stcd2,
stkza LIKE blfa1-stkza,
stkzu LIKE blfa1-stkzu,
stras LIKE blfa1-stras,
telbx LIKE blfa1-telbx,
telf1 LIKE blfa1-telf1,
telf2 LIKE blfa1-telf2,
telfx LIKE blfa1-telfx,
teltx LIKE blfa1-teltx,
telx1 LIKE blfa1-telx1,
xcpdk LIKE lfa1-xcpdk,
xzemp LIKE blfa1-xzemp,
vbund LIKE blfa1-vbund,
fiskn LIKE blfa1-fiskn,
stceg LIKE blfa1-stceg,
stkzn LIKE blfa1-stkzn,
sperq LIKE blfa1-sperq,
adrnr LIKE lfa1-adrnr,
mcod1 LIKE lfa1-mcod1,
mcod2 LIKE lfa1-mcod2,
mcod3 LIKE lfa1-mcod3,
gbort LIKE blfa1-gbort,
gbdat LIKE blfa1-gbdat,
sexkz LIKE blfa1-sexkz,
kraus LIKE blfa1-kraus,
revdb LIKE blfa1-revdb,
qssys LIKE blfa1-qssys,
ktock LIKE blfa1-ktock,
pfort LIKE blfa1-pfort,
werks LIKE blfa1-werks,
ltsna LIKE blfa1-ltsna,
werkr LIKE blfa1-werkr,
plkal LIKE lfa1-plkal,
duefl LIKE lfa1-duefl,
txjcd LIKE blfa1-txjcd,
sperz LIKE lfa1-sperz,
scacd LIKE blfa1-scacd,
sfrgr LIKE blfa1-sfrgr,
lzone LIKE blfa1-lzone,
xlfza LIKE lfa1-xlfza,
dlgrp LIKE blfa1-dlgrp,
fityp LIKE blfa1-fityp,
stcdt LIKE blfa1-stcdt,
regss LIKE blfa1-regss,
actss LIKE blfa1-actss,
stcd3 LIKE blfa1-stcd3,
stcd4 LIKE blfa1-stcd4,
ipisp LIKE blfa1-ipisp,
taxbs LIKE blfa1-taxbs,
profs LIKE blfa1-profs,
stgdl LIKE blfa1-stgdl,
emnfr LIKE blfa1-emnfr,
lfurl LIKE blfa1-lfurl,
j_1kfrepre LIKE blfa1-j_1kfrepre,
j_1kftbus LIKE blfa1-j_1kftbus,
j_1kftind LIKE blfa1-j_1kftind,
confs LIKE lfa1-confs,
updat LIKE lfa1-updat,
uptim LIKE lfa1-uptim,
nodel LIKE blfa1-nodel.
DATA: END OF vendor_file_x.
FIELD-SYMBOLS: <field>,
<field_1>.
DATA: delim TYPE x VALUE '09'.
DATA: fld_chk(4096),
last_char,
quote_1 TYPE i,
quote_2 TYPE i,
fld_lth TYPE i,
columns TYPE i,
field_end TYPE i,
outp_rec TYPE i,
extras(3) TYPE c VALUE '.,"',
mixed_no(14) TYPE c VALUE '1234567890-.,"'.
OPEN DATASET p_file FOR INPUT.
DO.
READ DATASET p_file INTO data_tab-data.
IF sy-subrc = 0.
APPEND data_tab.
ELSE.
EXIT.
ENDIF.
ENDDO.
* count columns in output structure
DO.
ASSIGN COMPONENT sy-index OF STRUCTURE vendor_file_x TO <field>.
IF sy-subrc <> 0.
EXIT.
ENDIF.
columns = sy-index.
ENDDO.
* Assign elements of input file to internal table
CLEAR vendor_file_x.
IF columns > 0.
LOOP AT data_tab.
DO columns TIMES.
ASSIGN space TO <field>.
ASSIGN space TO <field_1>.
ASSIGN COMPONENT sy-index OF STRUCTURE vendor_file_x TO <field>.
SEARCH data_tab-data FOR delim.
IF sy-fdpos > 0.
field_end = sy-fdpos + 1.
ASSIGN data_tab-data(sy-fdpos) TO <field_1>.
* Check that numeric fields don't contain any embedded " or ,
IF <field_1> CO mixed_no AND
<field_1> CA extras.
TRANSLATE <field_1> USING '" , '.
CONDENSE <field_1> NO-GAPS.
ENDIF.
* If first and last characters are '"', remove both.
fld_chk = <field_1>.
IF NOT fld_chk IS INITIAL.
fld_lth = strlen( fld_chk ) - 1.
MOVE fld_chk+fld_lth(1) TO last_char.
IF fld_chk(1) = '"' AND
last_char = '"'.
MOVE space TO fld_chk+fld_lth(1).
SHIFT fld_chk.
MOVE fld_chk TO <field_1>.
ENDIF. " for if fld_chk(1)=" & last_char="
ENDIF. " for if not fld_chk is initial
* Replace "" with "
DO.
IF fld_chk CS '""'.
quote_1 = sy-fdpos.
quote_2 = sy-fdpos + 1.
MOVE fld_chk+quote_2 TO fld_chk+quote_1.
ELSE.
MOVE fld_chk TO <field_1>.
EXIT.
ENDIF.
ENDDO.
<field> = <field_1>.
ELSE.
field_end = 1.
ENDIF.
SHIFT data_tab-data LEFT BY field_end PLACES.
ENDDO.
APPEND vendor_file_x.
CLEAR vendor_file_x.
ENDLOOP.
ENDIF.
CLEAR data_tab.
REFRESH data_tab.
FREE data_tab.
Rob
Maybe you are looking for
-
Connecting 5th gen. ipod to new LG stereo with USB port. Functionality?
Hi, I recently got a new LG "micro hi-fi system" (model LFU850) with a USB port for MP3 players. The problem is when I connect the ipod via USB, I lose all the functionality of the ipod database. In other words, the stereo numerically lists about hal
-
May Be Old question but undo not available in Acrobat X Standard
This maybe a tired old question but I can not find a straight forward answer. In Acrobat X standard, I have some large pdf's that I created by merging many smaller PDF files together that were MS Word files converted to PDF. When I want to update som
-
Not able to upload file in DMS(Document Mang. system) using Web dynpro ABAP
Hi All, I am facing a problem while uploading the file into the DMS ( Document Management System ) from Webdnrpo . I am using the BAPI - BAPI_DOCUMENT_CREATE2 to create the document . CASE - 1 when i am providing the storage category mention below an
-
Use my I-mac as a display for another PC?
How can I hook up another PC to my i-mac display?
-
Hi, Archiving Database Schema states that in the tables SessionDetails and Conferences tables, the column 'SessionIdTime' holds datetime value at which session request is captured by Archiving service. But, is there any order in which the records are