Need Tutorial about file upload
Hi folks!
Have anybody a link or something else to a tutorial for uploading files with JSF?
And i mean with the "plain" JSF RI 1.2 from Sun. Google gives me a lot of Websites with Apache myFaces and myfaces extensions, but i use facelets.
So i have to bring all the the packages together and to mutch action for my little app.
Greetings, cpt.crispy
Using plain JSF RI 1.2 is not possible to do what you want.That's a pity!
So, you need to use an additional component library
like apache tomahawk.I know that. But what does the "additional component library" do?
Don't misunderstand me please. I want to learn how file uploads works in JSF and J2EE, not to learn some "magic" libraries.
For most Java problems you can get "additional libraries", but sometimes it's better you make it on your own to learn how it works.
Thanks for your reply, cpt.crispy
Similar Messages
-
Need Navigation about BDC Upload (Diagramitacal way)
Need Navigation about BDC Upload (Diagramitacal way) for easy understand.
Hi
file:///C:/Documents%20and%20Settings/nnelapat/Desktop/New%20Microsoft%20PowerPoint%20Presentation.ppt#259,4,Slide 4
<b>Reward if usefull</b> -
I Need Information Regarding File Upload?
Where can I get information regarding the File uploading packages in Portal. Is there a specification I can get a hold of. I know such a package exists, as it is used by portal itself. I just need to know where I can get hold of information as to what it is called and how to invoke it.
Suraj,
The APIs to do file upload are not public as of yet. We are looking into the feature right now. Currently, the only supported method of file upload is using the Web Interface.
You may find more information about this in the 9iAs Portal forum
Sue -
I Need Navigation about BDC Upload
Need Navigation about BDC Upload
Hi
<b>the BDC program should be in this format</b>
Transaction Recorder (SHDB)
How to Upload Presentation Server Flat file to SAP R/3 system???
How to upload application server file to R/3 system?
Definition
<b>Example - Call Transaction Method</b>
<b>Transaction Recorder (SHDB)</b>
Before you work with the Batch Input methods, you should know the purpose of the tool
Transaction Recorder.
<b>Use:</b>
You can use the transaction recorder to record a series of transactions and their screens.
<b>Features:</b>
You can use the recording to create
Data transfer programs that use batch input or CALL TRANSACTION
Batch input sessions
Test data
Function modules.
Note: It doesnt record F1, F4 and Scrollbar movements
<b>Upload Flat file from Presentation Server to SAP R/3</b>
CALL FUNCTION GUI_UPLOAD'
EXPORTING
CODEPAGE = IBM'
FILENAME = P_UFILE
FILETYPE = 'DAT'
TABLES
DATA_TAB = INT_TAB
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
OTHERS = 10 .
IF SY-SUBRC NE 0.
MESSAGE E999(FR) WITH 'ERROR IN FILE UPLOAD'.
ENDIF.
<b>Upload file from application server to SAP R/3</b>
Open the the application server file
OPEN DATASET <dsn> FOR INPUT <mode>
Read the data from application server file
READ DATASET <dsn> INTO <wa>
And then close the application server file
CLOSE DATASET <dsn>
Definition- Declaring BDC Table
DATA: BDC_TAB LIKE STANDARD TABLE OF
BDCDATA INITIAL SIZE 6
WITH HEADER LINE .
The internal table used to collect the transactions information must be declared LIKE BDCDATA.
<b>Filling BDC Table Method #1</b>
FORM FILL_BDC_TAB.
REFRESH BDC_TAB.
CLEAR BDC_TAB.
BDC_TAB-PROGRAM = SAPMF02K.
BDC_TAB-DYNPRO = 01016.
BDC_TAB-DYNBEGIN = X.
APPEND BDC_TAB.
CLEAR BDC_TAB.
BDC_TAB-FNAM = RF02K-LIFNR.
BDC_TAB-FVAL = TEST1.
APPEND BDC_TAB.
CLEAR BDC_TAB.
BDC_TAB-FNAM = RF02K-D0010.
BDC_TAB-FVAL = X.
APPEND BDC_TAB.
CLEAR BDC_TAB.
BDC_TAB-PROGRAM = SAPMF02K.
BDC_TAB-DYNPRO = 0110.
BDC_TAB-DYNBEGIN = X.
APPEND BDC_TAB.
CLEAR BDC_TAB.
BDC_TAB-FNAM = LFA1-STRAS.
BDC_TAB-FVAL = 123 Main St..
APPEND BDC_TAB.
CLEAR BDC_TAB.
BDC_TAB-FNAM = BDC_OKCODE.
BDC_TAB-FVAL = /11.
APPEND BDC_TAB.
ENDFORM.
<b>Filling BDC Table Method #2</b>
FORM FILL_BDC_TAB.
REFRESH BDC_TAB.
PERFORM POPULATE_BDC_TAB
USING:
1 SAPMF02K 0106,
RF02K-LIFNR TEST1,
RF02K-D0010 X,
1 SAPMF02K 0110,
LFA1-STRAS, 123 Main St.,
BDC_OKCODE, /11.
ENDFORM.
FORM POPULATE_BDC_TAB USING FLAG VAR1 VAR2.
CLEAR BDC_TAB.
IF FLAG = 1.
BDC_TAB-PROGRAM = VAR1.
BDC_TAB-DYNPRO = VAR2..
BDC_TAB-DYNBEGIN = X.
ELSE.
BDC_TAB-FNAM = VAR1.
BDC_TAB-FVAL = VAR2.
ENDIF.
APPEND BDC_TAB.
ENDFORM.
This two subroutine method to fill the BDC table is preferable because the POPULATE_BDC_TABLE subroutine is reusable throughout all batch input programs.
Example #1 - Change Vendor (Call Transaction Method)
<b>Example #1- Declaration Section</b>
REPORT Y180DM10.
DATA: BDC_TAB LIKE STANDARD TABLE OF
BDCDATA INITIAL SIZE 6 WITH HEADER LINE.
INFILE(20) VALUE /tmp/bc180_file4.
DATA: BEGIN OF INREC.
VENDNUM LIKE LFA1-LIFNR.
STREET LIKE LFA1-STRAS.
END OF INREC.
PARAMETERS: DISPMODE DEFAULT A,
UPDAMODE DEFAULT S.
START-OF-SELECTION.
OPEN DATASET INFILE
FOR INPUT IN TEXT MODE.
DO.
READ DATASET INFILE INTO INREC.
IF SY-SUBRC < > 0. EXIT. ENDIF.
PERFORM FILL_BDC_TAB.
CALL TRANSACTION FK02
USING BDC_TAB
MODE DISPMODE
UPDATE UPDAMODE.
IF SY-SUBRC < > 0.
WRITE: /ERROR.
ENDIF.
ENDDO.
CLOSE DATASET INFILE.
<b>synchronous updating</b>
DO.
PERFORM FILL_BDC_TAB.
CALL TRANSACTION FK02
USING BDC_TAB
MODE N
UPDATE S.
IF SY-SUBRC < > 0.
WRITE: /ERROR.
ENDIF.
ENDDO.
With synchronous updating, we can check SY-SUBRC to determine the success of the transaction and the actual update to the database.
<b>asynchronous updating</b>
DO.
PERFORM FILL_BDC_TAB.
CALL TRANSACTION FK02
USING BDC_TAB
MODE N
UPDATE A.
IF SY-SUBRC < > 0.
WRITE: /ERROR.
ENDIF.
ENDDO.
With asynchronous updating, we can check SY-SUBRC to determine the success of the transaction only, not the actual update to the database.
<b>Error Handling</b>
Write an error report.
Send the record(s) in error to an error file.
Create a batch input session with the record(s) in error.
To store error messages ( CALL TRANSACTION )
data: begin of Tab_Mess occurs 0.
include structure bdcmsgcoll.
data : end of Tab_Mess,
CALL TRANSACTION FK02 USING BDC_TAB MODE N UPDATE S
MESSAGES INTO TAB_MESS.
IF SY-SUBRC NE 0.
WRITE: / Tab_MESS-TCODE, Tab_MESS-DYNUMB, Tab_MESS-MSGTYP ,
Tab_MESS-MSGID.
ENDIF.
<b>i am giving you example for Change Vendor you practice for ur tcode</b>
For our example, we will use the Change Vendor transaction (FK02) to add a street address to an already existing vendor.
<b>Step #1</b>
Use SystemStatus menu path to determine online program name (SAPMF02K), screen number (0110)
<b>Step #2</b>
Use F1 key and Technical Info pushbutton in each screen field to be filled to determine the field name.
<b>Step #3</b>
Determine how to proceed in the transaction
(save the record by clicking on the Save pushbutton or pressing the F11 key).
<b>BDC Table Contents</b>
After researching the transaction we can determine the contents of the BDC table.
PROGRAM DYNPRO DYNBEGIN FNAM FVAL
SAMPF02K 0106 X
RF02K-LIFNR TEST1
RF02K-D0110 X
SAMPF02K 0110 X
LFA1-STRAS 123 Main St.
BDC_OKCODE /11
<b>Batch Input Methods</b>
CALL TRANSACTION USING
STATEMENT
<b>Call transaction - for data transfer</b>Processing batch input data with CALL TRANSACTION USING is the faster of the two recommended data transfer methods. In this method, legacy data is processed inline in your data transfer program.
Syntax:
CALL TRANSACTION <tcode>
USING <bdc_tab>
MODE <mode>
UPDATE <update>
A Display all
E Display errors only
N No display
S Synchronous
A Asynchronous
L Local update
<b>The process flow of CALL TRANSACTION</b>
A program that uses CALL TRANSACTION USING to process legacy data should execute thefollowing steps:
Prepare a BDCDATA structure for the transaction that you wish to run.
Prepare a internal table to store error messages Tab_Mess like structure of BDCMSGCOLL.
With a CALL TRANSACTION USING statement, call the transaction and prepare the BDCDATA structure. For example:
CALL TRANSACTION MM01' USING BDCDATA MODE 'A' UPDATE 'S'. MESSAGES INTO TAB_MESS.
IF SY-SUBRC <> 0.
<Error_handling>.
ENDIF.
<b>Overview of Batch Input Session</b>
The first batch input method is to create a batch input session. It is the processing of this batch input session that updates the database, not the execution of the batch input program.
<b>Reward if usefull</b> -
HI Masters , I need information for file upload program in web dynpro java
Hi masters,
i need some inforamtion and documentation on file upload program in web dynpro javaHi surya,
You can follow this procedure to upload the file
i) Take One Context Attribute named as "D1" of Type "binary".
ii) Take one FileUpload UI Element in the Layout Tab.
iii) Bind FileUpload UI Element's data Property to the taken Context Attribute. Here it is "D1".
iv) Take one Button UI Element in the Layout Tab named "Upload" and in the Action of that Button write the following Code.
v) The following code Generates one Folder in the Server & inside that Folder given file is Uploaded.
File ff=new File("FolderXYZ"); // Creates One Folder with the given Name ( Here Folder name is "FolderXYZ")
ff.mkdir();
try
byte b[]=null;
IWDAttributeInfo objAttinfo=null;
IWDModifiableBinaryType binType=null;
File f=null;
FileOutputStream fos=null;
if(wdContext.currentContextElement().getD1()!=null)
b=wdContext.currentContextElement().getD1();
objAttinfo=wdContext.getNodeInfo().getAttribute(IPrivateAttachView.IContextElement.D1);
binType=(IWDModifiableBinaryType)objAttinfo.getModifiableSimpleType();
f=new File(ff.getName()+"
"+binType.getFileName());
fos=new FileOutputStream(f);
fos.write(b);
fos.flush();
fos.close();
objMessageManager.reportSuccess("File uploaded to server");
} catch (Exception e)
objMessageManager.reportException("Unable to upload file to server, error is:"+e,false);
return;
The Uploaded file is stored in the folder & that folder is stored in the Server's following Path.
<Your Server>\c$\usr\sap\J2E\JC00\j2ee\cluster\server0
You can access your Uploaded file from the following Path
<Your Server>\c$\usr\sap\J2E\JC00\j2ee\cluster\server0\FolderXYZ
Regards
Sagar Ingalwar -
Question about File upload functionality in Weblogic
Hi,
We're currently trying to deploy a web application on the weblogic 12c server (via war file). And the app needs to upload a text file onto the a temperary directory within weblogic server. And on the web page side, we use JQuery File upload plugin.
My question is, on the file receiver side, does weblogic provide any tools to receive the uploaded file and store it?
Thanks very much in advance.Hi,
Before setting the string or xstring to server->response->set_cdata (string) or server->response->set_data (xstring) try this:
CONCATENATE 'attachment;filename=' lv_filename '.xml' INTO lv_string.
* Setting the filename by default
server->response->set_header_field( name = 'Content-Disposition'
value = lv_string ).
Hope this helps.
Regards,
Abhinav -
Need help for file upload - reposted for Steve Muench
Hi Steve,
I have been involved developing a web application that requires a file upload operation. I have studied your example on Upload Text File and Image Example in the Not Yet Documented ADF Sample Applications section. I got the file upload part worked but could not get the original file name to populate the name field..i.e. if I upload myFile.txt to the database, the name field will be myFile.txt (not the name enter by user). Is there a way to capture the filename info? or is it possible to do so within ADF framework? I am using ADF/Struts/JSP with ORDDoc data type. Thanks very much.
BillHello Nani,
You need to change any settings in 'FILE' transaction. This transaction is used to set up Logical file paths. ( In general it will be set already for your system).
You can use the following code.
DATA: LC_LOGICAL_FILENAME_EXPSRC LIKE RCGIEDIAL-IEFILE
VALUE 'EHS_IMP_SOURCES'.
DATA: L_EMERGENCY_FLAG TYPE C.
DATA: L_FILE_FORMAT LIKE FILENAME-FILEFORMAT.
data : X_RCGIEDIAL LIKE RCGIEDIAL occurs 0 with HEADER LINE.
read the default pathname on application server
CALL FUNCTION 'FILE_GET_NAME'
EXPORTING
CLIENT = SY-MANDT
LOGICAL_FILENAME = LC_LOGICAL_FILENAME_EXPSRC
OPERATING_SYSTEM = SY-OPSYS
parameter_1 = ' '
PARAMETER_2 = ' '
USE_PRESENTATION_SERVER = ' '
WITH_FILE_EXTENSION = ' '
USE_BUFFER = ' '
IMPORTING
EMERGENCY_FLAG = L_EMERGENCY_FLAG
FILE_FORMAT = L_FILE_FORMAT
FILE_NAME = X_RCGIEDIAL-IEFILE
EXCEPTIONS
FILE_NOT_FOUND = 1
OTHERS = 2.
write :/ 'file format', L_FILE_FORMAT,
/ 'file name', X_RCGIEDIAL-IEFILE.
Thanks,
Jyothi -
is having a file upload function on a web page a hard thing to do?
i need to do this, but i do not know where to start...
if anyone can help me out/shed some light on this for me that would be greatly appreciated!~!!!
THANKS!No it is not particularly difficult; I let the user select a file on the client filesystem then upload to the server.
The form ENCTYPE must be multipart/form-data:
<FORM NAME="frmUpload" ENCTYPE="multipart/form-data" METHOD="POST" ACTION=...>
Use:
<INPUT TYPE="file" NAME="srcFile" SIZE="15" MAXLENGTH="40">
In my servlet:
verify:
String contentType = request.getHeader("Content-Type");
if (contentType.indexOf("multipart/form-data") < 0) {
...handle error...
String boundary = contentType.substring(contentType.indexOf("boundary=") + 9, contentType.length());
private boolean TransferFile(ServletInputStream is, String srcFile,
String destDir,String caseNo, String boundary, String errorPage,
HttpServletRequest request, HttpServletResponse response) throws ServletException
File pathName = new File(...);
// If the target directory does not already exist then create it.
if (!pathName.exists()) {
pathName.mkdir();
if (!pathName.exists()) { // did mkdir work?
... do lots more checking ...
boolean xferOK = false;
try {
FileOutputStream fout = new FileOutputStream(...);
byte[] nextBytes = null;
byte[] currBytes = null;
while ((nextBytes = ReadLine(is)) != null) {
if (currBytes != null) {
String snippet = "";
if (nextBytes.length - 10 <= boundary.length())
snippet = new String(nextBytes);
if (snippet.indexOf(boundary) < 0)
fout.write(currBytes, 0, currBytes.length);
else
fout.write(currBytes, 0, currBytes.length - 2);
currBytes = nextBytes;
fout.close();
xferOK = true;
catch (IOException ioe) {
return xferOK;
} // TransferFile()
Hope this helps -
hi,
what is the use of file uploading in bdc.
i mean that how can i see that my file was updated or not.
or where updation has happend using this files in both
session method and call transaction method.
i hope u can understood my problem.
hoping for good answer.
thanksTYPE-POOLS : TRUXS.
TYPES : BEGIN OF TYP_OUT,
PLVAR(2) TYPE C,
OTYPE(2) TYPE C,
SEARK(12) TYPE C,
INFTY(4) TYPE C,
SUBTY(4) TYPE C,
ISTAT(1) TYPE C,
BEGDA(10) TYPE C,
ENDDA(10) TYPE C,
RSIGN(1) TYPE C,
RELAT(3) TYPE C,
SCLAS(2) TYPE C,
SOBID(45) TYPE C,
END OF TYP_OUT.
DATA : TA_PP02 TYPE STANDARD TABLE OF TYP_OUT INITIAL SIZE 0,
WA_PP02 TYPE TYP_OUT.
DATA: TA_EXCEL TYPE STANDARD TABLE OF ALSMEX_TABLINE INITIAL SIZE 0,
WA_EXCEL TYPE ALSMEX_TABLINE.
DATA : RAW_DATA TYPE TRUXS_T_TEXT_DATA.
DATA: TA_BDCDATA TYPE STANDARD TABLE OF BDCDATA ,
WA_BDCDATA TYPE BDCDATA,
TA_BDCMESSAGE TYPE TABLE OF BDCMSGCOLL,
WA_BDCMESSAGE TYPE BDCMSGCOLL.
SELECTION-SCREEN : BEGIN OF BLOCK BLK1 WITH FRAME TITLE TEXT-001.
PARAMETERS FILE_N TYPE RLGRAP-FILENAME OBLIGATORY." Path name selected by user with help of Filemngr
SELECTION-SCREEN : END OF BLOCK BLK1 .
AT SELECTION-SCREEN ON VALUE-REQUEST FOR FILE_N.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
FIELD_NAME = 'FILE_N'
IMPORTING
FILE_NAME = FILE_N.
START-OF-SELECTION.
PERFORM UPLOAD.
PERFORM BDC_OPEN.
PERFORM BDC_SCREENS .
PERFORM BDC_CLOSE.
CALL TRANSACTION 'SM35'.
*& Form UPLOAD
text
--> p1 text
<-- p2 text
FORM UPLOAD .
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
I_FIELD_SEPERATOR =
I_LINE_HEADER =
I_TAB_RAW_DATA = RAW_DATA
I_FILENAME = FILE_N
TABLES
I_TAB_CONVERTED_DATA = TA_PP02[]
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. " UPLOAD
*& Form BDC_OPEN
text
--> p1 text
<-- p2 text
FORM BDC_OPEN .
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
CLIENT = SY-MANDT
DEST = FILLER8
GROUP = 'PP02'
HOLDDATE = FILLER8
KEEP = 'X'
USER = SY-UNAME
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. " BDC_OPEN
*& Form BDC_SCREENS
text
--> p1 text
<-- p2 text
FORM BDC_SCREENS .
LOOP AT TA_PP02 INTO WA_PP02.
REFRESH TA_BDCDATA.
PERFORM BDC_DYNPRO USING 'SAPMH5A0' '1000'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'PPHDR-ENDDA'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/00'.
PERFORM BDC_FIELD USING 'PPHDR-PLVAR'
WA_PP02-PLVAR.
'01'.
PERFORM BDC_FIELD USING 'PPHDR-OTYPE'
WA_PP02-OTYPE.
'S'.
PERFORM BDC_FIELD USING 'PM0D1-SEARK'
WA_PP02-SEARK.
PERFORM BDC_FIELD USING 'PPHDR-INFTY'
WA_PP02-INFTY.
PERFORM BDC_FIELD USING 'PPHDR-SUBTY'
WA_PP02-SUBTY.
PERFORM BDC_FIELD USING 'PPHDR-ISTAT'
WA_PP02-ISTAT.
PERFORM BDC_FIELD USING 'PPHDR-BEGDA'
WA_PP02-BEGDA.
PERFORM BDC_FIELD USING 'PPHDR-ENDDA'
WA_PP02-ENDDA.
PERFORM BDC_DYNPRO USING 'SAPMH5A0' '1000'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'PPHDR-PLVAR'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=INSE'.
PERFORM BDC_FIELD USING 'PPHDR-PLVAR'
WA_PP02-PLVAR.
PERFORM BDC_FIELD USING 'PPHDR-OTYPE'
WA_PP02-OTYPE.
PERFORM BDC_FIELD USING 'PM0D1-SEARK'
WA_PP02-SEARK.
PERFORM BDC_FIELD USING 'PPHDR-INFTY'
WA_PP02-INFTY.
PERFORM BDC_FIELD USING 'PPHDR-ISTAT'
WA_PP02-ISTAT.
PERFORM BDC_FIELD USING 'PPHDR-BEGDA'
WA_PP02-BEGDA.
PERFORM BDC_FIELD USING 'PPHDR-ENDDA'
WA_PP02-ENDDA.
PERFORM BDC_DYNPRO USING 'MP100100' '2000'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'P1001-SOBID'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/00'.
PERFORM BDC_FIELD USING 'P1001-BEGDA' WA_PP02-BEGDA.
'01.12.2009'.
PERFORM BDC_FIELD USING 'P1001-ENDDA' WA_PP02-ENDDA.
'31.12.9999'.
PERFORM BDC_FIELD USING 'P1001-RSIGN' WA_PP02-RSIGN.
'A'.
PERFORM BDC_FIELD USING 'P1001-RELAT' WA_PP02-RELAT.
'002'.
PERFORM BDC_FIELD USING 'P1001-SCLAS' WA_PP02-SCLAS.
'S'.
PERFORM BDC_FIELD USING 'P1001-SOBID' WA_PP02-SOBID.
'50001923'.
PERFORM BDC_DYNPRO USING 'MP100100' '2000'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'P1001-BEGDA'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=UPD'.
PERFORM BDC_DYNPRO USING 'SAPMH5A0' '1000'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'PPHDR-PLVAR'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=BACK'.
CALL FUNCTION 'BDC_INSERT'
EXPORTING
TCODE = 'PP02'
TABLES
DYNPROTAB = TA_BDCDATA.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
PERFORM BDC_TRANSACTION USING 'PP02'.
ENDLOOP.
PERFORM CLOSE_GROUP.
ENDFORM. " BDC_SCREENS
*& Form BDC_CLOSE
text
--> p1 text
<-- p2 text
FORM BDC_CLOSE .
CALL FUNCTION 'BDC_CLOSE_GROUP'
EXCEPTIONS
NOT_OPEN = 1
QUEUE_ERROR = 2
OTHERS = 3
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. " BDC_CLOSE
*& Form bdc_dynpro
*text
*-->P_1269 text
*-->P_1270 text
FORM BDC_DYNPRO USING PROGRAM TYPE SY-REPID
DYNPRO TYPE ANY.
WA_BDCDATA-PROGRAM = PROGRAM.
WA_BDCDATA-DYNPRO = DYNPRO.
WA_BDCDATA-DYNBEGIN = 'X'.
APPEND WA_BDCDATA TO TA_BDCDATA.
CLEAR WA_BDCDATA.
ENDFORM. " bdc_dynpro
**& Form bdc_field
*text
*-->P_1329 text
*-->P_1330 text
FORM BDC_FIELD USING FNAM TYPE ANY
FVAL TYPE ANY.
IF FVAL NE ''.
WA_BDCDATA-FNAM = FNAM.
WA_BDCDATA-FVAL = FVAL.
APPEND WA_BDCDATA TO TA_BDCDATA.
CLEAR WA_BDCDATA.
ENDIF.
ENDFORM. " bdc_field -
Need help on File uploading in JSF
Hi All,
i have to upload some document into IBM DB2 Content Management using JSF Portlet.
Is it possible to upload a document( in my case it is an image) using JSF Portlet into IBM DB2 Content Management? and also i need to keep the reference of the uploaded document in DB2 database.
i need some sample code to do this.
the tools i am using are
RAD 6.0 as IDE
IBM DB2 Content Managener 8.3
IBM DB2 8.2
its an urgent requirement please help me out in this regardIf it's possible in Portlets i don't know, but in JSF is possible with the Tomahawk component to upload files.
See
www.myfaces.org
Try it. -
NEED HELP about file handling and searching
Hi guys !!!!!!!!!!!!!!
A) I need a help from u i wrote this programme to read from the file and assign the lines for the string array.
import java.io.*;
public class ReadFile{
public static void main(String[] args){
int i;
BufferedReader file;
String line() = null;
String fileName = "xx.txt";
try {
file = new BufferedReader(new FileReader(fileName));
for(i=1;i<=10;i++){
line(i)= file.readLine();
System.out.println(line(i));
file.close();
} catch (FileNotFoundException e) {
System.out.println("File: " + fileName + " not found.");
} catch(IOException e) {
System.out.println("Error reading data from file: " + fileName);
the thing is it is compiling but when interpritting it gives the error
Exception in thread "main" java.lang.NullPointerException in line(i)= file.readLine();
plese help me on this and
B) i want to know how to search the string array to find 4 letter words.
i'm taking the each element which is line(i) one at a time and search it.
Plese help me on these issues !!!!!!!!!!!!!!!!!!!!!You try to create an array with line(i) (as far as i see) but you dont need to keep each line in memory. As far as i understand you just need to process lines sequentially.. (Null pointer exception is thrown because you did not create your array properly!)
Look at this code:
http://www.java-tips.org/java-se-tips/java.io/reading-text-from-a-file.html
You just need to define process method in that code. (and of course try to understand). So as far as i see, you will check for 4-letter words inside process method!
For detecting 4-character word, you need to extract the words in the line using StringTokenizer:
http://www.java-tips.org/java-se-tips/java.util/how-to-use-stringtokenizer.html
Then you can just just use length() method of String class:
http://java.sun.com/j2se/1.3/docs/api/java/lang/String.html
And if you need more advanced logic for processing the lines(currently seems to be the length of strings), you may try regular expressions:
http://java.sun.com/docs/books/tutorial/essential/regex/index.html
http://www.java-tips.org/java-se-tips/java.util.regex/ -
Hi all;
I have problem which is i down load the image in my table when i upload it it give me error like forbidden 403.
Please help me
thanks.thanks Denes to get interested
I can upload all the doc i want with less than a total cumulated size of 100Mo. But
I think that i've found. After have try to change different values in the SGA and PGA parameters without result, i'm almost sure my problem comes from the size of my temporary tablespace. I'm not Oracle specialist and i didn't expect this tablespace was in use during this operation. I'll make some tests but it should be work if i increase this buffer. But i don't understand, for downloading blob with 4Go size, do you have to fix temp tablespace size to 4Go?
For those who could be interested, there is my code (don't be afraid, there is a lot of comments):
[package client;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
public class DocBlobData {
public DocBlobData(String location, Log myLog, Integer IdBlob) {
myLog.lineWriter("**********************************************");
myLog.lineWriter("********** START document uploading **********");
try {
upLoadFile(location, myLog, (blobDocQuery(myLog, IdBlob)));
myLog.lineWriter("****** COMPLETE upload of this document ******");
myLog.lineWriter("**********************************************");
} catch (Exception e) {
myLog.lineWriter("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
myLog.lineWriter("!!!!!!!! ERROR during upload operation !!!!!!!");
myLog.lineWriter("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
* Take a document find at "location" then execute the query passed
* as parameter for insert or update a blob into the database
public static void upLoadFile(String location, Log myLog,
String query) throws Exception {
Connection conn = Log.oracleConnectionCreation();
File myFile = new File(location.toLowerCase());
InputStream myFileInStream = new FileInputStream(myFile);
try {
PreparedStatement ps = conn.prepareStatement(query);
try {
ps.setBinaryStream(1, myFileInStream, (int)myFile.length());
ps.executeUpdate();
myLog.lineWriter("following file has been uploaded");
myLog.lineWriter("from :", myFile.getAbsolutePath());
myLog.lineWriter("name :", myFile.getName());
} catch (Exception e) {
myLog.lineWriter("!!!!!!!!!! ERROR with following file !!!!!!!!!");
myLog.lineWriter("from :", myFile.getAbsolutePath());
myLog.lineWriter("name :", myFile.getName());
} finally {
ps.close();
} finally {
myFileInStream.close();
conn.close();
* Return the query "insert..." when the ID proposed doesn't already exist
* and return "update..." if the needed ID already exists
public static String blobDocQuery(Log myLog, Integer Id) throws Exception {
Connection conn = Log.oracleConnectionCreation();
String tableDoc = "DOC_BLOB";
String columnDoc = "ABLOB";
String id_columnDoc = "ID_BLOB";
Integer idDoc = Id;
String upDateDoc =
"update " + tableDoc + " set " + id_columnDoc + " = " + idDoc +
", " + columnDoc + " = ? where " + id_columnDoc + " = " + idDoc;
String insertDoc =
"insert into " + tableDoc + " (" + id_columnDoc + ", " +
columnDoc + ")" + " values " + "(" + idDoc + ", ?)";
String testQuery =
"select * from " + tableDoc + " where " + id_columnDoc + " = " +
idDoc;
try {
Statement ps = conn.createStatement();
ResultSet result = ps.executeQuery(testQuery);
if (result.next()) {
/* myLog.lineWriter("The query returned by blobDocQuery is :" +
upDateDoc); */
return upDateDoc;
} else {
/* myLog.lineWriter("The query returned by blobDocQuery is :" +
insertDoc); */
return insertDoc;
} finally {
conn.close();
* Take a repertory path then found the document details in function of its ID
* finally download the document into the repertory from the blob
* and name it with the pattern "type_name.extension"
public static void downloadFile(Log myLog, String location,
Integer Id) throws Exception {
Connection conn = Log.oracleConnectionCreation();
String table = "DOC_BLOB"; // Table for storing the Blob
String column = "ABLOB"; // Column for storing the Blob
String id_column = "ID_BLOB"; // Column for storing the Id
Integer id = Id; // Fix the id wanted
location =
location + "/" + DocDetailData.findTypefromBlobId(myLog, id) +
"_" + DocDetailData.findNamefromBlobId(myLog, id) +
DocDetailData.findExtensionfromBlobId(myLog, id);
File myFile = new File(location.toLowerCase());
FileOutputStream myFileOutStream = new FileOutputStream(myFile);
myLog.lineWriter("**********************************************");
myLog.lineWriter("********* START document downloading *********");
try {
String request =
"select " + column + " from " + table + " where " + id_column +
" = ? ";
PreparedStatement ps = conn.prepareStatement(request);
try {
ps.setInt(1, id);
ResultSet rs = ps.executeQuery();
try {
if (rs.next()) {
InputStream myFileInStream =
rs.getBinaryStream(column);
byte[] buffer = new byte[1024];
int length = 0;
while ((length = myFileInStream.read(buffer)) != -1) {
myFileOutStream.write(buffer, 0, length);
myLog.lineWriter("***** COMPLETE download of this document *****");
myLog.lineWriter("**********************************************");
} finally {
rs.close();
} finally {
ps.close();
} finally {
myFileOutStream.close();
conn.close();
* This main is used for testing purposes
public static void main(String[] args) {
Log myLog =
Log.myLogCreation("c:/Migration Logs/", "Test_DocBlobData.log");
Integer idEntryBlob =
1; // Fix the Id used into the database for the Blob
// Uncomment the following lines for testing the function blobDocQuery(Log,Integer)
/* try {
blobDocQuery(myLog, idEntryBlob);
} catch (Exception f) {
myLog.lineWriter("!!! ERROR during execution of blobDocQuery");
// Uncomment the following lines for testing the function upLoadFile(String,Log,String)
// You must create a document text using Notepad at the root of C with name "test"
/* try {
upLoadFile("c:\\image_vide.GIF", myLog, "update DOC_BLOB set ID_BLOB = 1, ABLOB = ? where ID_BLOB = 1");
//"insert into DOC_BLOB (ID_BLOB, ABLOB) values ( 1, ?)");
} catch (Exception f) {
myLog.lineWriter("!!! ERROR during execution of upLoadFile");
/* try {
downloadFile(myLog, "c:/", 1);
} catch (Exception e) {
myLog.lineWriter("!!! ERROR during execution of downloadFile");
I add just this function quite useful in my case, which enables to circulate through a folder arborescence :
* Enable to progress through a complexe directory and each one of its dependences
* All the documents found into this directory are uploaded into the database
* Their details are loaded too with keeping link between the doc and its details
public void parseFilesNUpLoad(File rootFolder,
Log myLog) throws Exception {
myLog.lineWriter("the root folder is : ",
rootFolder.getAbsolutePath());
if (rootFolder.isDirectory()) {
File[] list = rootFolder.listFiles();
if (list != null) {
for (int i = 0; i < list.length; i++) {
parseFilesNUpLoad(list[i], myLog);
if (list[i].isFile()) {
DocBlobData blobTest =
new DocBlobData(list[i].getAbsolutePath(), myLog,
idEntryBlob);
myLog.lineWriter(" ");
DocDetailData detailTest =
new DocDetailData(list[i].getAbsolutePath(), myLog,
idEntryBlob, idEntryDetails);
myLog.lineWriter(" ");
idEntryBlob = idEntryBlob + 1;
idEntryDetails = idEntryDetails + 1;
} else {
myLog.lineWriter("parseFilesNUpLoad",
"!!! CRITICAL ERROR with the root folder at : " +
rootFolder.getAbsolutePath());
And the last one, for populating the log and create the connection to the DB
[package client;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.text.DateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
public class Log {
private String fileName;
public Log(String name) {
this.fileName = name;
public void lineWriter(String line) {
try {
FileWriter f = new FileWriter(fileName, true);
BufferedWriter bf = new BufferedWriter(f);
Calendar c = Calendar.getInstance();
Date now = c.getTime();
String dateLog =
DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM,
Locale.FRANCE).format(now);
bf.write("[" + dateLog + "] :" + line);
bf.newLine();
bf.close();
} catch (IOException e) {
System.out.println(e.getMessage());
public void lineWriter(String header, String info) {
lineWriter(header + " > " + info);
public void lineWriter(String header, Long info) {
lineWriter(header + " > " + info);
public static Log myLogCreation(String location, String name) {
boolean exists = (new File(location)).exists();
if (!exists) {
(new File(location)).mkdirs();
Log myLog = new Log(location + name);
return myLog;
public static Connection oracleConnectionCreation() throws Exception {
// Register the Oracle JDBC driver
DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
//connecting to the DB
Connection conn =
DriverManager.getConnection("jdbc:oracle:thin:@192.192.20.1:1521:DFLY",
"DFLYDB", "DFLYDB");
// DriverManager.getConnection("jdbc:oracle:thin:@192.192.20.1:1521:DFLY", "DFLYDB", "DFLYDB");
return conn;
cheers,
Tif -
Need help w/ file uploading!
hi! i'm writing a JSP where the client has the possibility to upload image-files
to the server.. anyone have a good way to it? and if so how?
if you are referring me to some java-classes i would like to get proper
information on how to append them in the best way possible...
i've heard about the MaybeUpload package by Weft but there's one thing i
don't understand... in the form you use the <input file=""> tag, but how do i
obtain the file? if use request.getParameter() i would get the path, wouldn't i??
hope you can help me out!read this.
http://www.onjava.com/pub/a/onjava/2001/04/05/upload.html?page=1 -
Help needed on CSV file uploading
Hi All,
I need to upload a csv file in the table through file browse button.For that i have created the below process and function.This method is working perfectly fine when the file size is small.But i need to upload the file of 16 MB size and when i try to upload that file it gives error wwv_flow.accept error.Any expert of APEX please help me out on this error.As i am very new to APEX and i need to get this done as early as possible.Please provide any solution ,i will be really grateful to the person.
function
create or replace function hex_to_decimal
--this function is based on one by Connor McDonald
--http://www.jlcomp.demon.co.uk/faq/base_convert.html
( p_hex_str in varchar2 ) return number
is
v_dec number;
v_hex varchar2(16) := '0123456789ABCDEF';
begin
v_dec := 0;
for indx in 1 .. length(p_hex_str)
loop
v_dec := v_dec * 16 + instr(v_hex,upper(substr(p_hex_str,indx,1)))-1;
end loop;
return v_dec;
end hex_to_decimal;
Process
DECLARE
v_blob_data BLOB;
v_blob_len NUMBER;
v_position NUMBER;
v_clob_data CLOB := 'anything';
dest_offset NUMBER := 1;
src_offset NUMBER := 1;
blob_csid NUMBER := dbms_lob.default_csid;
lang_ctx INTEGER := dbms_lob.default_lang_ctx;
warning INTEGER;
v_raw_chunk RAW(10000);
v_char CHAR(1);
c_chunk_len number := 1;
v_line VARCHAR2 (32767) := NULL;
v_data_array wwv_flow_global.vc_arr2;
v_rows number;
v_sr_no number := 1;
BEGIN
delete from scg_recievables2;
-- Read data from wwv_flow_files
select blob_content into v_blob_data
from wwv_flow_files
where last_updated = (select max(last_updated) from wwv_flow_files where UPDATED_BY = :APP_USER)
and id = (select max(id) from wwv_flow_files where updated_by = :APP_USER);
v_blob_len := dbms_lob.getlength(v_blob_data);
v_position := 1;
-- Read and convert binary to char
WHILE ( v_position <= v_blob_len ) LOOP
dbms_lob.converttoclob(v_clob_data, v_blob_data, v_blob_len, dest_offset,src_offset,blob_csid,lang_ctx,warning);
v_char := dbms_lob.getlength(v_clob_data);
v_line := v_line || v_char;
v_position := v_position + c_chunk_len;
-- When a whole line is retrieved </span>
IF v_char = CHR(10) THEN
-- Convert comma to : to use wwv_flow_utilities
v_line := REPLACE (v_line, ';', ':');
-- Convert each column separated by : into array of data
v_data_array := wwv_flow_utilities.string_to_table (v_line);
if IsNumber(substr(v_data_array(9),1,1)) = 1 then
v_data_array(9) := substr(v_data_array(9),1,11);
else
v_data_array(9) := '01-JAN-1900';
end if;
v_data_array(9) := NVL(v_data_array(9),'01-JAN-1900');
-- Insert data into target table
EXECUTE IMMEDIATE 'insert into scg_recievables2 (Account_receivable_number, the_account_number, bill_history_tran, service_number, item_type, the_amount_billed, the_remaining_amount,source_of_payment)
values (:1,:2,:3,:4,:5,:6,:7,:8,:9)'
USING
v_data_array(1),
v_data_array(2),
v_data_array(3),
v_data_array(4),
v_data_array(5),
v_data_array(6),
v_data_array(7),
v_data_array(8);
-- Clear out
v_line := NULL;
v_sr_no := v_sr_no + 1;
END IF;
END LOOP;
END;You are probably timing out with your web server. Check the server logs to see if there are any errors there..
Thank you,
Tony Miller
Webster, TX
A lady came up to me on the street, pointed at my suede jacket and said "Do you know a cow was murdered to make that jacket?"
"I didn't know there were any witnesses", I replied " Now I'll have to kill you too" -
Need advice about files back up
Could you please tell me how I can easily (I am not technically competent) backup the following:
- Microsoft security updates
- Norton security updates
- other downloaded software program updates
- emails
- Internet "Favourites" list
- desktop display settings
- any other important files you suggest
Your help would be gratefully appreciated.It sounds like you need a disk cloning program similar to the software used by Toshiba for their product recovery discs.
There are several commercial products like Norton Ghost for example but there are also free ones like Terabyte Unlimited CopyWipe:
http://www.terabyteunlimited.com/copywipe.html
Unfortunately I have used neither program so I really can't comment on how good they work.
Richard S.
Maybe you are looking for
-
Unable to install final cut pro on mac pro computer
Hello, I started to use my new MacPro (Please see specs. at bottom of Page) and tried to install Final Cut Studio but never succeeded. I never can go beyond disk "apple loops for soundtrack pro." the application "installer" quits unexpectedly each ti
-
I'm looking to upgrade my '07 iMac to a new Macbook Pro. I'm wondering whether to get the hard drive or flash drive....any suggestions as to which is better? Also, going with the Retina display I lose the DVD drive & would have to go with an external
-
Did anyone realize there are third party stores? I resold a phone back to a third party store for 170 dollars. Bought a case and was told I would be able to use the gift card towards my bill. Well apparently I can't because it is a third party store
-
We want to separate ABAP+JAVA, or move ABAP or JAVA to another server
Hello, I want to separate my instance dual stak ABAP+JAVA, I don't lnow what's the better procedure or move ABAP or move JAVA, both stay in one server:sapnwd01 (it have BI,EP components) We wear Solaris 5.10, Oracle 10.2.0.4, SAP NetWeaver 7.0 (ABAP+
-
SCCM Inventory + WMI Classes
Hi, I have received a below request from my client, and due to my lack of knowledge i am unable to answer this query. Kindly guide me to right direction. Can you please confirm which of the following inventory data we are capturing in SCCM? Note tha