Copy file on application server with codepage changed
Hello Gurus,
I need to copy an existing *.csv file on the application server to a different location as a *.txt file with the code page UTF-8 /8400/ in the background.
Example:
I have a file with the name is: 'new.csv' in the DIR: '/SERVER/NEW'.
I need to convert the file to 'UTF-8' and copy to DIR: '/SERVER/ARCHIVE' with the name: 'archive.txt'
I was able to get the file via FM: DX_FILE_READ into an internal table. Now I tried to use GUI_UPLOAD, but failed due to the fact the GUI_UPLOAD will just upload a file from PC to an internal table. Additionally I need to run the report in background. So the FG: SFES will not do.
Could you please give me a hint on this?
I am running in a circle
Any help will be rewarded.
Thank you!
Martin
Hello Atish, Satish
Thank you for the quick answer!
@Atish,
Your guide is very helpful and I have downloaded it for further use, however I do not need to make any uploads/downloads from and to PC in the background.
@Satish
The OPEN DATASET helped. This works in the background as well.
I have allotted points to both of you as promised.
Thanks again!
Sample of the code I used:
OPEN DATASET g_out_file FOR OUTPUT IN TEXT MODE ENCODING UTF-8.
LOOP AT lt_file INTO ll_file.
TRANSFER ll_file TO g_out_file.
ENDLOOP.
CLOSE DATASET g_out_file.
Where g_out_file is the path and file name and lt_file and ll_file are internal tables I retrieve by FM: DX_FILE_READ /type: dxrawdata/
Similar Messages
-
Need a List of Files on Application Server WITH "Last Changed Date".
Experts:
I'm currently using FM 'SUBST_GET_FILE_LIST' but it does not return the date which I need because I'm working on something that needs to build an internal table of the files on the server with the oldest file on top (which means I need to sort by the date).
I've searched this forum and there's several existing posts with different function modules and I've tried several but they either display an ALV grid or they do return an itab but it doesn't have the date.
Please help and thank you!You can try:
data: begin of tabl occurs 0, "execute command on server
line(200),
end of tabl.
call 'SYSTEM' id 'COMMAND' field com
id 'TAB' field tabl-*sys*.
where com is something like 'ls -al'.
Rob -
Upload a csv file in application server with the specified codepage(Poland
Hi,
i want to upload a csv file in application server with the specified codepage ( for poland ) , please let me know how to use open dataset for that.?
AnuragI would upload the file with transaction CG3Z in binary mode and do the code page translation with a report: read from server an save with different name.
-
How to copy file from application server
Hello experts,
How to copy file from one folder of application server and paste it to other folder of application server(application server is same)?
Is there any function module exists???
thanks in advance
SaurabhHi you can use this function module to move a file from application server to another folder on application server.
call function 'WS_FILE_COPY'
exporting
destination = m_destination
source = m_source
importing
return = return.
Plus u can use this function module to delete the file from that folder from which u want to replace it.
call function 'WS_FILE_DELETE'
exporting
file = m_source
importing
return = return.
The above FM can help u copy a file from one folder to another and delete the file from that folder. -
Not able to get file from application server with read dataset
Hi,
Firstly i download a file from application server from read data set and then i sent this file as attachment. But problem is that i am able to send .jpg .bmp file but i am not able to send .pdf or .doc file so what can i do for that. ?
My code is like below...
DATA : PATH TYPE STRING.
DATA: E_FILE LIKE RLGRAP-FILENAME.
CONCATENATE '/tmp/' NAME_WITH_EXT INTO E_FILE SEPARATED BY SPACE.
CONDENSE E_FILE NO-GAPS.
IF EXTENSION = 'TXT'.
OPEN DATASET E_FILE FOR INPUT IN TEXT MODE ENCODING DEFAULT WITH WINDOWS LINEFEED . " MESSAGE MSG.
IF SY-SUBRC <> 0.
WRITE: SY-SUBRC, MSG, ' LIKE ', C_FNAME.
ELSE.
WHILE SY-SUBRC = 0.
READ DATASET E_FILE INTO WA_C.
IF SY-SUBRC <> 0.
EXIT.
ENDIF.
APPEND WA_C TO IT_C.
ENDWHILE.
CLOSE DATASET E_FILE.
ENDIF.
ELSE.
OPEN DATASET E_FILE FOR INPUT IN BINARY MODE. " ENCODING DEFAULT. " INPUT IN BINARY MODE . " TEXT MODE ENCODING NON-UNICODE.
IF SY-SUBRC = 0.
DO .
READ DATASET E_FILE INTO GS_PDF_TAB.
IF SY-SUBRC = 0.
APPEND GS_PDF_TAB TO GT_PDF_TAB.
ELSE.
EXIT.
ENDIF.
ENDDO.
CLOSE DATASET E_FILE.
ENDIF.
ENDIF.
Regards,
Gurprit Bhatiadelete this line DEFAULT WITH WINDOWS LINEFEED and check this..
-
Regarding writing file in application server with ISO8859 characters
Hello Experts,
I have a requirement that i need to write my file which read from the data base in ISO8859 characters in the application server.
Is there any FM or any particular code conver normal data base data to ISO8859 characters ?
Please give me some advise.
Thanks,
SureshHello Suresh,
You DONOT have to do any conversion. You need to use the CODE PAGE addition with your OPEN DATASET stmt.
Can you specify as to which Character Set you need to download? (e.g., Cyrillic, Greek, Polish etc)
You can have a look into the SAP Note 73606 for details.
BR,
Suhas
Edited by: Suhas Saha on Dec 19, 2008 7:27 AM -
How to upload file on Application Server with Forms 6i?
Please, I need to upload .csv file from local to Application Server, I think to use .jsp application, but I don't know where I had to put it...Apache can't read .jsp file without Tomcat? If I launch my .jsp file from Apache/htdocs directory can't view .jsp code (Method Not Allowed)...method is POST...any idea? Thanks in advance!
Hi,
You could write a java bean to get the file from the client and to upload to App Server. And, you simply use it in Forms 6i.
Also, you could use d2kwutil (not tried though. you could search this forum and get an idea of that).
Of course, For your information, You could use WebUtil (in Forms 10g / 10.1.2) which has the functionality.
HTH.
Regards,
Arun -
How to store a file in application server with comma as a delimiter !!
<i>Hi,
I'm Creating a file in app. server using "open dataset" statment and populating the file using Transfer stmt.
I like to store the data fields with comma delimiter, since it normally fixed length.
Please let me know Any method available.
Thank You,
Senthil</i>No problem, just concatenate all your fields into one field separated by a comma. Then transfer that field only.
data: your_dataset type localfile default '/usr/sap/TST/SYS/Data1.txt'.
data: output type string.
open dataset your_dataset for output in text mode.
loop at itab.
concatenate itab-fld1
itab-fld2
itab-fld3
into output separated by ','.
transfer output to your_dataset.
endloop.
close dataset your_dataset.
REgards,
Rich Heilman -
Delete files from APPLICATION SERVER?
Hi All,
I am creating the files in application server with folder name as
/interface/freeway/ and filename as PO concatenating with sy-datum and sy-uzeit.
Ex file name now is /interface/freeway/PO20081201064120.csv
Now my req is i need to delete files which has beeen created less than 30 days.
regards,
Sachin.hi,,,,,,
REPORT ZDELETE.
* Delete a file on the application server.
PARAMETERS: P_DIR LIKE RLGRAP-FILENAME
DEFAULT '/usr/sap/trans/',
P_FILE1 LIKE RLGRAP-FILENAME.
DATA: P_FILE(128).
DATA: W_ANS.
START-OF-SELECTION.
CONCATENATE P_DIR P_FILE1 INTO P_FILE.
* check file exists
OPEN DATASET P_FILE FOR INPUT.
IF SY-SUBRC NE 0.
MESSAGE E899(BD) WITH P_FILE 'does not exist'.
EXIT.
ELSE.
CALL FUNCTION 'POPUP_CONTINUE_YES_NO'
EXPORTING
DEFAULTOPTION = 'N'
TEXTLINE1 = P_DIR
TEXTLINE2 = P_FILE1
TITEL = 'ARE YOU SURE YOU WANT TO DELETE'
* START_COLUMN = 25
* START_ROW = 6
IMPORTING
ANSWER = W_ANS
EXCEPTIONS
OTHERS = 1.
ENDIF.
CLOSE DATASET P_FILE.
CHECK W_ANS = 'J'.
* delete
DELETE DATASET P_FILE.
IF SY-SUBRC NE 0.
MESSAGE E899(BD) WITH 'Invalid file name' P_FILE.
ELSE.
CLOSE DATASET P_FILE.
MESSAGE I899(BD) WITH P_DIR P_FILE1 'DELETED'.
ENDIF. -
Creation of Flat file in Application Server
Hi,
Can you please clarify what is Logical file path and Physical file pathe.
Also how to create a flat file in Application Server with Logical and Physical file paths.
ThanksHi Yasaswini,
Physical file is what you see from the OS level.
Logical file is what ABAP code can call certain functions to read/write.
Transaction FILE would link them together. Typically the logical path ends with "<FILENAME>", and the logical file refers to the logical path. You can check the help for more info.
http://help.sap.com//saphelp_erp2004/helpdata/EN/8d/3e4edc462a11d189000000e8323d3a/frameset.htm
Good luck,
Victor -
Unable to Open File In Application Server
Hi All,
I have generated csv file in application Server with the help of Open HUb Destination.In Open Hub 2 files will we generated(1 is structure of the file(s_ztest),2 is data file(ztest)).When i click on the structure of the file then it is opening,but when im tryin to open data file(i,e(ztest)its giving an message like UNABLE TO OPEN THE FILE.
Please let me know how it can be opened.
Thanks In Advance,
BobbyHi All,
File is Opening,it was an error in filed mapping.... -
How to create a inbound IDOC from flat file in Application server
HI All
Our requirement is to create the Inbound idocs from a flat file from application server with in R/3
Could any body please let me know the steps required for this.
Thanks
Malli1. Read the file using OPEN DATASET and read and fill up the segment info and fill the EDIDC header data
and then call function
CALL FUNCTION 'INBOUND_IDOC_PROCESS'
TABLES
IDOC_CONTROL = i_edidc
IDOC_DATA = i_edid4.
a® -
Move pdf file into application server
Hi ABAP Gurus,
i want your valuable help in solving my problem.
i tried to create PDF file in application server and its creating as
PDF file in Application server..but i am unable to see the content in text ,
instead it is displaying in binary content...but when i tried to create
in presentation server i am able to see it as text in PDF file....
Can u please let me know whats wrong in my work and how to create a PDF file
in Application server with text content
with regards,
Gowri.Hi Gowri,
Check this example....
report ztest.
data: begin of itab occurs 0,
field(256),
end of itab.
data: dsn(100) value '/usr/sap/xfr/FIS/testpdf',
length like sy-tabix,
lengthn like sy-tabix.
call function 'GUI_UPLOAD'
exporting
filename = 'c:\temp\test.pdf'
filetype = 'BIN'
importing
filelength = length
tables
data_tab = itab.
open dataset dsn for output in binary mode.
loop at itab.
transfer itab-field to dsn.
endloop.
close dataset dsn.
clear itab.
refresh itab.
*- To crosscheck if it went well
open dataset dsn for input in binary mode.
do.
read dataset dsn into itab-field.
if sy-subrc = 0.
append itab.
else.
exit.
endif.
enddo.
call function 'GUI_DOWNLOAD'
exporting
filename = 'c:\temp\testn.pdf'
filetype = 'BIN'
bin_filesize = length
importing
filelength = lengthn
tables
data_tab = itab.
Or
Use the TCode
CG3Z or CG3Y
for downloading to Application Server.
Thanks,
Reward If helpful. -
Change character set used to write a file in application server.
Hello Experts,
I want to know if we can change the character set used to create a file in application server.(Is it posible to use a particular character set while creating a file in application server.
I will be very great full for any help.
Thanks in advance.
SharathHello Sarath,
There is an extension CODE PAGE with OPEN DATASET stmt.
Can you please elaborate which character set you want to write to the application server?
BR,
Suhas -
Pleasant Hello Pals, ( This is Vipin Nambiar from Bangalore)
I am currently evaluating Adobe Robohelp 10 version for one of my technical architecture writing. Requesting help at the very earliest for the below-said big time hurdles.
I have completed my technical writing for a in-house application system and have generated and viewing the primary layout (courtesy File -> View -> Primary Layout. ) as Contents, Index, Glossary and would like these to be hosted onto the server so that all the users of this application can access these Contents, Index, Glossary and act as a knowhow notes to use this application.
Is there any single file in my local folder of Adobe RoboHelp 10 which can be copied onto the application server ?
(My Adobe RoboHelp 10 local folder contains
a.)Sub-folders called !Language!, !ScreenLayout!, !SkinSubFolder!, !SSL!
b.)File Types called *.ALI File, *.APJ File, *.Bitmap image, *.BRS File, *.Cascading Style Sheet Document, *.CPD File, *.FPJ File, *.GIF image, *.GLO File, *.H File, *.HHC File, *.HHK File, *.HHP File, *.HTML Document, *.HTT File, *.JPEG image, *.JScript Script File, *.LDB File, *.PPF File, *.PSS File, *.Robohelp HTML Project File, *.SSL File, *.XML Document)
Any help here will serve me in plentiousFirst, your username cannot be changed and it is not a good idea to have email addresses visible on any forum, unless you enjoy reading spam.
This question is covered in the online help. When you create an output it is generated to whatever folder you specify in the single source layout. Everything that is in that folder needs to go on the server.
If the help is in !SSL! > WebHelp, then everything in that folder including sub-folders is what needs to go on the server.
See www.grainge.org for RoboHelp and Authoring tips
@petergrainge
Maybe you are looking for
-
Warning: Lenovo system update 5.1 corrupts VPN connection
In MS Windows 8 networking forum are discussed many VPNs problems, when installing 3rd party software. http://social.technet.microsoft.com/Forums/en-US/w8itpronetworking/threads After installing Lenovo system update 5.01 my VPN connection stopped wor
-
Freezing and resetting solution, playlists the culprit, take a look Apple
Hi there, I've had a major issue with my 160gb ipod classic from day 1. I've got a 140g music library on my PC and I've not been able to sync it to the ipod because of freezing and resetting problems.. until today. When I first tried to sync my whole
-
Wireless nearly working, but can't ping
I've been trying to get wireless to work on my laptop using wpa_supplicant. I seem I be connected to the network, but I'm unable to ping google. Here's some info: bash-3.2# wpa_supplicant -Dwext -iwlan0 -c/etc/wpa_supplicant.conf Trying to associate
-
I have a new iMac I use with an HP 6180 Photosmart All-in-One. I've downloaded the driver update and can scan to the Mac however I am looking for a way to have the scanned images go directly to a folder rather than first to an app such as Preview or
-
Missing adobe brushes presets folder in OSX
Hello All, I was trying to install some brushes into the Brushes Preset folder but the only folders in the "Adobe Photoshop CS6" folder in the tree below doesn't have it. It's only a couple of random looking folders. Any thoughts as to where it might