on 09-16-2008 8:36 AM
Hi All,
Is it possible to put variable (from variable substitution) into OS command line? I need to create a specific filename, that issues from its payload. But substitution doesn't work - filename appears with percentage symbols and var names.
Thank you.
Hi,
Run Operating System Command Before/After Message Processing
● Command Line
The operating system command specified here is executed before or after successful file processing. The default value is an empty character string (no command).
When the operating system command is called, the file name currently being processed can be specified with the following placeholders:
%f (file name)
%F (absolute file name including path)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Guys,
Let me explain situation in details.
I have on source message split into several target messages. Then these messages are written as xml files. Finally, these files should be packed into zip archive, and zip archive should be named according to payload values.
In this scenario I can't use payloadzipbean - it creates many archives for each final message, while I need many in one. That's why I've decided to use os command to archive files:
jar -cvf pack_%var1%_%var2%.zip file_xml*
And it works, but at the end archive's name is pack_%var1%_%var2%.zip.
So, I know how variable substitution works, and how os command does... I just need to know if their collaboration is possible...
Hi Dmitriy
AFAIK this is not possible. You can pass only the file name (with/without path) dynamically to the script. No other parameter can be passed dynamically. I have tried the same earlier and came to this conclusion. However I have not found any SAP statement saying so.
Thanks
Jaishankar
Hi,
I think it is possible but better to choose UDF technique to generate file, why because it is easiest way to generate file.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In these blogs you have examples for OS command:
You can try with this commmand
with your receiver adapter where your file name comes with counter
and prefix as e.g. "abc".
this command will extract the filename starting only with abc and you can then move that file into any folder you want or simple you can generate a file name in name.txt.
save this command as bat file and give path in your in NFS file adapter and after processing.
@echo off
for /F %%a in ('dir /b abc.') do set FileName=%%~nxa
echo %FileName%>name.txt
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
25 | |
12 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.