Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Calling the Logon Function from ASP

Former Member
0 Likes
623

Hi,

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.

Thanks

1 REPLY 1
Read only

Former Member
0 Likes
439

Hi,

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

Reward if found helpful...

Varishtah.