Calling the Logon Function from
ASP
I am using RFC/BAPI from ASP to
connect to the SAP system and perform certain functions. I am having problems
passing the logon parameters implicitly from the ASP code. Can you guys
help me in passing the logon parameters so the user does not have to fill
up the logon details everytime he connects. I do not want the popup window
for Logon to appear at all.
Pls try the attached code. I hope
it will solve your queries.
======================================================================
Public theFunc
Public con As
Public functionCtrl
Dim returnFunc
Set functionCtrl = CreateObject("SAP.Functions")
Set sapConnection = CreateObject("SAP.Logoncontrol.1")
Set sapConnection = sapConnection.NewConnection
'**************************************
'Pass the name of the system
'**************************************
sapConnection.System = "SDS"
'**************************************
'Pass the name of the Server
'**************************************
sapConnection.ApplicationServer
= "192.168.60.111" '"/H/210.212.164.82/W/cmatrix/H/192.168.225.2"
'**************************************
'Pass the name of the Client
'**************************************
sapConnection.client = '800
'**************************************
'Pass the name of the USER
'**************************************
sapConnection.user = "DEVELOPer"
'**************************************
'Pass the name of the Password
'**************************************
sapConnection.Password = "ABAP"
'**************************************
'Pass the name of the Language
'**************************************
sapConnection.language = "EN"
'**************************************
'Log On to the SAP System
'**************************************
Set functionCtrl = server.CreateObject("SAP.Functions")
retcd=oConn.Logon(0,true)
If RetCd = False Then
Response.write "SAP
Logon Failed."
Response.Write "<A
href='admin.asp'>" & "Login Again" & "</A>"
Response.End
else
Response.write "SAP
Logon Succeeded."
end if
functionCtrl.Connection = oConn
'**************************************
'Give the name of RFC Function
'**************************************
Set theFunc = functionCtrl.Add("ZCNPL_MATR_STK")
theFunc.Exports("MATNR") = "HS1400BRN"
theFunc.Exports("WERKS") = "BWWA"
theFunc.Exports("LGORT") = "NMOD"
returnFunc = theFunc.Call
If returnFunc = True Then
'Give the Name
of Table parameter in RFC Function
Set docs = theFunc.tables.Item("MAT_STK_TAB")
end if
'**************************************
'Write The Out Put
'**************************************
for i = 1 to docs.rows.count
for each oCol in docs.columns
response.write oCol.value(i)
next
next
Anubhab
More Function Module
Functions /
SAP Script / ALV
Tables
Database Table
ABAP Books List
ABAP/4 Certification,
Programming, Smartforms, Sapscripts and Object Oriented Programming Books
Smart Forms
SAP Smartforms
ABAP Menu:
ABAP Example Hints
and Tips
Return to Index:-
SAP ABAP/4 Programming,
Basis Administration, Configuration Hints and Tips
(c) www.gotothings.com All material on this site is Copyright.
Every effort is made to ensure the content integrity.
Information used on this site is at your own risk.
All product names are trademarks of their respective
companies. The site www.gotothings.com is in no way affiliated with
SAP AG.
Any unauthorised copying or mirroring is prohibited.
|