Memory or space availabilty in the application server directory
hi
i have AS path /tmp
i want to know how much space is available for the temp folder.
Please suggest any FM.
Hi friend,
1. Goto to Transaction SM69.
2. Click on F5.
3. Click on F6.
4. Enter a name in Command Name box ex: z_com
5. Enter a os command in Operating system command box. ex: df -k (uinix command for disk free space of all directories)
6. Give location in application server in Parameters for operating system command box ex: /C dir
7. Click Save.
Goto SE 38 and develop a report using FM 'SXPG_COMMAND_EXECUTE' .
Ex:
REPORT zdemodownload .
data: g_out like BTCXPM occurs 0,
z_com type SXPGCOLIST-NAME value 'df -k'.
CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
EXPORTING
commandname = z_com
TABLES
exec_protocol = g_out
EXCEPTIONS
NO_PERMISSION = 1
COMMAND_NOT_FOUND = 2
PARAMETERS_TOO_LONG = 3
SECURITY_RISK = 4
WRONG_CHECK_CALL_INTERFACE = 5
PROGRAM_START_ERROR = 6
PROGRAM_TERMINATION_ERROR = 7
X_ERROR = 8
PARAMETER_EXPECTED = 9
TOO_MANY_PARAMETERS = 10
ILLEGAL_COMMAND = 11
WRONG_ASYNCHRONOUS_PARAMETERS = 12
CANT_ENQ_TBTCO_ENTRY = 13
JOBCOUNT_GENERATION_ERROR = 14
OTHERS = 15.
IF sy-subrc = 0.
display table g_out..............
ENDIF.
Thanks.......
Edited by: Sap Fan on Feb 19, 2009 12:44 PM
Edited by: Sap Fan on Feb 19, 2009 1:39 PM
Similar Messages
-
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. -
How to check if the file already exists in the application server directory
Hi all. I'm on devsuite 10g.
I transfer file from local machine to application server using webutil function webutil_file_transfer.client_to_as and I want to check if the file I'm transfering already exists on the server directory.
How can I make this?
Thanks all,
Fabriziouse the text_io package and open the file in read-mode.
like this
declare
xFileType text_io.file_type;
begin
xFileType := text_io.fopen('c:\temp\test.txt','R'); --file on the middle tier
-- file exists;
text_io.fclose(xFileType);
exception
when others then
--file doesn't exist
end;
regards
Christian -
Process Chain to do nothing if file does not exist in the application serve
Hi All,
We have a process chain that flows to different data targets daily if files delivered in the application server.
Process chain does works fine. But my question is do we have anyway to stop the process chain or do not run process chain if it does not find the file available any days during this time range instead of failing.*
Is there any settings to enable the check if file available then run or else do not run at all. Please help!!!
Thanks,Follow the function modules listed in :
http://wiki.sdn.sap.com/wiki/display/ABAP/Workingwithfiles
with these function modules - you can get a list of files available in the application server directory.
Pseudo code :
1. Generate the automated fiel name you want
2. Get the list of files in the directory
3. Search the list of files to see if your file exists
4. If the file exists then load the file , else load an empty file .
The code is unfortunately in a different BW system that I do not have access to at this moment... but then the procedre is the same as detailed above. -
How to change the format in the application server
The following is the uploading file in the application server:
Directory: /usr/sap/tmp
Name: ZMIRACA_SD27_LIUNIN_20070109_111913.csv
,0,000,ZMAT_TERRY,,19.12.2006,test material by terry,
,0,000,ZMAT_TERRY,,19.12.2006,test material by terry,
I click the menu System->List->Save->Local file->Spreadsheet and give a name: a.csv, then I open "a.csv", I find ",0,000,ZMAT_TERRY,,19.12.2006,test material by terry,,,EXTERNAL P,1.000,000,EA,," in one cell,but I want to separate them in different cell according to comma. Do you have some idea?
Thanks in advance!
NinaHI Nina
Have created a CSV file myself on application server using the following example code:
parameters: fname type filename obligatory lower case.
data: it_t001 type table of t001.
data: str type string.
field-symbols: <wa>, <fld>.
select * into table it_t001 from t001.
open dataset fname for output in text mode encoding default.
if sy-subrc ne 0.
write:/ 'Unable to open file.'.
else.
loop at it_t001 assigning <wa>.
clear: str.
do.
assign component sy-index of structure <wa> to <fld>.
if sy-subrc ne 0.
transfer str to fname.
exit.
elseif sy-index = 1.
move <fld> to str.
else.
concatenate str <fld> into str separated by ','.
endif.
enddo.
endloop.
endif.
After executing the program, have checked the file using following methods and i dont have any problem:
1. FTP transfer to PC.
2. AL11 -> Display -> Menupath: System->List->Save->Local File->Spread Sheet
3. Transfer via transaction: CG3Y.
In all the cases, the values are in separate cells. Please verify.
Kind Regards
Eswar -
Read application server directory and file
Hi,
I'm using the FM "RZL_READ_DIR_LOCAL" to retrieve the application server directory and filename. The returned result contain all the directory name and filename. Is there any other FM can separate the result into directory and file??
Regards,
Kithi
Ya One more FM is there - Call Function Gui Upload.
It will read the file from the app server.
See this Example:-
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.
reward if help. -
Upload tab-delimited file from the application server to an internal table
Hello SAPients.
I'm using OPEN DATASET..., READ DATASET..., CLOSE DATASET to upload a file from the application server (SunOS). I'm working with SAP 4.6C. I'm trying to upload a tab-delimited file to an internal table but when I try load it the fields are not correctly separated, in fact, they are all misplaced and the table shows '#' where supposedly there was a tab.
I tried to SPLIT the line using as separator a variable with reference to CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB but for some reason that class doesn't exist in my system.
Do you know what I'm doing wrong? or Do you know a better method to upload a tab-delimited file into an internal table?
Thank you in advance for your help.Try:
REPORT ztest MESSAGE-ID 00.
PARAMETER: p_file LIKE rlgrap-filename OBLIGATORY.
DATA: BEGIN OF data_tab OCCURS 0,
data(4096),
END OF data_tab.
DATA: BEGIN OF vendor_file_x OCCURS 0.
* LFA1 Data
DATA: mandt LIKE bgr00-mandt,
lifnr LIKE blf00-lifnr,
anred LIKE blfa1-anred,
bahns LIKE blfa1-bahns,
bbbnr LIKE blfa1-bbbnr,
bbsnr LIKE blfa1-bbsnr,
begru LIKE blfa1-begru,
brsch LIKE blfa1-brsch,
bubkz LIKE blfa1-bubkz,
datlt LIKE blfa1-datlt,
dtams LIKE blfa1-dtams,
dtaws LIKE blfa1-dtaws,
erdat LIKE lfa1-erdat,
ernam LIKE lfa1-ernam,
esrnr LIKE blfa1-esrnr,
konzs LIKE blfa1-konzs,
ktokk LIKE lfa1-ktokk,
kunnr LIKE blfa1-kunnr,
land1 LIKE blfa1-land1,
lnrza LIKE blfa1-lnrza,
loevm LIKE blfa1-loevm,
name1 LIKE blfa1-name1,
name2 LIKE blfa1-name2,
name3 LIKE blfa1-name3,
name4 LIKE blfa1-name4,
ort01 LIKE blfa1-ort01,
ort02 LIKE blfa1-ort02,
pfach LIKE blfa1-pfach,
pstl2 LIKE blfa1-pstl2,
pstlz LIKE blfa1-pstlz,
regio LIKE blfa1-regio,
sortl LIKE blfa1-sortl,
sperr LIKE blfa1-sperr,
sperm LIKE blfa1-sperm,
spras LIKE blfa1-spras,
stcd1 LIKE blfa1-stcd1,
stcd2 LIKE blfa1-stcd2,
stkza LIKE blfa1-stkza,
stkzu LIKE blfa1-stkzu,
stras LIKE blfa1-stras,
telbx LIKE blfa1-telbx,
telf1 LIKE blfa1-telf1,
telf2 LIKE blfa1-telf2,
telfx LIKE blfa1-telfx,
teltx LIKE blfa1-teltx,
telx1 LIKE blfa1-telx1,
xcpdk LIKE lfa1-xcpdk,
xzemp LIKE blfa1-xzemp,
vbund LIKE blfa1-vbund,
fiskn LIKE blfa1-fiskn,
stceg LIKE blfa1-stceg,
stkzn LIKE blfa1-stkzn,
sperq LIKE blfa1-sperq,
adrnr LIKE lfa1-adrnr,
mcod1 LIKE lfa1-mcod1,
mcod2 LIKE lfa1-mcod2,
mcod3 LIKE lfa1-mcod3,
gbort LIKE blfa1-gbort,
gbdat LIKE blfa1-gbdat,
sexkz LIKE blfa1-sexkz,
kraus LIKE blfa1-kraus,
revdb LIKE blfa1-revdb,
qssys LIKE blfa1-qssys,
ktock LIKE blfa1-ktock,
pfort LIKE blfa1-pfort,
werks LIKE blfa1-werks,
ltsna LIKE blfa1-ltsna,
werkr LIKE blfa1-werkr,
plkal LIKE lfa1-plkal,
duefl LIKE lfa1-duefl,
txjcd LIKE blfa1-txjcd,
sperz LIKE lfa1-sperz,
scacd LIKE blfa1-scacd,
sfrgr LIKE blfa1-sfrgr,
lzone LIKE blfa1-lzone,
xlfza LIKE lfa1-xlfza,
dlgrp LIKE blfa1-dlgrp,
fityp LIKE blfa1-fityp,
stcdt LIKE blfa1-stcdt,
regss LIKE blfa1-regss,
actss LIKE blfa1-actss,
stcd3 LIKE blfa1-stcd3,
stcd4 LIKE blfa1-stcd4,
ipisp LIKE blfa1-ipisp,
taxbs LIKE blfa1-taxbs,
profs LIKE blfa1-profs,
stgdl LIKE blfa1-stgdl,
emnfr LIKE blfa1-emnfr,
lfurl LIKE blfa1-lfurl,
j_1kfrepre LIKE blfa1-j_1kfrepre,
j_1kftbus LIKE blfa1-j_1kftbus,
j_1kftind LIKE blfa1-j_1kftind,
confs LIKE lfa1-confs,
updat LIKE lfa1-updat,
uptim LIKE lfa1-uptim,
nodel LIKE blfa1-nodel.
DATA: END OF vendor_file_x.
FIELD-SYMBOLS: <field>,
<field_1>.
DATA: delim TYPE x VALUE '09'.
DATA: fld_chk(4096),
last_char,
quote_1 TYPE i,
quote_2 TYPE i,
fld_lth TYPE i,
columns TYPE i,
field_end TYPE i,
outp_rec TYPE i,
extras(3) TYPE c VALUE '.,"',
mixed_no(14) TYPE c VALUE '1234567890-.,"'.
OPEN DATASET p_file FOR INPUT.
DO.
READ DATASET p_file INTO data_tab-data.
IF sy-subrc = 0.
APPEND data_tab.
ELSE.
EXIT.
ENDIF.
ENDDO.
* count columns in output structure
DO.
ASSIGN COMPONENT sy-index OF STRUCTURE vendor_file_x TO <field>.
IF sy-subrc <> 0.
EXIT.
ENDIF.
columns = sy-index.
ENDDO.
* Assign elements of input file to internal table
CLEAR vendor_file_x.
IF columns > 0.
LOOP AT data_tab.
DO columns TIMES.
ASSIGN space TO <field>.
ASSIGN space TO <field_1>.
ASSIGN COMPONENT sy-index OF STRUCTURE vendor_file_x TO <field>.
SEARCH data_tab-data FOR delim.
IF sy-fdpos > 0.
field_end = sy-fdpos + 1.
ASSIGN data_tab-data(sy-fdpos) TO <field_1>.
* Check that numeric fields don't contain any embedded " or ,
IF <field_1> CO mixed_no AND
<field_1> CA extras.
TRANSLATE <field_1> USING '" , '.
CONDENSE <field_1> NO-GAPS.
ENDIF.
* If first and last characters are '"', remove both.
fld_chk = <field_1>.
IF NOT fld_chk IS INITIAL.
fld_lth = strlen( fld_chk ) - 1.
MOVE fld_chk+fld_lth(1) TO last_char.
IF fld_chk(1) = '"' AND
last_char = '"'.
MOVE space TO fld_chk+fld_lth(1).
SHIFT fld_chk.
MOVE fld_chk TO <field_1>.
ENDIF. " for if fld_chk(1)=" & last_char="
ENDIF. " for if not fld_chk is initial
* Replace "" with "
DO.
IF fld_chk CS '""'.
quote_1 = sy-fdpos.
quote_2 = sy-fdpos + 1.
MOVE fld_chk+quote_2 TO fld_chk+quote_1.
ELSE.
MOVE fld_chk TO <field_1>.
EXIT.
ENDIF.
ENDDO.
<field> = <field_1>.
ELSE.
field_end = 1.
ENDIF.
SHIFT data_tab-data LEFT BY field_end PLACES.
ENDDO.
APPEND vendor_file_x.
CLEAR vendor_file_x.
ENDLOOP.
ENDIF.
CLEAR data_tab.
REFRESH data_tab.
FREE data_tab.
Rob -
Error while extracting XML file from the application server
Hi ,
I am writing a XML file into the application server, after which when i try to extract the file to the local server using the report - RFASLDPC ,
the file is extracted, but with a '#' symbol at the first position.
Because of which the XML File does not open. But after i open the file in notepad and manually delete the '#' symbol and then reopen the file, it works fine.
Is there any way to remove the '#' symbol while extracting itself ??
Thanks in advance,
Vikas.Select the option "No Character Set Conversion" in stead of Code page 1100.
However, I still have troubles -> the downloaded xml file misses a space on several places. This causes errors too. -
Regarding reading data from a file in the application server.
Hello Everyone,
My question is:
The file in the application server consists of data with header, detail and trail out of which the detail contains the main information. The detail again contains the data in the form of a continuous string and again some spaces corresponding to a single record. I need to split the data in the internal table in such a way so that the first few characters get into field-1 of the target internal table. Again I need to consider the spaces for accessing the data for filling up in field-2. How do I decide on the 'Split' statement and specially when the whole string has to be taken care of as contatining data in a single string format without space and again some data after some spaces corresponding to a single record.
Your help is very much needed. Thanks to all the experts in advance.Hi
This is the sample code I was used for the similar requirement.
DATA: single_line TYPE string .
v_file_listings = pa_filn1.
IF v_file_listings IS INITIAL .
MESSAGE e039 WITH v_file_listings.
ENDIF.
*-- read file, split lines into fields and put data into table
OPEN DATASET v_file_listings FOR INPUT IN TEXT MODE ENCODING NON-UNICODE. "Opening the files
IF sy-subrc EQ 0.
DO.
READ DATASET v_file_listings INTO single_line. "Reading the content of file into line
IF sy-subrc = 0.
IF sy-index > 1. "skip header-line
SPLIT "Split the content of line into work area
single_line
AT k_split
INTO
wa_listings-kschl " Condition type
wa_listings-tabname16 " Condition table name
wa_listings-vkorg " Sales organisation
wa_listings-kunnr " sold-to party numberor ship-to party number
wa_listings-matnr " Material Number
wa_listings-kodatab " Valid-from date
wa_listings-kodatb1. " Valid-to date
APPEND wa_listings TO itab_listings. "Appending Work Area to internal table
ENDIF.
ELSE.
EXIT.
ENDIF.
v_count1 = sy-tabix.
ENDDO.
Regards,
Sreeram -
Need to replace a file in the application server
Hello Experts,
Through ABAP coding, I need to replace a file which is available in the application server from one path to another. I should not use OPEN DATASET, CLOSE DATASET, DELETE DATASET and all as they deal with the data. I need to replace the file with out touching the data of the file.
Could anyone please help.
I heard that i have to use some UNIX script.
Regards,
SudheerSudheer,
Try this...
WITHOUT TOUCHING THE DATA OF A FILE . . .Just Moving the file ( unix commands in abap )
DATA: command(255) TYPE c,
fnam_sour(255),
fnam_target(255).
fnam_sour = '\hme\usr\interface\..... " path of source file
fnam_target = '\hme\usr\interface\..... " target path, where file to placed.
OPEN DATASET fnam_sour FOR INPUT " fnam_sour -> path of source file...
MESSAGE msg IN TEXT MODE
ENCODING DEFAULT.
IF sy-subrc <> 0.
< error msg : no file exits>
else.
OPEN DATASET fnam_target FOR INPUT " fnam_target -> path where file to be placed....
MESSAGE msg IN TEXT MODE
ENCODING DEFAULT.
if sy-surc = 0.
CONCATENATE 'mv' fnam_sour fnam_target INTO command SEPARATED BY
space.
CONDENSE command.
PERFORM uxcmd USING command.
endif.
endif.
*& Form UXCMD
FORM uxcmd USING p_command.
**issue UNIX command by calling system function.
DATA: BEGIN OF itab OCCURS 0,
line(255),
END OF itab.
CALL 'SYSTEM' ID 'COMMAND' FIELD p_command
ID 'TAB' FIELD itab-sys.
ENDFORM. " UXCMD
Regards
Ram -
ABAP Code for Backup the entire table data in the application server
Hello Friends,
I have to create the table data Backup and Store the entire table data in the application server and also be able to restore the data back if needed.
this should be dynamic program for any table based on the table name given on the application server.. I have developed a program for this but its having problems with the Quantity, amount. Its not writing it correctly at the application level.
ANy Suggestions on this.
Below is the program for this.
Thanks,
Ster.
* Report YWMM_TABLE_DUMP *
REPORT ywmm_table_dump .
TABLES :
dd03l.
* Type spool declaration
TYPE-POOLS:
abap, slis.
DATA: i_table_data1 TYPE REF TO data.
DATA : it_dd03l LIKE dd03l OCCURS 0 WITH HEADER LINE.
*DATA : gt_fieldcat TYPE lvc_s_fcat.
DATA : i_fcat TYPE STANDARD TABLE OF lvc_s_fcat,
l_dr_line TYPE REF TO data,
l_v_as4vers TYPE as4vers.
FIELD-SYMBOLS: <f_table_data1> TYPE STANDARD TABLE,
<f_wa_table_data1> TYPE ANY.
SELECTION-SCREEN: BEGIN OF BLOCK bl1 WITH FRAME TITLE text-001.
PARAMETERS: rb_copy RADIOBUTTON GROUP map DEFAULT 'X',
rb_rest RADIOBUTTON GROUP map.
SELECTION-SCREEN: END OF BLOCK bl1.
SELECTION-SCREEN: BEGIN OF BLOCK bl2 WITH FRAME TITLE text-002.
PARAMETERS: p_table TYPE tabname OBLIGATORY,
p_plfld TYPE dd03l-fieldname.
SELECTION-SCREEN SKIP 1.
PARAMETERS: p_bkfile TYPE localfile OBLIGATORY.
SELECTION-SCREEN: END OF BLOCK bl2.
PERFORM get_data.
IF rb_copy = 'X'.
PERFORM backup.
ELSEIF rb_rest = 'X'.
PERFORM database_update.
ENDIF.
*& Form get_data
FORM get_data.
CLEAR i_fcat.
REFRESH i_fcat.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = p_table " Table Name
CHANGING
ct_fieldcat = i_fcat
EXCEPTIONS
OTHERS = 1.
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = i_fcat
IMPORTING
ep_table = i_table_data1.
IF sy-subrc = 0.
ASSIGN i_table_data1->* TO <f_table_data1>.
ELSE.
WRITE: 'Error creating internal table'.
ENDIF.
IF rb_copy = 'X'.
SELECT * FROM (p_table) INTO CORRESPONDING FIELDS OF
TABLE <f_table_data1> UP TO 20 ROWS.
ELSEIF rb_rest = 'X'.
CREATE DATA l_dr_line LIKE LINE OF <f_table_data1>.
ASSIGN l_dr_line->* TO <f_wa_table_data1>.
*Get Data from Application Server
* Opening the dataset P_BKFILE given in the selection screen
TRANSLATE p_bkfile TO LOWER CASE.
OPEN DATASET p_bkfile FOR INPUT IN TEXT MODE." ENCODING DEFAULT.
IF sy-subrc NE 0.
* MESSAGE:
ELSE.
DO.
* Reading the file from application server
READ DATASET p_bkfile INTO <f_wa_table_data1>.
IF sy-subrc = 0.
APPEND <f_wa_table_data1> TO <f_table_data1>.
ELSE.
EXIT.
ENDIF.
ENDDO.
* Closing the dataset
CLOSE DATASET p_bkfile.
ENDIF.
ENDIF.
ENDFORM. " get_data
*& Form backup
* text
* --> p1 text
* <-- p2 text
FORM backup.
TRANSLATE p_bkfile TO LOWER CASE.
OPEN DATASET p_bkfile FOR OUTPUT IN TEXT MODE.
IF sy-subrc NE 0.
WRITE: text-017.
STOP.
ELSE.
LOOP AT <f_table_data1> ASSIGNING <f_wa_table_data1>.
TRANSFER <f_wa_table_data1> TO p_bkfile.
ENDLOOP.
ENDIF.
CLOSE DATASET p_bkfile.
ENDFORM. " backup
*& Form database_update
FORM database_update.
DATA : i_mara_u TYPE STANDARD TABLE OF mara WITH HEADER LINE,
i_ekpo_u TYPE STANDARD TABLE OF ekpo WITH HEADER LINE,
i_eban_u TYPE STANDARD TABLE OF eban WITH HEADER LINE,
i_resb_u TYPE STANDARD TABLE OF resb WITH HEADER LINE,
i_plpo_u TYPE STANDARD TABLE OF plpo WITH HEADER LINE,
i_stpo_u TYPE STANDARD TABLE OF stpo WITH HEADER LINE,
i_vbap_u TYPE STANDARD TABLE OF vbap WITH HEADER LINE,
i_vbrp_u TYPE STANDARD TABLE OF vbrp WITH HEADER LINE,
i_lips_u TYPE STANDARD TABLE OF lips WITH HEADER LINE,
i_afvc_u TYPE STANDARD TABLE OF afvc WITH HEADER LINE,
i_asmd_u TYPE STANDARD TABLE OF asmd WITH HEADER LINE,
* i_cooi_u TYPE STANDARD TABLE OF cooi WITH HEADER LINE,
i_qmel_u TYPE STANDARD TABLE OF qmel WITH HEADER LINE,
i_cooi_u TYPE STANDARD TABLE OF cooi WITH HEADER LINE,
i_esll_u TYPE STANDARD TABLE OF esll WITH HEADER LINE,
i_t165_u TYPE STANDARD TABLE OF t165 WITH HEADER LINE,
i_t165e_u TYPE STANDARD TABLE OF t165e WITH HEADER LINE,
i_twpko_u TYPE STANDARD TABLE OF twpko WITH HEADER LINE,
i_tpext_u TYPE STANDARD TABLE OF tpext WITH HEADER LINE,
i_ce4mxpa_u TYPE STANDARD TABLE OF ce4mxpa WITH HEADER LINE,
i_ce4mxpa_acct_u TYPE STANDARD TABLE OF ce4mxpa_acct WITH
HEADER LINE,
i_zaim_u TYPE STANDARD TABLE OF zaim WITH HEADER LINE,
i_s012_d TYPE STANDARD TABLE OF s012 WITH HEADER LINE,
i_s012_i TYPE STANDARD TABLE OF s012 WITH HEADER LINE,
i_dummy TYPE STANDARD TABLE OF mara.
CASE p_table.
WHEN 'MARA'.
* Non-Key
PERFORM move_to_table USING <f_table_data1>
CHANGING i_mara_u[]
i_mara_u.
PERFORM update_table USING i_mara_u[].
ENDCASE.
ENDFORM. " database_update
*& Form move_to_mara
FORM move_to_table USING p_tab_from TYPE STANDARD TABLE
CHANGING p_tab_to TYPE STANDARD TABLE
p_w_table.
DATA: l_wa_fcat TYPE lvc_s_fcat.
FIELD-SYMBOLS: <f_field_from> TYPE ANY,
<f_field_to> TYPE ANY.
LOOP AT p_tab_from ASSIGNING <f_wa_table_data1>.
LOOP AT i_fcat INTO l_wa_fcat.
ASSIGN COMPONENT l_wa_fcat-fieldname
OF STRUCTURE <f_wa_table_data1> TO <f_field_from>.
ASSIGN COMPONENT l_wa_fcat-fieldname
OF STRUCTURE p_w_table TO <f_field_to>.
<f_field_to> = <f_field_from>.
ENDLOOP.
APPEND p_w_table TO p_tab_to.
ENDLOOP.
ENDFORM. " move_to_mara
*& Form update_table
FORM update_table USING p_table_update TYPE STANDARD TABLE.
SELECT SINGLE *
FROM dd03l
WHERE fieldname = p_plfld
AND tabname = p_table
AND keyflag <> 'X'
AND as4local = 'A'
AND as4vers = l_v_as4vers
AND ( comptype = 'E' OR comptype = space ).
IF sy-subrc = 0.
* Do update
IF NOT p_table_update IS INITIAL.
UPDATE (p_table) FROM TABLE p_table_update.
IF sy-subrc = 0.
COMMIT WORK.
ELSE.
ROLLBACK WORK.
WRITE: text-003.
STOP.
ENDIF.
ENDIF.
ELSE.
*delete and insert.
IF NOT p_table_update IS INITIAL.
* DELETE (p_table).
IF sy-subrc = 0.
INSERT (p_table) FROM TABLE p_table_update.
IF sy-subrc = 0.
COMMIT WORK.
ELSE.
ROLLBACK WORK.
WRITE: text-018.
STOP.
ENDIF.
ELSE.
ROLLBACK WORK.
WRITE: text-018.
STOP.
ENDIF.
ENDIF.
ENDIF.
ENDFORM. " update_table
Edited by: Julius Bussche on Jul 18, 2008 1:43 PM
Please use a meaningfull subject title!ARS,
I am struggling a bit to get this.
there is a syntax error,
Field "FIELDS_INT-TYPE" is unknown. It is neither in one of thespecified tables nor defined by a "DATA" statement.
Again you have asked to move to a diffrent table. What is that table and how to build it.
LOOP AT <f_table_data1> ASSIGNING <f_wa_table_data1>.
LOOP AT i_fcat INTO l_fcat.
IF l_fcat-inttype EQ 'P'.
ASSIGN COMPONENT l_fcat-fieldname
OF STRUCTURE <f_wa_table_data1> TO <f_field>
TYPE fields_int-type
DECIMALS fields_int-decimals.
ELSE.
ASSIGN COMPONENT l_fcat-fieldname
OF STRUCTURE <f_wa_table_data1> TO <f_field>
TYPE fields_int-type.
ENDIF.
" Move <f_field> to a new table and use this table for download
ENDLOOP.
TRANSFER <f_wa_table_data1> TO p_bkfile.
ENDLOOP.
Ster -
Maximum number of characters that can be dowloaded to the application serve
Hello SAP Gurus,
Could you please tell me the maximum characters that can be written to a file at the application server (not the output length which is 255 characters).
Thanks for you rkind help.
<removed_by_moderator>
Thanks.
Abhijit.
Edited by: Julius Bussche on Sep 29, 2008 4:25 PMa) I don't think you are limited to 255 characters.
b) I think the limit is determined by the amount of space on the drive.
Rob -
Application server directory space
Hi All,
Request to confirm the function module / class / coding required to determine the currently available space
in a directory on the application server.
Regards
KunalHi Arindam,
Thanks for your response.
I believe you have understood our req. correctly.
For an SAP directory , used space = ?, total space = ?
The External command 'ls' only returns the file names in a directory.
I am not sure on implementing the df-k suggested by you.
Is it a separate command or do i have to use it like this
'df -k' in a new command ? Did try this formation but could not get it to work.
Returns an error
'Can't exec external program (No such file or directory) External program terminated with exit code 1
Appreciate your help on this issue.
Regards
Kunal -
Regarding moving files b/w folders in the Application server
Hi,
I need to move the file from one folder(main folder) of the application server to another (eg, archive, error) with certain conditions. When I try to move file from main folder to archive folder, it is working fine (.txt). The file along with the contents are moving, but when I try to move the file from main folder to error folder (.err), though the file has moved, the contents are not showing (though the file is erased from the main folder). I have used the function module
SXPG_COMMAND_EXECUTE for performing these actions. Can any one suggest as to why the contents are not showing.
LEAR: lv_mv_command_exitcode,
lv_mv_command_arguments,
lv_dummy_string.
CONCATENATE is_dir_list-fullname iv_error_file INTO lv_mv_command_arguments
SEPARATED BY space.
REFRESH lt_mv_command_stdout.
CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
EXPORTING
commandname = 'ZMV'
additional_parameters = lv_mv_command_arguments
IMPORTING
exitcode = lv_mv_command_exitcode
TABLES
exec_protocol = lt_mv_command_stdout
EXCEPTIONS
no_permission = 1
command_not_found = 2
parameters_too_long = 3
security_risk = 4
wrong_check_call_interface = 5
program_start_error = 6
program_termination_error = 7
x_error = 8
parameter_expected = 9
too_many_parameters = 10
illegal_command = 11
wrong_asynchronous_parameters = 12
cant_enq_tbtco_entry = 13
jobcount_generation_error = 14
OTHERS = 15.
IF sy-subrc <> 0 OR lv_mv_command_exitcode <> 0.
CONCATENATE 'Error in File'
iv_basefile
'but,not moved to Error folder.'
INTO lv_dummy_string SEPARATED BY space.
WRITE: / lv_dummy_string.
IF sy-batch = c_flag_on.
MESSAGE e054 WITH iv_basefile.
ENDIF.
ELSE.
CONCATENATE 'Error in File,'
iv_basefile
'moved to Error folder.'
INTO lv_dummy_string SEPARATED BY space.
WRITE: / lv_dummy_string.
IF sy-batch = c_flag_on.
MESSAGE s055 WITH iv_basefile.
ENDIF.
Regards,
JohnHi,
Here what I found was, if the file is empty, then the system is not moving the empty file to the destination , but if the file is not empty it is copying the contents and the corresponding folder to the destination folder. My intent is to copy the folder even if the contents of the folder is empty to the destination folder and delete the old file.
regards,
John -
Browse folder in the application server
Hi there,
In a program, I need to create an output file, and to save it either in the applictaion server or in the presentation server.
But I want the user to be able to choose the folder where to save it, not the file itself. Browsing the Web I have found a method of a class, the cl_gui_frontend_services=>directory_browse, by means of which I achieved displaying a screen to select a folder in the computer.
But I couldn't find a function module for displaying a screen for the user to choose a folder from the application server.
Sending an 'A' in the parameter i_server in function module F4_DXFILENAME_TOPRECURSION won't work, since the window displayed is to choose a file and not a folder.
Thanks a lot in advance.
Regards,
IgnacioSELECTION-SCREEN BEGIN OF BLOCK 002 WITH FRAME TITLE text-002.
PARAMETERS : p_aps LIKE rlgrap-filename MODIF ID pth .
SELECTION-SCREEN END OF BLOCK 002.
DATA : path_name(150) TYPE c.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_aps.
SUBMIT rs_get_f4_dir_from_applserv AND RETURN.
IMPORT path_name FROM MEMORY ID 'PATH_NAME_SDL'.
p_aps = path_name.
[Retrieve application server file names in F4 help|http://searchsap.techtarget.com/tip/0,289483,sid21_gci943422,00.html]
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file1.
PERFORM application_server_path.
*& Form application_server_path
FORM application_server_path.
IF p_read = 'X'.
*& Selecting file from server on pressing f4
CALL FUNCTION '/SAPDMC/LSM_F4_SERVER_FILE'
EXPORTING
directory = '.\'
filemask = ' '
IMPORTING
serverfile = p_file1
EXCEPTIONS
canceled_by_user = 1.
ELSE.
MESSAGE 'F4 is only valid for transfering data from Server to PC' TYPE 'S'.
ENDIF.
ENDFORM. " application_server_path
Maybe you are looking for
-
Problem setting Unicode (utf-8) in http header using tomcat
Hi: I am trying to set a file name in utf-8 to http header using the following code: response.setContentType("text/html; charset=utf-8"); response.setHeader("Content-disposition", "attachment; filename=解決.zip"); // I actually has file name in utf-8 h
-
How to SAP data convert into csv file.
hi, i have a one internal table , and i want to extract SAP data into csv file with filed separator ','(comma). Thanks
-
When I set the view to Zoom Font only, my email page looks normal, but facebook is off. I can't seem to get the settings back to where they were before I tried taking that screen shot. I have tried restarting the computer, but that doesn't help. Am I
-
Not recieved email to reset security questions
I have forgotton my security answers and reset them but haven't recieved an email yet. I don't think I ever will because a couple of weeks ago, I wanted to buy an app but my account doesn't have payment details so I reset the security answers and the
-
Elements 12 without Photomerge Panorama on MAC?
After installing Elements 12 on the MAC (10.8.5) the menu for Photomerge Panorama is greyed out, so Photomerge Panorama cannot be started. Any other Photomerge function is available and can be used. Is the panorama one of the missing function on MACs