on 01-27-2012 1:07 PM
Hi All,
I have another requirement.
I have two text files, both containing a list of materials. I want to compare file A with file B and add the materials from file B that are not in file A.
For example
Input: File A
15-G
12-B
18-A
18-D
Input: File B
15-J
12-B
19-C
Output: Updated File A
15-G
12-B
18-A
18-D
15-J
19-C
As you can see the material 12-B already exists in file A so it isnu2019t copied across but 15-J and 19-C were copied across. Do you know how I could do this?
Any suggestion.
Thanks,
Hi,
You can also try without additional DB, but this might require complicated mapping logic. Read both files in sender file adapter, use ABAP mapping (should be much easier than graphical one, as some quite complicated logic is required to detect and delete duplicates) and write the results to target file with File Construction Mode = Create in receiver CC.
Hope this helps,
Greg
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
1. set up a small DB (any)
2. use FILE - DB with update on the DB
3. send both files via this interface
4. get the updated list of records from the DB
nice and smooth
Regards,
Michal Krawczyk
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Dear Iqbal
You can try command level arguments, following should be the approach
1. Put both the incoming files in a folder
2. run as os level command in the communication channel to compare and write the result in a third file
diff FILE1 FILE2 >>FILE3
3. The FILE3 will only have those values which are not in FILE2.
4. Now you can merge the two files (FILE1 and FILE3) in whatever way you like.
Regards
Sourabh
You can always use a bpm. By changing the collect pattern you can have more than two files added to the same update.
Every new file adds just the information that is not already in the container.
this might help [http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/2034] [original link is broken] [original link is broken]; it's for idocs but you can change it for files
There are several possible ways for file comparison. You might want to see the feasiblity at your end. Using os command to compare the files is simpler approach. I would recommend it. Also if you good at java programming, you can write the file1 in the file3 and load the file1 data in list object and check with file2 data and then save the records that are not existing in the file3. This is another approach. I think you should handle without pi for this.
Hi,
The easiest approach is to do as I described above:
Read both files in sender file adapter, use ABAP mapping (should be much easier than graphical one, as some quite complicated logic is required to detect and delete duplicates) and write the results to target file with File Construction Mode = Create in receiver CC.
And use the Additional File(s) feature of the sender channel to get multiple files, as described here in Q4 and Q5:
http://wiki.sdn.sap.com/wiki/display/XI/SenderFileAdapterFrequentlyAsked+Questions
Hope this helps,
Greg
Hi Muhammad,
To suggest complete solution to the problem certain informations are required
1. what is the Operating system of the PI server.
2. You need a script here either batch file or shell script depending on your answer to first question.
3. How will the script determine when to compare two file contents and which files to choose to comapre?
4. In what manner files are arriving in the server? is it only two files at a time or multiple files may arrive in any order?
Regards
Anupam
User | Count |
---|---|
82 | |
10 | |
10 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.