ASP에서 RFC호출하기
참고문서
http://arraybox.com/entry/ASP%EC%97%90%EC%84%9C-SAP-Remote-Function-Call
<%@ Language=VBScript %>
<% Option Explicit %>
<%
Dim sapConnection, functionCtrl
Dim retcd
Dim theFunc
Dim returnFunc
Dim docs
Dim T_PERSON
Dim i
Dim pernr
'SAP 접속 함수
Sub ConnectSAP()
Set sapConnection = CreateObject("SAP.Logoncontrol.1")
Set sapConnection = sapConnection.NewConnection
sapConnection.System = "KKK"
sapConnection.ApplicationServer = "erperp"
sapConnection.SystemNumber = 00
sapConnection.user = "USERID"
sapConnection.Password = "USERPASS"
sapConnection.client = "300"
sapConnection.language = "3"
sapConnection.Codepage = "8500"
retcd=sapConnection.Logon(0,true)
If RetCd = False Then
Response.write "SAP Logon Failed. retcd=" & retcd
Response.End
end if
Set functionCtrl = CreateObject("SAP.Functions")
functionCtrl.Connection = sapConnection
End Sub
'SAP 접속 종료 함수
Sub CloseSAP()
functionCtrl.Connection.logoff
Set sapConnection = Nothing
Set functionCtrl = Nothing
End Sub
ConnectSAP()
functionCtrl.Connection = sapConnection
Set theFunc = functionCtrl.Add("FUNC_NAME")
' 인자를 넣을 때는 아래와 같이
'theFunc.exports("PERNR") = "00014657 "
returnFunc = theFunc.Call
If returnFunc = True Then
Set T_PERSON = theFunc.Tables ( "T_SEND")
For i = 1 To T_PERSON.ROWCOUNT
Response.write T_PERSON(i,"PERNR") & " - "
Response.write T_PERSON(i,"ENDDA") & " - "
Response.write T_PERSON(i,1) & " - "
Response.write T_PERSON(i,2) & " - "
Response.write "<BR>"
Next
End if
Set theFunc = Nothing
CloseSAP()
%>
<br><br>
RFC호출 페이지입니다.
'IT 개발 > SAP-ABAP' 카테고리의 다른 글
ABAP에서 WATCHPOINT 걸기 (0) | 2011.11.21 |
---|---|
ABAP 프로그램에서 다른 프로그램 호출하기 (0) | 2011.11.10 |
SAP ERP에서 Function Module(펑션모듈) 을 WebService(웹서비스)로 만들기 (0) | 2011.06.15 |
[정리] CTS에 관한 것들 (1) | 2011.06.15 |
[TIP] 프로그램 실행중에 디버깅하기 (0) | 2011.03.30 |