Flat File Upload from WebDynpro ABAP
Hi,
I am struggling to find a solution for this requirement and I hope I get some help from the Gurus here.
I have to upload a ".csv" file from the WebDynpro application, and then store the data in the flat file in a Z# table.
Can some one explain me how to go ahead with this requirement??
Regards,
Nadh
Hi Nrisimhanadh Yandamuri ,
After reading the csv file using file up load you can use the following code to tranfer the same to an itab of your required format
DATA : loc_conv TYPE REF TO cl_abap_conv_in_ce,
var_string TYPE string.
Convert XString to String
CALL METHOD cl_abap_conv_in_ce=>create
EXPORTING
input = item_content
encoding = 'UTF-8'
replacement = '?'
ignore_cerr = abap_true
RECEIVING
conv = loc_conv.
*Read the file contents
TRY.
CALL METHOD loc_conv->read
IMPORTING
data = var_string.
CATCH cx_sy_conversion_codepage.
*-- Should ignore errors in code conversions
CATCH cx_sy_codepage_converter_init.
*-- Should ignore errors in code conversions
CATCH cx_parameter_invalid_type.
CATCH cx_parameter_invalid_range.
ENDTRY.
SPLIT var_string AT crlf INTO TABLE it_string_tab.
Regards
Sarath
Similar Messages
-
Hi gurus,
i understood that there is a posibility to upload data from a flat file directly from the network. I know how to upload it from the PC, but how do I put the folder on the network?
Thanx,
RamonaHi Ramona,
First of all make sure, that every user has sufficiant auothraization for durectory required on application server,
Now you (or the users) are able to access it in windows after mapping to a drive represented by a caharcter ( e.g. ''R").
This is done in Windows Explorer "EXTRAS". It will appear as a new folder in explorer and can be handled like a "normal" one.
If you have any doubts contact your basis guys, they are surely familiar with this process.
Hope it helps
Joe -
Read file system from webdynpro ABAP
Hi All,
I wanted to check how the files in the client file system be read from a webdynpro ABAP.
I cannot use cl_guifrontend_services method directory_get_list as it gives dump sayin there is no proper GUI running.
-AbhishekHi Abhishek,
With file upload UI element you get, windows like OPEN file options. Below are the links of how to upload & Process a TAB delimeted file using the File Upload & reference from Thomas jung in reply to a similar query.
[file upload]
[Upload File in Mime Repository.]
[Save file in directory after upload with fileupload-element ?]
Greetings
Prashant -
Flat file upload (from local system) to internal table
I am trying to use BAPI to create sales order. for that I have to upload flat file containing header and item data from the local system (not from application server). please suggest me if any functional module is available for this.
Thanks,
RajanHi rajan,
Try this,
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = lv_filename " File name
filetype = 'ASC'
has_field_separator = cl_abap_char_utilities=>horizontal_tab
HEADER_LENGTH = 0
READ_BY_LINE = G_MARKED
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
VIRUS_SCAN_PROFILE = VIRUS_SCAN_PROFILE
NO_AUTH_CHECK = ' '
IMPORTING
FILELENGTH = FILELENGTH
HEADER = HEADERf
TABLES
data_tab = gt_table "internal table with fields from the flat file.
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17
Regards,
Shobana.K -
Hello,
I would like upload a excel file in Webdynpro for ABAP and I get the data in a attribute in the context node.
The data is there in Binary format.
If it is possible to get the data in the ASC format like the function "ws_upload"?
I had tested with the class "CL_GUI_FRONTEND_SERVICES" and
the function "ws_upload" both don't work in Webdynpro for ABAP can anyone give me information's how to get the file data in a internal table.
Regards
KlausHi Klaus,
do you know that there is a special Web Dynpro Java.
Regards
Gregor -
Excel or Any type of file upload in WebDynpro ABAP
Hi All,
I need to upload two files in my requirement, where one file is always going to be an excel sheet and another file could be of any type of file.
I am using below code for cracking the same but it is not behaving the expected way. It is working fine for TXT, CSV and PDF file but not for XLS files.
DATA: lc_file TYPE string.
get element via lead selection
lo_el_context = wd_context->get_element( ).
get single attribute
lo_el_context->get_attribute(
EXPORTING
name = `FILE_CONTENT`
IMPORTING
value = lv_file_content ).
CALL FUNCTION 'ECATT_CONV_XSTRING_TO_STRING'
EXPORTING
im_xstring = lv_file_content
im_encoding = 'UTF-8'
IMPORTING
ex_string = lc_file.
I would appreciate if any one could suggest me some other way to achieve the desired functionality.
Regds,
AshishHi,
Please try to use the UI element "Office Control" of a web dynpro view.
For more details, refer to the web dynpro component: IOS_TEST_HELLOWORLD_MS.
Best regards,
Shalini. -
File Upload from Webdynpro to R/3 Server
Hi all
We have a scenario. In that we want to upload any type of file (can be .txt, .pdf, .doc, .xls, .jpg, .gif etc.) to the R/3 server. We r using a FileUpload UI Element.
The problem is we want to pass the contents of the file (any type of file) to the rfc.
If anybody knows the solution for this please help us.
(It will be of great help if u give the code)
Thanks & Regards
AparnnaHi Aparna,
It happens becuse u r trying to access the byte array of the file in a loop.
For small file it will not make any pblm, but for for big files, the loop may have to iterate millions of times which result in server hang.
So dont try to access the byte array in loop in ur code. Try to pass the byte array u r getting as whole to RFC.
Regards
Fahad Hamsa -
Hi,
What kind of questions are needed to be asked (from client) for requirements gathering for a flat file upload (from legacy system) to BI? Basically what are all the questions that i need to ask them to make sure I have all information for designing a flat file extractor?
ThanksI would ask them what do they want to report on from the legacy system and is data already in R/3? I would also ask what kind of data is stored in the legacy system .... inventory, financial data, sales, etc ... Once I knew that, I would ask what do they want to report on .... stock quantities/costs, gl account data, revenue, deliveries, etc....
Then I would ask, do you want this to be seperated from the R/3 datastream? More than likely this will be yes, if not, fight to keep it seperated and possible in it's own cube/ODS and combine in a multiprovider (you need to use the same 0material, 0customer, 0vendor, 0gl_account info objects if you want to combine nicely on a multiprovider).
If the database the legacy system is on is either SQL Server or Informix or Oracle, you may want to consider DBConnect and connect directly to their tables.
In all cases, I try to avoid bringing everything in "just because we may need it". If the system is legacy and it's been a legacy for 2 years, see what people keep going back for and grab that data only. If someone claims to need data, but have not sought it out for 2 years, then the probably don't need it.
Also, check the granularity of the data. Do they need individual documents for legal reasons? Can you summarize the data? What are they going to use the data for?
Brian -
Excel File Upload In Webdynpro For ABAP
Hi All,
I have a doubt regarding EXCEL file upload for Webdynpro for ABAP.
I am able to get the path of file using 'FILEUPLOAD' UI element.Now I need to upload the EXCEL file into ALV.I have tried out with GUI_UPLOAD and other excel upload function module.But these Function Module throws Dump.
Can you please suggest how to go about it.It will be a great help if u can suggest any function module or method.Hi Amita,
Insetad of using GUI_UPLOAD use 'HR_KR_XSTRING_TO_STRING'
Here is the sample code,
TYPES :BEGIN OF str_itab,
name(10) TYPE c,
age(10) TYPE c,
END OF str_itab.
DATA : t_table1 TYPE STANDARD TABLE OF str_itab,
i_data TYPE STANDARD TABLE OF string,
lo_nd_sflight TYPE REF TO if_wd_context_node,
lo_el_sflight TYPE REF TO if_wd_context_element,
l_string TYPE string,
fs_table TYPE str_itab,
l_xstring TYPE xstring,
fields TYPE string_table,
lv_field TYPE string.
DATA : t_table TYPE if_main=>elements_data_tab,
data_table TYPE if_main=>elements_data_tab.
* get single attribute
wd_context->get_attribute(EXPORTING name = `DATASOURCE`
IMPORTING value = l_xstring ).
CALL FUNCTION 'HR_KR_XSTRING_TO_STRING'
EXPORTING
in_xstring = l_xstring
IMPORTING
out_string = l_string.
SPLIT l_string AT
cl_abap_char_utilities=>newline INTO TABLE i_data.
* Bind With table Element.
LOOP AT i_data INTO l_string.
SPLIT l_string AT cl_abap_char_utilities=>horizontal_tab INTO TABLE
fields.
READ TABLE fields INTO lv_field INDEX 1.
fs_table-name = lv_field.
READ TABLE fields INTO lv_field INDEX 2.
fs_table-age = lv_field.
APPEND fs_table TO t_table1.
ENDLOOP.
lo_nd_sflight = wd_context->get_child_node( 'DATA_TAB' ).
lo_nd_sflight->bind_table( t_table1 ).
ENDMETHOD.
if correct give correct answer
Thanks & Regards,
Meenachi.R -
Reg File Upload Object in abap Webdynpro
Hi Friends,
Would like to enquire one doubt in the file upload object in abap webdynpro.
By default when we press the browse button, near to the file name there is a button which shows the the file types like:
., *.html, ,gif,.jpeg etc.
Is there any way we can control that, as i have an requirement where in to upload only certain extension types.
thankyou.HI,
I would suggest you to follow this approach :
1. Create a Table in your View in which FileUpload is there.
2. Populate this value with valid file extension.
3. Make it invisible by default.
4. Now when you have entered value in Fileupload and click on Ok button.
5. Check whether Mimetype matches any value in Table.
6. If it is invalid, Throw an error message and mke Table of Valid extension Visible.
Sample code to have Table with Valid entries.
types : begin of str,
valid_ext type string,
end of str.
data : wa type str,
itab type table of str.
wa-valid_Ext = 'EXL'.
append wa to itab.
wa-valid_ext = 'DOC'.
append wa to itab.
lo_nd->bind_Table( itab ).
here lo_nd is your ref to node of Table having valid extensions.
7. Bind this Table's Visible property wiht wdui_visiblity .
8. Set it Visible - 02 , Inviisible - 01.
I hope it is clear. -
Debugging is not working in R/3 from WebDynpro-ABAP developed webpage input
Dear Friends,
We are facing a serious problem for debugging. Expecting valuable input for the same.
Debugging is not working in R/3 from WebDynpro-ABAP developed webpage input in Production Server.
The debugging (for WebDynpro-ABAP application) is working in Dev. Server for
1st ] Within R/3
Ex. debug for bapi within R/3. i.e. value enter as input in R/3 only.
2nd ] From webpage to R/3
Ex. Some input given on the internet web page developed through WebDynpro and external breakpoint set in R/3 it works. It directs to R/3 code through debugging.
In Prod. Server the 1st case above is working but the 2nd case is not working.
In Prod. Server the WebDynpro developed applications are running successfully through internet explorer webpage inputs. So running the application is not a problem in prod. Server but debugging of the same is the problem.
The setting which are done in Prod. server are,
1] RZ10 in parameters are set for port and host name.
2.1] In SMICM check for ICM.
2.2] Host file updated in Windows-System 32.
3] In SICF following services are active,
3.1] default_host/sap/bc/webdynpro
3.2] default_host/sap/public/bc
3.3] default_host/sap/public/bc/webdynpro/viewdesigner
3.4] default_host/sap/bc/wdvd
3.5] default_host/sap/public/icman
3.6] default_host/sap/bc/gui/sap/its/webgui
3.7] default_host/sap/public/ping
3.8] default_host/sap/bc/error
3.9] default_host/sap/bc/echo
4] In SE80
4.1] Internet services-System-are published
4.2] Internet services-WEBGUI-are published
4.3] Utilities-Setting-ABAP Editor-Debugging-Username & New Debugger set.
4.4] Utilities-Setting-ABAP Editor-Editor-Front-End Editor(New) set.
5] In Su01 for user profiles sap_all & sap_new is assigned and role SAP_BC_WEBSERVICE_DEBUGGER is assigned.
6] The support packages are also updated to latest level.
7] Gone through following links but not getting any clues.
http://help.sap.com/saphelp_nw70ehp1/helpdata/en/48/74d50bd1431b5ae10000000a42189c/frameset.htm
http://help.sap.com/saphelp_nw04s/helpdata/EN/77/3545415ea6f523e10000000a155106/frameset.htm
Thanks in Advance.
Best Regards,
Abhijit.No cross posting
Read the "Rules of Engagament"
Regards
Juan -
BPS Flat File Upload Error Messages
Hi,
I am using the BPS flat file upload and am getting error messages. These error messages are coming from the user exit in the characteristics relationships. Unfortunately the message does not indicate which line on the upload file the error is for. In the user exit it does not pass the line no of the flat file that is being processed.
Does anyone have any ideas how the message could be enhanced to indicate the line in error or if there is another exit I could perform the validation in?
regards
Paul CairncrossHi Sai,
The issue is not the particular message. The message is in fact my message in the user exit in the characteristic relationships. The issue is when using the flat file upload the message does not indicate which line in the file the message apply's to. Looking at the userexit no line number is passed. This is not a problem in the web as the specific line is highlighted when the user is keying in the data.
Regards,
Paul Cairncross -
How to Save a file uploaded in WebDynpro Java to Windows server
Hi Guys,
I need to save a file uploaded in WebDynpro Java to a location on one of my companys many internal Window servers but I cannot get it to work. I do not get any errors with the following code, but NOTHING happens... And when I check the folder it is still emply... Please advise. I am particularly not sure about specifying the Path syntax. Also, I do have permission to write to this server. Is it even possible to save to a Windows server from WebDynpro??
//uploaded document already in context...
byte[] file = element.getFileResource();
// get the size of the uploaded file
element.setFileSize(this.getFileSize(file));
wdContext.currentContextElement().setFSize(this.getFSize(file));
// get the extension of the uploaded file
element.setFileExtension(binaryType.getMimeType().getFileExtension());
String fName = wdContext.currentContextElement().getFName();
String fExt = wdContext.currentContextElement().getFileExtension();
String foName1 = "
server01.w9\Files\P
HRP_Attachments\" + fName + ".pdf";
File f1 = new File(foName1);
DataOutputStream dos1;
dos1 = new DataOutputStream(new FileOutputStream(f1));
dos1.write(file);
dos1.flush();
dos1.close();
Edited by: christiaanp on Sep 30, 2011 8:07 AMHi Christiaan,
When specifying the path, make sure you escape the slashes
So, when you would normally use something like
\\server\path\file.txt
in your code you must use it in the form:
String fileName = "\\\\server\\path\\file.txt";
Hope this helps!
Robin van het Hof -
Hi Marc,
I am following the July version of how-to. When generating the BSP page, I am told checkbrowser.htm and js.htm are not available. When I create a checkbrowser.htm and point the include to js3.htm, which is one of the page fragment available, there are a few other errors coming out. What am I missing?Do you already know if the flat file upload is possible from a multi planning area? Because I get the error message that my multi planning area does not exist when executing the function.
Thnx. -
Error when Interative Adobe Form is called from Webdynpro ABAP.
Hi Experts,
I trying to call a Interactive adobe form from ABAP Webdynpro application but I am facing the below error.
Line: -
The following error text was processed in the system GJD : User session (HTTP/SMTP/..) closed after timeout
The error occurred on the application server az18u021_GJD_01 and in the work process 0 .
The termination type was: ERROR_MESSAGE_STATE
The ABAP call stack was:
Method: PREPROCESS_REQUEST of program CL_WDR_CLIENT_ABSTRACT_HTTP===CP
Method: IF_HTTP_EXTENSION~HANDLE_REQUEST of program CL_WDR_MAIN_TASK==============CP
Method: EXECUTE_REQUEST_FROM_MEMORY of program CL_HTTP_SERVER================CP
Function: HTTP_DISPATCH_REQUEST of program SAPLHTTP_RUNTIME
Module: %_HTTP_START of program SAPMHTTP
Line: -
When I uncheck the enabled property of the Interactive From in the Page of the WebDynpro I am able to execute the application successfully.But the Adobe form behaves as a Static Form when I uncheck the enabled property.
So kindly provide your valuable suggestions to avoid the above error when I am calling a Interactive adobe form from Webdynpro ABAP.
Thanks in Advance.
Regards,
Arun.Hello,
Hello, are you sure you have your ADS credentials configured correctly and valid? I guess you know that is the only difference between clicking enabled on true or false. If you are not sure, you can use SE38, search for FP_* and pick some reports to check the licencing. The names of the reports are good enough to recognize the right one.
Or maybe that is a security problem? Have you checked the ADS_ERROR string? Did you use the ADS trace?
check: http://help.sap.com/saphelp_nw70/helpdata/en/2c/241a427ff6db2ce10000000a1550b0/content.htm
and especially note 999998
Regards, Otto
Maybe you are looking for
-
Table component disturbing the order of rows while displaying
HI, In jspx when ever data is displayed in table,when we select last page the table component is displaying data which is not sorted.(values given to table are changed in output). This is occuring only in last page. EX:If i have 87 records with pagin
-
Splitting Fios signal and using a repeater
I have FIOS and just purchased a flat screen for my office, which I want to hang on the wall. Issue - Set Box and where to place it. I understand I can move the box to a another space and use a repeater to transmit the signal from the box to the T
-
AppleScript: Activate the frontmost Safari and run Javascript.
I have the applescript like this below: on run argv set pid to item 1 of argv set fileLocation to item 2 of argv tell application "System Events" set theprocs to every process whose unix id is pid repeat with proc in theprocs set the fron
-
Inbound emails not landing on CRM
Hi Gurus, I am working with CIC win client, on Inbound E-mails. when a mail is send to a mail address (clients) its lands on the mail server and from that mail server it is routed to SMTP CRM server, i doubt some settings are missing here and t
-
Javascript code missing when inserting Fireworks html into DW document
I tried to insert fireworks html in a Dreamweaver file. After importing the fireworks html in the Dreamweaver document, the associated Javascript code was missing. Of course, the Fireworks html file includes the Javascript code and works properly. It