Dynamic Directory and File Naming in Receiver Adapter
Hi ..My Receiver file should Look like this.
COLCCYYMMDDHHMMSSLPMASTER___.tmp
1st 3 bytes: COL ( Sender File name is COLMASTER.txt)
Next 14 bytes is timestamp: CCYYMMHHMMSS
Next 1 byte: L ( constant Value )
Next 1 byte: P/Q/D (Production/QA/Dvlp.. Can we do this based on Sender Logical System ?)
Next 20 bytes ( Part of it comes from Sender file name and remaining fields should be filler with underscores )
Next 4 bytes ( .tmp)
After Iam done with writing this file in .tmp format I should change the file name to .txt format for further processing. Since File gets created dynamically how should I change Name from .tmp to .txt file?
Appreciate help and guidance with steps I neeed to follow to make this happen. Thanx again.
Hi Ram,
One option~~
Use ADAPTER SPECIFIC INDENTIFIERS in both sender and recievr file adapter with the filename selected.
In this case, the filename of sender will be made the file name of the reciver.
Now, change the file name in the mapping in an UDF with the following code, and this will be used as the filename,
String newfilename="";
// Write the logic to get the new file name into this string.
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
conf.put(key, <b>newfilename</b>);
return "";
Now, this filename in newfilename string will be used in the target filename.!!
Regards,
Bhavesh
Similar Messages
-
Dynamic directory and file name
Hi
I have requirement of dynamic file name and dynamic directory with condition based on doctype from source
I have used the following code and for file and directory with two different udfs. If I am using only file it is working but not with the directory
try
String directory = new String("");
DynamicConfiguration conf1 = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key1 = DynamicConfigurationKey.create("http:/"+"/sap.com/xi/XI/System/File","Directory");
if (var1.equals( "DOR" ))
directory = "/Inbound/DOR";
else {
directory = "/Inbound/KOR";
conf1.put(key1,directory);
return directory ;
catch(Exception e)
String Exception=e.toString();
return Exception;
in message mapping i used var1 to one of the not used field in target
similary i did for file with different udf and mapped sourcefield- to targetrootnode with same condition with different filename
But it is not working getting the following exception Message processing failed. Cause: com.sap.engine.interfaces.messaging.api.exception.MessagingException: com.sap.exception.standard.SAPIllegalArgumentException: The parameter "argument" has the value "remote://*/PACK _TEST20140226-152149-483.dat", so it contains the character "remote://*/PACK _TEST20140226-152149-483.dat" which is not allowed
Thanks for your helpHi Mahesh -
The parameter "argument" has the value "remote://*/PACK _TEST20140226-152149-483.dat", so it contains the character "remote://*/PACK _TEST20140226-152149-483.dat" which is not allowed
>>> I see that paramter name as "argument" in the above error. So you mean to say when you simply use the UDF just for file name it works for the above input.
But the same udf fails if you enable another UDF for the directory? having the same payload?
Is my understanding correct.
However i would suggest you to have a one UDF for both "directory" and "Filename" and map the field to Target message type but not to any of the fields.. -
How to attach Excel file in Mail Receiver Adapter?
Hello Experts,
In R/3 coding I have Internal Table data available for which i have to generate an Alert mail with Excel file attachment.
This is the scenario of Proxy sender to Mail Receiver. but I don't know how to convert the Internal Table data into Alert mail excel File attachment.
Please suggest me.
Regards,
JageshHi Santhosh,
Thanks for your suggestion.
But without using XSLT mapping also, I have generated the Excel File attachment.
Throgh R/3 coding I am passing following.
G_ALERT_INPUT-MT_R3REQUEST_MAIL_SEND-MAIL-FROM = From Mail Address.
G_ALERT_INPUT-MT_R3REQUEST_MAIL_SEND-MAIL-TO = TO Mail Address.
G_ALERT_INPUT-MT_R3REQUEST_MAIL_SEND-MAIL-SUBJECT = 'Test Alert mail'.
G_ALERT_INPUT-MT_R3REQUEST_MAIL_SEND-MAIL-DATE = SY-DATUM.
G_ALERT_INPUT-MT_R3REQUEST_MAIL_SEND-MAIL-CONTENT_TYPE = 'text/plain;name="CSV_data.csv"'.
G_ALERT_INPUT-MT_R3REQUEST_MAIL_SEND-MAIL-CONTENT = 'Testing1,Testing2,Testing3'.
G_ALERT_INPUT-MT_R3REQUEST_MAIL_SEND-MAIL-CONTENT_DISPOSITION = 'attachment'.
And in the Mail Receiver Adapter i have configured as following.
Use Mail package and Keep Attachment both options are selectd.
So I am getting the data in different columns in the excel file But How to set the Next ROW in Excel file?
I thnk i am missing something in CONTENT value.
Regards
Jagesh -
Use temporary file in FTP receiver adapter
Hi guys,
I'm not getting the purpose of "use temporary file" in FTP receiver adapter. Can you describe any situation, where this should be used?
What is the location of this temporary file?
Is it deleted after "normal" file is created?
Thanks a lot,
Olian> I'm not getting the purpose of "use temporary file" in FTP receiver adapter. Can you describe any situation, where this should be used?
Some times when you create the file on your target dir then if there is another application looking for same file is quite faster to pick the file before it is complety written on target dir then in this situation using temporary file option is very helpful. What it does, it simply creates the file first by using temporary name once all bytes or bits has been transfered then it creates the original name and the temp file get deleted.
> What is the location of this temporary file?
Same location, where your original file is suppose to be written.
> Is it deleted after "normal" file is created?
Yes.
Regards,
Sarvesh -
How can I get Directory and Files from a Maped Networkdrive of the AppS
Hello,
we have the following Situation.
We have a Windows-Server (Server-A) in an Network with ActivDirectory and an Windows-Server (Server-B with an WebApplicationServer outside of these ActivDirectory as standalone.
On Server-B we mapped a Directory from Server-A (FileExplorer and then MapNetworkDrives) as Drive Q.
Now i tried to get the Directory of Q:\abcd but it doesn't work.
I tried the FM EPS_GET_DIRECTORY_LISTING and also RZL_READ_DIR, but both doesn't worked.
RZL_READ_DIR is doing a "CALL 'ALERTS' ..." and is comming back with sy-subrc = 1
EPS_GET_DIRECTORY_LISTING is doing a "CALL 'C_DIR_READ_FINISH'..." and comes back with "Wrong order of calls" in the Field file-errmsg. Next Call is "CALL 'C_DIR_READ_START'..." and this comes back with "opendir" in Field file-errmsg.
I tried the same with two Servers in the same ActivDirectory-Network. The Result was the same, i don't get the directory of the mapped drive. But now i get from the Call "CALL 'C_DIR_READ_START'..." the file-errmsg "opendir: Not a directory" and file-errno 20.
Is there any idea for solving my Problem?
I have to get this directory, read the files from the List and have to rename them after wriing the data to our databasefile.
I want to read them with OPEN DATASET, rename them by writing a new File (also OPEN DATASET) and after that i do an DELETE DATASET.
Thanks and Greetings Matthias
Edited by: Matthias Horstmann on Mar 25, 2009 4:12 PM
Filled in Scenario with 2 Servers in same AD-NetworkHalo Mattias,
i using this function get file file name and directory:
at selection-screen on value-request for p_file.
call function 'F4_FILENAME'
exporting
program_name = syst-cprog
dynpro_number = syst-dynnr
field_name = 'P_FILE'
importing
file_name = p_file.
Rgds,
Wilibrodus -
Read application server directory and file
Hi,
I'm using the FM "RZL_READ_DIR_LOCAL" to retrieve the application server directory and filename. The returned result contain all the directory name and filename. Is there any other FM can separate the result into directory and file??
Regards,
Kithi
Ya One more FM is there - Call Function Gui Upload.
It will read the file from the app server.
See this Example:-
Refer this:
http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3ca6358411d1829f0000e829fbfe/frameset.htm
ABAP code for uploading a TAB delimited file into an internal table. See code below for structures.
*& Report ZUPLOADTAB * &----
*& Example of Uploading tab delimited file *
REPORT zuploadtab .
PARAMETERS: p_infile LIKE rlgrap-filename
OBLIGATORY DEFAULT '/usr/sap/'..
DATA: ld_file LIKE rlgrap-filename.
*Internal tabe to store upload data
TYPES: BEGIN OF t_record,
name1 like pa0002-VORNA,
name2 like pa0002-name2,
age type i,
END OF t_record.
DATA: it_record TYPE STANDARD TABLE OF t_record INITIAL SIZE 0,
wa_record TYPE t_record.
*Text version of data table
TYPES: begin of t_uploadtxt,
name1(10) type c,
name2(15) type c,
age(5) type c,
end of t_uploadtxt.
DATA: wa_uploadtxt TYPE t_uploadtxt.
*String value to data in initially.
DATA: wa_string(255) type c.
constants: con_tab TYPE x VALUE '09'.
*If you have Unicode check active in program attributes then you will
*need to declare constants as follows:
*class cl_abap_char_utilities definition load.
*constants:
con_tab type c value cl_abap_char_utilities=>HORIZONTAL_TAB.
*START-OF-SELECTION
START-OF-SELECTION.
ld_file = p_infile.
OPEN DATASET ld_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc NE 0.
ELSE.
DO.
CLEAR: wa_string, wa_uploadtxt.
READ DATASET ld_file INTO wa_string.
IF sy-subrc NE 0.
EXIT.
ELSE.
SPLIT wa_string AT con_tab INTO wa_uploadtxt-name1
wa_uploadtxt-name2
wa_uploadtxt-age.
MOVE-CORRESPONDING wa_uploadtxt TO wa_upload.
APPEND wa_upload TO it_record.
ENDIF.
ENDDO.
CLOSE DATASET ld_file.
ENDIF.
*END-OF-SELECTION
END-OF-SELECTION.
*!! Text data is now contained within the internal table IT_RECORD
Display report data for illustration purposes
loop at it_record into wa_record.
write:/ sy-vline,
(10) wa_record-name1, sy-vline,
(10) wa_record-name2, sy-vline,
(10) wa_record-age, sy-vline.
endloop.
reward if help. -
Output CSV File Naming Convention - Receiver File Adapter
Dear SAP experts,
I need help regarding my scenario.
My scenario is this, Customer will send EDI message to XI. XI will then translate the message and convert it into XML.. After, a Receiver File Adapter will receive the XML then convert it into .csv file.
I've already configured the Receiver File Adapter to convert the XML into .csv file.
But, my problem now is how will I configure to have my output .csv file has a File Naming Convention.
The output .csv file must be "CustomerName_YearMonthDate".
From the EDI message, there is indicated Sender GLN in which, each customer has its own Sender GLN.
E.g., Globus --> 200, Karstadt --> 300, Metro --> 400.
How will I configure so that I can have an output .csv file of,
If Globus sends the EDI message, the output .csv file is Globus_20080304.csv.
If Karstadt, Karstadt_20080304.csv.
If Metro, Metro_20080304.csv.
Kindly advise for a clear and complete solution.
Thank you very much for your usual support.
FredHi Nisar,
My target message (XML) in the mapping is this,
- <ns0:CSV>
- <SLI>
<PERIO> </PERIO>
<ILN> </ILN?
<EAN> </EAN>
perio, iln, and ean was rooted on SLI field. and the CSV is the rootnode of the target message.
I have created a UDF on the message mapping to accomodate the output customer name, here is the codes:
String fname="";
if(GLN.equals("23456"))
fname ="Globus" +dat;
else if(GLN.equals("5678"))
fname ="Karstadt"+dat;
else if(GLN.equals("6789"))
fname ="Metro"+dat;
DynamicConfiguration conf = (DynamicConfiguration) container
.getTransformationParameters()
.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create(
"http://sap.com/xi/XI/System/File",
"FileName");
conf.put(key,fname );
E.g.,
Globus --> 23456 (Sender GLN)
Karstadt --> 5678 (Sender GLN)
Metro --> 6789 (Sender GLN)
This UDF i've made in the Message Mapping was mapped in the root node CSV.
Is this UDF correct?
Then on the File Receiver Configurations, here are the configs,
Transport Protocol: File System (NFS)
Message Protocol: File Content Conversion
Adapter Engine: Integration Server
File Access Parameters
Target Directory: /var/opt/gsss/sample/csv
File Name Scheme: .csv
Processing Parameters
File Construction Mode: Create
- Overwrite Existing File
Write Mode: Directly
File Type: Text
Variable Substitution --> ???
Adapter Specific Message Attributes
- Use Adapter-Specific Message Attributes
- Fail if Adapter-Specific Message Attributes Missing
- File Name
Run Operating System Command After Message Processing
Command Line: chmod 664%F
Content Conversion Parameters
Recordset Structure: SLI
SLI.addHeaderLine: 3
SLI.headerLine: PERIO;ILN;EAN
SLI.fieldSeparator: ;
SLI.endSeparator: 'nl'
Adapter Status:
Status: Active
Kindly advise if my configs are correct.
Thank you very much!
Fred -
Dynamic file naming at Receiver
Hello Friends,
How to handle the dynamic file naming in XI at receiver side as file naming convention sequence to be incremented for every 1 hour...
my Client expecting to handle at mapping...How to do this...
Could any one give me the program if we need to do it in java...
and pls also give another approach if any
Setup dynamically ,>>naming convention sequence to be incremented for every 1 hour
You can set the file construction mode as "Add counter" in the receiver file adapter
Thanx
Aamir
Edited by: Aamir Suhail on Aug 15, 2008 7:57 AM -
Hi,
We have a mail receiver adapter which is sending out a edi payload as attachment to the external receiver.
When we send the normal .edi file it is ok.
But when we sign and encrypt the payload and send it out, the external customer receiver decrypts and validates the message successfully but when their application tries to read the edi payload it finds the extra header lines as below :
content-id:
<[email protected]>
Content-Disposition: attachment; filename=xxxxxxxx.edi Content-Type:
application/xml
At their end, their application (DataPower) expects the first three characters of the payload
(decrypted payload) to be either UNA or UNB.This is how it validates whether the incoming message is an EDI message.
But it encounters the extra MIME headers in the payload.
Therefore it gets rejected by DataPower which thinks the content is an
unknown message type.
How to suppress the header lines appearing in the payload(after decryption and validation).
Thanks,
Guesthi,
try content-type as "text/xml" -
File Content Conversion - Receiver Adapter
Hi To All
I have an XML Structure
<LIST>
<Seg1>
<Element1>123</Element1>
</Seg1>
<Seg2>
<Element1>ABC</Element1>
<Element2>DEF</Element2>
<Element3>GHF</Element3>
</Seg2>
<LIST>
I'm using File content conversion in receiver Adapter
I want my output like this.
ABCDEFGHF
I don't need the Segment Seg1.
In my parameters RecordsetStructure only I have Seg2 and the details for this Segment
but When I receive a file, the adapter convert with segment 1.
123
ABCDEFGHF
can you help me?.easiest alternative is mentioned here already, drop it in the mapping.
You can also try to write a java pgm and invoke it as an OS command. that cuts the segment1 out before passing it to content conversion. ..more painful..but will work.
Regards
Ravi Raman -
File Name Scheme - Receiver Adapter
Hi,
I have a File Receiver Adapter which is using content conversion to take in XML and output a file. I want the output file to be called EOD286ccyymmdd.txt where ccyymmdd is the current date. Seems to be 2 options for file names:
1. Add Time Stamp: No use as this adds the Date & Time. I only want the date.
2. Variables: Don't think I can use this as it only seems to work if the data is part of the XML message packet. The date in ccyymmdd format is not contained in the XML anywhere.
Is there anyway of getting the File Scheme Name I want ?
Cheers,
PaulC.Hi,
You have one option in the File adapter receiver channel: 'Run Operating System command After message processing", where you can give any std OS command or you can give batch file (.bat) to run after the message processing. In batch file, you can write a set of commands which would rename the file according to your name format.
Another bit complex solution is create your own custom adapter module and change the file name scheme.
Thanks,
RK -
Set default directory and file permissions
I'm trying to use setfacl to set the default permissions for directories and files but I get an error saying "sudo: setfacl: command not found." What I am trying to do is share a specific directory on a local external drive connected by Thunderbolt. Everyone in the group has access to the drive and can view all the files but once a new file is created, the group permissions are not updated. Here is an example of two PDF file. The one created by userA only has permissions for that user where the file created by userB allows all users to open and modity the file.
-rw------- 1 userA staff 1988176 Feb 13 15:09 TestFile01.pdf
-rwxr-----+ 1 userB staff 1827102 Feb 13 15:05 TestFile02.pdf
0: group:MarketingGroup allow read,write,append,readattr,writeattr,readextattr,writeextattr,readsecurity
I can manually update the permissions through the Get Info window but this requires me to reset permissions every time a person saves a new file to the drive. There needs to be a way to do this automatically.
Here is what I tried but the setfacl command is not supported.
sudo setfacl -Rdm g:GroupName:rwx /DirectoryPathThanks Frank. I have an externat drive connected to my Mac via Thunderbolt. On this drive I have a specific directory that I'm shairing with Mac and PC users. I've created a group on the network to limit access to this directory to specific users. That works perfectly. The issue I'm having is when one of these users creates a new file in this directory or any of it's subdirectories, no one has permission to open or edit the file. Right now I'm using Get Info to modify the permissions of the folder and all enclosed items. When I check the permissions of the files I've "corrected" I notice this extra imformation "0: group:MarketingGroup allow read,write,append,readattr,writeattr,readextattr,writeextattr,readsecurity." This is not included when I check the permissions of items saved by other uses in the group.
So my question is how do I set the default permissions for this directory so every new file and directory will have the correct permissions to allow anyone in this group full access to open and modify every file?
Thanks for your help!!!! -
Export for the Web and File Naming : Batch problem in Photoshop CC
Is it possible to use "File Naming" when you are using in a batch "Save for the Web" export ?
What I want to do:
I have images that I need to resize, crop and rename (change "filename.jpg" to "filename_850x490.jpg" and make an optimisation for the web
I want to create an action that I can use in a batch
What is working :
I can use my action (resize, crop, save) and use file renaming option if I use "save as" options
I can use my action (resize, crop, save for the web ...) but the file renaming option are not use at the export,
So I have to create two actions (one for resize, crop and rename and an other to compress images with "save for the web"
==> What's wrong with "File rename" and "save for the web"?
Thank You for support !
My Environement :
Photoshop CC : last update
OS : Windows 8 Entreprise - 64 bits
Proc : Intel Xeon CPU E5 3.00 GHz - Ram : 8 GB - GPU : AMD FirePro V5900 (FireGL V)Probably a lot easier if you use the Image Processor Pro script
(part of Dr. Brown’s Services 2.3.1)
http://www.russellbrown.com/scripts.html -
Post-Installation of RAC: main directory and file to set ORACLE_HOME ?
Folks,
Hello. I am installing Oracle 11gR2 RAC using 2 VMs (rac1 and rac2) whose OS are Oracle Linux 5.6 in VMPlayer according to the website http://appsdbaworkshop.blogspot.com/2011/10/11gr2-rac-on-linux-56-using-vmware.html
I have just finished installing Grid infrastructure and RAC database 11gR2 successfully.
After that, I add the entries into the file /home/ora11g/.bash_profile as below:
export ORACLE_SID=racdb2;
export ORACLE_HOME=/u02/11g_db/ora11g/racdb;
export GRID_HOME=/u01/app/grid;
PATH=$GRID_HOME/bin:$ORACLE_HOME/bin:$PATH; export PATH;
After that, I run the following command:
[ora11g@rac2 /]$ /u02/11g_db/ora11g/racdb/bin/srvctl config database -d racdb
Its output:
ORACLE_HOME environment variable is not set.
ORACLE_HOME should be set to main directory that contains Oracle products.
Set and export ORACLE_HOME and then re-run.
My questions are:
First, I have added entries into the file /home/ora11g/.bash_profile. Why it still says "ORACLE_HOME environment variable is not set" ? Is this way wrong ?
Second, what are the main directory and the file to set ORACLE_HOME ?
Thanks.Folks,
Hello. Thanks a lot for replying. I reboot OS and run the commands as below:
[ora11g@rac2 bin]$ ./srvctl config database -d racdb
Its output:
PRCD-1027 : Failed to retrieve database racdb
PRCR-1070 : Failed to check if resource ora.racdb.db is registered
Cannot communicate with crsd
[ora11g@rac2 bin]$ ./sqlplus
SQL*Plus: Release 11.2.0.1.0 Production on Fri Mar 9 15:28:59 2012
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Enter user-name: SYS
Enter password: SYS
ERROR:
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Linux-x86_64 Error: 2: No such file or directory
Process ID: 0
Session ID: 0 Serial number: 0
Enter user-name: SYSTEM
Enter password: SYSTEM
ERROR:
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Linux-x86_64 Error: 2: No such file or directory
Process ID: 0
Session ID: 0 Serial number: 0
Enter user-name: SYSMAN
Enter password: SYSMAN
ERROR:
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Linux-x86_64 Error: 2: No such file or directory
Process ID: 0
Session ID: 0 Serial number: 0
SP2-0157: unable to CONNECT to ORACLE after 3 attempts, exiting SQL*Plus
[ora11g@rac2 bin]$
As we see the outputs above for the 2 commands "srvctl" and "sqlplus", my questions are:
First, why cannot retrieve database racdb ?
Second, sqlplus is poped up. Why users SYS, SYSTEM, SYSMAN cannot log in ?
Third, does my RAC database installation have problems ?
Thanks. -
How to recreate ~/.ssh directory and files
Hi Folks,
I have a 10.4 user without the hidden .ssh directory and all the usual files within that directory (id_rsa, id_rsa.pub, known_hosts) due to a munged account, and am now wanting to know to recreate those files so I can SSH back to this machine.
Any tips/ideas much appreciated.
Thanks!
DougI have a 10.4 user without the hidden .ssh directory and all the usual files within that directory (id_rsa, id_rsa.pub, known_hosts) due to a munged account, and am now wanting to know to recreate those files so I can SSH back to this machine.
ssh-keygen -t rsa
will create the .ssh directory and the rsa files. known_hosts will be created as the account is used to ssh/scp/sftp into other accounts.
If other systems are to be allowed to login to this account, then copy their id_rsa.pub files and append them to .ssh/authorized_keys. That will allow them access to this account.
And if this account is suppose to be able to login to other systems, append the newly created id_rsa.pub file to the other system account's .ssh/authorized_keys file.
Check *man ssh* to make sure all permissions are set correctly. If some of the files and/or directories are too permissive, ssh will not work correctly, as it will assume your account can be compromised.
Maybe you are looking for
-
How to schedule the background job daily twice?
Hi, How to schedule the background job daily twice? any conditions? Regards, Srihitha
-
Why do videos from a shared photo stream not appear in iPhoto?
why do videos from a shared photo stream not appear in iPhoto? Within iMovie, it appears as though videos can be imported from the iPhoto library. However, within iPhoto there are no videos that appear within the Library. Is it possible to import
-
In Advanced Search Web Part , more than 5 properties filter cannot be added
In SharePoint 2013 Advanced Search Web Part, Under Add Property restrictions, Maximum number of search filter (AND / OR) is allowed is 5. How can I increase this count ?
-
Anyone know about secret tracking data stored by OS4?
I just saw a news report that iPhone and iPad 3G are secretly storing location and time data. This data can be extracted to track the users past movements. Does anyone know anything about this? It sounds fishy to me. Seems like the kind of underha
-
I downloaded photos from an external hard drive. When I tried moving the photos folder To iPhoto I lost all of the photos. They are no longer In the downloads folder and they are not in iPhoto. Where are they? How do I recover them?