Trnslate command in abap
dear all,
i am a student of abaper plz solve the below problem.
accept a string like 'emax technologies ,change all the occurenses of e to g?
As a student, you should be doing lots of searching and lots of reading documentation. Not until that should you post a question here. Please read the Rules of this forum to avoid trouble.
Edited by: kishan P on Aug 30, 2010 2:27 PM
Hi Sandeep,
Use REPLACE command to achieve this.
Do a F1 on REPLACE command.
And Please do search on SCN before posting such basic questions.
Regards
Abhii
Similar Messages
-
Is it possible to call ms-dos command in abap program?
Hi,
is it possible to call ms-dos command in abap program?
Thanks.Hi Cemil,
You probably have your answer here:
[Re: DOS/Windows command in app server;
You create your external command with SM69 (you can test it with SM49).
Then you call this command with function module "SXPG_COMMAND_EXECUTE".
(See function group SXPT for all the calls to external commands).
Regards,
Thomas -
I want to execute UNIX COMMAND in ABAP
Hi All,
I want to execute a UNIX XOMMAND sh <scriptname> <filename> to replace divsion codes.in ABAP.
But, I came to know that we can't (2) or try the following program but unfortunately the command CALL SYSTEM is not supported by SAP. If you are on R/3 2.1 - 2.2x you can get some idea's from the program SAPMSOS0.
REPORT ZUNIXCOM .
DATA: U_COMMAND(200).
Table for system messages
DATA: BEGIN OF RT OCCURS 100 ,
LINE(100) ,
END OF RT .
START-OF-SELECTION .
MOVE 'unix command' to U_COMMAND .
REFRESH RT.
CALL 'SYSTEM' ID 'COMMAND' FIELD U_COMMAND
ID 'TAB' FIELD RT-SYS .
LOOP AT RT.
WRITE : / RT-LINE .
ENDLOOP.
So please can u help me how to call a unix command from ABAP. it is very urgent. I want complete details and all possible solutions
<removed_by_moderator>
Thanks,
gyanaraj
Edited by: Julius Bussche on Aug 26, 2008 11:29 AMSelvaraj Gyanaraj wrote:>
> So please can u help me how to call a unix command from ABAP.
I was about to help you.
>it is very urgent.
I changed my mind.
>I want complete details and all possible solutions
I'm glad I changed my mind.
>Points are surely rewarded.
Too late. -
AT NEW command in ABAP Objects
Hi everyone!
Is there an equivalent of the AT NEW command in abap oo? When I try to use this command inside a BAdi, I get an error message.
Best Regards,
Luís.Hi,
Thank you for your response
Sample code:
LOOP AT c_t_data ASSIGNING variants are no longer supported in the OO context. Use dynamic variants instead.
Regards,
Luís. -
Hi All,
I need to use unix command (MOVE) in ABAP code for transfering a file from one directory to another directory.
Can any one help with how to used unix commands in ABAP?
Thanks in advance.
Regards,
HemendraThe recommended approach always used to be to use transaction SM69 to define a "soft" command name to the operating system command so that it could be configured to work across Windows, Unix etc. For example:
Command name OS Type OS command Parameters for operating system command
Z_FILE_MOVE SunOS Customer mv ? ?
You can then call function module SXPG_COMMAND_EXECUTE (quite well documented) to actually perform the command passing in the appropriate number of parameters.
Jonathan -
Command in ABAP Editor to improve the source code
Which command in ABAP Editor to be used to improve the readability of the program code ?plzz tell
Edited by: Alvaro Tejada Galindo on Feb 13, 2008 3:48 PMUse Pretty Printer or do a CTRL+F1.
Also u can change the settings of the way u want preety printer to behave by
going in the Settings->Abap Editor -> Pretty Printer -
Hi,
I need to call the following unix command in ABAP to encrypt a file on the app server .
crypt password <org filename> new_filename
1 But when i run it using call 'SYSTEM' .. i get message security risk , command not executed ..
2 I also created the command in SM69 and tries to run it but same error.
3 I also created a shell script , but i get another message when i try to run sh ...
Please help to find out a way to make it work ..
KunalHi kunal,
1. probably ur basis team might be able to help u.
2. even if we have authorisations thru sap
to run external os command,
the actual OS user on application server
must have the right for it
and access/write/read/modify
for the files (provided thru the command)
in question.
3. Due to this , the systems gives the message
of SECURITY RISK.
regards,
amit m. -
How to execute os command from ABAP program?
I want to execute some window commands from ABAP. What is the way to do it?
Hi,
See ht e coding below, I have used these Fm to connect to FTP server and get the Files..
*types for the ftp command result internal table
TYPES : BEGIN OF ty_result,
text TYPE char512,
END OF ty_result.
data it_result type standard table of ty_result.
*Connect to the FTP server
CALL FUNCTION 'FTP_CONNECT'
EXPORTING
user = lv_user " user name pass word to connect
password = l_v_pwd
host = 'dev.eu.pm.com' " Host name here
rfc_destination = 'SAPFTPA' "destination name
*Ask your functional people for the above data
IMPORTING
handle = v_handle
EXCEPTIONS
not_connected = 1
OTHERS = 2.
IF sy-subrc <> 0.
ENDIF.
*Changing directory
CONCATENATE 'cd' '<file path>' INTO l_v_cmd SEPARATED BY space.
you can also ser 'DIR in l_v_cmd which opens the directory and all the folders *get into it_result table..
*Execute the FTP Command
CALL FUNCTION 'FTP_COMMAND'
EXPORTING
handle = v_handle
command = l_v_cmd
TABLES
data = it_result
EXCEPTIONS
tcpip_error = 1
command_error = 2
data_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
ENDIF.
rewards if useful,
regards,
nazeer -
Please tell me how to execute DOS commands from within ABAP.
1.create your shell script your_shell_script.sh:
src=$1
dst=$2
mv -f $src $dst
2. Create your command Z_YOUR_COMMAND using SM69:
- Operating system command: /bin/sh (the path to your shell interpretator)
- Parameters for operating system command:
/home/sap/bin/your_shell_script.sh (the path to your shell script)
- Set "Additional parameters allowed" checkbox
3. Call your command from ABAP:
data:
param type sxpgcolist-parameters.
status type extcmdexex-status,
exitcode type extcmdexex-exitcode,
it_log type table of btcxpm.
p_src = '/common/home/edw/parsekb/b2/*'.
p_dst = '/common/home/edw/parsekb/b1'.
concatenate p_src p_dst into param separated by space.
CALL FUNCTION 'SXPG_CALL_SYSTEM'
EXPORTING
COMMANDNAME = 'Z_YOUR_COMMAND'
ADDITIONAL_PARAMETERS = param
IMPORTING
STATUS = status
EXITCODE = exitcode
TABLES
EXEC_PROTOCOL = it_log
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
OTHERS = 99.
if sy-subrc <> 0.
*TODO: add your error handling logic
endif. -
Logical command in ABAP.....Urgent
Hi,
i am pretty new using ABAP program so i neeed help urgently. i am trying to move a file on the application server from one directory to the other and i was using the open dataset function to do that. but the file i am trying to move is pretty big and because i am using internal table to store, it is causing problems with the space.
i have consulted the basis guys and they have managed to create a logical file for copying from one directory to the other on the application server. to help you furthter. i am enclosing the mail sent to me.
I have created a logical command which should copy the file from one location to the other but you need to pass it the source dir and file name and the destination dir and file name.
The logical command is ZCOPY and uses cmd /c copy
Copies one or more files to another location.
COPY [/V] [/N] [/Y | /-Y] [/Z] [/A | /B ] source [/A | /B]
[+ source [/A | /B] [+ ...]] [destination [/A | /B]]
source Specifies the file or files to be copied.
/A Indicates an ASCII text file.
/B Indicates a binary file.
destination Specifies the directory and/or filename for the new file(s).
/V Verifies that new files are written correctly.
/N Uses short filename, if available, when copying a file with a
non-8dot3 name.
/Y Suppresses prompting to confirm you want to overwrite an
existing destination file.
/-Y Causes prompting to confirm you want to overwrite an
existing destination file.
/Z Copies networked files in restartable mode.
The switch /Y may be preset in the COPYCMD environment variable.
This may be overridden with /-Y on the command line. Default is
to prompt on overwrites unless COPY command is being executed from
within a batch script.
the problem now is i have no idea about how to use the logical command. can any one help me.
Thank you,
Ravi.If memory is not an issue, then there should be no reason why this should not work.
report zrich_0001.
parameters: d1 type localfile default '/usr/sap/TST/SYS/Data1.txt',
d2 type localfile default '/usr/sap/TST/SYS/Data2.txt'.
data: itab type table of string with header line.
start-of-selection.
* Read old file
open dataset d1 for input in text mode.
if sy-subrc = 0.
do.
read dataset d1 into itab.
if sy-subrc <> 0.
exit.
endif.
append itab.
enddo.
endif.
close dataset d1.
* Write to new file
open dataset d2 for output in text mode.
loop at itab.
transfer itab to d2.
endloop.
close dataset d2.
* Delete the old file
delete dataset d1.
Regards,
Rich Heilman -
Hi guy,
I am using " Call 'SYSTEM' id 'COMMAND' field UnixCommand id 'TAB' field itFiles-SYS" to read number of files in folder, it works fine if number of line are around 200 but if its more then that it doesn't any file.
UnixCommand = 'ls -ld'.
UnixCommand+7(45) = /abap/.
call 'SYSTEM' id 'COMMAND' field UnixCommand
id 'TAB' field itFiles-SYS.
Thanks
AtulHi,
DATA: L_DIRNAME LIKE EPSF-EPSDIRNAM,
L_FILEMASK LIKE EPSF-EPSFILNAM.
CALL FUNCTION 'EPS_GET_DIRECTORY_LISTING'
EXPORTING
dir_name = l_dirname
file_mask = l_filemask
* IMPORTING
* DIR_NAME =
* FILE_COUNTER =
* ERROR_COUNTER =
TABLES
dir_list = pi_filelist
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.
Try with this -
Hi everyone!
I need to execute some instructions when user exit from the program.
Something like AT EXIT-COMMAND in PAI.
But i dont have any PAI module or declared flow logic in my screen definition,
becouse screen is calling automaticly by abap, i cant change anything there.
Structure of my program is similiar to this: [http://help-abap.blogspot.com/2008/10/dispaly-alv-report-output-in-same.html|http://help-abap.blogspot.com/2008/10/dispaly-alv-report-output-in-same.html]
How i should run some code when user leave the program?
EDIT:
ok, i got solved it
i needed this one:
AT SELECTION-SCREEN ON EXIT-COMMAND .
PERFORM EXIT_PRG.
Best regards,
Przemek
Edited by: hamsterman on Jul 26, 2010 11:15 AMTry the event:
AT SELECTION-SCREEN ON EXIT-COMMAND . -
What is the exact purpose of using a HIDE statement while making an interactive report? I know it is needed , but what purpose it exactly solves.
F1 help.....
HIDE
Basic form
HIDE f.
In an ABAP Objects context, a more severe syntax check is performed that in other ABAP areas. See Constants not allowed in HIDE area.
Effect
Retains the contents of f related to the current output line. When the user selects the line from the list f is automatically filled with the retained value.
The selection can occur in:
AT LINE-SELECTION
AT PFx
AT USER-COMMAND
READ LINE
The contents of the field do not have to have been displayed using WRITE in order for you to retain them.
The HIDE statement does not support deep structures (structures that contain internal tables).
Useful system fields for interactive reporting are listed in the System Fields for Lists documentation.
Note
Lines or components of lines of an internal table that you address using a field symbol (see ASSIGNING addition to the READ and LOOP statements), cannot be retained using HIDE. You can store them using a global variable instead.
Note
Runtime errors:
HIDE_FIELD_TOO_LARGE: The field is too long for HIDE.
HIDE_ON_EMPTY_PAGE: HIDE not possible on an empty page.
HIDE_NO_LOCAL: HIDE not possible for a local field.
HIDE_ILLEGAL_ITAB_SYMBOL: HIDE not possible for a table line or component of a table line.
and also a sample program.
data: begin of itab occurs 0,
field type c,
end of itab.
itab-field = 'A'. append itab.
itab-field = 'B'. append itab.
itab-field = 'C'. append itab.
itab-field = 'D'. append itab.
itab-field = 'E'. append itab.
loop at itab.
format hotspot on.
write:/ itab-field.
hide itab-field.
format hotspot off.
endloop.
at line-selection.
write:/ 'You clicked', itab-field.
null -
HI Gurus,
I have a ABAP report - basic list, with lot of batch data on it. based on the report they will copy the batch numbers and paste in standard transactions.
Users complaining to do a Ctrl + Y and then Ctrl + C then Ctrl + V to paste the batch numbers.
Is there anything we can do programatically using hot sopt on batch numbers so we get the selected BATCH and execute copy command programatically when they click on BATCH number on basic list.
All they need to do is Ctrl + V on standard transactions.
Is there anyway to achieve this?
Thanks GiriGiri - you would probably get more results if you mark this as a question. That way you can assign po1nts to helpful answers.
In any event why don't you just do a CALL TRANSACTION when the user double clicks on a line?
Rob -
Executing Operating system commands in ABAP
Hi
I want to execute a unix operating system command in an ABAP program. I remember seeing code which executes an operating system command. Could any please let me know about that code?
Thank You.
EswarHi,
you can try something like this.
data:cmd(254) type c.
data: RESULT(255) OCCURS 100 WITH HEADER LINE.
cmd = 'ls'.
** Execute command
REFRESH RESULT.
CALL 'SYSTEM' ID 'COMMAND' FIELD CMD
ID 'TAB' FIELD RESULT-*SYS*.
Kostas
Maybe you are looking for
-
Illustrator CS2 bridge will not open with Illustrator CS6 installed
I had CS6 loaded and working well but when I uninstalled a previously loaded copy of Illustrator CS2 my Bridge would not fire up. I tried reloading Illustrator from CS6 disc but it still would not work.What can I do?
-
How to identify new rows in a vo
Hie using jdev 11g I am having a eo based vo and this vo is dropped as a adf faces table. After page load the table is populated with pre-existing data. now i add couple of new rows and may modify one or two pre-existing rows. Before doing the commit
-
DW8 built in Flash not working
When in design view and choose media--flash button or flash text, i fill out the dialog box and save file but all I see when I hit apply and OK is a gray box with handles and a f in it. Then in browser check it does not show at all? My computer does
-
Ecrire des nombres binaires dans un fichier texte
Bonjour, je suis actuellement en stage, et je dois faire l'acquisition du signal d'un radar météo. Je récupère les données mais j'ai un problèmes au niveau de l'enregistrement dans un fichier texte. Je récupère un WordStatus (mot non signé de 16 bits
-
Need to prevent JRE download in JNLP
I need to have the following scenario. If JRE installed and correct value then go get the application JAR file and run. If JRE NOT installed then DO NOT download (display a message, throw an exception) (end user is not to install s/w on machine, but