Moving files across folder in application server
Hi to all experts,
My requirement is to move file between folders in the application server .i'm using the fm sxpg_command_execute . the problem im facing here the file move sometimes and it doesnt move sometimes . what could be the problem..
*& Form process_file_on_server
form process_file_on_server .
DATA: filename(128) TYPE c.
DATA: param LIKE sxpgcolist-parameters.
CASE sy-sysid.
WHEN 'BO1'.
p_arc = 'k:\\Share\MM_SCUBCode_PDAtxt_Archive'.
WHEN 'BQ1'.
p_arc = 'K:\\Share\MM_SCUBCode_PDAtxt_Archive'.
WHEN OTHERS.
ENDCASE.
CALL FUNCTION 'SO_SPLIT_FILE_AND_PATH'
EXPORTING
full_name = p_file
IMPORTING
STRIPPED_NAME = filename
* FILE_PATH =
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.
CONCATENATE p_arc filename INTO p_arc SEPARATED BY '\'.
CONCATENATE p_file p_arc INTO param SEPARATED BY space.
CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
EXPORTING
commandname = 'ZMOVE'
ADDITIONAL_PARAMETERS = param
* OPERATINGSYSTEM = SY-OPSYS
* TARGETSYSTEM = SY-HOST
* DESTINATION =
* STDOUT = 'X'
* STDERR = 'X'
* TERMINATIONWAIT = 'X'
* TRACE =
* DIALOG =
* IMPORTING
* STATUS =
* EXITCODE =
* TABLES
* EXEC_PROTOCOL =
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 ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
clear filename .
endform. " process_file_on_server
Hi,
PLEASE try this code ---
*& Form process_file_on_server
*form process_file_on_server .
DATA: filename(128) TYPE c.
DATA: param LIKE sxpgcolist-parameters.
CASE sy-sysid.
WHEN 'BO1'.
p_arc = 'k:\\Share\MM_SCUBCode_PDAtxt_Archive'.
WHEN 'BQ1'.
p_arc = 'K:\\Share\MM_SCUBCode_PDAtxt_Archive'.
WHEN OTHERS.
ENDCASE. " CASE SY-SYSID
DO. " Changed
CALL FUNCTION 'SO_SPLIT_FILE_AND_PATH'
EXPORTING
full_name = p_file
IMPORTING
STRIPPED_NAME = filename
* FILE_PATH =
EXCEPTIONS
X_ERROR = 1
OTHERS = 2
IF sy-subrc NE 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF. " IF SY-SUBRC NE 0
CONCATENATE p_arc filename INTO p_arc SEPARATED BY '\'.
CONCATENATE p_file p_arc INTO param SEPARATED BY space.
CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
EXPORTING
commandname = 'ZMOVE'
ADDITIONAL_PARAMETERS = param
* OPERATINGSYSTEM = SY-OPSYS
* TARGETSYSTEM = SY-HOST
* DESTINATION =
* STDOUT = 'X'
* STDERR = 'X'
* TERMINATIONWAIT = 'X'
* TRACE =
* DIALOG =
* IMPORTING
* STATUS =
* EXITCODE =
* TABLES
* EXEC_PROTOCOL =
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. " CHANGE
STOP. " CHANGE
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
clear filename .
endform. " process_file_on_server
ENDDO. " CHANGE
Regards
Pinaki
Similar Messages
-
How to read list of all files in folder on application server?
How to read list of all files in folder on application server?
Hi,
First get the files in application server using the following function module.
CALL FUNCTION 'RZL_READ_DIR_LOCAL'
EXPORTING
name = loc_fdir
TABLES
file_tbl = int_filedir.
Here loc_fdir contains the application server path.
int_filedir contains all the file names in that particular path.
Now loop at int_filedir.
OPEN DATASET int_filedir-name FOR INPUT IN TEXT MODE ENCODING DEFAULT MESSAGE wf_mess.
MESSAGE wf_mess.
IF sy-subrc = 0.
DO.
READ DATASET pa_sfile INTO wf_string.
IF sy-subrc <> 0.
EXIT.
endif.
close datset int_filedir-name.
endloop. -
All files in folder of Application server.
Hi Frnds,
how to get the all files from a folder of application server. I have to get the all files in internal table when i selecting only folder?
thanks in advance.
regards,
BaluHere is an example program, which acts like an application server file browser.
report zrich_0001 .
data: begin of itab occurs 0,
rec(1000) type c,
end of itab.
data: wa(1000) type c.
data: p_file type localfile.
data: ifile type table of salfldir with header line.
parameters: p_path type salfile-longname
default '/usr/sap/TST/DVEBMGS01/data/'.
call function 'RZL_READ_DIR_LOCAL'
exporting
name = p_path
tables
file_tbl = ifile
exceptions
argument_error = 1
not_found = 2
others = 3.
loop at ifile.
format hotspot on.
write:/ ifile-name.
hide ifile-name.
format hotspot off.
endloop.
at line-selection.
concatenate p_path ifile-name into p_file.
clear itab. refresh itab.
open dataset p_file for input in text mode.
if sy-subrc = 0.
do.
read dataset p_file into wa.
if sy-subrc <> 0.
exit.
endif.
itab-rec = wa.
append itab.
enddo.
endif.
close dataset p_file.
loop at itab.
write:/ itab.
endloop.
Regards,
Rich Heilman -
To create folder in Application server
hi,
How to create folder in application server from presentation server??
how is the program it??
reply me soon...
thx,
s.suresh.hi Suresh
Hope u r having nice day
here i am sending a sample report which can upload the file to Application Server which inturn automatically create folder .
REPORT ZSHR_UPLOAD_TO_APPLICATION .
DATA : BEGIN OF IT_MAT OCCURS 0,
MBRSH LIKE MARA-MBRSH,
MTART LIKE MARA-MTART,
MAKTX LIKE MAKT-MAKTX,
MEINS LIKE MARA-MEINS,
END OF IT_MAT.
DATA : W_DIR(40).
MOVE 'D:\usr\sap\DEV\DVEBMGS00\work\SHR' TO W_DIR.
"SHR" IS A FOLDER NAME TO BE CREATED
START-OF-SELECTION.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = 'C:\MAT.TXT'
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
TABLES
DATA_TAB = IT_MAT
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17.
OPEN DATASET W_DIR FOR OUTPUT IN TEXT MODE ENCODING UTF-8.
IF SY-SUBRC EQ 0.
LOOP AT IT_MAT.
TRANSFER IT_MAT TO W_DIR.
ENDLOOP.
ENDIF.
CLOSE DATASET W_DIR.
IF USEFUL AWARD POINTS.
REGARDS
HEMASEKHARA REDDY S -
Creating a folder in application server in background.
Hi experts,
Is it possible to Creating a folder in application server in background.?
My requirement is like this , every time a PO is created it has to be saved locally.
When atlast i manged to do this, i get stuck again by this CR ,
The PO has to be saved in a folder with the same name as PO number,
I do not know if it is possible.
So as always I am looking for inputs/suggestions or knowledge if you had come across scenario like this one.
Thanks and Regards,
KHi,
You could create a system command in SM69 to create a directory and then use the function module SXPG_CALL_SYSTEM to invoke the command and pass in the directory name as a parameter at run time.
Darren -
F4 help for file path in the Application server
Hi All,
i want to provide the F4 help so as to enable us to give the file path in the application server (AL11). I'm in version 4.0
Regards
ShekharHi
Copy paste the following code and see the result
Here you can see 2 types of open dialogs
1. Directory View
2. File View
Use any one as per your requirement.
DATA : l_filetable TYPE filetable,
l_rc TYPE i.
DATA: l_folder TYPE string,
l_file TYPE string.
PARAMETERS: p_folder(100) TYPE c,
p_file(100) TYPE c.
*Provide a Dialogue box for getting a folder path
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_folder.
CALL METHOD cl_gui_frontend_services=>directory_browse
EXPORTING
window_title = 'Select Folder Path'
initial_folder = 'D:\'
CHANGING
selected_folder = l_folder.
p_folder = l_folder.
*Provide a Dialogue box for getting a file path
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL METHOD cl_gui_frontend_services=>file_open_dialog
EXPORTING
window_title = 'Select a Text File'
initial_directory = l_folder
CHANGING
file_table = l_filetable
rc = l_rc.
Reward points generously
Regards
Akshay Chonkar
READ TABLE l_filetable INTO p_file INDEX 1.
CHECK sy-subrc <> 0. -
How to zip the folder in application server?
how to zip the folder in application server?
You can use
open dataset with filter
link:[http://help.sap.com/abapdocu_70/en/ABAPOPEN_DATASET_OS_ADDITION.htm#!ABAP_ADDITION_2@2@] -
How to store a JSP file in the SAP Application server ?
Hello All,
My reqt. is as follows :
1. I need to store a JSP File on the SAP Application server .
How can I do this ?
2. I want to call the uploaded jsp file from the server and call this jsp from abap to view the result of it .
How can I achieve this ?
First of all is this possible ?
Regards,
Deepu.KHello Mike,
Thanks for ur reply.
I've imported the JSP as a mime object into the BSP.
Now I've created the page to show that Mime Object as an image.
But nothing is coming as an output.
But then,there is an option for that mime object. i.e when I right click on the mime object there is an option called " convert to BSP".
I selected that option and it created a view in my BSP .( My BSP is a page with flow logic application )
Now how should i make this view to be an output ?
I guess this shud be posted in the BSP Forum ...but still taking a chance here :)-
Regards,
Deepu.K -
Reading the data from excel file which is in application server.
Hi,
Iam trying to read the data from excel file which is in application server.
I tried using the function module ALSM_EXCEL_TO_INTERNAL_TABLE. But it didn't work.
I tried just reading using open data set and read data set it is giving junk characters.
Please suggest me if you have any solution.
Best Regards,
Brahma ReddyHi Narendra,
Please see the below code I have written
OPEN DATASET pa_sfile for INPUT in text mode ENCODING DEFAULT MESSAGE wf_mess.
CHECK sy-subrc = 0.
DO.
READ DATASET pa_sfile INTO wf_string.
IF sy-subrc <> 0.
EXIT.
else.
split wf_string at wl_# into wf_field1 wf_field2 wa_upload-field3
wa_upload-field4 wa_upload-field5 wa_upload-field6 wa_upload-field7 wa_upload-field8
wa_upload-field9 wa_upload-field10 wa_upload-field11 wa_upload-field12 wa_upload-field13
wa_upload-field14 wa_upload-field15 wa_upload-field16 wa_upload-field17 wa_upload-field18
wa_upload-field19 wa_upload-field20 wa_upload-field21 wa_upload-field22 wa_upload-field23
wa_upload-field24 wa_upload-field25 wa_upload-field26 wa_upload-field27 wa_upload-field28
wa_upload-field29 wa_upload-field30 wa_upload-field31 wa_upload-field32 wa_upload-field33
wa_upload-field34 wa_upload-field35 wa_upload-field36 .
wa_upload-field1 = wf_field1.
wa_upload-field2 = wf_field2.
append wa_upload to int_upload.
clear wa_upload.
ENDIF.
ENDDO.
CLOSE DATASET pa_sfile.
Please note Iam using ECC5.0 and it is not allowing me to declare wl_# as x as in your code.
Also if Iam using text mode I should use extension encoding etc.( Where as not in your case).
Please suggest me any other way.
Thanks for your help,
Brahma Reddy -
Files are stored in application server,
Files are stored in application server, I am using Open dataset to write to a file in unix box.would like to convert my itab into tab delimted and download. Please let know
is there any function?You should do a search to get the right ascii value (you can get an
ascii chart, you can google a bit, you can visit the group's page and
search for tab delimited... ) and replace 09 by the right value. And
that's it.. The technique (which is what it matters) is right.
Another tip:: you could download in two steps: first you use
gui_download or ws_download to create a tab delimited file in your pc or
in a network. Then you upload this file (using gui_upload or ws_upload
into an internal table and the final step is to use open dataset -
transfer - close dataset to write down this last itab to your app
server. -
Regarding the File Format on the application server
Hi,
I would like to know the file format (ANSI, UTF-8, UTF-16, UTF-32) of the file placed on the application server in my program. Can anyone help me with the Function Module or Class or any other way which will retrieve this information.
Thanks
Sarves S V KHi
You can try the standard class CL_ABAP_FILE_UTILITIES and the method
CALL METHOD cl_abap_file_utilities=>check_utf8
EXPORTING
file_name = filename
IMPORTING
bom = file_bom
encoding = file_encoding.
Check the possible values returned by encoding and BOM:
NO_BOM
BOM_UTF8
BOM_UTF16_BE
BOM_UTF16_LE
ENCODING_UTF8
ENCODING_7BIT_ASCII
ENCODING_OTHER -
How i access file which stored at application server .? Is there any fm ?
Hi,
How i access file which stored at application server . Is there any function module which provide same funtinality.
Regards,
Gurprit BhatiaHi ,
U need to use datasets for reading data from application server.Do a f1 on dataset,u will get to know rest of the things.
TRY.
OPEN DATASET file FOR INPUT IN TEXT MODE ENCODING UTF-8.
ENDTRY.
IF sy-subrc = 0.
READ DATASET file INTO <wa_data> MAXIMUM LENGTH 200.
move the data in to internal table
close dataset
Edited by: A kumar on Aug 21, 2008 1:37 PM -
How to trigger a Report when a file is placed in Application server
Hi All,
How to triggger a Report and get executed when a new file is placed in the application server.?
It will be helpful if a Navigation is provided for the EVENT.
Thanks in advance
ChakriHi,
Check what is the frequency of the file coming to the application server.
Schedule your program in SM36 giving data and time make it periodic . select the check box Periodic Job
and then select the period values and give the period values as per the frequency of the file coming to app server.
Thanks,
Harini -
How to move PDF file from Spool to Application Server?
How to move PDF file from Spool to Application Server?
Cannot use RSTXPDFT4 because that converts OTF to PDF and the file is already PDF.
RSTXPDFT5 doesn't work. It picks the file up and assigns it a 'text' type and outputs a 1 line txt (1kb in size) on the server with the spool number in it!
The program which outputs the file to the spool, in the first place, uses adobe forms and outputs to a printer of type PDF.Hi Gemini ,
Please refer the below links.
[http://sap.ittoolbox.com/groups/technical-functional/sap-hr/convert-a-spool-to-pdf-and-save-on-application-server-in-background-720959]
[http://www.sapfans.com/forums/viewtopic.php?f=13&t=325628&start=15]
Edited by: Prasath Arivazhagan on Apr 13, 2010 4:48 PM -
Smartform into PDF and store in folder of application server
Hi Gurus,
I have to solve this issue please help meu2026
1.Convert Smartform into PDF and store in folder of application server
2.print the PDF stored in folder(Application Server) automatically
Please give suggestion for the above..
Moderator message: "spec dumping", please work yourself first on your requirement.
Edited by: Thomas Zloch on Oct 7, 2011 10:39 AMhi uma,
http://www.kodyaz.com/articles/sap-smartforms-download-as-smartform-pdf-using-ws_download-and-cl_gui_frontend_services.aspx
check this out...
thanks,
ram
Maybe you are looking for
-
Adobe reader 9.1.2: "copies" greyed out under page handling
windows xp pro: sp3 adobe reader 9.1.2 canon faxphone L80 (latest drivers) When printing from a NON PROTECTED document, the "copies" option is greyed out under page handling. This issue only applies to the Canon L80 and I can print multiple copies to
-
Using 4.0.2, strange error message when trying to created a webi rep
Hi all I'm getting the error message Protocol message end-group tag did not match expected tag. (WIS 00000) while trying to create a webi report using a unx (Designer Information Design tool) full error test below This unx is using a 7.1 BW cube, and
-
Banking + Bank Statement And Reconciliation Then how we use Link Invoice to payment ?
-
Farsi Titles in Premiere Pro CS6
I've seen a few posts that seem to be relevant but offer no conclusion about how to create Farsi subtitles in premiere pro CS6. I've seen many posts about persian font being reversed in adobe software, so that might be my next problem. Adobe phone su
-
Why can't I activate my Photoshop cs on a new computer?
I have a copy of Photoshop CS and I have only 14 days left to activate it. However the internet activation is not available and the phone activation is not available. I am instructed to go to adobe.com/go/activation but it is not helpful at all. Plea