Error!! uploading .txt file using WS_upload
Hi Friends,
I am trying to upload a .txt file with 5 fields into a ztable using WS_upload. In debug mode i see that the internal table itab has all the fields clustered together seperated by a # symbol. How do i remove this # symbol so that i can upload it into ztable properly .
For eg the error i m getting is
ibm#1042#krj#04-19-2006#PS. All these 5 fields get clustered under material column and not in their respective columns.
Your opinion and advice is greatly appreciated .
Thank you
Suppose you have the data from the file in i_text and i_vendor is a structure similar to the database, then you use the following logic to split the text with hash as delimiter.
loop at i_text.
split i_text-text at '#' into i_vendor-lifnr
i_vendor-ekorg
i_vendor-ktokd
i_vendor-name1
i_vendor-sortl
i_vendor-land1
i_vendor-spras
i_vendor-waers.
append i_vendor.
clear :i_vendor,
i_text.
endloop.
Let me send you a sample code. Let me know if this helps.
Award points if the answer helped you !
Session Method: ( Batch Input)
3 Function Modules are there.
1) BDC_OPEN_GROUP
2) BDC_INSERT
3) BDC_CLOSE_GROUP
Instead of all the Call Transactions we use the Function modules here.
1) Go for MK01
2) Go for recording. M4567,0001,0001 enter; test1, abcd, us, en, enter; usdollars; save.
3) Save and come back.
4) Select Vendor and Click on PROGRAM button . Stest_01
5) Select Transfer from recording button.
6) Save as local object
7) Copy the code into a Report program and execute it.
Example:
1) Create a text field having the following entries
t3456,0001,0001,testt3456,abcd123,US,E,USD and save the entries for 4-5 lines of these type.
2) Create a Program.
Report ZBDC_MK01.
*& Report ZBDC_MK01
REPORT ZBDC_MK01.
* Internal table for file
data : begin of i_text occurs 0,
text(255) type c,
end of i_text.
* Internal table for MK01 Transaction
data : begin of i_vendor occurs 0,
lifnr(10) type c,
ekorg(4) type c,
ktokd(4) type c,
name1(40) type c,
sortl(10) type c,
land1(3) type c,
spras(1) type c,
waers(3) type c,
end of i_vendor.
* Internal table for BDCDATA
data i_bdcdata like bdcdata occurs 0 with header line.
data : v_repid like sy-repid.
parameters p_file like rlgrap-filename.
INITIALIZATION.
v_repid = sy-repid.
at selection-screen on value-request for p_file.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = v_repid
* * DYNPRO_NUMBER = SYST-DYNNR
* FIELD_NAME = ' '
IMPORTING
FILE_NAME = p_file
start-of-selection.
* Get the data from file to internal table
perform get_data.
* Open the session
perform open_session.
* Process the bdcdata
perform process_bdcdata.
* Call the close_group
perform close_group.
*& Form get_data
* WS_UPLOAD FM
FORM get_data .
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
* CODEPAGE = ' '
FILENAME = p_file
FILETYPE = 'ASC'
* HEADLEN = ' '
* LINE_EXIT = ' '
* TRUNCLEN = ' '
* USER_FORM = ' '
* USER_PROG = ' '
* DAT_D_FORMAT = ' '
* IMPORTING
* FILELENGTH =
TABLES
DATA_TAB = i_text
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 ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
else.
loop at i_text.
split i_text-text at ',' into i_vendor-lifnr
i_vendor-ekorg
i_vendor-ktokd
i_vendor-name1
i_vendor-sortl
i_vendor-land1
i_vendor-spras
i_vendor-waers.
append i_vendor.
clear :i_vendor,
i_text.
endloop.
endif.
free: i_text.
ENDFORM. " get_data
*& Form open_session
* text
FORM open_session .
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
CLIENT = SY-MANDT
* DEST = FILLER8
GROUP = 'VENDOR_MK01'
* HOLDDATE = FILLER8
KEEP = 'X'
USER = sy-uname
* RECORD = FILLER1
* PROG = SY-CPROG
* IMPORTING
* QID =
EXCEPTIONS
CLIENT_INVALID = 1
DESTINATION_INVALID = 2
GROUP_INVALID = 3
GROUP_IS_LOCKED = 4
HOLDDATE_INVALID = 5
INTERNAL_ERROR = 6
QUEUE_ERROR = 7
RUNNING = 8
SYSTEM_LOCK_ERROR = 9
USER_INVALID = 10
OTHERS = 11
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. " open_session
*& Form process_bdcdata
* BDCDATA
FORM process_bdcdata .
loop at i_vendor.
perform bdc_dynpro using 'SAPMF02K' '0107'.
perform bdc_field using 'BDC_CURSOR'
'RF02K-KTOKK'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RF02K-LIFNR'
i_vendor-lifnr.
perform bdc_field using 'RF02K-EKORG'
i_vendor-ekorg.
perform bdc_field using 'RF02K-KTOKK'
i_vendor-ktokd.
perform bdc_dynpro using 'SAPMF02K' '0110'.
perform bdc_field using 'BDC_CURSOR'
'LFA1-SPRAS'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'LFA1-NAME1'
i_vendor-name1.
perform bdc_field using 'LFA1-SORTL'
i_vendor-sortl.
perform bdc_field using 'LFA1-LAND1'
i_vendor-land1.
perform bdc_field using 'LFA1-SPRAS'
i_vendor-spras.
perform bdc_dynpro using 'SAPMF02K' '0120'.
perform bdc_field using 'BDC_CURSOR'
'LFA1-KUNNR'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPMF02K' '0130'.
perform bdc_field using 'BDC_CURSOR'
'LFBK-BANKS(01)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_dynpro using 'SAPMF02K' '0310'.
perform bdc_field using 'BDC_CURSOR'
'LFM1-WAERS'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'LFM1-WAERS'
i_vendor-waers.
perform bdc_dynpro using 'SAPMF02K' '0320'.
perform bdc_field using 'BDC_CURSOR'
'RF02K-LIFNR'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_dynpro using 'SAPLSPO1' '0300'.
perform bdc_field using 'BDC_OKCODE'
'=YES'.
* Call the transaction code.
perform bdc_insert.
refresh i_bdcdata.
endloop.
ENDFORM. " process_bdcdata
*& Form bdc_dynpro
* text
* -->P_0264 text
* -->P_0265 text
FORM bdc_dynpro USING p_prog
p_scrn.
clear i_bdcdata.
i_bdcdata-program = p_prog.
i_bdcdata-dynpro = p_scrn.
i_bdcdata-dynbegin = 'X'.
append i_bdcdata.
ENDFORM. " bdc_dynpro
*& Form bdc_field
* text
FORM bdc_field USING p_fnam
p_fval.
clear i_bdcdata.
i_bdcdata-fnam = p_fnam.
i_bdcdata-fval = p_fval.
append i_bdcdata.
ENDFORM. " bdc_field
*& Form bdc_insert
* text
FORM bdc_insert .
CALL FUNCTION 'BDC_INSERT'
EXPORTING
TCODE = 'MK01'
* POST_LOCAL = NOVBLOCAL
* PRINTING = NOPRINT
* SIMUBATCH = ' '
* CTUPARAMS = ' '
TABLES
DYNPROTAB = i_bdcdata
EXCEPTIONS
INTERNAL_ERROR = 1
NOT_OPEN = 2
QUEUE_ERROR = 3
TCODE_INVALID = 4
PRINTING_INVALID = 5
POSTING_INVALID = 6
OTHERS = 7
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_insert
*& Form close_group
* text
* --> p1 text
* <-- p2 text
FORM close_group .
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. " close_group
4) Save and activate.
5) Go to SM35 and see the session created. Vendor_MK01 (group name which was given)
6) Need to go to SM35. Select the Session name and Click on Process. Select BACKGROUND.
7) Click on PROCESSED Tab.
8) For seeing the log file select the session and click on LOG. Click on Display.
Difference between Call Transaction and Sessions Method.:
1) In CT if mode is ¡¥A¡¦ then there wont be log messages. In sessions method we can get log messages in Foreground and Background too.
2) In session method until and unless session Is created it wont update the data. But in CT data is updated immediately.
3) In CT for log messages have to write BDCMSGCOLL structure and Format_Messages function module. Logs are created automatically in Session method.
4) Data UPDATION in CT is Asynchronous. In Session method its Synchronous.
5) In CT we have to split the file. In Session method we need not split the file.
6) In CT we use BEND in Session we have to use END
Real time most of the times its SESSION Method.
Use CT method when:
a) Run time Validation. Example: We are creating a sales order. Here we are validating when selecting Payment Terms etc.
DIRECT INPUT Method:
If anything modified in SAP transaction don¡¦t use DI method. Updation is very fast.
There is no Restart mechanism in DI method.
Ex: have 10 records. 6,7 are error. In session method we needent go to the file. We have to go to BI and process again. Process in Foreground and during this time change at run time.
We need to go for the file. Delete the first files, last files and then upload the data and run again.
Main Transaction Code for DI is SXDB
1) Click on GoTo-----³ DX Tools
2) Object type---Select G/L Account ; Task type: Load Data; Program type: Batch Input; Program: RFBISA00 .
Q) How to copy files from SAP server to local?
Ans) Bcos we don¡¦t get authorization for AL11 transaction. If we know file directory and File name. We can see structure.
In SXDB.
1) Click on GoTo-----³ DX Tools
2) Object type---Select G/L Account (BUS 3006) ; Task type: Load Data; Program type: Batch Input; Program: RFBISA00 .
Go for Copy file. Give the Application Server file name and also he presentation server name and location.
*& Report ZBDC_MM01
REPORT ZBDC_MM01.
* Constants
constants : c_x type c value 'X'.
* Internal table for file
data : begin of i_text occurs 0,
text(255) type c,
end of i_text.
* iNTERNAL TABLE FOR MATERIAL LOAD
DATA : BEGIN OF I_MATERIAL OCCURS 0,
MATNR(18) TYPE C,
MBRSH(1) TYPE C,
MTART(4) TYPE C,
MAKTX(40) TYPE C,
MEINS(3) TYPE C,
MAKTL(3) TYPE C,
END OF I_MATERIAL.
* INTERNAL TABLE FOR BDCDATA
DATA I_BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
* internal table for for logs
data i_bdcmsg like bdcmsgcoll occurs 0 with header line.
* Report id
data : v_repid like sy-repid,
v_msg(255) type c.
* Internal tabel for log records
data : begin of i_log occurs 0,
text(255) type c,
end of i_log.
* Selection-screen
selection-screen : begin of block blk with frame title text-001.
parameter p_file like rlgrap-filename.
selection-screen : end of block blk.
* fill the defaut value
INITIALIZATION.
v_repid = sy-repid.
* F4 value for File
at selection-screen on value-request for p_file.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = v_repid
* DYNPRO_NUMBER = SYST-DYNNR
* FIELD_NAME = ' '
IMPORTING
FILE_NAME = p_file
start-of-selection.
* get the data from file to internal table
perform get_data_itab.
* tO PROCEESS BDCDATA
PERFORM PROCESS_BDCDATA.
end-of-selection.
* Process the data into file
perform download_file.
*& Form get_data_itab
* ws_upload
FORM get_data_itab .
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
* CODEPAGE = ' '
FILENAME = P_FILE
FILETYPE = 'ASC'
* HEADLEN = ' '
* LINE_EXIT = ' '
* TRUNCLEN = ' '
* USER_FORM = ' '
* USER_PROG = ' '
* DAT_D_FORMAT = ' '
* IMPORTING
* FILELENGTH =
TABLES
DATA_TAB = I_TEXT
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 ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ELSE.
LOOP AT I_TEXT.
SPLIT I_TEXT-TEXT AT ',' INTO I_MATERIAL-MATNR
I_MATERIAL-MBRSH
I_MATERIAL-MTART
I_MATERIAL-MAKTX
I_MATERIAL-MEINS
I_MATERIAL-MAKTL.
APPEND I_MATERIAL.
CLEAR : I_MATERIAL,
I_TEXT.
ENDLOOP.
ENDIF.
ENDFORM. " get_data_itab
*& Form PROCESS_BDCDATA
* bdcdata
FORM PROCESS_BDCDATA .
LOOP AT I_MATERIAL.
* First Screen
perform f_get_program using 'SAPLMGMM' '0060'.
perform f_get_field using 'BDC_CURSOR' 'RMMG1-MATNR'.
perform f_get_field using 'BDC_OKCODE' '=AUSW'.
perform f_get_field using 'RMMG1-MATNR' i_material-matnr.
perform f_get_field using 'RMMG1-MBRSH' i_material-mbrsh.
perform f_get_field using 'RMMG1-MTART' i_material-mtart.
* Second screen
perform f_get_program using 'SAPLMGMM' '0070'.
perform f_get_field using 'BDC_CURSOR' 'MSICHTAUSW-DYTXT(01)'.
perform f_get_field using 'BDC_OKCODE' '=ENTR'.
perform f_get_field using 'MSICHTAUSW-KZSEL(01)' c_x.
* third screen
perform f_get_program using 'SAPLMGMM' '4004'.
perform f_get_field using 'BDC_CURSOR' 'MAKT-MAKTX'.
perform f_get_field using 'BDC_OKCODE' '=BU'.
perform f_get_field using 'MAKT-MAKTX' i_material-maktx.
perform f_get_field using 'MARA-MEINS' i_material-meins.
perform f_get_field using 'MARA-MATKL' i_material-maktl.
** call transaction
call transaction 'MM01'
using i_bdcdata
mode 'N'
messages into i_bdcmsg.
refresh i_bdcdata.
* Log message
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = SY-MSGID
LANG = '-E'
NO = SY-MSGNO
V1 = SY-MSGV1
V2 = SY-MSGV2
V3 = SY-MSGV3
V4 = SY-MSGV4
IMPORTING
MSG = v_msg
EXCEPTIONS
NOT_FOUND = 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.
i_log-text = v_msg.
append i_log.
clear: i_log,
v_msg.
ENDLOOP.
ENDFORM. " PROCESS_BDCDATA
*& Form f_get_program
* Program ,Screen no, Dynbegin
* -->P_0206 text
* -->P_0207 text
FORM f_get_program USING p_prog
p_scrn.
clear : i_bdcdata.
i_bdcdata-program = p_prog.
i_bdcdata-dynpro = p_scrn.
i_bdcdata-dynbegin = c_x.
append i_bdcdata.
ENDFORM. " f_get_program
*& Form f_get_field
* field name ,field value
* -->P_0217 text
* -->P_0218 text
FORM f_get_field USING p_fnam
p_fval.
clear i_bdcdata.
i_bdcdata-fnam = p_fnam.
i_bdcdata-fval = p_fval.
append i_bdcdata.
ENDFORM. " f_get_field
*& Form download_file
* text
* --> p1 text
* <-- p2 text
FORM download_file .
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
* BIN_FILESIZE = ' '
* CODEPAGE = ' '
FILENAME =
'C:Documents and SettingsAdministratorDesktoplog.txt'
FILETYPE = 'ASC'
* MODE = ' '
* WK1_N_FORMAT = ' '
* WK1_N_SIZE = ' '
* WK1_T_FORMAT = ' '
* WK1_T_SIZE = ' '
* COL_SELECT = ' '
* COL_SELECTMASK = ' '
* NO_AUTH_CHECK = ' '
* IMPORTING
* FILELENGTH =
TABLES
DATA_TAB = i_log
* FIELDNAMES =
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_WRITE_ERROR = 2
INVALID_FILESIZE = 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 ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " download_file
Similar Messages
-
Problem in uploading a file using Ws_upload.
Hi Experts,
I am using WS_UPLOAD for uploading .xls file into SAP Standard table T558A.
Problem is file is not uploaded to DB table.....getting error like
ERROR DURING FILE UPLOAD/DOWNLOAD as pop up message.....
can any boady please help on this issue.
Regards,
Praveena.Hi,
If you want to upload the data using EXCEL file use the function module ALSM_EXCEL_TO_INTERNAL_TABLE.
Examples for ALSM_EXCEL_TO_INTERNAL_TABLE.
http://wiki.sdn.sap.com/wiki/display/Snippets/Howtouse+FM'ALSM_EXCEL_TO_INTERNAL_TABLE' -
Hi All,
upload failed your changes were saved but could not be uploaded because of an error. you may be able to upload this file using server web page. save a copy button.
This is the issue which I am facing while working with SharePoint 2010. In a sharePoint 2010 document library I am having an excel file and I am trying to open it from Windows 7 and is office 2010.
I cam e across few suggestion as mentined below but unable to find the location where to do
Go to Resource Policies > Web >
Rewriting > Custom Headers > (if 'Custom Headers' is not visible, click
Customize on the right top to enable the view).
Create a new policy with the Resource as <fully qualified domain name of the SharePoint server:*/*> (for example https://sharepoint.juniper.net:*/* ).
Create the action as Allow Custom Headers.
Apply the settings to the required roles.
Please suggest.Hi rkarteek
All things you have to do is as follows:
1. Open regedit.exe
2. Naviagate to following key:
[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Office\14.0\Common\Internet]
3. Click Edit Menu -> New -> DWORD with name of "FSSHTTPOff"
(without quotes)
4. Click on "FSSHTTPOff" and enter value of 1
5.
Close any Office Applications and browser sessions
6. Try to reopen your document (no more read only or failure to upload)
have a nice day! -
Uploading image file using tcode se78 occuring some Error
Hai Gurus
I am uploading image file using tcode se78 but while Uploading it giving some error i cant resolve the problem so any one help me plz
Error "Graphic LOGO could not be saved (2LOGO)"
Regards
SelvendranHai
Thanks
I had done in all method but i can't save it
error is coming ..so plz help me to upload the image
Error "Graphic LOGO could not be saved (2LOGO)"
Regards
Selvendran -
I am trying to upload a file using PRC, I am using .Net 2.0. Here is my code
IRemoteSession rSession = base.portletContext.GetRemotePortalSession();
IDocumentManager dManager = rSession.GetDocumentManager();
IRemoteDocument rDocument = dManager.CreateRemoteDocument(4079, 217, Server.MapPath("temp.txt"));
rDocument.SetType("http://www.plumtree.com/dtm/mime", "text/plain");
rDocument.SetOverrideName("Trying to upload");
rDocument.SetOverrideDescription("No Description");
int docID = -1;
try
docID = rDocument.Save();
catch (Exception ex)
Response.Write(ex);
Response.Write("<BR><BR>" + docID);
The code always falis with following errorPlumtree.Remote.PRC.PortalException: Exception of type 'Plumtree.Remote.PRC.PortalException' was thrown. ---> System.Web.Services.Protocols.SoapException: java.rmi.RemoteException: Error in function PTDataSource.ImportDocument (vDocumentLocationBagAsXML == '1001text/plainD:\Plumtree\RemotePortlets\FileContainer\temp.txt', lDocumentTypeID == 104, pCard == com.plumtree.server.impl.directory.PTCard@65e83f, bSummarize == false, pProvider == null): Error in function PTDataSource.ImportDocument (vDocumentLocationBagAsXML == text/plain1001D:\Plumtree\RemotePortlets\FileContainer\temp.txt, lDocumentTypeID == 104, pCard == com.plumtree.server.impl.directory.PTCard@65e83f, bSummarize == false, pProvider == null): Error in function SOAPEnvelope.Restore (arrayText == [B@7aa6f0): SOAP fault: faultcode='soapenv:Server.userException' faultstring='java.lang.NullPointerException' at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall) at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) at com.plumtree.remote.prc.soap.DirectoryAPIService.submitRemoteDocumentMerge(String sLoginToken, Int32 nDataSourceID, Int32[] nFolderIDs, String sLocation, String sTypeID, String sTypeNameSpace, String sOverrideName, String sOverrideDesc, String sLanguage, Boolean bMergeACLs) at com.plumtree.remote.prc.soap.DirectoryProcedures.SubmitRemoteDocument(String sLoginToken, Int32 nDataSourceID, Int32[] nFolderIDs, String sLocation, String sTypeID, String sTypeNameSpace, String sOverrideName, String sOverrideDesc, String sLanguage, Boolean bMergeACLs) --- End of inner exception stack trace --- at Plumtree.Remote.PRC.DocumentWrapper.Save() at Gov.NSW.CCSU.Portal.FileContainer.FileBrowser.cmdUpload_Click(Object sender, EventArgs e) in D:\MyWorks\CCSU\Portal\ALUI\Portlets\FileContainer\FileContainer\FileBrowser.aspx.cs:line 48
I thought that there might be some problem in getting the file from the client,
so i used my own uploading routines for copying the
file in current App's directory,
even then i get the same error.
Any help is greatly appreciated!!!
Thanks,
Avi
[pre]Hello Dmitry,
Thanks a ton for your patience!
I have already tried step 1, still same error.
I have already tried step 2 and it works using Portal UI
Knowledge Directory-> Going to that specific folder - having ID 4079 -> selecting same file from same network share
Followed Step 3 and the result confirmed that I am using the correct DataSourceID
Here is the small piece of code
<Code>
IRemoteSession rSession = this.portletContext.GetRemotePortalSession();
IObjectManager oManager = rSession.GetObjectManager(ObjectClass.DataSource);
IObjectQuery oQuery = oManager.QueryObjects();
for (int i = 0; i < oQuery.GetRowCount(); i++)
Response.Write(oQuery.GetRow(i).GetName() + "-" + oQuery.GetRow(i).GetID() + "<BR>");
</Code>
Step 4 - We are not using ALI Content Service Windows File. Do you reckon I require this for Upload?
Step 5 – I ran PT Spy, reproduced the problem but couldn’t find any exception(On the portal server).
Let me give you a little insight of our dev environment here. Portal Server along with Remote Apps are installed on ServerX and Studio, Content Upload, Collaboration, Publisher are installed on ServerY. To neglect any permission issue I created the network share on ServerY as the Content Upload Service runs on Server Y.
Running PT Spy on other server (running Content Upload Service) showed few errors but I can not make much sense out of those.
What I can understand is
1. It makes the call to [submitRemoteDocumentMerge] with correct parameters.
<Parameter List>
nDataSourceID = 217
nFolderIDs = (1) { 4079 }
sLocation = \\ccsu-gmt-952.gnet.ccsu.nsw.gov.au\TempShare\temp.txt
sTypeID = text/plain
sTypeNameSpace = http://www.plumtree.com/dtm/mime
sOverrideName = Trying to upload
sOverrideDesc = No Description
sLanguage = (null)
bMergeACLs = false <ptLogMsgEnd>
</Parameter List>
2. But the call fails with following stack trace (copied partially)
<Stack Trace>
com.plumtree.server.impl.webservice.PTWebService SOAP call failed, an internal error occured on the remote server. Attempting to parse the SOAP fault for detailed error info. Web Service='File Upload Web Service', SOAP Action='urn:plumtree-com:DocumentProvider.AttachToDocument', URL='http://ServerY:11910/ptupload/services/DocumentProvider'
</Stack Trace>
3. Next line shows following Stack Trace
<Stack Trace>
com.plumtree.server.impl.soap.SOAPEnvelope Error in function SOAPEnvelope.Restore (arrayText == [B@7bd8a5): SOAP fault: faultcode='soapenv:Server.userException' faultstring='java.lang.NullPointerException'
com.plumtree.server.impl.soap.OpenSoapException: SOAP fault: faultcode='soapenv:Server.userException' faultstring='java.lang.NullPointerException'
</Stack Trace>
4. Then it starts giving the same error again.
5. I thought it might be expecting a value in Language Parameter, so I Passed US-en but still it screams.
I can send you the entire trace file if that helps.
Thanks a lot for helping so far, Plumtree is pretty new to me and I am finding it difficult to get my steps going.
Thanks,
Avi
Edited by asolvent at 03/24/2008 10:05 PM -
Uploading .txt file to z table
Hai Friends,
I want to upload a .txt file to Z table which contains around 27 fields. but .txt file contains data in two lines by as follows.
4.5 2.36 21.56 25 36.14 47.00 145.3 1247.6
10.2 4.6 23.5 589.1 20.1 45.6
Is it possible to upload the .txt file.Hi,
It is possible to upload txt file to ztable. You need to write small program for that.
Please see the example code below. Here from excel they are converting to internal table, use 'GUI_UPLOAD' to convert text file data to internal table and use this internal table to upload data into ztable. use MODIFY ZTABLE FROM TABLE ITAB.
Also maintain the internal table structure and structure of the ZTABLE should match.
**& Report Z_DEMO_FILL_TABLE
report z_demo_fill_table no standard page heading line-size 255.
selection-screen begin of block b1 with frame title text-003.
selection-screen skip.
*File Name
selection-screen begin of line.
selection-screen comment 5(28) text-001 for field p_file.
parameters: p_file type rlgrap-filename.
selection-screen end of line.
selection-screen skip.
selection-screen end of block b1.
data declarations.
*data: get_po_header type standard table of BAPIEKKOC,
get_PO_HEADER_ADD_DATA type standard table of BAPIEKKOA,
get_PO_ITEMS type standard table of BAPIEKPOC,
get_PO_ITEM_ADD_DATA type standard table of BAPIEKPOA,
data: get_poheader type standard table of bapimepoheader,
get_poitem type standard table of bapimepoitem,
it_data type table of alsmex_tabline initial size 0.
data: wa_poheader like line of get_poheader,
wa_poitem like line of get_poitem,
wa_data like line of it_data,
*tables used for catching messages returned by bapi
gt_return type standard table of bapiret2,
gt_return1 type standard table of bapiret2.
types: begin of x_po_tab,
doc_date type bapimepoheader-doc_date,
comp_code type bapimepoheader-comp_code,
purch_org type bapimepoheader-purch_org,
pur_group type bapimepoheader-pur_group,
vendor type bapimepoheader-vendor,
po_number type bapimepoheader-po_number,
pmnttrms type bapimepoheader-pmnttrms,
po_item type bapimepoitem-po_item,
material type bapimepoitem-material,
plant type bapimepoitem-plant,
stge_loc type bapimepoitem-stge_loc,
tax_code type bapimepoitem-tax_code,
end of x_po_tab.
Search help for file *
at selection-screen on value-request for p_file.
call function 'F4_FILENAME'
exporting
PROGRAM_NAME = SYST-CPROG
DYNPRO_NUMBER = SYST-DYNNR
field_name = 'P_FILE'
importing
file_name = p_file.
START-OF-SELECTION *
start-of-selection.
perform for uploading Excel file
perform upload_file_path.
perform for transfering Excel data to Internal table
perform excel_to_itab.
perform int_process.
*& Form upload_file_path
text
--> p1 text
<-- p2 text
form upload_file_path .
call function 'ALSM_EXCEL_TO_INTERNAL_TABLE'
exporting
filename = p_file
i_begin_col = 1
i_begin_row = 1
i_end_col = 12
i_end_row = 5000
tables
intern = it_data
exceptions
inconsistent_parameters = 1
upload_ole = 2
others = 3.
if sy-subrc <> 0.
message e000(zdbm) with 'Error in getting filename'.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
endform. " upload_file_path
*& Form excel_to_itab
text
--> p1 text
<-- p2 text
form excel_to_itab .
loop at it_data into wa_data.
at new row.
clear: wa_poheader, wa_poitem.
endat.
case wa_data-col.
when '001'.
move wa_data-value to wa_poheader-doc_date.
when '002'.
move wa_data-value to wa_poheader-comp_code.
when '003'.
move wa_data-value to wa_poheader-purch_org.
when '004'.
move wa_data-value to wa_poheader-pur_group.
when '005'.
move wa_data-value to wa_poheader-vendor.
when '006'.
move wa_data-value to wa_poheader-po_number.
when '007'.
move wa_data-value to wa_poheader-pmnttrms.
when '008'.
move wa_data-value to wa_poitem-po_item.
when '009'.
move wa_data-value to wa_poitem-material.
when '010'.
move wa_data-value to wa_poitem-plant.
when '011'.
move wa_data-value to wa_poitem-stge_loc.
when '012'.
move wa_data-value to wa_poitem-tax_code.
endcase.
at end of row.
append wa_poheader to get_poheader.
append wa_poitem to get_poitem.
endat.
clear: wa_data.
endloop.
endform. " excel_to_itab
*& Form Int_process
text
--> p1 text
<-- p2 text
form int_process .
loop at get_poheader into wa_poheader.
read table get_poitem into wa_poitem index 1.
call function 'BAPI_PO_CREATE1'
exporting
poheader = wa_poheader
POHEADERX =
POADDRVENDOR =
TESTRUN =
MEMORY_UNCOMPLETE =
MEMORY_COMPLETE =
POEXPIMPHEADER =
POEXPIMPHEADERX =
VERSIONS =
NO_MESSAGING =
NO_MESSAGE_REQ =
NO_AUTHORITY =
NO_PRICE_FROM_PO =
IMPORTING
EXPPURCHASEORDER =
EXPHEADER =
EXPPOEXPIMPHEADER =
tables
RETURN =
poitem = get_poitem
POITEMX =
POADDRDELIVERY =
POSCHEDULE =
POSCHEDULEX =
POACCOUNT =
POACCOUNTPROFITSEGMENT =
POACCOUNTX =
POCONDHEADER =
POCONDHEADERX =
POCOND =
POCONDX =
POLIMITS =
POCONTRACTLIMITS =
POSERVICES =
POSRVACCESSVALUES =
POSERVICESTEXT =
EXTENSIONIN =
EXTENSIONOUT =
POEXPIMPITEM =
POEXPIMPITEMX =
POTEXTHEADER =
POTEXTITEM =
ALLVERSIONS =
POPARTNER =
POCOMPONENTS =
POCOMPONENTSX =
POSHIPPING =
POSHIPPINGX =
POSHIPPINGEXP =
endloop.
endform. " Int_process -
Problem in Uploading excel file using WebDynpro for Java
Hi All
I have followed for Uploading excel file using WebDynpro for Java added by Tulasi Palnati
I done all, but I'm getting 500 Exception please contact u r system admin meag at run time also Jxl/Workbook class not found msag but i downloaded Jxl.jar file and there is no error signals in coding part. How can I solve the Problem.
Thanks
PolakaPlease ask the people in the Web Dynpro Java forum for a solution.
-
Upload .txt file into Database Table
Hi,
I was wondering if someone could please point me in the right direction. I've been looking around the forum but can't find anything to help me achieve the following.
I would like to be able to upload a .txt file using a webpage. Then store the information inside this file into database tables.
eg. contents of mytextfile.txt:
richard
10 anywhere street, anytown, somewhere
111 222 333 444
joe
9 somestreet, elsewhere
999 888 777 666
peter
214 nearby lane, overhere
555 555 555 555
I would like to insert this data into a table.
eg. table name = CONTACTS
userid = primary key (using sequence)
username = (line 1 - richard, joe, peter)
address = (line 2)
phone_no = (line 3)
As you can see the records will appear 1 at a time and will have a blank line between records. Is there anyway for me to upload a file like this and have it placed into tables?
I have seen http://otn.oracle.com/products/database/htmldb/howtos/howto_file_upload.html but this seems to be for uploading a whole file and downloading the same file, rather than extracting data from the file.
I hope I have managed to explain my problem.
Many thanks,
Richard.Richard,
HTML DB allows you to upload CSV files via the Data Workshop. That data would then be parsed and inserted into a specific table. Alternatively, if you have your data in an Excel spreadsheet, and it is less than 32k, you can copy & paste the data directly into HTML DB's Data Workshop, which will then parse and import it into the Oracle database.
The one obstacle you may have to overcome is converting your data from the format you outlined to CSV format. Specifically, you would have to make this:
richard
10 anywhere street, anytown, somewhere
111 222 333 444
Look something like this:
"richard","10 anywhere street, anytown, somewhere","111 222 333 444"
Hope this helps,
- Scott - -
BEx Analyzer 7.0: Uploading txt-file
Hello experts,
when I start a query and want to upload a txt-file for variable selection, it takes minutes and hours (depending on how many entries are in the txt-file).
e.g. when using this BEx Analyzer 3.x and uploading txt-file with 60.000 entries for variable selection it takes just a few seconds. When using BEx Anlayzer 7.0 (selection upload) it takes 30 minutes an more.
Is there any solution for this?
Thanks in advanceDear Toni,
Functionality has changed litle bit in BEx 7.0
From Clipboard:
1. After clicking on the "Select from List" click on the "More >>" button.
2. Click on the right box to set the focus.
3. Past (Ctrl + V).
From txt file:
1. After clicking on the "Select from List" click on the "More >>" button.
2. Right click on the right box and choose "Upload selections" option.
3. Select the txt file you want to import.
Regards,
Arvind -
URGENT: Is it possible to upload multiple files using STRUTS
Hi,
Is it possible to upload multiple files using STRUTS.
I am able to upload a single file. But how do i upload multiple files ??
upload.jsp
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-template.tld" prefix="template" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<html:html>
<head>
<title>New Page 1</title>
</head>
<body>
<html:form action="/secure/uploadFile.do" enctype="multipart/form-data" method="POST" type="com.smartstream.webconnect.user.actions.UploadActionForm">
<p>File to upload
<html:file property="fileUpload" size="20"/></p>
<p><html:submit/></p>
</html:form>
</body>
</html:html>
UploadAction.java
public class UploadAction extends BaseAction {
Logger log = Logger.getLogger(AttachMessageAction.class);
public ActionForward executeAction(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ActionException {
System.out.println("executeAction of UploadAction");
UploadActionForm uploadActionForm = (UploadActionForm) form;
int fileSize = uploadActionForm.getFileUpload().getFileSize();
System.out.println("uploadActionForm.getFileUpload().getFileSize() = " + uploadActionForm.getFileUpload().getFileSize());
byte buffer[] = new byte[1024];
try {
BufferedInputStream bufferedInputStream = new BufferedInputStream(uploadActionForm.getFileUpload().getInputStream());
FileOutputStream fos = new FileOutputStream("s:\\uploaded\\" + uploadActionForm.getFileUpload().getFileName());
int read;
while ( (read = bufferedInputStream.read(buffer,0,buffer.length)) != -1) {
fos.write(buffer, 0, read);
fos.flush();
fos.close();
bufferedInputStream.close();
return mapping.findForward("success");
} catch (IOException e) {
e.printStackTrace();
return mapping.findForward("error");
}catch(OutOfMemoryError o){
o.printStackTrace();
System.out.println("o.getMessage() " + o.getMessage());
return mapping.findForward("error");
UploadActionForm.java
public class UploadActionForm extends ActionForm{
private FormFile fileUpload;
private byte[] fileContent;
public FormFile getFileUpload() {
org.apache.struts.taglib.html.FormTag _jspx_th_html_form_0;
return fileUpload;
public byte[] getFileContent() {
return fileContent;
public void setFileUpload(FormFile fileUpload) {
this.fileUpload = fileUpload;
public void setFileContent(byte[] fileContent) {
this.fileContent = fileContent;
}--Bhupendra MahajanYes, you could try using the multipart handler...
But I have a better idea...
Determine the maximum number of file uploads that the
user can do at one time. I mean, you can't
realistically have the user upload a million files at
one time. So say the max is 20. So you create your
action form class with 20 FormFile fields called file1
to file20.
Then when you dynamically create your page, you
dynamically create the specified number of file fields
and 1 hidden field called "totalFiles" which contains
the number of file fields you created. This should be
an int field in the form bean.
Then when you do your action processing, you just loop
thru the totalFiles... Or well, actually, you may not
need that at all. You could just check all the
FormFile fields and whatever ones aren't null contain
files.But what about UploadActionForm.java[b]
How do i have exact mapping of the HTML form in this file ??
--[b]Bhupendra Mahajan -
How to retrieve IndividualStrings from a txt file using String Tokenizer.
hello can any one help me to retrieve the individual strings from a txt file using string tokenizer or some thing like that.
the data in my txt file looks like this way.
Data1;
abc; cder; efu; frg;
abc1; cder2; efu3; frg4;
Data2
sdfabc; sdfcder; hvhefu; fgfrg;
uhfhabc; gffjcder; yugefu; hhfufrg;
Data3
val1; val2; val3; val4; val5; val6;
val1; val2; val3; val4; val5; val6;
val1; val2; val3; val4; val5; val6;
val1; val2; val3; val4; val5; val6;
i need to read the data as an individual strings and i need to pass those values to diffarent labels,the dat in Data3 i have to read those values and add to an table datamodel as 6 columns and rows depends on the data.
i try to retrieve data using buffered reader and inputstream reader,but only the way i am retrieving data as an big string of entire line ,i tried with stringtokenizer but some how i was failed to retrive the data in a way i want,any help would be appreciated.
Regards,Hmmm... looks like the file format isn't even very consistent... why the semicolon after Data1 but not after Data2 or Data3??
Your algorithm is reading character-by-character, and most of the time it's easier to let a StringTokenizer or StreamTokenizer do the work of lexical analysis and let you focus on the parsing.
I am also going to assume your format is very rigid. E.g. section Data1 will ALWAYS come before section Data2, which will come before section Data3, etc... and you might even make the assumption there can never be a Data4, 5, 6, etc... (this is why its nice to have some exact specification, like a grammar, so you know exactly what is and is not allowed.) I will also assume that the section names will always be the same, namely "DataX" where X is a decimal digit.
I tend to like to use StreamTokenizer for this sort of thing, but the additional power and flexibility it gives comes at the price of a steeper learning curve (and it's a little buggy too). So I will ignore this class and focus on StringTokenizer.
I would suggest something like this general framework:
//make a BufferedReader up here...
do
String line = myBufferedReader.readLine();
if (line!=null && line.trim().length()>0)
line = line.trim();
//do some processing on the line
while (line!=null);So what processing to do inside the if statement?
Well, you can recognize the DataX lines easily enough - just do something like a line.startsWith("Data") and check that the last char is a digit... you can even ignore the digit if you know the sections come in a certain order (simplifying assumptions can simplify the code).
Once you figure out which section you're in, you can parse the succeeding lines appropriately. You might instantiate a StringTokenizer, i.e. StringTokenizer strtok = new StringTokenizer(line, ";, "); and then read out the tokens into some Collection, based on the section #. E.g.
strtok = new StringTokenizer(line, ";, ");
if (sectionNo==0)
//read the tokens into the Labels1 collection
else if (sectionNo==1)
//read the tokens into the Labels2 collection
else //sectionNo must be 2
//create a new line in your table model and populate it with the token values...
}I don't think the delimiters are necessary if you are using end-of-line's as delimiters (which is implicit in the fact that you are reading the text out line-by-line). So the original file format you listed looks fine (except you might want to get rid of that rogue semicolon).
Good luck. -
How do i search for a string in a txt file using java??
How do i search for a string in a txt file using java??
could you please help thanks
JRegular expressinos work just fine, especially when
searching for patterns. But they seem to be impying
it's a specific group of characters they're looking
for, and indexOf() is much faster than a regex.If he's reading from a file, the I/O time will likely swamp any performance hit that regex introduces. I think contains() (or indexOf() if he's not on 5.0 yet) is preferable to regex just because it's simpler. (And in the case of contains(), the name makes for a very clear, direct mapping between your intent and the code that realizes it.) -
How to upload multiple files using af:inputfile
Hi,
I am using J dev 11.1.1.3. I have a requirement wherein i need to upload multiple files using af:inputfile. Can we do in it ADF ? Is there any other work around to implement the same. I have checked previous questions but not able to find proper solution for this.
Any pointer in this regard is highly helpful.
Regards,
KalyanYou have to do this your self by either (as vinod said) using a different component (not present in adf) or implementing this:
1) allow the user to select multiple filenames (somehow)
2) zip them together
3) upload the zip
4) unpack the zip on the server
5) work with the files
Timo -
How to upload multiple files using wicket
Hai,
how to upload multiple files using wicket at a single browse.
any suggestion?
Thanks in advanceYou have to do this your self by either (as vinod said) using a different component (not present in adf) or implementing this:
1) allow the user to select multiple filenames (somehow)
2) zip them together
3) upload the zip
4) unpack the zip on the server
5) work with the files
Timo -
Read a Document and replace the text numbers in a txt file using c++..
For ex:
Before Document:
hai hello my daily salary is two thousand and five and your salary is five billion. my age is
twenty-five.
After Document:
hai hello my daily salary is # and your salary is #. my age is #.
All the text numbers and i put the # symbol..
I am trying this code:
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
ifstream myfile_in ("input.txt");
ofstream myfile_out ("output.txt");
string line;
void find_and_replace( string &source, string find, string replace ) {
size_t j;
for ( ; (j = source.find( find )) != string::npos ; ) {
source.replace( j, find.length(), replace );
myfile_out << source <<endl;
cout << source << endl;
int main () {
if (myfile_in.is_open())
int i = 0,j;
//string strcomma ;
// string strspace ;
while (! myfile_in.eof() )
getline (myfile_in,line);
string strcomma= "two";
string strspace = "#";
find_and_replace( line , strcomma , strspace );
i++;
myfile_in.close();
else cout << "Unable to open file(s) ";
system("PAUSE");
return 0;
Please help me.. Give me the correct code..Open the file as a RandomAccessFile. Check its length. Declare a byte array as big as its length and do a single read to get the file into RAM.
Is this a simple text file (bytes)? No problem. If it's really 16-bit chars, use java.nio to first wrap the byte array as a ByteBuffer and then view the ByteBuffer as a CharBuffer.
Then you're ready for search/replace. Do it as you would in any other language. Be sure to use System.arraycopy() to shove your bytes right (replace bigger than search) or left (replace smaller than search).
When done, a single write() to the RandomAccessFile will put it all back. As you search/replace, keep track of size. If the final file is smaller than the original, use a setLength() to the new size to avoid extraneous data at the end.
Maybe you are looking for
-
I can't update my iPhoto. "Update is not available for this Apple ID".
Updating my iPhoto has always been a problem. When I try, I get the error of: "This update is not available for this Apple ID either because it was bought by a different user or the item was refunded or cancelled." This is the only apple ID I have e
-
Dynamic Wartermark in AutoVue or where do the bytes come from?
I am working on an AutoVue integration with Oracle UCM and wanting to do dynamic watermarking for PDFs based on a various inputs. PDFWatermark is being used to statically stamp a few watermarks but will not handle true dynamic (per request) watermar
-
For some odd reason, when I play movies (any kind mind you, DVD's, iTunes movies, homemade movies) Front row will freeze up during the movie for 4 seconds and then go back to normal. It happens with multiple files. Any idea whats going on?
-
Ordinary outgoing calls are stopped in less than a second
I was extremely satisfied with my new I-phone 5S until I tryed to call a friend of mine. The call was stopped in less than a second. Rebooting and resetting have had no effect, I simply can´t use the phone! I have no problems recieving calls or using
-
System Idle process at Exchange server too high
Hi there everyone, I am having an issue since a long period of time regarding the usage of CPU by system idle process at my exchange server 2010.I am hereby attaching the screenshots for more details. What might be the issue guys as per your experien