How System Command can replace a file in Application Server
Hi Guys,
A new system Command is created. When that system command is executed, the client wants to take a file from one directory in application server and put that file into another directory on the application server itself. How this can be achieved?
What I know is we can create a function module and place that function module in the system command. But in that function module, I have to change the fielname and put that into another directory. I don't know how to do it.
Note: I shouldn't read the data from the file using Open Dataset statements..
Please let me the solution if any one has encountered such a scenario.
Regards.
Hari.
I think you are mixing up things here.
The program "sapiconv" is for converting files into different codepages, it´s not for copying/moving files to other directories.
If you want to use the ZSAPICONV to you need to modify it, take out the "sapiconv" and put in the "mv" (move) command to move the file to the other directory.
I suggest though creating a NEW command. e.g ZMV and give the appropriate parameters.
Markus
Similar Messages
-
How to Provide search Help for files on Application Server
Hi Guys,
Can anyone tell me How to Provide search Help for files on Application Server. I have put a file name on selection screen. I want to give search help for files on application server.
Thanks & Regards.
Harish.Hi Harish,
Use the following code,
tables sxpgcotabe.
data: lt_execprot LIKE btcxpm OCCURS 0 WITH HEADER LINE,
w_filepath(60) TYPE c, --> length depending on your Directory path.
SELECT SINGLE *
FROM sxpgcotabe
WHERE name = 'LIST_DB2DUMP'
AND opsystem = sy-opsys.
IF sy-subrc <> 0.
SELECT SINGLE *
FROM sxpgcotabe
WHERE name = 'LIST_DB2DUMP'
AND opsystem = 'UNIX'.
IF sy-subrc <> 0.
MESSAGE e000 WITH 'External operating system command '
'LIST_DB2DUMP not found'.
ENDIF.
ENDIF.
sxpgcotabe-parameters = p_filepath. --> provide the directory path.
CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
EXPORTING
commandname = sxpgcotabe-name
additional_parameters = sxpgcotabe-parameters
operatingsystem = sxpgcotabe-opsystem
TABLES
exec_protocol = lt_execprot
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.
MESSAGE e000 WITH text-e01 p_filepath. "Directory failed
ENDIF.
Loop round the directory list, split each line up into a line table
and get the last data for each line, should be the filename
Then build the dirlist.
REFRESH t_dirlist.
LOOP AT lt_execprot.
REFRESH t_dirline.
SPLIT lt_execprot-message AT space INTO TABLE t_dirline.
DESCRIBE TABLE t_dirline LINES w_nolines.
READ TABLE t_dirline INDEX w_nolines.
MOVE t_dirline-data TO t_dirlist-filename.
APPEND t_dirlist.
ENDLOOP.
Here you will get all the files in the directory mentioned in Application server.
For displaying them as a Search help use the FM '/BMC/ZPOPUP_GET_VALUE'
Pass the Internal table to this FM.
Regards,
Paul. -
Can i transfer file from application server to lotus server.
hi
can i transfer file from application server to lotus server.
i m geting file on application server but i want to transefer that file from application server to lotus server.
if yes than give me suggestion.
thanks in advanced.Hello Laxman
If you want to trigger the file transfer from within SAP then you need to execute an <b>external OS command</b> (transaction <b>SM49</b>, <b>SM69</b>).
At the level of the OS (operating system, e.g. Windows, Linux) you need to be able to transfer files to the Lotus server.
Your task is, for example, to write a report executing the external OS command which will be executed at the OS level where the file transfer happens.
Regards
Uwe -
How to get the list of file from application server
Hi Expert.
I want to get the file list from dicrectory in application server
best regards.
AlexHi.
Yes, You are right, i can get the file list by AL11.
But i need get the list in ABAP program.
So i need a function modul to get the list. If you has some sample code, it should be very nice.
Best.
Alex -
How to get correct format in file at Application server
Hi,
I am retrieving data MATNR,MAKTX,VENDOR,VENDOR NAME,PRODUCT HIERARCHY,QUANTITY(LABST),BUDAT.
I am downloading the data into .xls file in both presentation and application server.
In presentation I am getting correct format.
Where as in application server I am not getting proper format.
Quantity(MARD-LABST) is not coming proprely.(###6## instead of 36)
How to get it in correct forma?Isymbol means Space
Before transfer the data to File..
condense MARD-LABST and then transfer it.
I guess you are using charcter field LABST while transferring the data to file.
Do not use quantity field directly,please move it to charcter field then condense it.
Thanks
Seshu -
How to know the first placed file in Application server directory
Hi All ,
i want to Know the First plased file in a application server directory . i have tried with
FM EPS_GET_FILE_ATTRIBUTES but it is giving the file size. Can anybody give some idea to get the file lastmodify property.
Thanks & Regards
Prithvi.Hi Prithvi!
Use the methods of class CL_GUI_FRONTEND_SERVICES (if your release is at least 620, sorry otherwise).
Method DIRECTORY_LIST_FILES will give you all files of a directory, then you can check with method FILE_GET_ATTRIBUTES for some date info.
But maybe you can agree about a timestamp in the filename - this has to be set by the sender, but is much easier and reliable, too.
Regards,
Christian -
Delete file on application server (Froms9iAS)
How can I delete file on application server (Froms9iAS) from client machine (file such as *.txt,*dbf). I try use old win_api_utility (from Forms6i) but it doesn't work.
Check out Webutil.
More on it in the Forms page. -
I want to put header while stroing file in application server
Hi Guru,
Can anybody tell how to put header while stroing file in application server.
in the below pgm data is coming i want to put heading .if we see in al11 transaction the header should come .plese give on eg in the code itself.its urgent
eg:
material number
100
200
declarations...................................................
tables: bkpf. " Accounting Document Header
*"Selection screen elements............................................
parameters:
p_burks like bkpf-bukrs. " Company Code
select-options:
s_gjahr for bkpf-gjahr. " Fiscal year
Type declaration of the structure to hold Accounting Document Header*
data:
begin of fs_bkpf,
bukrs type bkpf-bukrs, " Company Code
belnr type bkpf-belnr, " Accounting Document Number
gjahr type bkpf-gjahr, " Fiscal year
blart type bkpf-blart, " Document type
bldat type bkpf-bldat, " Document date in document
end of fs_bkpf.
Internal table to hold Accounting Document Header *
data:
t_bkpf like standard table
of fs_bkpf.
Type declaration of the structure to hold file data *
data:
begin of fs_table,
str type string,
end of fs_table.
Internal table to hold file data *
data:
t_table like standard table
of fs_table.
field-symbols: <fs>.
*" Data declarations...................................................
Work variables *
data:
w_char(50) type c,
w_file_name(50) type c value 'YH645_050103'.
select bukrs " Company Code
belnr " Accounting Document Number
gjahr " Fiscal year
blart " Document type
bldat " Document date in document
from bkpf
into table t_bkpf
where bukrs eq p_burks
and gjahr in s_gjahr.
if sy-subrc eq 0.
loop at t_bkpf into fs_bkpf.
do.
assign component sy-index of structure fs_bkpf to <fs>.
if sy-subrc ne 0.
exit.
else.
move <fs> to w_char.
if sy-index eq 1.
fs_table-str = <fs>.
else.
concatenate fs_table-str ',' w_char into fs_table-str.
endif. " IF SY-INDEX...
endif. " IF SY-SUBRC...
enddo. " DO...
append fs_table to t_table.
endloop. " LOOP AT T_KNA1...
endif. " IF SY-SUBRC...
open dataset w_file_name for output in text mode encoding default.
loop at t_table into fs_table.
transfer fs_table-str to w_file_name.
endloop. " LOOP AT T_TABLE...Hi,
may i know what kind of heading you want to display?
like date, filename, time etc
then modify the below code:
*& Form send_statistic
Create the status Report on application Server
---> pv_rlines - Total No of Records in Internal table *
---> pv_slines - Total No of Successful records *
---> pv_elines - Total No of Errornous records *
---> pv_path - File Path where the file to be created *
---> pv_flag - Flag to check for A/c group *
FORM sub_send_statistic USING pv_rlines TYPE int4
pv_slines TYPE int4
pv_elines TYPE int4
pv_path TYPE salfile-longname
pv_name TYPE rlgrap-filename
pv_flag TYPE char1.
CLEAR : i_tab,
wa_tab.
Convert date to MM/DD/YYYY format
PERFORM date_convert.
Convert Time to HH:MM:SS format
CONCATENATE sy-uzeit+0(2)
c_colon
sy-uzeit+2(2)
c_colon
sy-uzeit+4(2)
INTO v_time1.
Build the Output File name
IF p_sold = c_x
AND pv_flag = c_x.
CONCATENATE c_objid
c_us
c_z001
c_us
sy-datum
c_us
sy-uzeit
INTO v_file.
ENDIF. " IF p_sold = c_x
IF p_cons = c_x.
CONCATENATE c_objid
c_us
c_z008
c_us
sy-datum
c_us
sy-uzeit
INTO v_file.
ELSEIF p_sold = c_x
AND pv_flag <> c_x.
CONCATENATE c_objid
c_us
sy-datum
c_us
sy-uzeit
INTO v_file.
ENDIF. " IF p_cons = c_x
Build the Complete Output File Path
CONCATENATE pv_path
c_slash
v_file
INTO v_outfile.
Populate the data required for output into an internal table and
then transfer the table contents to file on application server
DATA UPLOAD STATISTICS
wa_tab-rec = text-001.
APPEND wa_tab TO i_tab.
CLEAR wa_tab.
TITLE
IF p_sold = c_x
AND pv_flag <> c_x.
sy-title = text-t17.
ENDIF. " IF p_sold = c_x
IF p_sold = c_x
AND pv_flag = c_x.
sy-title = text-t16.
ENDIF. " IF p_sold = c_x
IF p_cons = c_x
AND pv_flag = c_x.
sy-title = text-t19.
ENDIF. " IF p_cons = c_x
wa_tab-rec+0(7) = text-002.
wa_tab-rec+7(60) = sy-title.
APPEND wa_tab TO i_tab.
CLEAR wa_tab.
Date & Time
wa_tab-rec+0(5) = text-012.
CONDENSE v_date NO-GAPS.
wa_tab-rec+6(10) = v_date.
wa_tab-rec+60(10) = text-003.
wa_tab-rec+70(15) = v_time1.
APPEND wa_tab TO i_tab.
CLEAR wa_tab.
Folder Name
wa_tab-rec+0(18) = text-005.
wa_tab-rec+19(72) = pv_path.
APPEND wa_tab TO i_tab.
CLEAR wa_tab.
File Name
wa_tab-rec+0(18) = text-006.
---Begin of addition -Shivakumar - 09-05-2007--
wa_tab-rec+19(72) = pv_name.
---Begin of addition -Shivakumar - 09-05-2007--
APPEND wa_tab TO i_tab.
CLEAR wa_tab.
Records Read
CLEAR v_count.
v_data = pv_rlines.
v_count = STRLEN( v_data ).
CONDENSE v_data NO-GAPS.
wa_tab-rec+0(46) = text-007.
wa_tab-rec+47(4) = v_data.
APPEND wa_tab TO i_tab.
CLEAR : wa_tab,
v_data.
Successfull Records
CLEAR v_count.
v_data = pv_slines.
v_count = STRLEN( v_data ).
CONDENSE v_data NO-GAPS.
wa_tab-rec+0(46) = text-008.
wa_tab-rec+47(4) = v_data.
APPEND wa_tab TO i_tab.
CLEAR : wa_tab,
v_data.
Error Records
CLEAR v_count.
v_data = pv_elines.
v_count = STRLEN( v_data ).
CONDENSE v_data NO-GAPS.
wa_tab-rec+0(46) = text-009.
wa_tab-rec+47(4) = v_data.
APPEND wa_tab TO i_tab.
CLEAR : wa_tab,
v_data.
v_mesg = text-t04.
IF p_sold = c_x
AND pv_flag <> c_x.
MOVE i_tab TO i_file.
ENDIF. " IF p_sold = c_x
IF p_sold = c_x
AND pv_flag = c_x.
MOVE i_tab TO i_file1.
ENDIF. " IF p_sold = c_x
IF NOT i_tab IS INITIAL.
Open the file on Application server to write the report
OPEN DATASET v_outfile
FOR OUTPUT IN TEXT MODE
ENCODING DEFAULT MESSAGE v_mesg.
IF sy-subrc <> 0.
MESSAGE e000(zconversions) WITH v_mesg.
ELSE. " IF sy-subrc <> 0
Transfer details to the file on application server
CLEAR wa_tab.
LOOP AT i_tab INTO wa_tab.
TRANSFER wa_tab-rec TO v_outfile.
CLEAR wa_tab.
ENDLOOP. " LOOP AT i_tab INTO wa_tab
Close the file
CLOSE DATASET v_outfile.
ENDIF. " IF sy-subrc <> 0
ENDIF. " IF NOT i_tab IS INITIAL
ENDFORM. " Create_Report -
How best store files on application server: Tables vs File system
Hi Experts,
We want to let users to upload files to application server. The number of files can potencially grow over time (1000 files every month) though I whould like to limit size of each file not more than 1-2 MB.
Also files should be classified (having custom attributes) so later on we need to search, select files according to attributes.
So what are the best options in long run (for performance, reliability etc)?
We have NW system 7.0 with MaxDB
I can think of the following options:
1. Store files in TRANSPARENT table in RAWSTRING. Easiest variant (to select files etc) Here I have concerns how this table and database behave after some period of time and what will happen if size will grow to let say 50 GB. Will it work? What are normal size limits for transparent tables?
2. Store files in CLUSTER table in RAWSTRING. Less convenient to work with (joins are not allowed etc). Will cluster table help to handle big size of table? What are practical size limits for cluster tables?
3. Store files on file system (on application server) and write info (attributes etc) into ztable. Select from ztable and read content file from file system (dataset commands?). So files will be written to one directory just one after another.
What are the best option to follow? I would personally prefer option 1 as easiest but have servious concerns regarding size of one transparent table.
What do you recommend?
Regards,
Dmitry.
Edited by: Dmitry Kalmykov on Jul 28, 2009 8:58 AMHi,
I too feel that option 1 would be best choice.
For your ref: Check the Transp.table REPOSRC and the field name DATA
Also Check the technical settings (Size category). -
How do one can upload a file (a PDF, doc etc) while filling a web form through chrome or safari? It is possible to upload a photo from the camera role, but other file types can not be uploaded.
For a variety of reasons, mostly related to security, the iOS operating system limits what can be done with respect to file uploading and downloading. But whenever you encounter a limitation like this always think, "There must be an app for this."
Check the apps James Ward suggests. -
How to copy a file from application server to local system
Guys,
Need to copy a file from application server to local system.Is there an FM for the same.
Tried searching for it but couldn't find anything useful.
Code snippets will be highly appreciated.
Warm Regards,
P.
Moderator message: very frequently asked and answered question, obviously you did not search thoroughly, all points removed.
Edited by: Thomas Zloch on Dec 3, 2010 4:48 PMhi,
You can use the transactions CG3Y or through program u can do like this..
DATA: BEGIN OF IT_FILE OCCURS 0,
LINE TYPE STRING,
END OF IT_FILE.
OPEN DATASET <file_name> FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF SY-SUBRC IS INITIAL.
DO.
READ DATASET<file_name> INTO IT_FILE-LINE.
IF SY-SUBRC = 0.
APPEND IT_FILE.
CLEAR IT_FILE.
ELSE.
EXIT.
ENDIF.
ENDDO.
ENDIF.
CLOSE DATASET <file_name>.
Download it to local system using FM - GUI_DOWNLOAD -
How System Centre can manage Azure ?
Hi
How System Centre can manage Azure in better way?
Is there any better tool available in market, which can manage Azure.. ?
Thanks, Kkonly two possibilities i see here
make these VM part of your network so they are visible to the System center, this can be done by creating a vpn or use system center that allow you to manage cloud VMs without having them in vpn, which i believe is called "System
Center Management Pack for Windows Azure"
The System Center Management Pack for Windows Azure enables you to monitor the availability and performance of resources that are running on Windows Azure. The management pack runs on a specified resource pool and then uses various Windows Azure APIs to remotely
discover and collect instrumentation information about a specified Windows Azure resource, such as a Cloud Service, Storage or Virtual Machine. The Management Pack for Windows Azure provides no functionality on import. For each Windows Azure subscription that
contains Azure resources you want to monitor, you must configure discovery and monitoring by first using the Windows Azure wizard in the administration section of the OM Console, then the Windows Azure Monitoring template in the authoring section of the OM
Console.
you can download it from
here
Hope this helps
Please mark as answered if it helped
Vishal Narayan Saxena http://twitter.com/vishalishere http://www.ogleogle.com/vishal/ -
How to rename a file in Application server
Hi All,
Here I have a issue with the present file which is being generated in application server.
Before the completion of the file the EDI tool is extracting the file from the app server.So here I would like to generate the file with a temp name and then rename to the actual file name which EDI recognises and fetches.
Please correct me If I am wrong and let me know how to rename the file in application server.
Thanks,
Vijay Nyou can try using unix command , if your application server is unix.
use move command
mv <source> <target>
REPORT ZUNIX line-size 400
no standard page heading.
data: unixcom like rlgrap-filename.
unixcom = 'mv file1 file2'.
data: begin of tabl occurs 500,
line(400),
end of tabl.
data: lines type i.
start-of-selection.
refresh tabl.
call 'SYSTEM' id 'COMMAND' field unixcom
id 'TAB' field tabl[].
or else you can open dataset/ read the dataset and move it to another file and delete the old file. -
How to delete files from application server posted in last 30 days
I have some files in application server posted through ABAP program with the below format
\.\.\.abcd_20110209_111209.csv (with date and time). I need to delete those files which was posted in last 30 days through another program. Could you plaese help me to achieve the requirement?There are many ways you can delete/archive files in application servers.
1. Depending on the application server, usually administrators setup delete/archive programs. For e.g. if the application server is a UNIX, then the unix admin will write a script to delete/move older files. - this is the most common approach I've seen.
If you have to achieve this through ABAP then,
1. You can get the script from the server admin and then use that script to create an external system command through SM69/49 and use the function module SXPG_COMMAND_EXECUTE to execute it.
2. You can also look at FM EPS_DELETE_FILE and see if it fits the bill for you.
There are many other possibilities too and each one has its own pros/cons. So you'll have to choose the right one for your requirement. -
How to copy file from application server
Hello experts,
How to copy file from one folder of application server and paste it to other folder of application server(application server is same)?
Is there any function module exists???
thanks in advance
SaurabhHi you can use this function module to move a file from application server to another folder on application server.
call function 'WS_FILE_COPY'
exporting
destination = m_destination
source = m_source
importing
return = return.
Plus u can use this function module to delete the file from that folder from which u want to replace it.
call function 'WS_FILE_DELETE'
exporting
file = m_source
importing
return = return.
The above FM can help u copy a file from one folder to another and delete the file from that folder.
Maybe you are looking for
-
Hi, I have writen a servlet that sends back a List of SummaryRec structure via ServletSession. What did I do wrong here? The Jsp can't locate the SummaryRec.class. <%@ page contentType="text/html;charset=ISO-8859-1" language="java" import="java.util.
-
Grant permission to a role.
Oracle 11g R2 Windows. I have an oracle user, named user_1. User_1 needs to be able to grant select on a table owned by another user, User_2, to a role. I keep getting the error ORA-01031: insufficient privileges. User_1 has the following system pri
-
After updating Premiere to 4.1 - XDCAM EX error- files offline?
Hi! I have a problem; after updating Premiere CS4 ver. 4.0.1. to version 4.1 files in projects are offline. There are some files (for example, CG animation in other formats as quick time) that are on timeline normally, but all XDcame EX footage is of
-
Hi all, GoodMorning,. what exactly does the option of "Allow Bulk Data Load" option on Company Profile page do, it is clear in doc. that it allows crm on demand consultants to load bulk data. But i am not clear on how they load etc etc, do they use a
-
Just how do I use a photo of a church building and make a line drawing of it? There are hundreds of lines, bricks, indented windows, steps,etc. and the whole thing is flooded with trees. They don't want a photo image and I've tried drawing it in PS 7