Flex based Offline File Upload Application
Hi,
I am developing a flex based desktop client application,
which provides capability for offline and online file upload.
I want to achieve following functionality.
It detects whether user is online or not, If not online then
it saves data to somewhere on local file system folder
and as soon as it detects that user is online, it uploads
data from local file systm folder to HTTP based server.
I explored FileReference object in flash.net API, Apparently
it does not provide any capability to store content to local file
system.
Is above mentioned offline file upload possible using action
script ?
Pls. help.
Regards
Tarun
hi,
for all offline working applications you need an offline swf
to exe maker. i use mdm zinc. it is fantastic for the type of
problem you mentioned. visit www.multidmedia.com and download a
trial version. it will provide you with the necessary tool.
gaurav
Similar Messages
-
Flex and php file uploader cross browser problems
Hi, I have a problem in flex and php file uploader. It was
working fine in Internet Explorer, but nothing would work in
Firefox and in other browsers. Firefox and other browsers was not
sending the session with the file upload and was producing a login
error. On IE the session cookie is picked up and the upload request
uses the authenticated session, no login error. I'm newbie in flex.
Please help me. Thanks in advance!
Here's my code:
bgupload.mxmlHello, I am Gamaliel Arredondo, i have solved this problem, the error is in the code, you have a mistake in your code, check it out.
The way to run the flex applications, in my case, i installed xampp, in the htdoc directory i put the folder with the files of the application and all is working very well, only when the apache is running because if it is stoped the application show error, please review your code and if you have problems you can contact me by e-mail ([email protected]) i also fought with that problem but i could find the solution, i hope to help you. -
File upload demo application in 2.0
Hi!
I implemented the file upload application from the demo applications with the standard table HTMLDB_APPLICATION_FILES. It works very fine. Thanks for sharing this code.
BUT I was unable to implement a custom table, because I could not locate the insert-function (as described in the tutorial). It is no known process on any of my pages.
Could you help me finding it?
(And is a file always stored as blob, or could it be a clob as well?)
My main motive for this question is to gain inside knowledge in building some crude filerepository. We receive plain-ascii-data files via ftp and I have to import their data into a table.
I do not want to go through all this 'reading OS-directory with java, opening files as external tables, moving them with utl_file', if I simply could
a) receive the file directly as a clob in my table
b) get the necessary data with sql
c) handle all archiving, file renaming directly by updating a table
Beside application express's file upload (speaking only http), the is a XML repository which 'speaks' ftp and http.
Does someone have experience with uploading non-xml files and storing them as clobs?
Thanks,
MichaelHello Michael,
I believe the reference in the demo tutorial is to Insert process (not function). This is probably the process defined on page 8-6, step 4a of the "Create a process to insert information" section.
Basically you can upload and store files in CLOB. For my self, I only did it with XML files, but I don't see any reason not to do it with other types of files.
I think that in order to work with non-structured files (like ASCII) you should learn more about Oracle Text. Apex is also using this product. Search this forum for "oracle text" and continue from there.
Hope this helps,
Arie. -
Hi All,
Can anyone give me some resources for creating a File Upload application ??
TXT file to Internal Table.
(new to BSP)
Thanks in Advance
ChemmanzThey are useful but i need to SAVE that i uploaded file to SAP.
But i think that applications hold files in cache.
I want i can download file when i want.
Thanks
ibrahim
Message was edited by: Ibrahim UGUR -
I am doing one file upload program using
<af:inputFile label="File to Upload" columns="90"
value="#{FileProcessor.uploadedFile}"/>
component..
in Jdeveloper 11g i am getting the correct result,
but when i'm tryin to run it in Jdeveloper jdevstudio10131 it is giving this error.
java.io.EOFException: Per-request disk space limits exceeded. at oracle.adfinternal.view.faces.webapp.UploadedFileImpl.loadFile(UploadedFileImpl.java:187) at
i want this file upload application to run in ecplise..but there it is not working..do i need so some to import some jar files??
tomat 5.0 i'm using there..
Or is there any otherway to upload file using jsf component which should work in eclipse-tomcat enviornment also..
please help
thanksMr BalusC,
Yes Iam talking about a custom made upload component. The fileupload tutorials u send are good but my requirement is not meeting them. Among my requirements one is mutilple file uploads in the single view page. This is possible at present with my custom upload componet. Only if the problem gets solved. Any way once again please think on my problem and give your solution on it.
Here is my problem:
The problem is I have to access the components from view page which this kind of requirement possible in jsp by request parsing which results the key value pairs of the form components. This same thing/way I should get in backing bean from JSF view page.
The solution I want may like as follows.
Note this code is incorrect and wrong but for to understand my requirement.
someobject.getComponentIdValue("clientID"); which returns a string value as d:\images\Tutle.jpg
The clientID is upload file component' Id . In the request it may be the key associated with value as file complete path. By this kind of way my upload filter is able to get the orignal file. Ok i need this in my backing bean to get the orignal filename to insert into the database. Please for this give the solution or reply.many thanx,
vijaycanaan. -
Issues with file upload in flex mobile application (sharepoint as backend)
Hello,
I am working on flex mobile application for android platform for which we are having sharepoint as a backend.
(Flex SDK 4.6 and AIR 3.9)
Issue which we are facing is as follows:
We are communicating with the backend server using webservices: example:
<s:WebService id="kWebService" wsdl="http://www.kservice.net/kdatabaseservice.asmx?WSDL" >
<s:operation name="AddPost"
resultFormat="object"
result="addPostResult(event)"
fault="postsfaulterr(event)" />
</s:WebService>
Above services are working fine but we are facing issue with one service which is related to file upload.
File upload for <10 MB is working fine but when we try to upload larger file on server it fails to process.
We are sending bytearray to the backend and backend code is writing those bytearray into file.
We have tried many ways to overcome from this situation. like we have checked configuration for file upload size on server , we have tried wcf services as well. Please help us on this criticle point as soon as possible
Thanks
DhwaniPrashant8809 wrote:
Hi
>
> I have already gone through the video by Thomas Jung for multiple file upload but it saves the contents in server and not in >transparent table. So please suggest me alternative solutions.
>
>
> Regards
> Prashant Chauhan
What do you mean that my video saves the contents int he server and not in transparent table? I save the data into a temporary database table so it can be accessed by the parent WDA session. From there the WDA session can do whatever it wants with it. What do you mean by transparent table - that would be a database table. Do you actually mean internal table? if so, just read the data from the temporary database table into memory. -
Getting extra things in the uploaded file by flex file upload
Hi,
I am working on a application where I am using adobe flex. I
have a requirement wher I have to upload file to the server. System
allows user to browse file from local machine and flex uploads it
to the server.
Now there is a upload url, its a jsp page which gets
mutipart/form-data content from the request, opens an outputstream
and writes the content of the inputstrem to the file.
fileUpload.mxml
quote:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
layout="vertical" creationComplete="initApp()">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.utils.ObjectUtil;
import flash.events.*;
import flash.net.FileReference;
import flash.net.URLRequest;
private var fileRef:FileReference;
private function initApp():void {
fileRef = new FileReference();
fileRef.addEventListener(Event.CANCEL, traceEvent);
fileRef.addEventListener(Event.COMPLETE, completeEvent);
fileRef.addEventListener(Event.SELECT, selectEvent);
fileRef.addEventListener(IOErrorEvent.IO_ERROR, traceEvent);
fileRef.addEventListener(Event.OPEN, traceEvent);
fileRef.addEventListener(ProgressEvent.PROGRESS,
progressEvent);
fileRef.addEventListener(SecurityErrorEvent.SECURITY_ERROR,
traceEvent);
private function traceEvent(event:Event):void {
var tmp:String = "================================\n";
//ta.text += tmp + event.type + " event:" +
mx.utils.ObjectUtil.toString(event) + "\n" ;
//ta.verticalScrollPosition += 20;
private function ioErrorEvent(event:IOErrorEvent):void{
Alert.show("IOError:" + event.text);
traceEvent(event);
private function selectEvent(event:Event):void{
btn_upload.enabled = true;
traceEvent(event);
filename.text = fileRef.name;
progressBar.setProgress(0, 100);
progressBar.label = "Loading 0%";
private function progressEvent(event:ProgressEvent):void {
progressBar.setProgress(event.bytesLoaded,
event.bytesTotal);
traceEvent(event);
private function completeEvent(event:Event):void {
progressBar.label = "Complete.";
filename.text += " uploaded";
traceEvent(event);
btn_upload.enabled = false;
btn_cancel.enabled = false;
private function uploadFile(endpoint:String):void {
var param:String = "author=" + ti_author.text;
var req:URLRequest = new URLRequest(endpoint);
req.method = URLRequestMethod.POST;
fileRef.upload(req, param, false);
progressBar.label = "Uploading...";
btn_cancel.enabled = true;
]]>
</mx:Script>
<mx:Panel title="Flex 2 File Uploading Demo" width="100%"
height="100%" >
<mx:Form>
<mx:FormItem label="Upload URL:">
<mx:TextInput editable="false" id="uploadURL"
width="100%" text="
http://localhost/flexApp/jsps/upload.jsp"
enabled="true" />
</mx:FormItem>
<mx:FormItem label="Selected File:">
<mx:Label id="filename"/>
</mx:FormItem>
<mx:FormItem label="Upload By:">
<mx:TextInput id="ti_author" text="Author" />
</mx:FormItem>
<mx:FormItem direction="horizontal" width="100%">
<mx:Button width="80" label="Browse"
click="fileRef.browse()" />
<mx:Button width="80" label="Upload" id="btn_upload"
enabled="false" click="uploadFile(uploadURL.text)" />
<mx:Button width="80" label="Cancel" id="btn_cancel"
enabled="false" click="fileRef.cancel()" />
</mx:FormItem>
<mx:HRule width="100%" tabEnabled="false"/>
<mx:FormItem label="Progress:">
<mx:ProgressBar id="progressBar" mode="manual" />
</mx:FormItem>
</mx:Form>
</mx:Panel>
</mx:Application>
test.jsp page
quote:
InputStream is = null;
BufferedInputStream bis = null;
BufferedOutputStream bos = null;
try {
System.out.println("request.getContentType()...." +
request.getContentType());
is = request.getInputStream();
bis = new BufferedInputStream(is);
bos = new BufferedOutputStream(new FileOutputStream(new
File("d:/naseem.txt")));
int i=0;
while ((i = bis.read())!=-1) {
bos.write(i);
bos.flush();
catch(Exception e){
e.printStackTrace();
finally{
try{
if(bos!=null && is!=null && bis!=null){
bos.close();is.close();bis.close();
}catch(Exception e){e.printStackTrace();}
Above jsp writes the content of browsed file to d:/naseem.txt
Problem which I am facing is besides the actual content, it
also write something else.
Actual file:
quote:
My Text
upload txt file which I got: naseem.txt
quote:
------------cH2ei4GI3ae0KM7cH2GI3ei4ae0cH2
Content-Disposition: form-data; name="Filename"
test.txt
------------cH2ei4GI3ae0KM7cH2GI3ei4ae0cH2
Content-Disposition: form-data; name="author=Author";
filename="test.txt"
Content-Type: application/octet-stream
My Text
------------cH2ei4GI3ae0KM7cH2GI3ei4ae0cH2
Content-Disposition: form-data; name="Upload"
Submit Query
------------cH2ei4GI3ae0KM7cH2GI3ei4ae0cH2--
My question is how do I remove these content-disposition,
content type i.e., extra things from my file. I need only content
to be written in the file.
Regards,
NaseemHi Naseem,
You need a multipart request parsing utility. Check commons-fileupload for example. -
File Upload using Flex/ColdFusion. 2044 error
I am looking for a little more clarity around the file upload using Flex and Cold Fusion. When I run this using my server I get Error #2044: Unhandled IOErrorEvent:. text=Error #2038: File I/O Error.
I did create a regular cfform and had it use my ColdFusion upload form and that worked fine, so I feel good about the upload form. I am starting to think there is a permission error with the Flash Player writing to the folder. When this is ran, it will show the file being 100% loaded but the complete event is never triggered. I put alerts to see where it hits and 100 does show at the same time as my error message. The complete alert never shows. I also put an alert in my cfm page and it never reaches that page to hit it. Whether I use an absolute URL or relative path. I have also tried the urlrequestmethod.post and nothing changed. Thanks in advance. BTW. I am using Flex 3.
This is my mxml file
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:example="com.example.*" horizontalAlign="center" viewSourceURL="srcview/index.html">
<mx:Script>
<![CDATA[
import com.example.FileDownload
import mx.controls.Label
import com.example.FileUpload]]>
</mx:Script>
<mx:Label id="title" text="File I/O Example" fontSize="24" fontStyle="bold" />
<mx:Text id="subtitle" text="From Programming ActionScript 3.0, Chapter 22: Networking and communication" width="100%" textAlign="center" fontSize="12" /><example:FileDownload
id="fileDownload" creationComplete="fileDownload.init(downloadProgress, cancelDownload);" />
<example:FileUpload id="fileUpload" creationComplete="fileUpload.init(uploadProgress, cancelUpload);" />
<mx:HBox>
<mx:Panel title="Upload File" paddingTop="10" paddingBottom="10" paddingLeft="10" paddingRight="10">
<mx:ProgressBar id="uploadProgress" label="" mode="manual" />
<mx:ControlBar horizontalAlign="right">
<mx:Button id="startUpload" label="Upload..." click="fileUpload.startUpload();" />
<mx:Button id="cancelUpload" label="Cancel" click="fileUpload.cancelUpload();" enabled="false" />
</mx:ControlBar>
</mx:Panel>
<mx:Panel title="Download File" paddingTop="10" paddingBottom="10" paddingLeft="10" paddingRight="10">
<mx:ProgressBar id="downloadProgress" label="" mode="manual" />
<mx:ControlBar horizontalAlign="right">
<mx:Button id="startDownload" label="Download..." click="fileDownload.startDownload();" />
<mx:Button id="cancelDownload" label="Cancel" click="fileDownload.cancelDownload();" enabled="false" />
</mx:ControlBar>
</mx:Panel>
</mx:HBox></mx:Application>
here is my coldfusion upload script
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<script>alert('hello')</script>
<cfset currentPath = getCurrentTemplatePath()>
<cfset currentDirectory = getDirectoryFromPath(currentPath)>
<cfoutput>This directory is #currentDirectory#</cfoutput>
<cffile action="UPLOAD" filefield="Filefield" destination="#currentDirectory#" nameconflict="OVERWRITE"/>
</body>
</html>
here is the package
package
com.example { import flash.events.*;
import flash.net.FileReference;
import flash.net.URLRequest;
import flash.net.URLRequestMethod;
import mx.controls.Button;
import mx.controls.ProgressBar;
import mx.core.UIComponent;
import mx.controls.Alert;
public class FileUpload extends UIComponent {
// Hard-code the URL of the remote upload script.
private const UPLOAD_URL:String = "upload_script.cfm";
private var fr:FileReference;
// Define reference to the upload ProgressBar component.
private var pb:ProgressBar;
// Define reference to the "Cancel" button which will immediately stop the upload in progress.
private var btn:Button;
public function FileUpload() {}
/*** Set references to the components, and add listeners for the SELECT,
* OPEN, PROGRESS, and COMPLETE events.
public function init(pb:ProgressBar, btn:Button):void {
// Set up the references to the progress bar and cancel button, which are passed from the calling script.
this.pb = pb;
this.btn = btn;
fr =
new FileReference();fr.addEventListener(Event.SELECT, selectHandler);
fr.addEventListener(Event.OPEN, openHandler);
fr.addEventListener(ProgressEvent.PROGRESS, progressHandler);
// fr.addEventListener(Event.COMPLETE, completeHandler);
/*** Immediately cancel the upload in progress and disable the cancel button.
public function cancelUpload():void {fr.cancel();
pb.label =
"UPLOAD CANCELLED";btn.enabled =
false;}
/*** Launch the browse dialog box which allows the user to select a file to upload to the server.
public function startUpload():void {fr.browse();
/*** Begin uploading the file specified in the UPLOAD_URL constant.
private function selectHandler(event:Event):void {
var request:URLRequest = new URLRequest(UPLOAD_URL);
/* request.url = UPLOAD_URL*/request.method = URLRequestMethod.POST;
try
{fr.upload(request);
}catch (error:Error){
trace
("error uploading")}
/*** When the OPEN event has dispatched, change the progress bar's label
* and enable the "Cancel" button, which allows the user to abort the
* upload operation.
private function openHandler(event:Event):void {pb.label =
"UPLOADING";btn.enabled =
true;}
/*** While the file is uploading, update the progress bar's status and label.
private function progressHandler(event:ProgressEvent):void {pb.label =
"UPLOADING %3%%";pb.setProgress(event.bytesLoaded, event.bytesTotal);
if(event.bytesLoaded==event.bytesTotal){
trace(Event.COMPLETE)Alert.show(
"100")}
/*** Once the upload has completed, change the progress bar's label and
* disable the "Cancel" button since the upload is already completed.
private function completeHandler(event:Event):void {Alert.show(
"in function")pb.label =
"UPLOADING COMPLETE";pb.setProgress(0, 100);
btn.enabled =
false;}Presumably you need to add a result handler to your request.
-
How do I enable CF to allow file uploads from Flex?
You will need to set the accept attribute of the cffile tag
to allow the mime type application/octet-stream. -
How to upload a file in application server to an internal table
Hi,
I am asked to upload a file from application server to internal table. Can you please suggest me the ways to do it or the function module which helps to browse the application server file names.
I have done a program. But its giving problem in searching the files from application server. I am pasting my code for ur review. Please tell me which part i have to correct or suggest me some other ways to do it.
*& Report ZUPLOAD1
REPORT ZUPLOAD1.
type-pools: truxs.
parameters: p_upl_ps radiobutton group g1 default 'X', "upload from pres. server
p_path type rlgrap-filename,
p_upl_as radiobutton group g1, "upload from appln server
<b>p_dir LIKE filepath-pathintern DEFAULT 'Y_ABAP',
p_file LIKE filepath-pathintern lower case,</b>
p_test as checkbox.
constants: c_x value 'X',
c_tab type c value cl_abap_char_utilities=>horizontal_tab.
types: ty_data(1000) type c. "structure to hold legacy data
data: i_data type standard table of ty_data. "internal table of ty_data
types: begin of stritab,
land1 type v_t604-land1, "structure of legacy file.
stawn type v_t604-stawn,
bemeh type v_t604-bemeh,
impma type v_t604-impma,
minol type v_t604-minol,
end of stritab.
data: gi_itab type standard table of stritab, "internal table of legacy file
gw_itab type stritab. "work area
data: i_raw type truxs_t_text_data,
v_fullpath type string.
at selection-screen on value-request for p_path.
if p_upl_ps = c_x. "if presentation server is selected
perform get_file.
else. "if application server is selected
perform set_file_path.
perform upload_from_server.
perform split_data.
endif.
form get_file.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = SYST-CPROG
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = ' '
IMPORTING
FILE_NAME = p_path. "getting the file name of pres server
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
I_FIELD_SEPERATOR =
I_LINE_HEADER = 'X' "converting excel to sap and filling in
I_TAB_RAW_DATA = i_raw "internal table
I_FILENAME = p_path
TABLES
I_TAB_CONVERTED_DATA = gi_itab
EXCEPTIONS
CONVERSION_FAILED = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
endform.
form set_file_path. "Getting the file path of application server
data: lv_file type p_file.
lv_file = p_file.
CALL FUNCTION 'FILE_GET_NAME_USING_PATH'
EXPORTING
CLIENT = SY-MANDT
LOGICAL_PATH = p_dir
OPERATING_SYSTEM = SY-OPSYS
PARAMETER_1 = ' '
PARAMETER_2 = ' '
PARAMETER_3 = ' '
USE_BUFFER = ' '
FILE_NAME = lv_file
USE_PRESENTATION_SERVER = ' '
ELEMINATE_BLANKS = 'X'
IMPORTING
FILE_NAME_WITH_PATH = v_fullpath
EXCEPTIONS
PATH_NOT_FOUND = 1
MISSING_PARAMETER = 2
OPERATING_SYSTEM_NOT_FOUND = 3
FILE_SYSTEM_NOT_FOUND = 4
OTHERS = 5
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
endform.
form upload_from_server.
data: lv_msg type string,
lw_data type ty_data.
open dataset v_fullpath for input message lv_msg in text mode encoding default.
if sy-subrc <> 0.
message lv_msg type 'i'.
stop.
endif.
do.
read dataset v_fullpath into lw_data.
if sy-subrc <> 0.
write:/5 'Error in processign data set'.
exit.
endif.
append lw_data to i_data.
enddo.
close dataset v_fullpath.
if sy-subrc <> 0.
write: /5 'Error closing dataset'.
endif.
endform.
form split_data.
data: lw_data type ty_data.
data: lw_itab type stritab.
data: begin of ty_itab,
land1 type v_t604-land1,
stawn type v_t604-stawn,
bemeh type v_t604-bemeh,
impma type v_t604-impma,
minol type v_t604-minol,
end of ty_itab.
loop at i_data into lw_data.
split lw_data at c_tab into
ty_itab-land1
ty_itab-stawn
ty_itab-bemeh
ty_itab-impma
ty_itab-minol.
lw_itab-land1 = ty_itab-land1.
lw_itab-stawn = ty_itab-stawn.
lw_itab-bemeh = ty_itab-bemeh.
lw_itab-impma = ty_itab-impma.
lw_itab-minol = ty_itab-minol.
append lw_itab to gi_itab.
endloop.
endform.
start-of-selection.
loop at gi_itab into gw_itab.
write: /5 'COUNTRY', 'IMPORT CODE', 'SUP UNIT', 'FIRST UOM', 'SECOND UOM',
/5 gw_itab-land1, gw_itab-stawn,gw_itab-bemeh,gw_itab-impma,gw_itab-minol.
endloop.
end-of-selection.
I hope problem must be in p_dir and p_file which are in bold.. Kindly help me out. Thanks in advance.see the following ex:
*& Form SUB_GET_FILEPATH
text
--> p1 text
<-- p2 text
FORM SUB_GET_FILEPATH .
GFILE = 'D:\SAP_INT\INBOUND\INBOX'. "Path
ENDFORM. " SUB_GET_FILEPATH
*& Form SUB_GET_FILE
text
--> p1 text
<-- p2 text
FORM SUB_GET_FILE .
DATA: P_FDIR(200) TYPE C.
DATA: IT_FILEDIR1 TYPE STANDARD TABLE OF TY_FILEDIR WITH HEADER LINE.
P_FDIR = GFILE.
CALL FUNCTION 'RZL_READ_DIR_LOCAL'
EXPORTING
NAME = P_FDIR
TABLES
FILE_TBL = IT_FILEDIR.
REFRESH : IT_FILEDIR1.
LOOP AT IT_FILEDIR.
IF IT_FILEDIR-NAME(4) = 'ZINC' OR IT_FILEDIR-NAME(4) = 'zinc'.
MOVE IT_FILEDIR-NAME TO IT_FILEDIR1-NAME.
APPEND IT_FILEDIR1.
ENDIF.
ENDLOOP.
IF IT_FILEDIR1[] IS INITIAL.
STOP.
ENDIF.
LOOP AT IT_FILEDIR1.
REFRESH: I_TAB.
CLEAR: I_TAB.
NAME = IT_FILEDIR1-NAME.
CONCATENATE: GFILE '\' NAME INTO G_FILE.
OPEN DATASET G_FILE FOR INPUT IN TEXT MODE
ENCODING DEFAULT
IGNORING CONVERSION ERRORS.
IF SY-SUBRC EQ 0.
CONCATENATE 'FILENAME : ' G_FILE INTO I_MSG1.
APPEND I_MSG1.
DO.
READ DATASET G_FILE INTO RECORD.
IF SY-SUBRC = 0.
SPLIT RECORD AT ',' INTO I_TAB-BUKRS I_TAB-EBELN
I_TAB-BLDAT I_TAB-XBLNR I_TAB-LIFNR I_TAB-AMOUNT
I_TAB-CURR I_TAB-BUSAREA
I_TAB-BKTXT I_TAB-DMBTR I_TAB-MENGE I_TAB-SRNO.
MOVE-CORRESPONDING I_TAB TO I_TAB1.
ELSE.
EXIT.
ENDIF.
APPEND I_TAB1.
CLEAR: I_TAB, I_TAB1.
ENDDO.
ENDIF.
CLOSE DATASET G_FILE. -
Remove link for uploaded files in application
Hi all,
I've been following the tutorial on how to upload and download files in application at http://download-uk.oracle.com/docs/cd/B32472_01/doc/appdev.300/b32469/up_dn_files.htm. I have now created my own table which stores the uploaded files and can download them successfully. I would now like to add the ability to delete these files within the application and was wondering what the best way of doing this was?
I would like to add another column to the displayed report with a 'Remove file' link for each listed file, which when clicked would delete the file from the table. I've already tried using a similar method to the one used to upload the files (instead of uploading the file, the called procedure deletes it from the table using the specified ID), but this causes the application to display a blank page when the link is clicked, which I dont want (but does delete the file).
I would appreciate any suggestions.
Regards,
DaveDave,
See the login page:
http://htmldb.oracle.com/pls/otn/f?p=31517:101
There are details on how to access the application builder, where you can see how the
setup of that download, delete, upload application has been done.
Denes Kubicek
http://deneskubicek.blogspot.com/
http://htmldb.oracle.com/pls/otn/f?p=31517:1
------------------------------------------------------------------- -
Regarding uploading the file from Application Server
I am trying to upload a .csv file to Application Server through CG3Z tcode.
But i am getting dump ad below..
What happened?
While a text was being converted from code page '4102' to '1100', one
the following occurred:
- an character was discovered that could not be represented in one of
the two code pages;
- the system established that this conversion is not supported.
The running ABAP program, 'SAPLC13Z' had to be terminated, since the
conversion could cause incorrect data to be generated.
1 characters could not be represented (and thus could not converted).
If 1 = 0, a second or a different error has occurred.
Please let me know..how can i resolve this??
Thanks
PriyankaCheck if your CSV file is UNICODE encoding.
If CG3Z steel not works you can check on OSS SUPPORT if a note solve your problem. -
Uploading and reading file from application server
Hi
My problem is when am uploading a file to application server it is getting stored in
usr/sap/transyp1/prod/in directory
after that i want to read that file from application server to update database
when using below code it is showing some other directory in f4 help
DATA: lv_hostname TYPE msxxlist-name.
DATA: lv_server TYPE bank_dte_jc_servername.
PARAMETERS: p_file TYPE rlgrap-filename.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL FUNCTION 'BANK_API_SYS_GET_CURR_SERVER'
IMPORTING
e_server = lv_server.
lv_hostname = lv_server.
CALL FUNCTION 'F4_DXFILENAME_4_DYNP'
EXPORTING
dynpfield_filename = 'P_FILE'
dyname = sy-cprog
dynumb = '1000'
filetype = 'P'
location = 'A'
server = lv_hostname.
experts could you please help me out
Thanks & Regards
Nagesh.ParuchuriUser Transaction file. You will get all logical file path names.
used following fucntion module to read file name and use command open dataset to read the file.
CALL FUNCTION 'FILE_GET_NAME'
EXPORTING
CLIENT = SY-MANDT
LOGICAL_FILENAME = C_LOGICAL_FILENAME
OPERATING_SYSTEM = SY-OPSYS
PARAMETER_1 = P_IN_FILENAME
IMPORTING
FILE_NAME = P_OUT_FILENAME
EXCEPTIONS
FILE_NOT_FOUND = 1
OTHERS = 2.
OPEN DATASET P_OPEN_FILE ENCODING UTF-8 IN TEXT MODE FOR OUTPUT.
IF SY-SUBRC <> 0.
MESSAGE E000(38) WITH 'Error in Opening file: ' V_PHY_FILENAME.
ENDIF. -
Problem in uploading file from Application Server
Hi everyone,
i got a problem in uplaoding a file from application server.i am having two folder (one folder name is current and another one is processed)in application server. In current folder i am having N no of files.I want to upload all the files names into one internal table and i want to process one by one file.After processing each file the file should be moved to processed folder and the files should not exist in current folder.All these process must be done everyday.Please rectify my problem asap.Ramesh,
Take authorization from basis guy.
Use the below code to get the list of files from require directory
*& Report ZDIRFILES *
REPORT ZDIRFILES .
PARAMETER: p_fdir type pfeflnamel DEFAULT '/usr/sap/tmp'.
data: begin of it_filedir occurs 10.
include structure salfldir.
data: end of it_filedir.
*START-OF-SELECTION
START-OF-SELECTION.
Get Current Directory Listing for OUT Dir
call function 'RZL_READ_DIR_LOCAL'
exporting
name = p_fdir
tables
file_tbl = it_filedir.
Now in internal table "it_filedir" will have all your files.
For moving and deleting
report zrich_0001.
Parameters: d1 type localfile default '/usr/sap/TST/SYS/fld1/Data1.txt',
d2 type localfile default '/usr/sap/TST/SYS/fld2/Data1.txt'.
data: begin of itab occurs 0,
rec(20) type c,
end of itab.
data: wa(20) type c.
start-of-selection.
open dataset d1 for input in text mode.
if sy-subrc = 0.
do.
read dataset d1 into wa.
if sy-subrc <> 0.
exit.
endif.
itab-rec = wa.
append itab.
enddo.
endif.
close dataset d1.
open dataset d2 for output in text mode.
loop at itab.
transfer itab to d2.
endloop.
close dataset d2.
delete dataset d1.
Check below FM if required
To move the file to archive directoryuse FMs 'PFL_COPY_OS_FILE'
To Delete 'EPS_DELETE_FILE'.
Don't forgot to reward if useful -
How to upload file from Application Server?
Dear Friends,
How to upload file from Application Server?
Plz. with example...
Regards,
Dharmeshhi,
check the code for upload from application server.
tables: kna1.
types: begin of s_file,
customer type kna1-kunnr,
country type kna1-land1,
name type kna1-name1,
region type kna1-regio,
end of s_file.
*--Internal tables
data: it_file type s_file occurs 0 with header line.
*-- Selection screen
selection-screen: begin of block b1 with frame title text-001.
parameter: p_file type rlgrap-filename default 'C:/customer.txt'
obligatory.
selection-screen: end of block b1.
*-- At selection screen
at selection-screen on value-request for p_file.
perform file_help using p_file.
*-- Process File
start-of-selection.
perform upload_file using p_file.
*-- write File data to o/p
end-of-selection.
perform write_data.
*& Form file_help
form file_help using p_p_file.
data: l_filepath type ibipparms-path.
call function 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = SYST-CPROG
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = ' '
importing
file_name = l_filepath
p_p_file = l_filepath.
endform. " file_help
*& Form upload_file
form upload_file using p_p_file.
call function 'WS_UPLOAD'
exporting
filename = p_p_file
filetype = 'DAT'
IMPORTING
FILELENGTH =
tables
data_tab = it_file
exceptions
conversion_error = 1
file_open_error = 2
file_read_error = 3
invalid_type = 4
no_batch = 5
unknown_error = 6
invalid_table_width = 7
gui_refuse_filetransfer = 8
customer_error = 9
no_authority = 10
others = 11
if sy-subrc <> 0.
message i001.
endif.
endform. " upload_file
*& Form write_data
form write_data .
loop at it_file.
write:/ it_file-customer, it_file-country, it_file-name,
it_file-region.
endloop.
endform.
regards,
keerthi.
Maybe you are looking for
-
New office configuration - is Mac Mini Server a viable choice?
I am totally reconfiguring our business back office. We have 2 MacBook Pro's, 2 new IMac's, 2 older iBooks, 3 iPhones, and a newly purchased Time Capsule. We also have a Windows desktop that is solely used for Quickbooks accounting, as well as 2 HP p
-
Disabling cookies is not 100% working
Hi! I'm trying to force clients using urlrewriting from the server, so in the session descriptor, I set the 'URLRewriting Enabled' to true and 'Cookies Enabled' to false. Then I test it by setting cookies enabled in browser. Seems this way can't guar
-
Consolidated financial reports
Hi everyone, I have two separate SAP Business One company databases and need to have consolidated reports for Balance Sheet and Profit and Loss from both (having separate balances for each and also a summary of the balances). How can this be done usi
-
Restricting a user for KM repository
Hi All i have created a file repository.Is it possible to set the permission ,so that one user cant access that repository but another user can access the repository. I have tried with setting the details-properties-permissions . Then also every user
-
Is it possible to NOT print the background of a form without having to remove it every time? I have a form that uses an official state form as the background template. I need to keep the image visible so that the information typed in the respective f