Upload file from Presentation to Application
Hi Friends,
I M uploading EXEL file from presentation to application server.
but in the transaction AL11 when i double click the file path ,i can not see the EXEL data. it is appearing the dump data. that way, i m finding the dump data in internal table also . what can i do for uploading EXEL file to application server.
please help me.
Thanks,
Rohini
hai rohini
To upload excel file to AL11 Please refer to the given below code:
data : if_intern type kcde_cells occurs 0 with header line.
data : vf_index type i.
data : vf_start_col type i value '1',
vf_end_col type i value '256'.
field-symbols : <fs>.
* ----------- " Define Internal tables for ABAP.
data: begin of i_mat OCCURS 10,
empc(5),
name(12),
Age(3),
end of i_mat.
* ----------- " Define data variables for ABAP.
* " Define data variables for Excel Upload.
data: p_text type natxt.
data: dataset(150) type c.:
* ----------- " Selection-Screen.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE text-001.
parameters: p_file2 type rlgrap-filename,
p_brow2 type i,
p_erow2 type i.
SELECTION-SCREEN END OF BLOCK B1.
* ----------- " At Selection- screen.
at selection-screen on value-request for p_file2.
call function 'KD_GET_FILENAME_ON_F4'
EXPORTING
program_name = syst-repid
CHANGING
file_name = p_file2.
* ----------- " Start of ABAP SQL Commands
START-OF-SELECTION.
* dataset = '/tmp/new.xls'.
dataset = '/tmp/new.xls'.
if rg1 = 'X'.
if p_file2 is not initial and
p_brow2 is not initial and
p_erow2 is not initial.
call function 'KCD_EXCEL_OLE_TO_INT_CONVERT'
EXPORTING
filename = p_filename
i_begin_col = vf_start_col
i_begin_row = p_brow2
i_end_col = vf_end_col
i_end_row = p_erow2
TABLES
intern = if_intern.
if if_intern[] is initial.
p_text = 'No Data Uploaded'.
else.
sort if_intern by row col.
loop at if_intern.
move : if_intern-col to vf_index.
assign component vf_index of structure p_download to <fs>.
move : if_intern-value to <fs>.
at end of row.
append p_download.
clear p_download.
endat.
endloop.
endif.
delete dataset dataset.
open dataset dataset for output in text mode encoding default.
loop at i_mat.
if sy-subrc eq 0.
transfer i_mat to dataset.
endif.
endloop.
close dataset dataset.
Similar Messages
-
FM to tansfer data in flat file from presentation to application server
Hi Experts,
Please tell the FM to tansfer data in flat file from presentation server to application server or vice versa in ECC 6.0.
Thanks.Hi,
This is how you can achieve it:
1. You read the flat file from presentation layer and store the file content in internal table gt_inrec
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = gw_filename
filetype = 'ASC'
IMPORTING
filelength = gw_length
header = gw_header
TABLES
data_tab = gt_inrec
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.
2. Create a new file at the application server:
OPEN DATASET p_ofile FOR OUTPUT IN
TEXT MODE ENCODING DEFAULT.
3. Transfer the content from the internal table into the file at the application server:
LOOP AT gt_inrec.
TRANSFER gt_inrec-record TO p_ofile.
ENDLOOP.
Hope it helps,
Lim.... -
Interface Mngr: Option for Uploading file from presentation or unix server
Hi all,
I want to upload file through interface manager where the file can be on the presentaion server or the unix server. How do i achieve the same? I need to create parameters for 'Filename' and 'Unix Filename'. Either of the 2 will be chosen at a time. But how do i retrieve the respective file?Hi!
For handling a file on the apllication server (unix), you have to use the OPEN DATASET, CLOSE DATASET commands.
For handling the files on the presentation server (local PC), you have to use the upload/download method (GUI_UPLOAD, GUI_DOWNLOAD function elements).
You can make 2 parameters in your ABAP program like this:
PARAMETERS: p_f_app LIKE rlgrap-filename.
PARAMETERS: p_f_pre LIKE rlgrap-filename.
both is filled - error
IF NOT p_f_app IS INITIAL AND
NOT p_f_pre IS INITIAL.
MESSAGE E001(ZERROR).
ENDIF.
both is empty - error
IF p_f_app IS INITIAL AND
p_f_pre IS INITIAL.
MESSAGE E002(ZERROR).
ENDIF.
IF NOT p_f_app IS INITIAL. "application server
open dataset...
ENDIF.
IF NOT p_f_pre IS INITIAL. "presentation server
call function 'gui_upload'...
ENDIF.
Regards
Tamá -
Regarding tranfer of exel file from Presentation to Application server
Hi,
I want to transfer <b>excel file</b> in presentation server [Desktop] to Application server[<b>AL11</b>].
I have made use of F.M <b>C13Z_FRONT_END_TO_APPL</b>, But it is showing the data in AL11 as some junk characters.
Where as when i transfer a Text file to AL11 using above F.M it is showing the data correctly.
How can solve this issue!
I need to transfer <b>Excel file</b> data in <b>Presentation Server</b> to <b>Application Server</b> with tab delimeter.
Can any body give the solution for the same!
Thanks in advance.
Thanks,
Deep.Dear Deep,
Please go though the following lines of code:
D A T A D E C L A R A T I O N *
TABLES: ANEP,
BKPF.
TYPES: BEGIN OF TY_TABDATA,
MANDT LIKE SY-MANDT, " Client
ZSLNUM LIKE ZSHIFTDEPN-ZSLNUM, " Serial Number
ZASSET LIKE ZSHIFTDEPN-ZASSET, " Original asset that was transferred
ZYEAR LIKE ZSHIFTDEPN-ZYEAR, " Fiscal Year
ZPERIOD LIKE ZSHIFTDEPN-ZPERIOD, " Fiscal Period
ZSHIFT1 LIKE ZSHIFTDEPN-ZSHIFT1, " Shift No. 1
ZSHIFT2 LIKE ZSHIFTDEPN-ZSHIFT1, " Shift No. 2
ZSHIFT3 LIKE ZSHIFTDEPN-ZSHIFT1, " Shift No. 3
END OF TY_TABDATA.
Declaration of the Internal Table with Header Line comprising of the uploaded data.
DATA: BEGIN OF IT_FILE_UPLOAD OCCURS 0.
INCLUDE STRUCTURE ALSMEX_TABLINE. " Rows for Table with Excel Data
DATA: END OF IT_FILE_UPLOAD.
S E L E C T I O N - S C R E E N *
SELECTION-SCREEN: BEGIN OF BLOCK B1 WITH FRAME,
BEGIN OF BLOCK B2 WITH FRAME.
PARAMETERS: P_FNAME LIKE RLGRAP-FILENAME OBLIGATORY.
SELECTION-SCREEN: END OF BLOCK B2,
END OF BLOCK B1.
E V E N T : AT S E L E C T I O N - S C R E E N *
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FNAME.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
PROGRAM_NAME = SYST-REPID
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = ' '
STATIC = 'X'
MASK = '.'
CHANGING
FILE_NAME = P_FNAME
EXCEPTIONS
MASK_TOO_LONG = 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.
E V E N T : S T A R T - O F - S E L E C T I O N *
START-OF-SELECTION.
Upload Excel file into Internal Table.
PERFORM UPLOAD_EXCEL_FILE.
Organize the uploaded data into another Internal Table.
PERFORM ORGANIZE_UPLOADED_DATA.
E V E N T : E N D - O F - S E L E C T I O N *
END-OF-SELECTION.
*& Form UPLOAD_EXCEL_FILE
text
--> p1 text
<-- p2 text
FORM UPLOAD_EXCEL_FILE .
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = P_FNAME
I_BEGIN_COL = 1
I_BEGIN_ROW = 3
I_END_COL = 7
I_END_ROW = 32000
TABLES
INTERN = IT_FILE_UPLOAD
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 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. " UPLOAD_EXCEL_FILE
*& Form ORGANIZE_UPLOADED_DATA
text
--> p1 text
<-- p2 text
FORM ORGANIZE_UPLOADED_DATA .
SORT IT_FILE_UPLOAD BY ROW
COL.
LOOP AT IT_FILE_UPLOAD.
CASE IT_FILE_UPLOAD-COL.
WHEN 1.
WA_TABDATA-ZSLNUM = IT_FILE_UPLOAD-VALUE.
WHEN 2.
WA_TABDATA-ZASSET = IT_FILE_UPLOAD-VALUE.
WHEN 3.
WA_TABDATA-ZYEAR = IT_FILE_UPLOAD-VALUE.
WHEN 4.
WA_TABDATA-ZPERIOD = IT_FILE_UPLOAD-VALUE.
WHEN 5.
WA_TABDATA-ZSHIFT1 = IT_FILE_UPLOAD-VALUE.
WHEN 6.
WA_TABDATA-ZSHIFT2 = IT_FILE_UPLOAD-VALUE.
WHEN 7.
WA_TABDATA-ZSHIFT3 = IT_FILE_UPLOAD-VALUE.
ENDCASE.
AT END OF ROW.
WA_TABDATA-MANDT = SY-MANDT.
APPEND WA_TABDATA TO IT_TABDATA.
CLEAR: WA_TABDATA.
ENDAT.
ENDLOOP.
ENDFORM. " ORGANIZE_UPLOADED_DATA
In the subroutine --> ORGANIZE_UPLOADED_DATA, data are organized as per the structure declared above.
Regards,
Abir
Don't forget to award points * -
Copy File from Presentation Server to Application Server in Background
Hi,
I need to copy Image file from Presentation Server to Application Server.
The below given code is workking fine in Foreground but whenevr I am trying to execute in Background, the job is cancelled and I am getting a dump.
data : wa_source type string,
wa_destination type string.
wa_source = 'C:\PARBIND.BMP'.
wa_destination = 'D:\PARBIND.BMP'.
start-of-selection.
call method cl_gui_frontend_services=>file_copy
exporting
source = wa_source
destination = wa_destination
* overwrite = SPACE
* EXCEPTIONS
* cntl_error = 1
* error_no_gui = 2
* wrong_parameter = 3
* disk_full = 4
* access_denied = 5
* file_not_found = 6
* destination_exists = 7
* unknown_error = 8
* path_not_found = 9
* disk_write_protect = 10
* drive_not_ready = 11
* not_supported_by_gui = 12
* others = 13
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
In backgound Error is....
Exception condition "CNTL_ERROR" raised.*
Any solution is appreciated.
Thanks
ArbindHi Arbind,
Just realize... when you run it in foreground, you have a foreground to capture the file location. so it runs fine..
but when you are running it in background, there is no foreground to check that is no gui present... how can it check where the C:\.... location is??
no need of reading any oss note... just see.. the name is cl_GUI_FRONTEND_service.. its only for front end..
u need open dataset, read dataset, close dataset kind of things while running in background. or RFCs to read the file... (search SDN). -
How to upload file from Application Server?
Dear Friends,
How to upload file from Application Server?
Plz. with example...
Regards,
Dharmeshhi,
check the code for upload from application server.
tables: kna1.
types: begin of s_file,
customer type kna1-kunnr,
country type kna1-land1,
name type kna1-name1,
region type kna1-regio,
end of s_file.
*--Internal tables
data: it_file type s_file occurs 0 with header line.
*-- Selection screen
selection-screen: begin of block b1 with frame title text-001.
parameter: p_file type rlgrap-filename default 'C:/customer.txt'
obligatory.
selection-screen: end of block b1.
*-- At selection screen
at selection-screen on value-request for p_file.
perform file_help using p_file.
*-- Process File
start-of-selection.
perform upload_file using p_file.
*-- write File data to o/p
end-of-selection.
perform write_data.
*& Form file_help
form file_help using p_p_file.
data: l_filepath type ibipparms-path.
call function 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = SYST-CPROG
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = ' '
importing
file_name = l_filepath
p_p_file = l_filepath.
endform. " file_help
*& Form upload_file
form upload_file using p_p_file.
call function 'WS_UPLOAD'
exporting
filename = p_p_file
filetype = 'DAT'
IMPORTING
FILELENGTH =
tables
data_tab = it_file
exceptions
conversion_error = 1
file_open_error = 2
file_read_error = 3
invalid_type = 4
no_batch = 5
unknown_error = 6
invalid_table_width = 7
gui_refuse_filetransfer = 8
customer_error = 9
no_authority = 10
others = 11
if sy-subrc <> 0.
message i001.
endif.
endform. " upload_file
*& Form write_data
form write_data .
loop at it_file.
write:/ it_file-customer, it_file-country, it_file-name,
it_file-region.
endloop.
endform.
regards,
keerthi. -
Upload data from excel to application server
Hi all,
Is there any process to upload data from excel to application server other than reading the data from excel to z program through gui_upload and transferring the data to application server.
I want to run background job for a BDC program with the data present in the excel file.
Thanks & regards
sreehari p.Hi Sreehari,
Please use the tcode - CG3Z, where you can transfer the file from presentation server to the application server.
Regards,
Selva K. -
How to upload file from client to server in servlets.
actually in my application i have to upload file from client m/c to server.
it is not possible through file i/p stream as fileStreams does not work on network. Please mail me if you have any solution to this.
Thank's in advance............Haii roshan
Pls go through this thread..
http://forum.java.sun.com/thread.jspa?forumID=45&threadID=616589
regards
Shanu -
Uploading files from web to db server
hi, yesterday discover article from otn about uploading file from clients filesystem to web application server.
but how about uploading from clients filesystem directly into database column? (i'm talking about forms application via web server, btw, not c/s app)
i've search through the archieve, but cant find anything useful, just alot of similar question with no useful answer. so i guess alot of people could use this feature, if it can be done.
thanks in advance
PhilThe demo titled "Forms, Reports, and Portal Integrated Demo"
has the package and a form using it.
You can download it from http://technet.oracle.com/sample_code/products/forms/content.html
Read the script and search the part where you upload an image. -
How to upload file from a client machine to server machine
hei evryone!
can anyone pls help me on how i can upload file from a client machine to another machine (or server). using jsp.Then later on, i can also retrieve the names of these files to place it as values for option tag in an html form.I have a seperate screen for uploading the file and the screen for displaying all the files that were uploaded on the server...
any sample code/ ideas would be much appreciated.Thx!!!!hei evryone!
can anyone pls help me on how i can upload file from a client machine to another machine (or server). using jsp.Then later on, i can also retrieve the names of these files to place it as values for option tag in an html form.I have a seperate screen for uploading the file and the screen for displaying all the files that were uploaded on the server...
any sample code/ ideas would be much appreciated.Thx!!!! -
How to search file from presentation server
Hi All,
In a ABAP program i want to display a dialog box which will help me to find out any file from presentation server.That dialog box should be display after clicking on parameter on selection screen.Parameter is a simple variable,not a field from any internal table. so i can not use function module F4IF_INT_TABLE_VALUE_REQUEST
Please suggest me any function module which will satisfy my requirement.
Thank you.Hi,
Check this example..
DATA: T_FILETABLE TYPE FILETABLE.
DATA: RC TYPE I.
DATA: USER_ACTION TYPE I.
CALL METHOD cl_gui_frontend_services=>file_open_dialog
CHANGING
file_table = T_FILETABLE
rc = RC
USER_ACTION = USER_ACTION
EXCEPTIONS
FILE_OPEN_DIALOG_FAILED = 1
CNTL_ERROR = 2
ERROR_NO_GUI = 3
others = 4
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Thanks,
Naren -
How can i upload files from one ip address to another ip address machine ?
how can i upload files from one ip address to another ip address machine ?
i need to copy files from one client m/c to server m/c like sftp
please suggest solution on this -
Read XML file from presentation server
Hi All,
I want read XML file from presentation server currently i am using GUI_UPLOAD fm . but it is reading some junk data.
DATA : BEGIN OF upl OCCURS 0,
f(255) TYPE c,
END OF upl.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = D:\XX.XML'
filetype = 'BIN'
TABLES
data_tab = upl.
is there any other alternative.
Thanks
Swarup,Hi Swarup,
Use method IMPORT_FROM_FILE of class CL_XML_DOCUMENT.
A sample code snippet :-
PARAMETERS: p_filnam TYPE localfile OBLIGATORY
DEFAULT 'C:\Documents and Settings\ssaha\Desktop\test.xml'.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_filnam.
DATA: l_v_fieldname TYPE dynfnam.
l_v_fieldname = p_filnam.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
field_name = l_v_fieldname
IMPORTING
file_name = p_filnam.
START-OF-SELECTION.
TYPES:
BEGIN OF ty_tab,
name TYPE string,
value TYPE string,
END OF ty_tab.
DATA:
lcl_xml_doc TYPE REF TO cl_xml_document,
v_subrc TYPE sysubrc,
v_node TYPE REF TO if_ixml_node,
v_child_node TYPE REF TO if_ixml_node,
v_root TYPE REF TO if_ixml_node,
v_iterator TYPE REF TO if_ixml_node_iterator,
v_nodemap TYPE REF TO if_ixml_named_node_map,
v_count TYPE i,
v_index TYPE i,
v_attr TYPE REF TO if_ixml_node,
v_name TYPE string,
v_prefix TYPE string,
v_value TYPE string,
v_char TYPE char2.
DATA:
itab TYPE STANDARD TABLE OF ty_tab,
wa TYPE ty_tab.
CREATE OBJECT lcl_xml_doc.
CALL METHOD lcl_xml_doc->import_from_file
EXPORTING
filename = p_filnam
RECEIVING
retcode = v_subrc.
CHECK v_subrc = 0.
v_node = lcl_xml_doc->m_document.
CHECK NOT v_node IS INITIAL.
v_iterator = v_node->create_iterator( ).
v_node = v_iterator->get_next( ).
WHILE NOT v_node IS INITIAL.
CASE v_node->get_type( ).
WHEN if_ixml_node=>co_node_element.
v_name = v_node->get_name( ).
v_nodemap = v_node->get_attributes( ).
IF NOT v_nodemap IS INITIAL
* attributes
v_count = v_nodemap->get_length( ).
DO v_count TIMES.
v_index = sy-index - 1.
v_attr = v_nodemap->get_item( v_index ).
v_name = v_attr->get_name( ).
v_prefix = v_attr->get_namespace_prefix( ).
v_value = v_attr->get_value( ).
ENDDO.
ENDIF.
WHEN if_ixml_node=>co_node_text OR
if_ixml_node=>co_node_cdata_section.
* text node
v_value = v_node->get_value( ).
MOVE v_value TO v_char.
IF v_char <> cl_abap_char_utilities=>cr_lf.
wa-name = v_name.
wa-value = v_value.
APPEND wa TO itab.
CLEAR wa.
ENDIF.
ENDCASE.
* advance to next node
v_node = v_iterator->get_next( ).
ENDWHILE.
LOOP AT itab INTO wa.
ENDLOOP.
Regards
Abhii -
Timecapsule - opening files from within an application!!
I have a time capsule... 500Mb
I have an airport extreme with external hard drive - 250 Mb.
Through Finder, I can place files on either of these drives and open them from Finder.
If I open Numbers, or Pages, then try to open any file on Timecapsule, it appears that there are no files
If I open Number, or Pages, then try to open any file on the Airport Extreme external disk - it works!
Simple question really.... why cannot I see or open any file from within an application that resides on Timecapsule?? It's driving me crazy!!!
Message was edited by: GrahamDurkinFile dialogs have the ability to "group" items, which prohibits you from changing sort options. The group icon looks like six little squares. Click on it and instead of grouping by date, group by "none" and then you can change sort orders.
-
Unable to upload files from local computer to remote server (Was: Dreamweaver)
I have lost the connection between the remote location and the local location for files on my computer. Where to I correct this issues, since I cannot upload files from local to remote. Host server from server to my computer works fine, Running Dell computerr XP operating system with CS3 Dreamweaver. Need all the help I can get.
I am now having a "ftp error - cannot make connection to host. Dreamweaver
encoutered a netwoerk or file system error. I did as you suggested and I
get to basic site definition, ( which looks o.k.), next screen ( no,I do
not want to use a server technology) Next screen ( edit local copies on my
machine ( file location looks o.k.), next screen (connect to remote
server=ftp) address of web server is correct, ( no folder on server, or ftp
login or ftp password) do not enable check in or check out
summary: local
Site name:midhba
local root folder:midhba
remote info:
access; ftp
FTP host: midhba.com
check in.check out diabled
testing server (set up later)
Maybe you are looking for
-
IDOC Not getting Posted in PI from CRM
HI All, I had Configured, in CRM side : SM59,WE21,BD54,WE20 in XI side: datatypes,MT,MI, Maaping not yet done, IDX1,SM59 Idoc is not getting displayed in XI system. I had a small Question, Do we need to Configure all the setting in XI for Getting IDO
-
Proxy - ABAP mapping - file with content conversion
Scenario goes from ECC (proxy) to XI then I do ABAP mapping. I have tested the ABAP mapping with SXI_mapping_test transaction. My ABAP mapping puts the payload back into XML and then the data goes to a file adapter where I also use content conversi
-
Database applet error in web browser
hi to all i have query in applet. MY APPLET IS USING ODBC AND CONNECTING TO ACCES. I HAVE CREATED POLICY FILE SO THAT I CAN DISPLAY APPLET IN APPLETVIEWER. APPLET RUNS FINE IS APPLETVIEWER WITH FOLLOWING COMMANDLINE Appletviewer -jDJava.security.poli
-
What is Silverlight 5.1.31211.0 and how did it get on my computer?
I've checked sllauncher.exe, the registry, various update checker programs, the official Silverlight download page, and the official version history, and they all confirm the following: [1] The latest version of Silverlight is 5.1.30514.0. [2] The ve
-
Unable to locate an offline ipad at my home:(
i am unable to locate my ipad in my own home. its in offline mode. i don't remember the serial number. unable to understand what to do....any suggestions please?