‎2005 Dec 06 11:04 AM
Hi to all
i need some help about this .
i've been asked to create a function that send parameters to an vb script file that vb script will send email with the parameters like:
from ,to,attach file and so on.
our email is on exchange server we don't use the sap email.
thnaks.
gil.
‎2005 Dec 07 4:22 AM
Hi Gil,
If u find any answer helpful, kindly award points.
Regards,
Amit M.
‎2005 Dec 06 11:08 AM
Hi Gil,
1. So what is the problem.
2. Assuming that the VB Script file is
ready (with considers the command line
parameters and sends mail)
3. Just call this Function
GUI_RUN
COMMAND = 'VBSCRIPTFILE'
PARAMETER = 'FROM=ABC@XYZ.COM;TO=ABC.COM; ETC'.
I Hope it helps.
Regards,
Amit M.
‎2005 Dec 06 11:10 AM
Hi again,
1 Two things are important.
2. Where is the VB script file ?
Front-end
or Application Server ?
BCOS the program/approach will differ.
My previous post was for Front-End.
3. If it is on application server,
then the app server needs to Windows NT, etc.
and not UNIX, AIX etc.
(Bcos VBSCript runs only on Microsofts OS)
Regards,
Amit M.
‎2005 Dec 06 11:21 AM
Hi amit,
the VB script file is on the front-end now for tests later on it will be on the Application server.(By the way there is a way to test it on the front-end?? )
the app server is on Windows NT so if i enderstand its not have to be a problem.
thanks for your answers.
‎2005 Dec 06 11:50 AM
Hi again,
1. Please award points if any reply(s) are useful.
Regards,
Amit M.
‎2005 Dec 06 12:14 PM
Hi amit,
By the way there is a way to test it on the front-end??
thanks.
‎2005 Dec 06 12:18 PM
Hi amit,
well i try what you write me to do but it always give me an error msg,
maybe if you can take alook on this vbscript code that i want the FM will execute you will have an idea.
Dim From
Dim Destination
Dim Subject
Dim Body
Dim Attachment
Argument
Private Sub Argument
Set objArgs = WScript.Arguments
For I = 0 to objArgs.Count - 1
Select Case objArgs(I)
Case Lcase("-f")
From=objArgs(I+1)
If Check_Address(From)="fail" Then
Msgbox "You didn`t type source address correctly.",vbCritical,"Send Mail"
Exit Sub
End If
Case Lcase("-d")
Destination=objArgs(I+1)
If Check_Address(Destination)="fail" Then
Msgbox "You didn`t type destination address correctly.",vbCritical,"Send Mail"
Exit Sub
End If
'Msgbox Destination
Case Lcase("-s")
Subject=objArgs(I+1)
'Msgbox Subject
Case Lcase("-b")
Body=objArgs(I+1)
'Msgbox Body
Case Lcase("-att")
Attachment=objArgs(I+1)
'Msgbox Attachment
End Select
Next
Send_Mail From, Destination, Subject, Body, Attachment
End Sub
Private Sub Send_Mail(From, Destination, Subject, Body, Attachment)
Dim NewMail
Set NewMail = CreateObject("CDO.Message")
NewMail.From = From
NewMail.To = Destination
NewMail.Subject = Subject
NewMail.Textbody = Body
NewMail.AddAttachment Attachment
NewMail.Send
End Sub
Private Function Check_Address(Mail_Address)
For i = 1 To Len(Mail_Address)
If Mid(Mail_Address, i, 1) = "@" Then
Check_Address = "ok"
Exit Function
Else
Check_Address = "fail"
End If
Next
End Function
notice that the parameters are -f for form field ,-d for to field, -s for subject and so on...
thank you very much for your help...
Message was edited by: Gil Hadida
‎2005 Dec 06 12:20 PM
‎2005 Dec 06 12:55 PM
the second fm that you gave me is run but nothing is happen how i custom my vbscript parameters to the sap fm??
‎2005 Dec 06 12:17 PM
Hi again,
1. Just call this Function Module
(As already mentioned in my first reply)
CALL FUNCTION 'GUI_RUN'
EXPORTING
command = 'c:\VBSCRIPTFILE.vbs'
PARAMETER = 'FROM=ABC@XYZ.COM;TO=ABC.COM; ETC'
CD =
IMPORTING
RETURNCODE =
.
2. I assume that the VBSCript file has been developed
and it works fine (after taking in the input parameters)
This is the way to test in front-end.
I Hope it helps.
regards,
amit m.
Message was edited by: Amit Mittal
‎2005 Dec 06 1:00 PM
Hi again,
1. i copied the script file as
d:\ml.vbs
2. then i executed the abap code: (just copy paste)
REPORT abc NO STANDARD PAGE HEADING.
data : s type i.
break-point.
CALL FUNCTION 'GUI_EXEC'
EXPORTING
command = 'D:\ML.VBS'
PARAMETER = '-f abc@abc.com -d def@def.com '
IMPORTING
RETURNCODE = s
.
break-point.
3. It is not giving any error.
regards,
amit m.
‎2005 Dec 06 1:14 PM
Hi again,
like you mention It is not giving any error,but does nothing if i run this file from the command prompt it run perfectly after i installed on my machine smtp in the iis.
(now for the test i run it on my local machine.)
thank you very very much.
‎2005 Dec 06 2:41 PM
OK,
its work all i have to do is to add cscript before the path of the command like that:
data : s type i.
CALL FUNCTION 'GUI_EXEC'
EXPORTING
command = 'cscript D:\ML1.vbs'
PARAMETER = ' -f from@abc.com -d to@abc.com '
IMPORTING
RETURNCODE = s.
thank you very match for your help.
Message was edited by: Gil Hadida
‎2005 Dec 07 4:22 AM
Hi Gil,
If u find any answer helpful, kindly award points.
Regards,
Amit M.