Empty the Application server file
Dear Friends,
Good Morning.I have a requirement to empty the Given application server file.How can we achieve through Programmitically.Pls. help on this..
HI
GOOD
go through these links
http://help.sap.com/saphelp_nw2004s/helpdata/en/fc/eb3c7f358411d1829f0000e829fbfe/content.htm
thanks
mrutyun
Similar Messages
-
Error while accessing the application server file
Hello,
When I try to load the data from CSV file to PSA , I am getting following error message
"Error while accessing the application server file"
"Errors in source system"
I gave the right file path
I am not sure about this error message.
Thanks,Hi ram,
if you have more than one application server running in your BI system (see at transaction SM51) be aware that your infopackage will be executed on the right one. Each application server has its own file system and your job need to run on the server your file is stored on.
Also check if the os user of the SAP system itself (<sid>adm on Unix) has rights to read that file.
Bye
Frank -
How to give the application server file path in the module pool programming
Hi,
Could somebody help me how to provide the application server file path in module pool programming once the logo is uploaded to sap system.
For eg I have imported a logo name owens into sap system by using transaction se78; now I need to call the path in the below url,
if container2 is initial.
CREATE OBJECT CONTAINER2
EXPORTING
CONTAINER_NAME = 'PICTURE_CONTAINER2'.
CREATE OBJECT PICTURE2
EXPORTING
PARENT = CONTAINER2.
CALL METHOD PICTURE2->SET_DISPLAY_MODE
EXPORTING
DISPLAY_MODE = CL_GUI_PICTURE=>display_mode_fit_center
EXCEPTIONS
ERROR = 1.
CALL METHOD PICTURE2->LOAD_PICTURE_FROM_URL
EXPORTING
URL = " ? "
EXCEPTIONS
ERROR = 1
Others = 2.
endif.
Thanks in advance
Deepuhi Deepu,
Use FM '/SAPDMC/LSM_F4_FRONTEND_FILE' for fetching the data from the application server path/presentation server path
Regards,
Santosh -
How to check whether the Application Server file has already been opened?
Hi Experts,
I have a query related to Application Server file. I am using multithreading concept to process the data and write it in to a single file.
For example, I have 4 workprocesses. Each workprocess will process the data and whenever it has a record available it will access the file and write it directly.
Problem is the statements that are written in the workprocess is same and I want to check the status whether the file has been opened or not ?
Thanks in advance!!!
Thanks,
Babu KilariDepends on the structure, and whether the data needs to be sorted in some way in the final file.
In any case, I don't think there will be a significant performance difference between using OPEN DATASET again and getting funny with Unix commands.
If you don't need to sort the final file, you can use strings to read, concatenate and write the data even without line-based DO ENDDO loops, this works pretty fast.
I hope we are not talking about GBytes of data
Thomas -
Save string data type text in the application server file opened in binary
Hi All,
My requirement is to save the string "abcd 23432423 asdada" to the text file in the application server.
I have written like this. but its not getting saved properly in the text file. Please help.
constants X_LINESIZE type I value 128.
types X_LINETYPE type X length X_LINESIZE.
data: WA_TAB_X type X_LINETYPE.
data: str1(64) type C.
data: WA_TAB_X_HDR1 type xstring.
str1 = 'abcd 23432423 asdada'.
CONVERT TEXT STR1 INTO SORTABLE CODE WA_TAB_X_HDR1.
concatenate F_FILENAME1 SY-SYSID F_FILENAME2 '/' TAB_REGUT-TSNAM '.TXT' into F_FILENAME1.
open dataset F_FILENAME1 for output in binary mode .
if SY-SUBRC = 0.
transfer WA_TAB_X_HDR to F_FILENAME1.
loop at TAB_X into WA_TAB_X.
transfer WA_TAB_X to F_FILENAME1.
endloop.
endif.
close dataset F_FILENAME1.
Edited by: madhuri sonawane on Jun 2, 2009 4:05 PMHI,
constants X_LINESIZE type I value 128.
types X_LINETYPE type X length X_LINESIZE.
data: WA_TAB_X type X_LINETYPE.
data: str1(64) type C.
data: WA_TAB_X_HDR1 type xstring.
data : file (1000) type c.
str1 = 'abcd 23432423 asdada'.
CONVERT TEXT STR1 INTO SORTABLE CODE WA_TAB_X_HDR1.
concatenate F_FILENAME1 SY-SYSID F_FILENAME2 '/' TAB_REGUT-TSNAM '.TXT' into F_FILENAME1.
open dataset file for output in binary mode .
if SY-SUBRC = 0.
transfer WA_TAB_X_HDR to file.
loop at TAB_X into WA_TAB_X.
transfer WA_TAB_X to file
endloop.
endif.
close dataset file.
regards,
Munibabu.k -
File from the Application server
Hi gurus,
I am working on a scenario where I need to get a file from the application server and for this I need to ask user to enter the location and that too at the selection screen and then I need to read this location using open data set and read data set in my program , once I am done with this I need to do some other validations. so can you please help me out how to achieve this.
Thanks
Rajeev GuptaHi
Declare the selection screen with file as parameter so that the user enter the application server file..
the use the OPEND DATASET as mentioned in below code and process
Refer this:
http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3ca6358411d1829f0000e829fbfe/frameset.htm
ABAP code for uploading a TAB delimited file into an internal table. See code below for structures.
*& Report ZUPLOADTAB * &----
*& Example of Uploading tab delimited file *
REPORT zuploadtab .
PARAMETERS: p_infile LIKE rlgrap-filename
OBLIGATORY DEFAULT '/usr/sap/'..
DATA: ld_file LIKE rlgrap-filename.
*Internal tabe to store upload data
TYPES: BEGIN OF t_record,
name1 like pa0002-VORNA,
name2 like pa0002-name2,
age type i,
END OF t_record.
DATA: it_record TYPE STANDARD TABLE OF t_record INITIAL SIZE 0,
wa_record TYPE t_record.
*Text version of data table
TYPES: begin of t_uploadtxt,
name1(10) type c,
name2(15) type c,
age(5) type c,
end of t_uploadtxt.
DATA: wa_uploadtxt TYPE t_uploadtxt.
*String value to data in initially.
DATA: wa_string(255) type c.
constants: con_tab TYPE x VALUE '09'.
*If you have Unicode check active in program attributes then you will
*need to declare constants as follows:
*class cl_abap_char_utilities definition load.
*constants:
con_tab type c value cl_abap_char_utilities=>HORIZONTAL_TAB.
*START-OF-SELECTION
START-OF-SELECTION.
ld_file = p_infile.
OPEN DATASET ld_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc NE 0.
ELSE.
DO.
CLEAR: wa_string, wa_uploadtxt.
READ DATASET ld_file INTO wa_string.
IF sy-subrc NE 0.
EXIT.
ELSE.
SPLIT wa_string AT con_tab INTO wa_uploadtxt-name1
wa_uploadtxt-name2
wa_uploadtxt-age.
MOVE-CORRESPONDING wa_uploadtxt TO wa_upload.
APPEND wa_upload TO it_record.
ENDIF.
ENDDO.
CLOSE DATASET ld_file.
ENDIF.
*END-OF-SELECTION
END-OF-SELECTION.
*!! Text data is now contained within the internal table IT_RECORD
Display report data for illustration purposes
loop at it_record into wa_record.
write:/ sy-vline,
(10) wa_record-name1, sy-vline,
(10) wa_record-name2, sy-vline,
(10) wa_record-age, sy-vline.
endloop.
Regards
Anji -
Various ways to place a File in the Application Server.
Hi all,
What are the various ways to place a file in the application Server.
Please classify them as shown below.
1. Use of ABAP Code.
2. Without the use of ABAP code.
RegardsHi
<b>1. Use of ABAP Code.</b>
by writing code like this
REPORT ZSD_EXCEL_INT_APP.
parameter: file_nm type localfile.
types : begin of it_tab1,
f1(20),
f2(40),
f3(20),
end of it_tab1.
data : it_tab type table of ALSMEX_TABLINE with header line,
file type rlgrap-filename.
data : it_tab2 type it_tab1 occurs 1,
wa_tab2 type it_tab1,
w_message(100) TYPE c.
at selection-screen on value-request for file_nm.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
* PROGRAM_NAME = SYST-REPID
* DYNPRO_NUMBER = SYST-DYNNR
* FIELD_NAME = ' '
STATIC = 'X'
* MASK = ' '
CHANGING
file_name = file_nm
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.
start-of-selection.
refresh it_tab2[].clear wa_tab2.
file = file_nm.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = file
i_begin_col = '1'
i_begin_row = '1'
i_end_col = '10'
i_end_row = '35'
tables
intern = it_tab
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.
loop at it_tab.
case it_tab-col.
when '002'.
wa_tab2-f1 = it_tab-value.
when '004'.
wa_tab2-f2 = it_tab-value.
when '008'.
wa_tab2-f3 = it_tab-value.
endcase.
at end of row.
append wa_tab2 to it_tab2.
clear wa_tab2.
endat.
endloop.
data : p_file TYPE rlgrap-filename value 'TEST3.txt'.
OPEN DATASET p_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
*--- Display error messages if any.
IF sy-subrc NE 0.
MESSAGE e001(zsd_mes).
EXIT.
ELSE.
*---Data is downloaded to the application server file path
LOOP AT it_tab2 INTO wa_tab2.
TRANSFER wa_tab2 TO p_file.
ENDLOOP.
ENDIF.
*--Close the Application server file (Mandatory).
CLOSE DATASET p_file.
loop at it_tab2 into wa_tab2.
write : / wa_tab2-f1,wa_tab2-f2,wa_tab2-f3.
endloop.
Here is a pseudo code for what you are looking for-
OPEN DATASET P_FLPTH FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
IF SY-SUBRC eq 0.
LOOP AT LT_TAB INTO LS_TAB.
TRANSFER LS_TAB TO P_FLPTH.
ENDLOOP.
CLOSE DATASET P_FLPTH.
if sy-batch = 'X'.
write:/ 'File uploaded successfully'.
else.
message sXXX with 'File uploaded successfully'.
endif.
Else.
if sy-batch = 'X'.
write:/ 'Error in File upload'.
else.
message sxxx with 'Error in File upload'.
endif.
LEAVE PROGRAM.
ENDIF.
<b>2. Without the use of ABAP code.</b>
CG3Y -
Appl to Presentation server
<b>Reward if useful</b> -
Validate application server file
Hi,
I have to validate the application server file path on selection screen.
I am using following code :
form VALID_APP_FILEPATH using p_filpath TYPE FILENAME-FILEINTERN.
data : l_fname(60).
CALL FUNCTION 'FILE_GET_NAME'
EXPORTING
LOGICAL_FILENAME = p_filpath
OPERATING_SYSTEM = SY-OPSYS
IMPORTING
FILE_NAME = L_FNAME
EXCEPTIONS
FILE_NOT_FOUND = 1
OTHERS = 2.
IF SY-SUBRC ne 0.
MESSAGE 'Enter the valid file path'(e01) TYPE 'E'.
ENDIF.
endform. " VALID_APP_FILEPATH
but if i choose correct file path from F4 help also.
It displays error message.
Sy-subrc always equals 1.
Help me outHi,
I have implemented the code mentioned by you and am not having any problems even when I use F4 to get the fle name.
Pls recheck and get back if the error persists.
Reward if found helpful.
Warm Regards,
R Adarsh -
Application server file formats.
Hi,
I have one query regarding the application server file formats, when we are creating a file we give some extension (.txt, .dat),what is the use of different extensions.
When we are downloading the file from appl server using CG3Y we have two options(ASC and BIN ) what is the use of these options.
Thanks in advance.Hi,
A text file is a kind of computer file that is structured as a sequence of lines.
A .dat file is a computer file which stores data for use by a computer application or system.
A character encoding consists of a code that pairs a sequence of characters from a given character set (sometimes referred to as code page) with something else, such as a sequence of natural numbers, octets or electrical pulses, in order to facilitate the storage of text in computers and the transmission of text through telecommunication networks.
ASCII and BINARY codes are used for internal representation of data.
The major difference between ASCII and BINARY is that when ASCII mode is used then the READ DATASET stmt starts at new line each time and in case of BINARY it reads character by character ( or some characters).
Thanks and regards. -
Application Server file into EXCEL SHEET
Hi ,
i want down load the Application Server FILE into EXCEL SHEET directly..
how to do this one.
regards,
venu.Hi Srinivas
I tried using CG3Z to upload excel onto application server but failed to do the same,
Any pointers regarding the same would be of great help.
Regards
Sukumari
Edited by: Manjeera Chinigiri on Mar 31, 2008 3:08 PM -
Application Server file to internal table
Hi,
How can i read the application server file into the internal table?? Which FM should i use??
Regards,
KitHi,
Open Dataset is used to read or write on to application server ... other than that i am not sure that there exists any way to do the same ... here is a short description for that
FILE HANDLING IN SAP
Introduction
Files on application server are sequential files.
Files on presentation server / workstation are local files.
A sequential file is also called a dataset.
Handling of Sequential file
Three steps are involved in sequential file handling
OPEN
PROCESS
CLOSE
Here processing of file can be READING a file or WRITING on to a file.
OPEN FILE
Before data can be processed, a file needs to be opened.
After processing file is closed.
Syntax:
OPEN DATASET <file name> FOR {OUTPUT/INPUT/APPENDING}
IN {TEXT/BINARY} MODE
This statement returns SY_SUBRC as 0 for successful opening of file or 8, if unsuccessful.
OUTPUT: Opens the file for writing. If the dataset already exists, this will place the cursor at the start of the dataset, the old contents get deleted at the end of the program or when the CLOSE DATASET is encountered.
INPUT: Opens a file for READ and places the cursor at the beginning of the file.
FOR APPENDING: Opens the file for writing and places the cursor at the end of file. If the file does not exist, it is generated.
BINARY MODE: The READ or TRANSFER will be character wise. Each time n characters are READ or transferred. The next READ or TRANSFER will start from the next character position and not on the next line.
IN TEXT MODE: The READ or TRANSFER will start at the beginning of a new line each time. If for READ, the destination is shorter than the source, it gets truncated. If destination is longer, then it is padded with spaces.
Defaults: If nothing is mentioned, then defaults are FOR INPUT and in BINARY MODE.
PROCESS FILE:
Processing a file involves READing the file or Writing on to file TRANSFER.
TRANSFER Statement
Syntax:
TRANSFER <field> TO <file name>.
<Field> can also be a field string / work area / DDIC structure.
Each transfer statement writes a statement to the dataset. In binary mode, it writes the length of the field to the dataset. In text mode, it writes one line to the dataset.
If the file is not already open, TRANSFER tries to OPEN file FOR OUTPUT (IN BINARY MODE) or using the last OPEN DATASET statement for this file.
IF FILE HANDLING, TRANSFER IS THE ONLY STATEMENT WHICH DOES NOT RETURN SY-SUBRC
READ Statement
Syntax:
READ DATASET <file name> INTO <field>.
<Field> can also be a field string / work area / DDIC structure.
Each READ will get one record from the dataset. In binary mode it reads the length of the field and in text mode it reads each line.
CLOSE FILE:
The program will close all sequential files, which are open at the end of the program. However, it is a good programming practice to explicitly close all the datasets that were opened.
Syntax:
CLOSE DATASET <file name>.
SY-SUBRC will be set to 0 or 8 depending on whether the CLOSE is successful or not.
DELETE FILE:
A dataset can be deleted.
Syntax:
DELETE DATASET <file name>.
SY-SUBRC will be set to 0 or 8 depending on whether the DELETE is successful or not.
Pseudo logic for processing the sequential files:
For reading:
Open dataset for input in a particular mode.
Start DO loop.
Read dataset into a field.
If READ is not successful.
Exit the loop.
Endif.
Do relevant processing for that record.
End the do loop.
Close the dataset.
For writing:
Open dataset for output / Appending in a particular mode.
Populate the field that is to be transferred.
TRANSFER the filed to a dataset.
Close the dataset.
chk a sampel
parameters: p_file like rlgrap-filename obligatory
default '/usr/sap/upload.xls'.
types: begin of t_data,
vbeln like vbap-vbeln,
posnr like vbap-posnr,
matnr like vbap-matnr,
werks like vbap-werks,
megne like vbap-zmeng,
end of t_data.
data: it_data type standard table of t_data,
wa_data type t_data.
open dataset p_file for output in text mode encoding default.
if sy-subrc ne 0.
write:/ 'Unable to open file:', p_file.
else.
do.
read dataset p_file into wa_data.
if sy-subrc ne 0.
exit.
else.
append wa_data to it_data.
endif.
enddo.
close dataset p_file.
endif.
And if you want to write on the file.
*--- open UNIX file
open dataset unixfile for output in text mode message w_msg.
if sy-subrc ne 0.
write: / 'Cannot open for writing:', unixfile, w_msg.
exit.
endif.
*--- write UNIX file
loop at it_file.
transfer it_file to unixfile.
endloop.
*--- close UNIX file
close dataset unixfile. -
Application Server file Accessing problem
Hi all,
In my program i am writing data to the application server file ( temp.txt ) in Appending mode.
I am having 1000 records to write. In the mean time ( while temp.txt have 200 records ) i am running the same program using same application server file ( temp.txt ) same client but different user. That time writting option for both programs are successfully done.
But in my case i have to restrict the file writing at that time only one user.
Is there any way to lock the application server file for particular user while writting.
Thanks in Advance,
Florian.
Edited by: Florian Thiruselvan on Dec 22, 2008 6:51 AMHi Kishan Singh,
You are exactly write. Its working but i got some more problem in that.
Importing Parameter
VOLDIR_SET TYPE TXW_LOCK2-VOLDIR_SET
VOLDIR_SET TXW_VOLSET CHAR 10 0 Data file directory set
But the Data file directory set length is more than 10.
What shall i do? do you have any idea please suggest me.
Thanks
Florian -
Sending IDOC information in the XML format on the application server
Hello All,
We have a requirement like, while creating a billing document, an IDOC should be generated and the XML file should be created for that data in IDOC and that XML file would be sent to further via XI.
For this purpose, we have created
1. Logical Sender Receiver Systems We are sending the data from DL3 system 100 client to DL3 800 client
2. Assigned the clients to the logical system.
3. Created the distribution model with the message type INVOIC.
4. Created the partner profiles.
5. Created an XML port in transaction WE21, in which the application server file path is mentioned on which the xml file would be generated and the function module is provided which will only generate the file name is mentioned. In the outbound trigger tab the RFC destination is mentioned which is of type TCP/IP LOCAL_EXEC
6. In transaction WE20, for the 100 logical system added the message type INVOIC as a outbound parameter and same for the 800 client. The receiver port is mentioned as XML port which we have created.
Now, when we create the billing document via VF01 transaction, we give the transmission medium as ALE in the output. Hence the IDOC gets generated. The XML file also gets generated but the contents of the file are ONLY control records of the IDOC.
And not the data record and the status records.
The IDOC, if we see in WE02 displayes all the data in control , data and status records.
We want the control, Data and Status records of the IDOC to be populated in the XML file.
Please suggest if any extra configuration is required in this case. We are working on SAP 4.6.
Thanks in advance for your answers.
Regards,
AnujaHi Rob,
Ya ,i will take care your suggestion from next time..
Yes, we have downloaded the file using transaction CG3Y and opned it with IE as suggested by you. Howerver the contents are still seems to be control record.
For your reference putting the contents of the file.
<?xml version = "1.0"?><INVOIC01><IDOC BEGIN="1"><EDI_DC40 SEGMENT="1"><TABNAM><![CDATA[EDI_DC40]]></TABNAM><MANDT>100</MANDT><DOCNUM>0000000000227012</DOCNUM><DOCREL>46C</DOCREL><STATUS>30</STATUS><DIRECT>1</DIRECT><OUTMOD>2</OUTMOD><IDOCTYP>INVOIC01</IDO
Please advice.
Thanks.
Regards,
Anuja. -
Need utilities class for application server file system (i.e. unix etc)
I need to do things to directories and files on the application server.
Is there an SAP class with methods for the application server file system (i.e. unix or whatever) with functionality similiar to what is provided by the methods of CL_GUI_FRONTEND_SERVICES for the presentation server?
Is there a group of SAP functions for this task?You may have a look at Thomas Jung article: [sdn contribution : ABAP Server Side File Access, by Thomas Jung|http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/7a13f367-0401-0010-47ba-eab0b15cf31c]
Moreover, in release 7.10, it could be possible that SAP introduced input and output stream classes (to mimic java classes), so I guess there could be the ones for application server file system. -
How to check whether the Application Server directory exits or not
Hi,
I have a selection screen in which I give the Application server file name(UNIX file) as input. Here, I would like to check whether the Server directory exists or not.
Let us say, the path I gave in the selection screen is /usr/sap/tmp/testfile.txt . Here, the file name is testfile.txt and the server directory is /usr/sap/tmp . I would like to check whether this directory /usr/sap/tmp exists in the server or not. I am not bothered about the file name as I am going to write data into the file. I am mainly concerned about whether the directory exists in the server or not. and one more thing... this is the Application Server path not the Local path.
Can anyone help me on the same how to check whether the server directory exists or not.
Thanks in advance.
Best Regards,
Pradeep.Also you can use the FM EPS_GET_DIRECTORY_LISTING for this purpose.
Store the directory name
l_dpath = p_file+0(l_no).
Validate the directory of the application server
CALL FUNCTION 'EPS_GET_DIRECTORY_LISTING'
EXPORTING
dir_name = l_dpath
TABLES
dir_list = l_i_dlist
EXCEPTIONS
invalid_eps_subdir = 1
sapgparam_failed = 2
build_directory_failed = 3
no_authorization = 4
read_directory_failed = 5
too_many_read_errors = 6
empty_directory_list = 7
OTHERS = 8.
If any problem occurs with the directory then display proper
error message
IF sy-subrc <> 0.
Display error message
MESSAGE e018 WITH 'Problem with directory entered'(008).
ENDIF. " sy-subrc <> 0
Regards,
Joy.
Maybe you are looking for
-
Alarm clock: wake to music or radio?
Please help: I want to set an alarm in my iPhone3G and wake up to an internet radio station or iPod music. Anyone know how I can do this? Is there a general way to scrip some iPhone3G functions at a scheduled time? Like a chron job for instance. Than
-
Hi all, Is quality info record required if I want to block payment for a particular vendor based on the Usage Decision? Thanks and Regards, Raghu
-
3.0.2 installation hangs on HP ProLiant DL 120 G5
When installing Oracle VM 3.0.2 on HP ProLiant DL 120 G5 (1x Xeon 3065, 4GB RAM, 2x SATA disks in software RAID 1), install hangs on loading kernel. Article "Oracle VM Server Installation Hangs While Loading Xen.gz" (http://itnewscast.com/oracle-vm-3
-
[CS5] Create Export PDF Preset w/ High text quality
Hello, I've created an Export Preset for PDFs using the PDF/X-1a 2001 Standards. I've left all the default settings, and the PDF looks good, but now its been requested that I make the text appear more "crisp". I'm wondering what settings I could twea
-
I am precompiling JSPs in one node of the cluster and trying to reuse the generated class files in other nodes. I am having no luck. Each node is doing its own precompilation when I start managed node. Is there any way t