Uploading file to Application Server using Tcode: CG3Z
Hi Friends,
I am facing a weird problem when uploading a file(PIPE delimited format) to application server
using the transaction CG3Z. The data is getting truncated at the end of each row and the file size
doesn't match with the one i had uploaded.
Can anyone resolve this issue.
Thanks in advance.
Murthy
Hi Friends
I wrote the custom program to upload the file on application server.
Thanks for your time.
Murthy
Similar Messages
-
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. -
Unable to create a file in Application Server using OPEN DATASET stattement.
I am unable to create a file in Application Server using the following statement.
OPEN DATASET filename FOR OUTPUT
IN TEXT MODE ENCODING DEFAULT
MESSAGE msg.
The message I'm getting is "Permission Denied". I have checked authorisation using SU53 which says "The last authorization check was successful". Please help.You can use following code to capture the error.
TRY.
OPEN DATASET filename FOR OUTPUT IN BINARY MODE MESSAGE V_MSG.
CATCH CX_ROOT
INTO EXCEPTION.
CALL METHOD O_EXCEPTION ->IF_MESSAGE~GET_TEXT
RECEIVING
RESULT = V_MSG.
MESSAGE v_msg
TYPE 'E'.
ENDTRY.
You can capture error in v_msg.
Following are the exceptions for the same:
Exceptions
Catchable Exceptions
CX_SY_FILE_OPEN
Cause: The file is already open.
Runtime Error: DATASET_REOPEN
CX_SY_CODEPAGE_CONVERTER_INIT
Cause: The desired conversion is not supported. (Due to specification of invalid code page or of language not supported in the conversion, with SET LOCALE LANGUAGE.)
Runtime Error: CONVT_CODEPAGE_INIT
CX_SY_CONVERSION_CODEPAGE
Cause: Internal error in the conversion.
Runtime Error: CONVT_CODEPAGE
CX_SY_FILE_AUTHORITY
Cause: No authorization for access to file
Runtime Error: OPEN_DATASET_NO_AUTHORITY
Cause: Authorization for access to this file is missing in OPEN DATASET with addition FILTER.
Runtime Error: OPEN_PIPE_NO_AUTHORITY
CX_SY_PIPES_NOT_SUPPORTED
Cause: The operating system does not support pipes.
Runtime Error: DATASET_NO_PIPE
CX_SY_TOO_MANY_FILES
Cause: Maximum number of open files exceeded.
Runtime Error: DATASET_TOO_MANY_FILES Non-Catchable Exceptions
Cause: An attempt was made to open a pipe that is already open.
Runtime Error: DATASET_PIPE_POSITION
Hope that will help you.
Please reward if useful. -
Problem while uploading file from application server to internal tab in BG
Hi all,
When i see the file in application server.data is like this
#################00\);_(#####}#-#}###############################00\);_(#####}#-#}###############################00\);_(*#####}#-#}#########
###################}###}#############A#############???#00\);_(*#################;_(@_) ########???# ########???# ########???###
#######???#########}###}#############)##############}##00\);_(*#################;_(@_) ############ ############ ##############
###################}#A#}#############:##############}##00\);_(#################;_(@_) }###}##############################00\);_(*##########
#######???#########}#-#}#############F#################00\);_(#####}###}#############@#################00\);_(#################;_(@_) #####
###################}#-#}#############3#################00\);_(#####}#U#}#############E#################00\);_(#################;_(@_) #####
Because the csv which is uploaded has dropdowns and some formattings.
when download from tcode cg3y i am getting correct file
When try to use open(binary mode) and read dataset i getting data as it is (junk).
i need to process in background.
Any help.
Rhea.upload file to string format
begin of ty_tab,
string type char200,
end of ty_tab.
loop at ty_tab into string
use statement replace string into tab deliminated fromat(particular occurance in string)
now call class to break string at tab into fields
endloop.
DATA : BEGIN OF i_data OCCURS 0,
data(200) TYPE c, "To hold Upload file data
END OF i_data.
OPEN DATASET v_str FOR INPUT
IN TEXT MODE
ENCODING DEFAULT IGNORING CONVERSION ERRORS.
IF sy-subrc EQ 0.
DO.
*Read a line from input file
READ DATASET v_str INTO i_data-data.
IF sy-subrc NE 0.
EXIT.
ENDIF.
*Append record to an internal table
APPEND i_data.
CLEAR: i_data.
ENDDO.
*Close the file
CLOSE DATASET v_str.
*---Start of inserti
LOOP AT i_data.
REPLACE ALL OCCURRENCES OF '"' IN i_data WITH '#'.
SPLIT i_data AT cl_abap_char_utilities=>horizontal_tab
INTO i_doc-pvaudt
i_doc-pvpate
i_doc-vecatc
i_doc-vhvend
i_doc-vhidt8
i_doc-vhinvn
i_doc-vhhexp
i_doc-vhiref. -
Problem in uploading file from Application Server
Hi everyone,
i got a problem in uplaoding a file from application server.i am having two folder (one folder name is current and another one is processed)in application server. In current folder i am having N no of files.I want to upload all the files names into one internal table and i want to process one by one file.After processing each file the file should be moved to processed folder and the files should not exist in current folder.All these process must be done everyday.Please rectify my problem asap.Ramesh,
Take authorization from basis guy.
Use the below code to get the list of files from require directory
*& Report ZDIRFILES *
REPORT ZDIRFILES .
PARAMETER: p_fdir type pfeflnamel DEFAULT '/usr/sap/tmp'.
data: begin of it_filedir occurs 10.
include structure salfldir.
data: end of it_filedir.
*START-OF-SELECTION
START-OF-SELECTION.
Get Current Directory Listing for OUT Dir
call function 'RZL_READ_DIR_LOCAL'
exporting
name = p_fdir
tables
file_tbl = it_filedir.
Now in internal table "it_filedir" will have all your files.
For moving and deleting
report zrich_0001.
Parameters: d1 type localfile default '/usr/sap/TST/SYS/fld1/Data1.txt',
d2 type localfile default '/usr/sap/TST/SYS/fld2/Data1.txt'.
data: begin of itab occurs 0,
rec(20) type c,
end of itab.
data: wa(20) type c.
start-of-selection.
open dataset d1 for input in text mode.
if sy-subrc = 0.
do.
read dataset d1 into wa.
if sy-subrc <> 0.
exit.
endif.
itab-rec = wa.
append itab.
enddo.
endif.
close dataset d1.
open dataset d2 for output in text mode.
loop at itab.
transfer itab to d2.
endloop.
close dataset d2.
delete dataset d1.
Check below FM if required
To move the file to archive directoryuse FMs 'PFL_COPY_OS_FILE'
To Delete 'EPS_DELETE_FILE'.
Don't forgot to reward if useful -
Program for uploading file on application server...
Hi,
I have created a program to upload a file from presentation server (local desktop) to application server. But in this program I have to specify the file length. What should I do in given program so that I can upload file of any length on application server ?
*& Report Z_FILE_DOWNLOAD_TO_APP_SERVER *
* This Program can be used to move flat files to application server from presentation server.
REPORT Z_FILE_DOWNLOAD_TO_APP_SERVER.
PARAMETERS: P_FILE LIKE IBIPPARMS-PATH,
P_FILE1(20000) default 'E:CONVERSIONFLAT' lower case.
DATA: WS_FILE TYPE STRING.
DATA: BEGIN OF T_DATA OCCURS 0,
RECORD(20000),
END OF T_DATA.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = SYST-CPROG
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = ' '
IMPORTING
FILE_NAME = P_FILE
START-OF-SELECTION.
WS_FILE = P_FILE.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = WS_FILE
FILETYPE = 'ASC'
TABLES
DATA_TAB = T_DATA
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
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Creating the file at Appl server............................
OPEN DATASET P_FILE1 FOR OUTPUT IN TEXT MODE encoding utf-8.
if sy-subrc ne 0.
message e000(--) with 'Error in opening file'.
endif.
* Trasfer the records to file.............
loop at t_data.
transfer t_data to p_file1.
endloop.
close dataset p_file1.
if sy-subrc eq 0.
write: / 'Written the files at ', p_file1.
write:/ 'Goto AL11 Transaction and then click on SAP Directory DIR_SAPUSERS to look for the file'.
endif.
Please advice.
Regards,
RajeshTry declaring it as TYPE STRING. Not sure though.
There are two predefined types in ABAP with variable length:
STRING for character strings
XSTRING for byte strings
Thanks,
SKJ -
How to search file in application server using pattern
Hi all,
I want to search file in application server.
Suppose there is file named abc20090808.dat.
Is there is any function module to search the file?
it should return back the file names starting with abc, if the import parameter is abc*
Regards,
Nikhilhello,
Have a look
You can use this function module /SAPDMC/LSM_F4_SERVER_FILE for F4 help for application server file and then you can use the function module TEXT_CONVERT_XLS_TO_SAP to read data into internal table.
access file from application server
regards,
shweta -
To access pdf files from application server using web.show_document
Hello!
If my pdf file is copied in Oracle_home/forms90/java directory.Then using web.show_document i can access the pdf file.But I can't copy all the pdf files in /forms90/java directory.We have lacs of pdf files which I want to keep in my own directory.But my requirement is if my pdf file is in /home2/docs directory in (Linux application server) ie in my own directory where I store all the pdf files.Then web.show_document does not open the pdf file.It says page cannot be displayed.For that I think we have to configure the directory /home2/docs directory as a webserver.From otn I got something like forms90.conf file in application server where we have to set virtual directory mapping etc.If the pdf is in local machine then in orion-web.xml file we have to mention real path and save the file and shutdown oc4j instance and restart it again.I tried it.But it is not working.Can u give me step by step instructions to solve this problem.I found a few links in discussion forum.But is doesn't work out.My pdf file is in /home2/docs directory in Linux application server.Please treat it as urgent.
Regards
JayashreeHi Sandeepmsandy,
There is no available code sample for this scenario. You may write your own.
Step 1: Get pdf URL from sqlite database. Please refer to the following MSDN blog and see a code sample.
http://blogs.msdn.com/b/robertgreen/archive/2012/11/13/using-sqlite-in-windows-store-apps.aspx. Note, you need to retarget the project to 8.1 and then get two sqlite packages from NuGet before building this sample.
Step 2: Use some special classes to get file from serer.
HttpWebRequest can help download small pdf files. For more information to see
https://social.msdn.microsoft.com/Forums/windowsapps/en-US/de96a61c-e089-4595-8349-612be5d23ee6/download-file-with-httpwebrequest?forum=winappswithcsharp. It’s easy for use, but if you want to download the larger or many files, it’s recommend to use
BackgroundTransfer namespace. The classes in this namespace provide a power way to transfer files in the background. See a code sample from MSND.
https://code.msdn.microsoft.com/windowsapps/Background-Transfer-Sample-d7833f61.
Regards,
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. Click HERE to participate
the survey. -
Issue in Uploading file to application server
Hi folks,
I need to transfer data to excel file on application server but i am facing issues while doing so.
I am working on ECC6.0 system.
I am trying with this code and it giving dump error on transfer command.
w_file = '/usr/data/020//varun.xls'.
OPEN DATASET w_file for input in text mode encoding non-unicode.
LOOP AT T_MARD.
TRANSFER string to w_file.
endloop.
CLOSE DATASET w_file.
Please help.
Is there any other way to do so please let me knowHi Got the solution :-
If the data to be transferred is having all characters then we can use this:-
OPEN DATASET w_file for output in text mode encoding non-unicode.
if sy-subrc eq 0.
LOOP AT T_MARD into wa_mard.
TRANSFER wa_mard to w_file.
endloop.
endif.
CLOSE DATASET w_file.
If all the data is not in char then - declare a char strinf of the table length.
Data: loc_string(300) type c.
OPEN DATASET w_file for output in text mode encoding non-unicode.
if sy-subrc eq 0.
LOOP AT T_MARD into wa_mard.
CALL FUNCTION 'HR_99S_COPY_STRUC1_STRUC2'
EXPORTING
p_struct1 = wa_mard
IMPORTING
p_struct2 = loc_string.
TRANSFER loc_string to w_file.
endloop.
endif.
CLOSE DATASET w_file.
Thanks for the help -
Reading File from Application Server using Read Dataset
Hi,
i am trying to read excel file from Application Server and has multiple records in that based on structure below. but when i execute its giving me error message.here is the code, can sumone suggest me on this please ??
FORM f_data_upload .
DATA:
l_filename TYPE string, "file name
l_wa_string TYPE string. "file record
l_filename = p_inp_as. "File path from Application Server
OPEN DATASET l_filename FOR INPUT IN TEXT MODE ENCODING DEFAULT.
DO.
IF sy-subrc <> 0.
EXIT.
ENDIF.
Read the data from the file in Application server.
READ DATASET l_filename INTO l_wa_string.
IF sy-subrc = 0.
SPLIT l_wa_string AT cl_abap_char_utilities=>horizontal_tab
INTO w_data-tcode
w_data-matnr
w_data-mtart
w_data-werks
w_data-vkorg
w_data-vtweg
w_data-lgort
w_data-meins
w_data-maktx
w_data-spart
w_data-kosch
w_data-mstae
w_data-brgew
w_data-ntgew
w_data-groes
w_data-matkl
w_data-prdha
w_data-mstde
w_data-mtpos_mara
w_data-gewei
w_data-spart
w_data-mstav
w_data-mstdv
w_data-dwerk
w_data-taxkm
w_data-versg
w_data-kondm
w_data-ktgrm
w_data-mtpos
w_data-mtvfp
w_data-tragr
w_data-ladgr
w_data-herkl
w_data-ekgrp
w_data-webaz
w_data-dismm
w_data-beskz
w_data-prctr
w_data-bklas
w_data-bwtty
w_data-vprsv
w_data-verpr
IN CHARACTER MODE.
APPEND w_data TO i_data.
CLEAR w_data.
ENDIF.
ENDDO.
CLOSE DATASET l_filename.
Error Message while executing
What happened?
At the conversion of a text from codepage '4110' to codepage '4102':
- a character was found that cannot be displayed in one of the two
codepages;
- or it was detected that this conversion is not supported
The running ABAP program 'ZHDI_LOMM_VEHI_MAT_MASS_CREATE' had to be terminated
as the conversion
would have produced incorrect data.
The number of characters that could not be displayed (and therefore not
be converted), is 449. If this number is 0, the second error case, as
mentioned above, has occurred.
Error analysis
An exception occurred that is explained in detail below.
The exception, which is assigned to class 'CX_SY_CONVERSION_CODEPAGE', was not
caught in
procedure "F_DATA_UPLOAD" "(FORM)", nor was it propagated by a RAISING clause.
Since the caller of the procedure could not have anticipated that the
exception would occur, the current program is terminated.
The reason for the exception is:
Characters are always displayed in only a certain codepage. Many
codepages only define a limited set of characters. If a text from a
codepage should be converted into another codepage, and if this text
contains characters that are not defined in one of the two codepages, a
conversion error occurs.
Moreover, a conversion error can occur if one of the needed codepages
'4110' or '4102' is not known to the system.
If the conversion error occurred at read or write of screen, the file
name was '/usr/sap/interfaces/conversion/pioneer/ddm/data/test_data1.xls'.
(further information about the file: "X 549
24064rw-rw----200812232135082008122307293120081223072931")
Please help me
Thank YouWoah ... perfect guru
but data looks like all junk characters ? its filling with special characters, hashes # and other characters but not with Excel data.. any idea ??
Temesh
Edited by: New2Sap Abap on Dec 24, 2008 6:42 AM -
Uploading file in application server to a transaction
Hi All,
I have a requirment where in i want to upload the transaction FF_5 using the file in the application server. Is there any way to do this. I dont want to download the file to presentation server and then upload the file in FF_5 transaction. According to the requirement i have to directly upload the application server file in the tcode FF_5. Pls let me know how to do this.
Thanks,
RajuHi,
You cannot upload the data from the applcation server. You have to upload from the presentation server.
If you have data on the application server then you need to save it to presentation server and upload to FF_5. -
How to upload file on Application Server with Forms 6i?
Please, I need to upload .csv file from local to Application Server, I think to use .jsp application, but I don't know where I had to put it...Apache can't read .jsp file without Tomcat? If I launch my .jsp file from Apache/htdocs directory can't view .jsp code (Method Not Allowed)...method is POST...any idea? Thanks in advance!
Hi,
You could write a java bean to get the file from the client and to upload to App Server. And, you simply use it in Forms 6i.
Also, you could use d2kwutil (not tried though. you could search this forum and get an idea of that).
Of course, For your information, You could use WebUtil (in Forms 10g / 10.1.2) which has the functionality.
HTH.
Regards,
Arun -
To Delete the uploaded file in Application Server
Hi Friends,
I developed an BSP Application displaying the results from ITAB though Iterator, for which , each row there is feature to upload a particular file in the Application Server, where I stored the file path into a database table field. .When I delete the the row, I am successfully get rid of the entire row including the file path.
My Question.
1. How to delete the uploaded file of the Application Server ?
Please mail me in this regard.
Regards
CSM ReddyHi,
you have the keyword and you have the documentation. What is your problem?
Search in the forums with keyword "delete dataset", there are lots of threads about this.
Example
Deletion of dataset in applicaiton server
deleting file from AL11 Tcode
Best regards
Renald -
Uploading files a landing server using webutil
dear all,
i have the current situation and i'm looking for solution.
i'm using the webutil in order to upload files from the client side to a landing server, the situation here is :
when i use the following code
webutil_file_transfer.Client_To_AS_with_progress
(clientFile => :upload.file_name
,serverFile => 'd:\temp\'||l_bare_filename
,progressTitle => 'Upload to Application Server in progress'
,progressSubTitle => 'Please wait'
,asynchronous => false
,callbackTrigger => null
where d:\temp is alocal directory on the AS
but if i change the server file to a drive mapping i'll have the following error
WUT-132, my question here is it possible for the webutil to upload a file to another landing server other than AS?
how can i do it without making a hidden share to the folder ?
the other question if i have a firewall between the client and the AS, will it prevent the webutil uploading process ?i want to add another point, when we make hidden share to the map drive the uploading worked successfuly.
what i need here is a way to access the map drive without making hidden share to the map drive? -
Error in uploading file from Application server
Hi
My scenario is file->XI->Idoc.I am using a senedre file adpator
My adaptar cofiguration is
transport protocol NFS
message protocol file
Adaptor engine integration server
source directory .\ (application server path of XI)
file name invoice.xml
quality of servise exactly once
poll interval 10 sec
proceesing mode test
processing seq by namefile type text
But the problem is adaptor monitoring it is showng that it it polled succesfully with green signal
but in the message montoring it is showing "Canceled with errors"
in the detail list it is showing the error category is XI_J2EE_MESSAGING_SYSTEM
and the error code is CALL_CUSTOMER_ERROR
Any one can help me in this matter?
Thanks
Debraj RoyDebraj,
in SXMB_MONI, go through the "Trace" header section of the message and find the exact point in which the exception occurs. Paste it here.
At a glance, it seems an RFC call that fails inside the mapping... Do you use JCo & UDF in the mapping to do some lookup/check in R/3?
Let me know.
Alex
Maybe you are looking for
-
I have the following issue while opening PowerPoint PPTX file and PPSX from the Document ID link provided by SharePoint 2010. Issue Initially when I opened PPTX file from the DOC ID link from SharePoint 2010, it is opening up in Slide Show mode which
-
I'm having problems with my iTunes account in my Macbook. None of the music I have in the cloud is accessable to me. A few days ago I tried to update music on my iPod and instead of adding music it erased almost everything on it. After that much of m
-
Call to a C++ DLL, using JNI - C++ method has char*
I am trying to link into an existing C++ Dynamically Linked Library(DLL) using the Java Native Interface(JNI). All goes fine, and the library loads into the current program, however when I try to call the function, it crashes. The function has char p
-
Performance Counter monitors stay unhealthy even when values drop below thresholds
I'm investigating some (SCOM 2012) alerts on our Exchange 2013 (SP1) environment: Malware filtering is taking too long (90th percentile) Mailbox Transport Submission is not keeping up with the work... Queue Alert: Internal Aggregate Delivery Queue (N
-
Storing videos, database vs filesystem
Hello I was not sure what category this should go in, so I wil start here. I have a database application that was written in .net with an Oracle backend. This applicaiton now needs to be able to display videos. I am trying to determine where it is be