Program to execute ARCHIVFILE_CLIENT_TO_SERVER FM
Hi experts;
My knowhow of ABAP is very limited so be patience.
I need to create a program to execute FM ARCHIVFILE_CLIENT_TO_SERVER.
If you run it, the FM will ask you a path and a targetpath.
my path should be
pclis02\consult\Equipa_EM\Line_TEXT.csv (CSV file that is in the customer network)
my targetpath should be
debtdc00\sapmnt\trans_DEB\LINE (to be located in application server)
Can anyone help me building the program?
Best regards;
Ricardo
DATA:W_FILEPATH TYPE SAPB-SAPPFAD,
W_SPATH TYPE SAPB-SAPPFAD.
W_SPATH = '
pclis02\consult\Equipa_EM\Line_TEXT.csv'.
W_FILEPATH = '
debtdc00\sapmnt\trans_DEB\LINE '.
CALL FUNCTION 'ARCHIVFILE_CLIENT_TO_SERVER'
EXPORTING
PATH = W_SPATH
TARGETPATH = W_FILEPATH
EXCEPTIONS
ERROR_FILE = 1
OTHERS = 2
Similar Messages
-
Submit a program to execute in background.
Hi Everyone,
Is there a way to submit a program to execute in background. So that the runtine is fast. Any help on this will be great.
Thanks,
Prabhu.Hi,
Check this code -
*Submit report as job(i.e. in background)
data: jobname like tbtcjob-jobname value
' TRANSFER TRANSLATION'.
data: jobcount like tbtcjob-jobcount,
host like msxxlist-host.
data: begin of starttime.
include structure tbtcstrt.
data: end of starttime.
data: starttimeimmediate like btch0000-char1.
Job open
call function 'JOB_OPEN'
exporting
delanfrep = ' '
jobgroup = ' '
jobname = jobname
sdlstrtdt = sy-datum
sdlstrttm = sy-uzeit
importing
jobcount = jobcount
exceptions
cant_create_job = 01
invalid_job_data = 02
jobname_missing = 03.
if sy-subrc ne 0.
"error processing
endif.
Insert process into job
SUBMIT zreport and return
with p_param1 = 'value'
with p_param2 = 'value'
user sy-uname
via job jobname
number jobcount.
if sy-subrc > 0.
"error processing
endif.
Close job
starttime-sdlstrtdt = sy-datum + 1.
starttime-sdlstrttm = '220000'.
call function 'JOB_CLOSE'
exporting
event_id = starttime-eventid
event_param = starttime-eventparm
event_periodic = starttime-periodic
jobcount = jobcount
jobname = jobname
laststrtdt = starttime-laststrtdt
laststrttm = starttime-laststrttm
prddays = 1
prdhours = 0
prdmins = 0
prdmonths = 0
prdweeks = 0
sdlstrtdt = starttime-sdlstrtdt
sdlstrttm = starttime-sdlstrttm
strtimmed = starttimeimmediate
targetsystem = host
exceptions
cant_start_immediate = 01
invalid_startdate = 02
jobname_missing = 03
job_close_failed = 04
job_nosteps = 05
job_notex = 06
lock_failed = 07
others = 99.
if sy-subrc eq 0.
"error processing
endif.
URL: http://www.sapdevelopment.co.uk/reporting/rep_submit.htm
Hope this code snippet helps you! -
Program should execute both for F8 and F9
Hi All,
I have a requirement that my program should execute both for F8 and F9.
I have developed it as a report as the selection-screen contains 'Select-Options' and they want the Multiple Selection Button.
I know that if I develop it as a Module pool, my problem is very easily solved.
But since they want the Multiple-Selection button for Select-options which we cannot provide in a Module-Pool I am forced to develop a report.
Please let me know if its possible to execute the program with both F8 and F9 function keys, while F8 can be the normal execute button, there is no need of any button for F9, that is a F9 key press is enough. The Report should execute if the user presses F8 or F9 key on the Key-board.
Hope I am clear.
Please help me with your suggestions.
Thanks in Advance.
Edited by: Dagny on Apr 1, 2009 6:57 AMHi, Dangy
I dont think you can do with f9 fkey,
but you can do with ctrl+f9 , if ur client like this..
this are some available FKeys.
Freely assigned function keys
F5
F6
F7
F8 ONLI Execute
Shift-F1 DOCU Program Documenta...
Shift-F6 SCRH Selection Screen ...
Shift-F7 ALLS All Selections
Shift-F8 FEWS Chosen Selections
Shift-F9
Shift-Ctrl-0
Shift-F11
Shift-F12
Ctrl-F1 FC01 <SSCRFIELDS-FUNC...>
Ctrl-F2 FC02 <SSCRFIELDS-FUNC...>
Ctrl-F3 FC03 <SSCRFIELDS-FUNC...>
Ctrl-F4 FC04 <SSCRFIELDS-FUNC...>
Ctrl-F5 FC05 <SSCRFIELDS-FUNC...>
Ctrl-F6 LVUV User Variables...
Ctrl-F7
Ctrl-F8
Ctrl-F9
Ctrl-F10
Ctrl-F11
Ctrl-F12
Ctrl-Shift-F1
Ctrl-Shift-F2
Ctrl-Shift-F3
Ctrl-Shift-F4
Ctrl-Shift-F5
Ctrl-Shift-F6
Ctrl-Shift-F7
Ctrl-Shift-F8
Ctrl-Shift-F9
Ctrl-Shift-F10
Ctrl-Shift-F11
Ctrl-Shift-F12
Just execute ur program, and go to system>status->in SAP data , there is GUI status-> dbl clik in ur gui status and assign Fcode for ctrl+f9 and handle the same in user command.
I hope it will solve ur problem. -
Need to execute a FM before any program is executed
Friends, I have a requirement of executing a FM before every Z program is executed in Background. Can anyone plz suggest a way to accomplish this. Otherwise we may have to change all programs to incorporate FM call.
Thanks friends
BhaskarJust trying to do more digging......
Is there any SAP Program or FM that executes before any program is executed or is there any provision so that I can execute another Z-program(this inturn contains FM) before I execute any other program......Or can events be used by any change......
all suggestions welcome....
Thanks all for visiting this post...
Bhaskar -
Disallow java program to execute external command
How to disallow java program to execute some external command.
Thank.It work by using custom policy, thank
Test.java
String command1[] = {"/bin/ls","-a,","-l"};
String command2[] = {"/bin/pwd"};
Runtime runtime = Runtime.getRuntime();
try{
Process p1 = runtime.exec(command1);
Process p2 = runtime.exec(command2); // AccessControlException: access denied
Scanner s1 = new Scanner(p1.getInputStream());
Scanner s2 = new Scanner(p2.getInputStream());
System.out.println(s1.nextLine());
System.out.println(s2.nextLine());
}catch(Exception ex){
ex.printStackTrace();
}java.policy
grant{
permission java.io.FilePermission "/bin/ls", "execute";
}Run
$java -Djava.security.manager -Djava.security.policy=java.policy Test
java.security.AccessControlException: access denied (java.io.FilePermission /bin/pwd execute) -
Hi Friends ,
Can anyone please give the solution for the following issue
To write an SAP program to execute the following.
http://133.0.1.91:7777/epaprod
http://pkg_epadb:7777/epaprod
Hosts:
Entry in hosts file.
133.0.1.91 pkg_epadb
Thanks in advance.*& Report YH627_HTML_CONTROL
REPORT YH627_HTML_CONTROL.
TYPE-POOLS: ICON.
CLASS CLS_EVENT_HANDLER DEFINITION DEFERRED.
G L O B A L V A R I A B L E S
DATA:
OK_CODE LIKE SY-UCOMM,
Container for html viewer
W_HTML_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
HTML viewer
W_HTMLVIEWER TYPE REF TO CL_GUI_HTML_VIEWER,
Container for toolbar
W_TOOLBAR_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
SAP Toolbar
W_TOOLBAR TYPE REF TO CL_GUI_TOOLBAR,
Event handler for toolbar
W_EVENT_HANDLER TYPE REF TO CLS_EVENT_HANDLER,
Variable for URL text field on screen 100
W_SCREEN100_URL_TEXT(255) TYPE C,
W_SCREEN100_DISPLAY_URL(255) TYPE C.
I N T E R N A L T A B L E S
DATA:
Table for button group
T_BUTTON_GROUP TYPE TTB_BUTTON,
Table for registration of events. Note that a TYPE REF
to cls_event_handler must be created before you can
reference types cntl_simple_events and cntl_simple_event.
T_EVENTS TYPE CNTL_SIMPLE_EVENTS,
Workspace for table T_EVENTS
FS_EVENT TYPE CNTL_SIMPLE_EVENT.
START-OF-SELECTION.
SET SCREEN '100'.
CLASS cls_event_handler DEFINITION
Handles events for the toolbar an the HTML viewer
CLASS CLS_EVENT_HANDLER DEFINITION.
PUBLIC SECTION.
METHODS:
Handles method function_selected for the toolbar control
ON_FUNCTION_SELECTED
FOR EVENT FUNCTION_SELECTED OF CL_GUI_TOOLBAR
IMPORTING FCODE,
Handles method navigate_complete for the HTML viewer control
ON_NAVIGATE_COMPLETE
FOR EVENT NAVIGATE_COMPLETE OF CL_GUI_HTML_VIEWER
IMPORTING URL.
ENDCLASS. " CLS_EVENT_HANDLER DEFINITION
CLASS cls_event_handler IMPLEMENTATION
CLASS CLS_EVENT_HANDLER IMPLEMENTATION.
Handles method function_selected for the toolbar control
METHOD ON_FUNCTION_SELECTED.
CASE FCODE.
WHEN 'BACK'.
CALL METHOD W_HTMLVIEWER->GO_BACK
EXCEPTIONS
CNTL_ERROR = 1.
WHEN 'FORWARD'.
CALL METHOD W_HTMLVIEWER->GO_FORWARD
EXCEPTIONS
CNTL_ERROR = 1.
WHEN 'STOP'.
CALL METHOD W_HTMLVIEWER->STOP
EXCEPTIONS
CNTL_ERROR = 1.
WHEN 'REFRESH'.
CALL METHOD W_HTMLVIEWER->DO_REFRESH
EXCEPTIONS
CNTL_ERROR = 1.
WHEN 'HOME'.
CALL METHOD W_HTMLVIEWER->GO_HOME
EXCEPTIONS
CNTL_ERROR = 1.
WHEN 'EXIT'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMETHOD. " ON_FUNCTION_SELECTED
Handles method navigate_complete for the HTML viewer control
METHOD ON_NAVIGATE_COMPLETE.
Display current URL in a textfield on the screen
W_SCREEN100_DISPLAY_URL = URL.
ENDMETHOD. " ON_FUNCTION_SELECTED
ENDCLASS. "CLS_EVENT_HANDLER IMPLEMENTATION
*& Module STATUS_0100 OUTPUT
MODULE STATUS_0100 OUTPUT.
IF W_HTML_CONTAINER IS INITIAL.
Create container for HTML viewer
CREATE OBJECT W_HTML_CONTAINER
EXPORTING
CONTAINER_NAME = 'HTML_CONTAINER'.
Create HTML viewer
CREATE OBJECT W_HTMLVIEWER
EXPORTING PARENT = W_HTML_CONTAINER.
Create container for toolbar
CREATE OBJECT W_TOOLBAR_CONTAINER
EXPORTING
CONTAINER_NAME = 'TOOLBAR_CONTAINER'.
Create toolbar
CREATE OBJECT W_TOOLBAR
EXPORTING
PARENT = W_TOOLBAR_CONTAINER.
Add buttons to the toolbar
PERFORM ADD_BUTTON_GROUP.
Create event table. The event ID must be found in the
documentation of the specific control
CLEAR FS_EVENT.
REFRESH T_EVENTS.
FS_EVENT-EVENTID = W_TOOLBAR->M_ID_FUNCTION_SELECTED.
FS_EVENT-APPL_EVENT = 'X'. " This is an application event
APPEND FS_EVENT TO T_EVENTS.
FS_EVENT-EVENTID = W_HTMLVIEWER->M_ID_NAVIGATE_COMPLETE.
APPEND FS_EVENT TO T_EVENTS.
Use the events table to register events for the control
CALL METHOD W_TOOLBAR->SET_REGISTERED_EVENTS
EXPORTING
EVENTS = T_EVENTS.
CALL METHOD W_HTMLVIEWER->SET_REGISTERED_EVENTS
EXPORTING
EVENTS = T_EVENTS.
Create event handlers
CREATE OBJECT W_EVENT_HANDLER.
SET HANDLER W_EVENT_HANDLER->ON_FUNCTION_SELECTED
FOR W_TOOLBAR.
SET HANDLER W_EVENT_HANDLER->ON_NAVIGATE_COMPLETE
FOR W_HTMLVIEWER.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
MODULE USER_COMMAND_0100 INPUT.
Handles the pushbutton for goto url
CASE OK_CODE.
WHEN 'GOTOURL'.
PERFORM GOTO_URL.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form add_button_group
Adds a button group to the toolbar
FORM ADD_BUTTON_GROUP.
BACK button
CALL METHOD CL_GUI_TOOLBAR=>FILL_BUTTONS_DATA_TABLE
EXPORTING
FCODE = 'BACK'
ICON = ICON_ARROW_LEFT
BUTN_TYPE = CNTB_BTYPE_BUTTON
TEXT = ''
QUICKINFO = 'Go back'
CHANGING
DATA_TABLE = T_BUTTON_GROUP.
FORWARD button
CALL METHOD CL_GUI_TOOLBAR=>FILL_BUTTONS_DATA_TABLE
EXPORTING
FCODE = 'FORWARD'
ICON = ICON_ARROW_RIGHT
BUTN_TYPE = CNTB_BTYPE_BUTTON
TEXT = ''
QUICKINFO = 'Go forward'
CHANGING
DATA_TABLE = T_BUTTON_GROUP.
STOP button
CALL METHOD CL_GUI_TOOLBAR=>FILL_BUTTONS_DATA_TABLE
EXPORTING
FCODE = 'STOP'
ICON = ICON_BREAKPOINT
BUTN_TYPE = CNTB_BTYPE_BUTTON
TEXT = ''
QUICKINFO = 'Stop'
CHANGING
DATA_TABLE = T_BUTTON_GROUP.
REFRESH button
CALL METHOD CL_GUI_TOOLBAR=>FILL_BUTTONS_DATA_TABLE
EXPORTING
FCODE = 'REFRESH'
ICON = ICON_REFRESH
BUTN_TYPE = CNTB_BTYPE_BUTTON
TEXT = ''
QUICKINFO = 'Refresh'
CHANGING
DATA_TABLE = T_BUTTON_GROUP.
Home button
CALL METHOD CL_GUI_TOOLBAR=>FILL_BUTTONS_DATA_TABLE
EXPORTING
FCODE = 'HOME'
ICON = ''
BUTN_TYPE = CNTB_BTYPE_BUTTON
TEXT = 'Home'
QUICKINFO = 'Home'
CHANGING
DATA_TABLE = T_BUTTON_GROUP.
Separator
CALL METHOD CL_GUI_TOOLBAR=>FILL_BUTTONS_DATA_TABLE
EXPORTING
FCODE = 'SEP1'
ICON = ' '
BUTN_TYPE = CNTB_BTYPE_SEP
CHANGING
DATA_TABLE = T_BUTTON_GROUP.
EXIT button
CALL METHOD CL_GUI_TOOLBAR=>FILL_BUTTONS_DATA_TABLE
EXPORTING
FCODE = 'EXIT'
ICON = ICON_CLOSE
BUTN_TYPE = CNTB_BTYPE_BUTTON
TEXT = ''
QUICKINFO = 'Close porgram'
CHANGING
DATA_TABLE = T_BUTTON_GROUP.
Add button group to toolbar
CALL METHOD W_TOOLBAR->ADD_BUTTON_GROUP
EXPORTING
DATA_TABLE = T_BUTTON_GROUP.
ENDFORM. " ADD_BUTTON_GROUP
*& Form goto_url
Calls method SHOW_URL to navigate to an URL
FORM GOTO_URL.
CALL METHOD W_HTMLVIEWER->SHOW_URL
EXPORTING
URL = W_SCREEN100_URL_TEXT.
ENDFORM. " GOTO_URL
Before executing the program,
you need to define HTML container and TOOLBAR container....
So, double click on call screen 100 and then define the containers....
Then give the URL which you want to give and then execute the program....
Regards,
Pavan P. -
Concurrnet Program of Executable type Host
Hi All,
I am facing some problems with Oracle Concurrent Programs whose executable type is 'Host'.
The program is completing normal but not processing anything, it not even printing proper logs and even going in to shell script written in .prog file.
Is it because, i had modified the .prog file and recreated the soft link??
Can you please help.
Thanks,
SHi,
Please mention the application release and the OS.
Have you completed all the steps in these documents?
Note: 156636.1 - How to Register a Host Concurrent Program in Applications
Note: 266268.1 - How To Create A Custom Concurrent Program With Host Method and Pass Parameters To The Shell Script
Note: 170878.1 - How to Register a Host Concurrent Program for NT
Thanks,
Hussein -
Program to run ARCHIVFILE_CLIENT_TO_SERVER in Process Chain
Hi experts;
I had created one program that run ARCHIVFILE_CLIENT_TO_SERVER function module with path and target path defined.
REPORT ZTEST.
DATA:W_FILEPATH TYPE SAPB-SAPPFAD,
W_SPATH TYPE SAPB-SAPPFAD.
break-point.
W_SPATH = '
pclis02\consult\Equipa_EM\Line_TEXT.csv'.
W_FILEPATH = '
debtdc00\sapmnt\trans_DEB\LINE '.
CALL FUNCTION 'ARCHIVFILE_CLIENT_TO_SERVER'
EXPORTING
PATH = W_SPATH
TARGETPATH = W_FILEPATH
EXCEPTIONS
ERROR_FILE = 1
OTHERS = 2.
I run it in se38 and it works fine.
However, if I add it to one process chain to run it but it doesnu2019t work.
I had tried both calling modes and assigning the program name u201CZTESTu201D. No variant was created.
Can anyone help me?
Best regards;
RicardoHi Meiyappan;
The only messages that appear in the job are these:
1. Job started
2. Step 001 started (program RSPROCESS, variant &0000000003888, user ID BI_RFC)
3. Job finished
No errors occur.
Best regards;
Ricardo -
Speed at which JAVA programs are executed
While it is true that a typical JAVA program will execute slower than an equivalent program written in other languages such as C++.
Is it because the compiled bytecodes (.class) have to be interpreted by the JVM?
Thanks.yep, a .class is bytecode... the JVM interprets the bytecode "on the fly".
The JVM's major task is to "interpolate" native operating system requests. That's why the JVM is platform specific.
The bytecode to native interpretation takes a few clock ticks, so it's a might slower than native compiled code... but it's practically important to realise that this is not the big performance hit inherent in a "Virtual Machine"... the big (potential) performance loss is the overhead of "interpolating" every single O/S interface request... hence String BufferedReader.readLine() is light-years faster than char InputStream.read(), because .read() has to (1) interpret your request, (2) set the registers, (3) do an operating system interupt, (3) interpret the response... for EVERY SINGLE EENY WEENY CHARACTER... which in practice means you can't do an usable java port of directX... which is a shame really.
But is does mean that you can (almost) write a webapp which is completely portable across platforms (with zero code change).
horses....
keith.
Message was edited by:
corlettk -
Concurrent Program not executing
Hi All,
I have created new custom concurrent program of type SQL*Plus to purge the data. To my surprize when I submit the program, program is not getting executed, which I can confirm saying the data is not getting deleted. Also the log messages mentioned script is also not displayed in the LOG.
No debug message is displayed in neither LOG nor OUTPUT.
Executable File Name is correctly given and taken care of all other mandatory stuff while registration.
Bleow the script:
I am passing Number of Days ( 500 ) as parameter to this program.
So here &1 = 500:
DECLARE
L_deleted_rec_cnt NUMBER;
BEGIN
fnd_file.put_line ( fnd_file.LOG, ' Conc Program Starts');
DELETE
FROM xxX_TABLE_NAME
WHERE TRUNC (creation_date) < TRUNC (SYSDATE- &1);
L_deleted_rec_cnt := SQL%ROWCOUNT;
IF L_deleted_rec_cnt > 0 THEN
COMMIT;
fnd_file.put_line ( fnd_file.LOG, L_deleted_rec_cnt||' Records purged');
ELSE
fnd_file.put_line ( fnd_file.LOG, ' No Records to purge');
END IF;
fnd_file.put_line ( fnd_file.OUTPUT, ' Conc Program End');
EXCEPTION
WHEN OTHERS THEN
fnd_file.put_line (fnd_file.LOG, 'Error in purging '||SQLCODE||' '||SQLERRM);
END;
Please advise.
Regards,
RamIt is 11i and the LOG is showing as Concurrent Program executed succesfully. THere is not error reported in the LOG.
And also nothing writter to OUT file also.
Content in LOG file:
XXXX Customer Advocacy: Version : 1.0 - Development
Copyright (c) 1979, 1999, Oracle Corporation. All rights reserved.
XXCC module: XXXX Error Log Purge
Current system time is 28-DEC-2009 04:55:46
+-----------------------------
| Starting concurrent program execution...
+-----------------------------
Arguments
450
Start of log messages from FND_FILE
End of log messages from FND_FILE
Executing request completion options...
------------- 1) PRINT -------------
Printing output file.
Request ID : 52374634
Number of copies : 0
Printer : noprint
Finished executing request completion options.
Concurrent request completed successfully
Current system time is 28-DEC-2009 04:55:47
Content in Out FIle:
Input truncated to 2 characters
Regards,
Ram -
LOAD-OF-PROGRAM IS EXECUTED AT EVERY PBO
Dear All:
I'm working with a ECC6 system, which was upgraded from a 4.6C.
Concerning to LOAD-OF-PROGRAM: When an ABAP program is loaded in an internal session, the runtime environment triggers the LOAD-OF-PROGRAM event, and the corresponding event block is executed.
This means that LOAD-OF-PROGRAM should be executed only once.
But I have different behaviour. In my system is executed at every PBO.
I have this test code:
REPORT ztest .
PARAMETERS: p_gjahr TYPE gjahr.
LOAD-OF-PROGRAM.
BREAK-POINT.
START-OF-SELECTION.
WRITE:/ 'Hello'.
When I run this program, the break-point is triggered. This is correct.
After that, I press F8, to skip the break-point, and F8 to launch the report.
The system shows 'Hello'.
But when I press back, the break-point located in load-of-program is triggered again, which is incorrect.
Has someone faced the same problem?
Thanks in advance.When I run this program, the break-point is triggered. This is correct.
After that, I press F8, to skip the break-point, and F8 to launch the report.
The system shows 'Hello'.
But when I press back, the break-point located in load-of-program is triggered again, which is incorrect.
No, which is not Incorrect. It is correct. Even if you try to put the INITIALIZATION event and put a break-point system will go it both the time as it went in the LOAD-OF-PROGRAM.
That means when you come back from the List to selection screen, system will load the program using the LOAD-OF-PROGRAM and that's why all your global data is being cleared everytime your run the program from the selection screen.
Regards,
Naimesh Patel -
Problem in BDC program when executed using scheduled job
I have developed a BDC program for J1I5 T-code whcih updates RG1 Register. This is working as expected when run in foreground as well as in background. But it is not giving expected results when scheduled in Job. It is not giving any error message, job is executed without error.
What can be the problem? pls. help.
Thanks!
PrakashHi,
Thanks for reply.
I have checked log using SM37, it is not showing any error.
Log details are as follows...
Date Time Message text Message class Message no. Messag
08.05.2010 11:47:10 Job started 00 516 S
08.05.2010 11:47:10 Step 001 started (program ZSDB_J1I5_REG_UPDATE_BDC, variant 1101_1_RMA, user ID STK) 00 550 S
08.05.2010 11:47:20 Job finished 00 517 S -
ABAP program to execute shell script !
Hi Friends,
I have created some shell scripts and need to be executed through ABAP prog in order to automate some process. can any one tell me how to execute these scripts through ABAP program? i know that we have to setup those scripts through SM69 but i dont have clear idea about this.can some one tell me step by step how to do this. ur help will be awarded in terms of points.
ThanksDefine the scripts as commands in SM69. Test them in SM69/SM49 to see if they work.
Next, go to SE37, run FM SXPG_COMMAND_EXECUTE, and specify your command there. Does it work?
If yes, you can just code a 'CALL FUNCTION' to this FM in your ABAP program, and you are ready to invoke your script from your ABAP.
For a list of functions that work with commands (defined in SM69), do a drop-down on SXPG_COMMAND* in SE37.
A sample code may look like this
concatenate zsys_id z_infile z_extfile into parm
separated by space.
*C_FTP_COMMAND is a script defined in SM49
CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
EXPORTING
COMMANDNAME = C_FTP_COMMAND
ADDITIONAL_PARAMETERS = parm
OPERATINGSYSTEM = SY-OPSYS
TABLES
EXEC_PROTOCOL = PROT
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.
else.
write: /, 'FTP Function module executed with no errors.'.
ENDIF. -
How to display pdf file once a program is executed?
I am writing a program in se80 and i am getting the pdf data in the type FPFORMOUTPUT-PDF.
Now i want to display the pdf once the user execute the program. Is there a FM to do that? The pdf should open in Adobe so i have would have the option of printing or saving the pdf file.
Any help will be appreciated.
Thankshi,
well i don't think that there is any FM to call pdf but you can always save the pdf in local disk and then use FM GUI_RUN to specify the pdf's path and once the file's printing is done..use gui_delete to delete the same file..
I hope this might help u.
regards,
Gaurav -
How to write a JAVA program to execute the SQL queries
I have a database in the Microsoft Access queries and I need to execute the query by some how write the Java program to make it execute the query. because I need to get the different of time so I know how fast each query run.
Thank youYou need jdbc-driver for MSAccess for run this example:
JDBCClient.java
import java.util.Properties;
import java.lang.String;
import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.BufferedOutputStream;
import java.lang.System;
import java.lang.Class;
import java.sql.SQLException;
import java.util.Date;
import java.util.Locale;
import java.text.DateFormat;
import java.sql.Time;
public class JDBCClient{
private String DriverName = new String();
private String DatabaseURL = new String();
private String UserName = new String();
private String Password = new String();
private String SQLFile = new String();
private String OutputFile = new String();
private String Separator = new String();
private boolean NeedColumnHeaders;
private String EncodingParamName = new String();
private String EncodingValue = new String();
private String OutputEncoding = new String();
private boolean AfterLastColumnSeparator;
JDBCClient( String propfilename){
System.out.println( "Initializing...");
Properties properties = new Properties();
try{
properties.load( new FileInputStream( propfilename));
catch( Exception e){
System.out.println( "Error: " + e.toString());
System.exit( 0);
DriverName = properties.getProperty( "DriverName");
DatabaseURL = properties.getProperty( "DatabaseURL");
UserName = properties.getProperty( "UserName");
Password = properties.getProperty( "Password");
SQLFile = properties.getProperty( "SQLFile");
OutputFile = properties.getProperty( "OutputFile");
Separator = properties.getProperty( "Separator");
if( properties.getProperty( "NeedColumnHeaders").compareToIgnoreCase( "yes") == 0 ||
properties.getProperty( "NeedColumnHeaders").compareToIgnoreCase( "true") == 0)
NeedColumnHeaders = true;
else
if( properties.getProperty( "NeedColumnHeaders").compareToIgnoreCase( "no") == 0 ||
properties.getProperty( "NeedColumnHeaders").compareToIgnoreCase( "false") == 0)
NeedColumnHeaders = false;
else{
System.out.println( "Invalid value for \"NeedColumnHeaders\" property (logical expected)");
System.exit( 0);
EncodingParamName = properties.getProperty( "EncodingParamName");
EncodingValue = properties.getProperty( "EncodingValue");
OutputEncoding = properties.getProperty( "OutputEncoding");
if( properties.getProperty( "AfterLastColumnSeparator").compareToIgnoreCase( "yes") == 0 ||
properties.getProperty( "AfterLastColumnSeparator").compareToIgnoreCase( "true") == 0)
AfterLastColumnSeparator = true;
else
if( properties.getProperty( "AfterLastColumnSeparator").compareToIgnoreCase( "no") == 0 ||
properties.getProperty( "AfterLastColumnSeparator").compareToIgnoreCase( "false") == 0)
AfterLastColumnSeparator = false;
else{
System.out.println( "Invalid value for \"AfterLastColumnSeparator\" property (logical expected)");
System.exit( 0);
try{
byte[] EOL = new byte[2];
EOL[0] = 13;
EOL[1] = 10;
Class.forName( DriverName);
Properties connInfo = new Properties();
connInfo.put( "user", UserName);
connInfo.put( "password", Password);
if( EncodingParamName.length() != 0 && EncodingValue.length() != 0)
connInfo.put( EncodingParamName, EncodingValue);
Connection connection = DriverManager.getConnection( DatabaseURL, connInfo);
FileInputStream in = new FileInputStream( SQLFile);
byte[] buffer = new byte[in.available()];
in.read( buffer);
in.close();
String SQL = new String( buffer);
PreparedStatement statement = connection.prepareStatement( SQL);
Date d1 = new Date();
System.out.println( "Database connected at " + d1 + " Executing statement...");
ResultSet resultSet = null;
if( statement.execute())
resultSet = statement.getResultSet();
else{
System.out.println( "Script updates " + statement.getUpdateCount() + " records.");
System.exit( 0);
ResultSetMetaData metaData = resultSet.getMetaData();
BufferedOutputStream out = new BufferedOutputStream( new FileOutputStream( OutputFile));
if( NeedColumnHeaders && metaData.getColumnCount() > 0){
String head = new String();
for( int i = 1; i < metaData.getColumnCount(); i++)
head += metaData.getColumnName( i) + Separator;
head += metaData.getColumnName( metaData.getColumnCount());
out.write( head.getBytes( OutputEncoding), 0, head.length());
out.write( EOL, 0, 2);
String record = new String();
while( resultSet.next()){
record = "";
for( int i = 1; i < metaData.getColumnCount(); i++)
record += resultSet.getString( i) + Separator;
record += resultSet.getString( metaData.getColumnCount());
if( AfterLastColumnSeparator)
record += Separator;
out.write( record.getBytes( OutputEncoding), 0, record.length());
out.write( EOL, 0, 2);
out.close();
Date d2 = new Date();
System.out.println( "Done at " + d2);
System.out.println( "Executing time " + new Time( d2.getTime() - d1.getTime() - 10800000));
catch( ClassNotFoundException e){
System.out.println( e.toString());
catch( SQLException e){
System.out.println( e.toString());
catch( java.io.IOException e){
System.out.println( e.toString());
System.exit( 0);
public static void main( String args[]){
if( args.length == 1)
new JDBCClient( args[0]);
else
System.out.println( "Usage JDBCClient <properties_file>");
}JDBCClient.properties ( for Oracle database)
DriverName=oracle.jdbc.driver.OracleDriver
DatabaseURL=jdbc:oracle:thin:@192.168.1.1:1521:test
UserName=test
Password=test
SQLFile=test.sql
OutputFile=test.csv
Separator=*
NeedColumnHeaders=yes
EncodingParamName=
EncodingValue=
OutputEncoding=windows-1251
AfterLastColumnSeparator=yestest.sql
select * from users;
Maybe you are looking for
-
Just starting to use aperture. is there a way to find and delete duplicate pix?
I'm working on a huge project and there are duplicates here and there. Is there a way to delete all duplicates from projects--or at least an easier way to do it then 1 by 1?
-
In my header is there a way to point to a directory with images that it will rotate through all of the images based on a user defined time? Thanks in advance!
-
Remove GrantSendOnBehalfTo disabled user accounts - A novice at scripting
Hello. Can anyone help please In our exchange 2010 environment we have users who are granted send on behalf to access. Obviously some users leave and I m finding that there are ghosts left behind which are causing issues with our team who add users
-
Another question about receiver determination
Hi friends Can we add a new receiver to the list of receivers in the receiver determination , based in some condition only for this new receiver. Let us say we have the message 1 sent to receiver_1 and receiver_2 no matter what , but the message 1 s
-
Hello, I have 2 CMP having master and detailed relationship. 1) BookingMasterBean 2) BookingDetailsBean (having one to many relationship). This is to do with a new booking to be made for Squash halls in our application. The primary key in Master bean