on 04-03-2009 8:49 PM
Hello Experts,
I have a scenario where a job runs weekly and creates 6 files on one of the prod folders in a legacy system. The files are FTPd to PI. Before picking the files we need to ensure that the count for the files on that folder is 6. If it is 6 or greater then we can pick all those 6 files and send it across to PI (also with archiving it on another folder structure in the legacy system) where PI will send it to another system. If the count is less than 6, then we do not need to do any thing. If count 6 is reached and the files are picked, reset the counter to 0.
So for this scenario do we need to use a BPM or we can manage with the "Run OS Command...." option??. If any of you have come across such a scenario, then pls let me know the solution. Current version of PI is 7.1 .
Points to best answer/solution will be given.
Thanks.
Hi,
The best solution would be to use scripts. Just run a os command before picking up the files to check whether 6 files are present.
Just for the case of checking, using BPM would be not advisable.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can it be possible in BPM or not? If yes, then what are the cons about it? Why it is not advisable? If it can be done using BPM then i guess we can use it to pass the files. Also the interface is a passthrough interface. The source .TXT file is transferred from Windows=> PI => Legacy as it is. Will there be any issue as such if we design this scenario using BPM.pls let me know.
Because in your case, you want to adapter pick up all 6 files in once, that is the reason using BPM is a difficult, to trigger BPM, you have to have at least one message passing to it via integration engine.
If you can share your folder to your WAS user, you porbably can program with ABAP, in your program, check if the folder has 6 files or not,
if yes, trigger ABAP proxy and send all 6 files to PI all in once. This way you can schedule your job in SM37.
Regards.
Liang
Hi,
In this case, it is a bit hard for PI side to set the condition of picking up file.
"Run OS Command...." is the commands that reside in your WAS application server (PI Server), not application system.
I have pure solution on your source windows system, not PI Solution. I have used all the features I mentioned below for other non-sap-pi applications.
I do believe there are some PI solution as well
1. Suppose your XI adapter pick up files in folder_1
2. You create another folder called folder_2
3. Make sure your source files are put into folder_2 first
4. Write a VBScript (saying script_1) to count the number of files in folder_2 (this is pretty easy for VBScript)
if the number of file = 6, then copy all the files into folder_1, then XI will pick up all 6 files and send to target
otherwise, send a email to designated receipient.
5. Write a VBScript (saying script_2), to schedule the script_1, saying run it every 1 hour, or 2 hours etc...
Regards.
Liang
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, This is just sample script you can reference:
Script_1:
Dim objFileScripting, objFolder
Dim filename, filecollection, currentFolder,counter
currentFolder = ActiveDocument.Path
On Error Resume Next
Set objFileScripting = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFileScripting.GetFolder(currentFolder)
Set filecollection = objFolder.Files
For Each filename In filecollection
counter = counter+1
Next
if counter = 6 then
For Each filename In filecollection
objFileScripting.CopyFile filename,"..\Folder_1\" & filename
Next
else
call sendmail("mailaddress", "Title Here","Content Here")
endif
set objFileScripting = nothing
set objFolder = nothing
set filecollection = nothing
'##########################
'This function is used to send out email notification, the usage are like:
'call sendmail("mailaddress", "Title Here","Content Here")
'##########################
Function sendmail (recipient, title, message)
Dim oLapp
Dim oItem
Set oLapp = CreateObject("Outlook.application" )
Set oItem = oLapp.CreateItem(0)
With oItem
.To = recipient
.Subject = title
.Body = message
End With
oItem.Send
Set oLapp = Nothing
Set oItem = Nothing
end function
Script_2: scheduler
Dim ws
On Error Resume Next
set ws = WScript.CreateObject("WScript.Shell")
ws.Run ("script_1.vbs")
while 1 = 1
WScript.Sleep 1000*60*60 'sleep 1 hour, run your first script every 1 hour
ws.Run ("script_1.vbs")
Wend
set ws = nothing
Make sure in your source system, you have outlook mail setup there.
Put the two scripts in folder_2, to check the number of files
Regards.
Liang
Edited by: Liang Ji on Apr 4, 2009 4:14 AM
hi ,
this can be done using BPM
1. use a loop and specify the end condition as counter = 6.
2. receive step inside the loop
3. container step to initialise the counter
4. container step to increment the counter
5. async send step to send the files to folder 2....
6. loop close
7. switch to chk if counter = 6 then receive files from folder 2 and send async to target folder
otherwise do nothing
8. also have a deadline branch over the loop and specify a time limit say 6 hrs....if even after 6 hrs 6 files are not received use a asyn send step to send a mail thru mail adapter
Thanks Liang for the sample script. Let me chk n see if this option is a good one.
One Question to Tarang.
In point number 5, u mentioned that use folder 2.
Where should that be defined, In the PI end or the Source system? Do we need to have two folders in the source system like what Liang had said or are you referring to something else?
Extra info: The source system is Windows. On a Saturday, if we run a job at say 1;00pm then within an hour or two, if 6 files are not present then an alert/mail should be sent to the Business informing that 6 files are not present in the folder. The basic scenario is Windows>FTP>PI>FTP>Legacy system.
Edited by: Debaprasad Narendra on Apr 3, 2009 10:18 PM
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 | |
24 | |
11 | |
9 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.