홈 · 개발 참고자료

개발 참고자료

파워빌더에서 SAP RFC 호출하기

작성자
왕희복
작성일
2015-04-21
조회
12552
분류
파워빌더
1. Instance Variables 선언

Oleobject pbobject, pblogin, ltable, ltablerows, addrows

2. logon ( open )

Boolean lb_return = False

pblogin = create oleobject

pblogin.ConnectToNewObject("SAP.Functions")
pblogin.connection.SystemNumber = "00"
pblogin.connection.ApplicationServer = "xxx.xxx.xxx.xxx" // SAP IP 주소
pblogin.connection.Client = "100" // 클라이언트 번호
pblogin.connection.User = "xxxx" // SAP User Id
pblogin.connection.Language = "KO" // 언어
pblogin.connection.Password = "xxxxxx" // User Password
lb_return = pblogin.connection.logon(0, TRUE)

3. RFC 호출

long ll_row, n

ltable = pblogin.Add("xxxxxxxxx") // RFC "Function명"
ltable.exports("I_WERKS","1400") // Paramater값1
ltable.exports("I_WADAT_IST",ls_wadat) // Paramater값2
ltablerows = ltable.Tables("T_TAB") // SAP Table

if ltablerows.rowcount = 0 then
MessageBox("SAP 자료가져오기","등록된 정보가 없습니다!")
else
dw_rfc.reset() // Data Windows reset
for n = 1 to ltablerows.rowcount
ll_row = dw_rfc.insertrow(0)
dw_rfc.setitem(ll_row,"WERKS",string(ltablerows.cell(n,'WERKS'))) // Table 속성
dw_rfc.setitem(ll_row,"WADAT_IST",string(ltablerows.cell(n,'WADAT_IST'))) // Table 속성
dw_rfc.setitem(ll_row,"MATNR",string(ltablerows.cell(n,'MATNR'))) // Table 속성
next
end if

4. logoff ( close )