Append data into the file in application server
Hi Friends,
I have an issue where i have a job which has three different stepst for same program. If i run the job the program will create a file in the application server and append the other two steps in the same file without overwriting the file or creating a new file.
My problem is like its creating three different files in application server for that particular job since it has three steps . Its not appending into one particular file .
I am using the FM 'Z_INTERFACE_FILE_WRITE' where i have used the pi_append in the exportng parameter . ITs working when i specify the file in local system. It is appending correctly when i run the report normally to apppend into local system.
But when i schedule a job to append the file in application server its creating three different files.
Kindly help me if anyone is aware of this issue
Thanks in advance
Kishore
Hi,
Please use open dataset to write and append files.Please check the logic of Z FM which you are using .
To open and write into a file use
OPEN DATASET FNAME FOR OUTPUT.
To append data into existing file use
OPEN DATASET FNAME FOR APPENDING.
To write into file:
v_file = file path on application server
OPEN DATASET v_file FOR output.
IF sy-subrc NE 0.
write:/ 'error opening file'.
ELSE.
TRANSFER data TO v_file.
ENDIF.
CLOSE DATASET v_file.
For appending :
OPEN DATASET v_file fOR APPENDING.(file is opened for appending data position is set to the end of the file).
Thanks and Regards,
P.Bharadwaj
Similar Messages
-
Regarding Reading the file from Application Server
Hi,
I am trying to read data from Application Server but due to special characters it is getting dumped out.
US24,Q,Acero (Carbon),AA,0010,0001,01,Ver Mir para dimension#
US24,Q,Acero (Carbon),AA,0010,0002,01,Area rectificada sin da#os ra
US24,Q,Acero (Carbon),AA,0010,0003,01,Ver Mir para dimension#
US24,Q,Acero (Carbon),CD,0010,0001,01,ITPE Soken para verificacion
US24,Q,Acero (Carbon),CD,0010,0010,01,No se permite desprendimiento
US24,Q,Acero (Carbon),CD,0010,0002,01,"Vernier, cinta metrica"#
In the last line it is going into dump due to special character ".
Please suggest.
Thanks
Priyanka.Hi,
You can check the mode in which you are reading the file
from application server that is
Open Dataset in Binary or Text Mode.
Hope it helps
Regards
Mansi -
Problem while dowloading the file from Application Server
Dear Experts,
I am facing the Problem while downloading the file from Application server.
We done the automatic function while saving the invoice, this will create an idoc, and this idoc is written in the Application Server.
I am running the Transaction AL11 and select the record, and from menu --> List, i am downloading into TXT format.
But for some segments, the length is long, and so the last 3 to 4 fields values are not appearing in the File. Even though i am unable to view the values in the file before downloading. But i can view in IDOC.
Please help me to solve this issue.
Thanks & Regards,
Srinibut our user will use the Txn. AL11 and they will download from there
Educate the user On a serious note, tell him this is not how data from app server should be downloaded. You can ask him to talk to the basis team to provide him access to the app server folder where the file is being stored.
I can set the Variant and put this in background, But always the file name will be change, Like we use Time stamp in the File name.
You can't automate this process by scheduling in BG mode. This is because the in BG mode you can't dwld the file to presentation server.
Hope i'm clear.
BR,
Suhas -
Need a pipe delimiter after every field in the file on application server
Hi ,
i have to transport data in internal table to a file on application server.
I have done this successfully. But the problem is i have to put a pipe
delimiter after every field in the file on application server.
Could yoe plz help in this issue.
Thanks & Regards
Suresh kumar DHi Should,
I think the below code should solve your problem as i also had a similar type of requirement and this was the code i had used in my program.
FIELD-SYMBOLS: <FS> TYPE ANY.
DATA: L_FLINE TYPE STRING.
Open file for output
M_CHECK_SELSCR_FNMS O1 O.
LOOP AT I_TARGET.
Write records to file
DO.
ASSIGN COMPONENT SY-INDEX OF STRUCTURE I_TARGET TO <FS>.
IF SY-SUBRC EQ 0.
IF SY-INDEX EQ 1.
MOVE <FS> TO L_FLINE.
ELSEIF <FS> NE C_PIPE.
CONCATENATE L_FLINE C_PIPE <FS> INTO L_FLINE.
ELSE.
CONCATENATE L_FLINE <FS> INTO L_FLINE.
ENDIF.
ELSE.
TRANSFER L_FLINE TO W_SRVR_NM_O_O1.
EXIT.
ENDIF.
ENDDO.
ENDLOOP.
Close file
CLOSE DATASET W_SRVR_NM_O_O1.
IF SY-SUBRC EQ 0.
MESSAGE S208(00) WITH TEXT-M02.
ENDIF.
Regards
Sikha -
How to provide the F4 functionality to the files on application server
Hi,
How to provide the F4 functionality to the files on application server at selection screen.as it is F4_FILENAME for files on desktop , is there any Function module for this purpose also. I did a search in R/3 but didnt get any FM .Please advise.
Regards,
sam.You can get to it using frontend class CL_GUI_FRONTEND_SERVICES if you know the host name and have the correct permissions, for example, this program works great for me in my system.
report zrich_0001 .
data: ifiletable type filetable.
data: xfiletable like line of ifiletable.
data: rc type i.
parameters: p_file1 type localfile default'\sapprdusr'.
at selection-screen on value-request for p_file1.
call method cl_gui_frontend_services=>file_open_dialog
EXPORTING
* WINDOW_TITLE =
* DEFAULT_EXTENSION =
* DEFAULT_FILENAME =
* FILE_FILTER =
INITIAL_DIRECTORY = '\sapprdusr'
* MULTISELECTION =
changing
file_table = ifiletable
rc = rc
* USER_ACTION =
EXCEPTIONS
FILE_OPEN_DIALOG_FAILED = 1
CNTL_ERROR = 2
ERROR_NO_GUI = 3
others = 4.
read table ifiletable into xfiletable index 1.
if sy-subrc = 0.
p_file1 = xfiletable-FILENAME.
endif.
Regards,
Rich Heilman -
Error in Reading the file from Application Server
Hi,
This Error is regarding one of my interface, the issue is that , the interface reads data from file in bunch suppose 100 records at a time , then processes those records and once finished go for next 100 records .
Noe the error is that , the process takes place till 500 records correctly but when it went to fetch for next 100 i.e fom 501 to 600 it selects only 501 to 583 .
this records has been processed successfully but the job finished there only
but the file contains 788 records
When the same file has been run in other server it ran successfully without such error .
Can you please suggest how to resolve the issueHi,
Try to manually download the file from application server using standard transactions, and than check how many records are you able to download from app. server.
I guess there might be something wrong with the format of 583rd record, which makes sap assume that the file has come to an end.
Hope this will help you.
Regards,
Vinit... -
Error while writing the data into the file . can u please help in this.
The following error i am getting while writing the data into the file.
<bindingFault xmlns="http://schemas.oracle.com/bpel/extension">
<part name="code">
<code>null</code>
</part>
<part name="summary">
<summary>file:/C:/oracle/OraBPELPM_1/integration/orabpel/domains/default/tmp/
.bpel_MainDispatchProcess_1.0.jar/IntermediateOutputFile.wsdl
[ Write_ptt::Write(Root-Element) ] - WSIF JCA Execute of operation
'Write' failed due to: Error in opening
file for writing. Cannot open file:
C:\oracle\OraBPELPM_1\integration\jdev\jdev\mywork\
BPEL_Import_with_Dynamic_Transformation\WORKDIRS\SampleImportProcess1\input for writing. ;
nested exception is: ORABPEL-11058 Error in opening file for writing.
Cannot open file: C:\oracle\OraBPELPM_1\integration\jdev\jdev\mywork\
BPEL_Import_with_Dynamic_Transformation
\WORKDIRS\SampleImportProcess1\input for writing. Please ensure 1.
Specified output Dir has write permission 2.
Output filename has not exceeded the max chararters allowed by the
OS and 3. Local File System has enough space
.</summary>
</part>
<part name="detail">
<detail>null</detail>
</part>
</bindingFault>Hi there,
Have you verified the suggestions in the error message?
Cannot open file: C:\oracle\OraBPELPM_1\integration\jdev\jdev\mywork\BPEL_Import_with_Dynamic_Transformation\WORKDIRS\SampleImportProcess1\input for writing.
Please ensure
1. Specified output Dir has write permission
2. Output filename has not exceeded the max chararters allowed by the OS and
3. Local File System has enough space
I am also curious why you are writing to a directory with the name "..\SampleImportProcess1\input" ? -
Gui_download function to download the file in application server in bdc
Can we use gui_download function to download the file in application server in bdc?
Regards,
pandu.for downloading the file on application sever you use the concept of Dataset. GUI_DOWNLOAD is for presentaion server.
regards
Abhi -
Can I append date to the file name using Bursting
Hi All,
I know that we can append date to the file using %y, %m and %d for
Email
FTP
WEBDAV
But is there any way of appending the date to the file name if I am bursting my file to a shared location.
I tried that %y, %m and %d but that doesn't work for bursting.
Please reply
Thanks,
RonnyIf this requirment is for EBS, please refer the following blog
http://blogs.oracle.com/BIDeveloper/2010/08/xdoburstrpt_passing_parameters.html
For standalone see the following delivery sql query as example.
select
d.department_name KEY,
'Standard' TEMPLATE,
'RTF' TEMPLATE_FORMAT,
'en-US' LOCALE,
'PDF' OUTPUT_FORMAT,
'FILE' DEL_CHANNEL,
'C:\Temp' PARAMETER1,
d.department_name||'_'||to_char(sysdate,'mmddyyyy')|| '.pdf' PARAMETER2
from
departments d
Thanks
Ashish -
Urgent - Append data to internal table from Application server
Hi All,
I encountered the problem while read the input file from Application server...then append it to internal table. I manage to read the input file from presentation and append the data to internal table.
Below are my coding which cause me not able the append data from Application server. Please kindly help me to solving/correct my coding. Thanks in advance .
PARAMETERS : p_inpfl LIKE rlgrap-filename. "Material Input File
SELECTION-SCREEN BEGIN OF LINE.
Application Server
SELECTION-SCREEN COMMENT 1(19) text-002 FOR FIELD rb_ux.
SELECTION-SCREEN POSITION 33.
PARAMETERS: rb_ux RADIOBUTTON GROUP g1.
Presentation Server
SELECTION-SCREEN COMMENT 40(21) text-003 FOR FIELD rb_pc.
SELECTION-SCREEN POSITION 65.
PARAMETERS: rb_pc RADIOBUTTON GROUP g1 DEFAULT 'X'.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN SKIP.
SELECTION-SCREEN END OF BLOCK b01.
FORM f_Input_file.
CLEAR: v_f_exists.
CHECK NOT p_inpfl IS INITIAL. "input file exist
IF NOT rb_pc IS INITIAL. " Pc check
PERFORM f_read_tab_delimited_file TABLES i_input
USING c_09
p_inpfl
rb_ux
CHANGING v_ifile_str_with_tab
v_f_exists
v_ifile_record_count
v_message.
IF v_f_exists EQ '1' .
UPLOAD FILE could not be read
MESSAGE e546 .
ENDIF .
IF v_ifile_record_count EQ 0 .
Zero records in upload file
MESSAGE e547 .
ENDIF.
ELSE.
OPEN DATASET p_inpfl FOR INPUT IN TEXT MODE.
DO.
READ DATASET p_inpfl INTO i_input.
IF sy-subrc EQ 0.
APPEND i_input.
ELSE.
EXIT.
ENDIF.
ENDDO.
CLOSE DATASET p_inpfl.
ENDIF.Hi,
Refere the following code for the poulating internal from the application server.
PARAMETERS : pr_sfile TYPE filename-fileintern,
Here give the logical file name from the application serevr.
data : w_param_1 LIKE filename-fileintern,
x_file(500),
w_move_file LIKE epsf-epsfilnam,
w_from_dir LIKE epsf-epsdirnam,
w_path LIKE rlgrap-filename,
input_line(1000),
w_path LIKE rlgrap-filename,
w_file LIKE rlgrap-filename,
w_dir LIKE rlgrap-filename,
w_dir1 LIKE epsf-epsdirnam,
w_file1 LIKE epsf-epsfilnam,
**************Start of the code***************
MOVE '*' TO w_param_1.
PERFORM get_file_name USING pr_sfile w_param_1.
LOOP AT it_file WHERE name CP w_file1.
CLEAR : x_file, w_path,
w_move_file, w_from_dir.
REFRESH : it_input,
it_input_err.
IF w_flag IS INITIAL.
CONCATENATE w_dir it_file-name INTO x_file.
CONDENSE x_file.
TO Move file from sever for backup storing the file name and path
w_path = x_file.
CALL FUNCTION 'TRINT_SPLIT_FILE_AND_PATH'
EXPORTING
full_name = x_file
IMPORTING
stripped_name = w_move_file
file_path = w_from_dir
EXCEPTIONS
x_error = 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.
********here it_input will be the structure of the file present on the application server
PERFORM read_file TABLES it_input
USING x_file.
CLEAR it_input_err.
REFRESH it_input.
ENDLOOP.
*******************end of the code****************
*& Form read_file
text
-->P_X_FILE text
FORM read_file TABLES it_tab
USING x_file.
OPEN DATASET x_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc NE 0.
WRITE : / text-006.
ELSE.
DO.
READ DATASET x_file INTO input_line.
IF sy-subrc = 0.
CLEAR: it_input, count.
DO.
ADD 1 TO count.
ASSIGN COMPONENT count OF STRUCTURE it_tab TO <fs>.
IF sy-subrc = 0.
SPLIT input_line AT separator INTO <fs> input_line.
ELSE.
EXIT.
ENDIF.
ENDDO.
APPEND it_tab.
ELSE.
EXIT.
ENDIF.
ENDDO.
ENDIF.
CLOSE DATASET x_file.
*& Form get_file_name
text
-->P_P_SFILE text
-->P_W_PARAM_1 text
FORM get_file_name USING p_sfile
w_param_1.
CHANGING x_file.
CALL FUNCTION 'FILE_GET_NAME'
EXPORTING
client = sy-mandt
logical_filename = p_sfile
parameter_1 = w_param_1
IMPORTING
file_name = x_file
EXCEPTIONS
file_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.
w_path = x_file.
CALL FUNCTION 'TRINT_SPLIT_FILE_AND_PATH'
EXPORTING
full_name = w_path
IMPORTING
stripped_name = w_file
file_path = w_dir
EXCEPTIONS
x_error = 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.
w_dir1 = w_dir.
w_file1 = w_file.
CALL FUNCTION 'EPS_GET_DIRECTORY_LISTING'
EXPORTING
dir_name = w_dir1
file_mask = w_file1
TABLES
dir_list = it_file
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 sy-subrc <> 0.
WRITE : / text-006.
ENDIF.
Hope this will help you. -
FM to get the file from application server to presenatation server automati
Hi!
In my upload program I am egtting the error log file onmy application server directly. Is there a function module or a way that in my abap code I can mention to bring the file or transfer the file to the presentation server . As my program is been run in the back ground so I cannot directly get the file on the presenattion server, so I need to bring it back on teh presentation server back to see teh eror log.
I would like my program to do the transfer in background itself so that I can see the error log on a daily basis from my local file .
Thanks
when 'X'. "X is application server
* TRANSLATE p_err USING '\/'." correct slash for unix
open dataset p_err2 for output in text mode encoding default.
if sy-subrc = 0.
loop at t_err into s_nts.
transfer s_nts to p_err2.
if sy-subrc ne 0.
message i010(ad) with p_err2 'Download Failed'.
endif.
endloop.
close dataset p_err2.
else.
message i010(ad) with p_err 'dataset could not be found'.
sy-subrc = -1. "Maintain error condition
endif.
* endif.
when ' '. "Blank is presenation server
translate p_err using '/\'."correct slash Dos file
call function 'DOWNLOAD'
EXPORTING
filename = p_err
filetype = 'ASC' "FTYPE set to DAT in DATA seg
TABLES
data_tab = t_err.
if sy-subrc ne 0.
message i010(ad) with 'File ' p_err 'cannot be located.'.
sy-subrc = -1. "Maintain error condition
exit.
endif.
endcase.
ENDIF.
ThanksSO , after reading all , I assume that there is no way in which when I run the background job and get a errro file on application server can be retrievd on my presenattion serevr during the background job run. I was thinking that theer might be a functionn module which will convert the application server file into presenttion server file during the program run in background and store it in the location provided.
I was trying to use FM CALL FUNCTION 'C13Z_APPL_TO_FRONT_END' and CALL FUNCTION 'ARCHIVFILE_SERVER_TO_SERVER' but using teh first one asks for source file and destination file name during teh program run and as it runs in background it cannot be provided again and again and teh second one dosent seem to work.
Thanks -
Problem with saving data in text file in Application server
Hello Experts,
I am trying to save a text file in application server.When I text file have less that 60000 (i.e 59999) records, it saves the file successfully, but if records in text file (saved in application server) is more than 60000 (i.e 60002), it creates a new file at the 60000th record with the continued records.
Can anyone please advise, why it is creating a new file if records are more that 60000. I tested it with 59000 records in my internal table and it is working fine. I have not given any restriction in my program to create a new file if records are more than 60000.
The logic I implemented is the following:
*Open file
open dataset g_accnt_file for output in text mode encoding utf-8.
if sy-subrc = 0.
clear g_header_record.
*Building header record for Accounting Validation file
concatenate gc_hdr_desc
gc_filetype
gc_sequence
gc_idntf_refresh
gc_cmpny_idntf
gc_accnt_id
sy-datum
sy-uzeit
gc_linde_group
sy-sysid
gc_not_used into g_header_record separated by
gc_deliminator.
transfer g_header_record to g_accnt_file.
*Move Cost center data to file to create a detail record for Accounting
*Validation file
loop at gt_csks into gs_csks.
*Remove leading Zeros
call function 'CONVERSION_EXIT_ALPHA_OUTPUT'
exporting
input = gs_csks-kostl
importing
output = gs_csks-kostl.
* Overlay gs_csks-kostl with space.
* SHIFT gs_csks-kostl RIGHT DELETING TRAILING gc_space.
*Prepare Cost Centre String
perform prepare_costcentre_string.
*Prepare detail record with Company Code & Cost Centre
perform prepare_detail_record.
clear:g_detail_record,gs_csks,g_coa.
endloop.
*Move Order data to file to create a detail record for Accounting
*Validation file
loop at gt_aufk into gs_aufk.
*Remove leading Zeros
call function 'CONVERSION_EXIT_ALPHA_OUTPUT'
exporting
input = gs_aufk-aufnr
importing
output = gs_aufk-aufnr.
* SHIFT gs_aufk-aufnr RIGHT DELETING TRAILING gc_space.
*Prepare Order String
perform prepare_order_string.
*Prepare detail record with Company Code & Order
perform prepare_detail_record.
clear:g_detail_record,gs_aufk,g_coa.
endloop.
*Move WBS data to file to create a detail record for Accounting
*Validation file
loop at gt_prps into gs_prps.
call function 'CONVERSION_EXIT_ABPSP_OUTPUT'
exporting
input = gs_prps-pspnr
importing
output = g_wbs_element.
* SHIFT g_wbs_element RIGHT DELETING TRAILING gc_space.
*Prepare WBS Element String
perform prepare_wbs_string.
*Prepare detail record with Company Code & WBS Element
perform prepare_detail_record.
clear:g_detail_record,gs_prps,g_coa.
endloop.
*Building trailer record for Accounting Validation file which will
*contain the total number of detail records in file
concatenate gc_trail_desc
g_total_count
into g_trailer_record
separated by gc_deliminator.
transfer g_trailer_record to g_accnt_file.
*Close file
close dataset g_accnt_file.
if sy-subrc = 0.
message s036(/lig/fi).
endif.
endif.
endform. " SELECT_DATA
Edited by: Matt on Sep 30, 2010 11:02 AM - added tagsHi Pankaj,
Can u check the concatenate statement with one more data. Check the no of lines for a single file.
concatenate gc_hdr_desc
gc_filetype
gc_sequence
gc_idntf_refresh
gc_cmpny_idntf
gc_accnt_id
sy-datum
sy-uzeit
gc_linde_group
sy-sysid
sy-subrc
gc_not_used into g_header_record separated by
gc_deliminator.
Regards,
Amitava -
Not recognizing # while reading the file from application server
Hi
I am reading a file from application server. While reading into internal table with read statement the last field in each record is filling with hash symbol in the last digit. If I write any if condition with HASH symbol its not going inside the if condition, means its not recognizing as hash may be its internally treating as some other. I need to remove the hash from that field. How I can do that.
Thanks,
kishoreI faced exact situation. Yes, internally its treated as some other special character. What i did was, becuase hash symbol was always coming at the end...i created a dummy field in my internal table so that it will not interfere with my actual data. When i see the data in my internal table, the hash always falls in the last field (dummy) which i will ignore. I could not get solution to remove this hash so i adopted this approach and it worked!!
Hope it helps,
SKJ -
Regarding uploading the file from Application Server
I am trying to upload a .csv file to Application Server through CG3Z tcode.
But i am getting dump ad below..
What happened?
While a text was being converted from code page '4102' to '1100', one
the following occurred:
- an character was discovered that could not be represented in one of
the two code pages;
- the system established that this conversion is not supported.
The running ABAP program, 'SAPLC13Z' had to be terminated, since the
conversion could cause incorrect data to be generated.
1 characters could not be represented (and thus could not converted).
If 1 = 0, a second or a different error has occurred.
Please let me know..how can i resolve this??
Thanks
PriyankaCheck if your CSV file is UNICODE encoding.
If CG3Z steel not works you can check on OSS SUPPORT if a note solve your problem. -
Error Loading the file from application server
Hi Team,
I'm trying to load the .CSV file from application server and I'm getting the error message.
In the data package
Update to PSA --Green
Transfer Rule -- Green
Update Rule - error ABORT was set in the customer routine 9998
Error 1 in the update
Please help me to provide the solution.
But when I try to load the other files there are no issues. thanks.
Regards,
SenthilRaj
check the below links, which can helps to solve your issues
Flat file data load
flat file Data loading issue
Mahesh
Maybe you are looking for
-
HI All , I am using the method SET_TABLE_FOR_FIRST_DISPLAY of class CL_GUI_ALV_GRID for a report program . In the Menu bar I have SYSTEM and HELP by default But in REUSE_ALV_GRID_DISPLAY in Menu bar we have LIST EDIT GOTO SETTINGS other than SY
-
Firefox was working fine until I did a system restore to get rid of a DLL initialization failed error; it went back 20 days; an older version of firefox was there and it wouldn't update, then I noticed all my major search engines and defaults were go
-
iTunes (10.5.2) won't recognize my iPhone even after I've gone through all the steps recommended by Apple Support (restarted iPhone, restarted computer, used different USB port, updated iTunes, removed and reinstalled Apple Mobile Device Service). I
-
How do I formulate (d-c) +(b-a) or d-a in the same cell?
I'm trying to create a formula in Numbers. I have 4 columns to enter time data (for daycare). On some days, kids have school. I need a formula that will total the hours depending on school (d-c) + (b-a) or for when I have them the full day (d-a). I n
-
I think I've just trashed iPhoto by mistake and all my photos with it - help! It's not appearing in the trash.