注册 登录
编程论坛 PowerBuilder

专题:SAP 与 PB 怎么做接口?已有结果

freele_china 发布于 2008-09-11 10:00, 4788 次点击
最近我们开发WMS,需要与SAP作接口。不知道怎样接口。希望大家帮帮忙

[[it] 本帖最后由 freele_china 于 2008-9-24 13:56 编辑 [/it]]
6 回复
#2
freele_china2008-09-12 08:59
但是不知道好不好使
//以下是PB和SAP通訊
oleobject  saprfc,connection2,funct,table_d,functions,funct2,intab,categ
long       ll_status,result

saprfc = create oleobject
ll_status = saprfc.connecttonewobject("sap.functions"
connection2 = saprfc.connection
connection2.applicationserver = "112.12.2.10"
connection2.systemnumber = '00'
connection2.client = '300'
connection2.user = 'wx-qpd'
connection2.password = 'baobei'
connection2.language = 'zf'
if connection2.logon(0,true) = false then
        messagebox('connet sap','connect failed')
end if


//調用z_rfc_read_bom
funct = create oleobject
funct = saprfc.add("z_rfc_read_bom"

//convert oleobject in any variable to string
funct.exports("I_matnr", sle_1.text )          //輸入參數值
funct.exports("i_plant",sle_2.text)
funct.exports("i_bom_us",ddplb_1.text)
funct.exports("i_valid",rq)


if funct.call = false then               //Call Rfc
        messagebox('','Read bom call failed')
end if
#3
freele_china2008-09-16 17:32
高手高手,我需要高手
#4
freele_china2008-09-24 13:29
此问题已经解决
1.        系统信息
请用如下参数连接:
                   应用服务器:10.23.25.27
                   系统编号:  00
                    系统标识:  EMD








2.        RFC说明

Function Module: Z_WIFM0023
        Import:         I_EBELN  TYPE  CHAR 10
                        I_MATNR  TYPE  CHAR  18
        Export:
                        E_RETURN TYPE  I
                        E_ERRMSG TYPE  CHAR 480      
        TABLES :
                        T_EKPO STRUCTURE  EKPO

////////////////////////////////////////////////////////////////////////////////////
oleobject  saprfc,connection2,funct,table_d,functions,funct2,intab,categ
long       ll_status,result

saprfc = create oleobject
ll_status = saprfc.connecttonewobject("sap.functions")                //sap.functions

connection2 = saprfc.connection
connection2.applicationserver = "192.168.1.240"                        //服务器IP
connection2.system = 'DD'                                                //系统标识
connection2.systemnumber = '00'
connection2.client = '120'
connection2.user = 'FR'
connection2.password = 'fr123'
connection2.language = 'en'

if connection2.logon(0,true) = false then                                //登录
        messagebox('connet sap','connect failed')
        return
else
        messagebox('connect sap','success')
end if


//调用Z_WIFM01
//funct = create oleobject
funct = saprfc.add("Z_WIFM01")

//convert oleobject in any variable to string
//funct.exports("I_EBELN",trim(sle_1.text))                //输入参数
//funct.exports("I_MATNR",trim(sle_2.text))

funct.exports("I_EBELN","qa110000428")
funct.exports("I_MATNR",'0000000028')

if funct.call = false then      //Call Rfc
   messagebox('','Read bom call failed')
end if


//string ls_msg
//ls_msg = string(funct.Imports('E_ERRMSG'))
//messagebox('',ls_msg)
//funct.Imports("E_RETURN",rt)
//funct.Imports("E_ERRMSG",ls_msg)


intab = funct.tables("T_EKPO")

string ls_aa,ls_bb
Long ll_r
ll_r = intab.rowcount()
if ll_r > 0 then
        ls_aa = intab.value(ll_r,'MATNR')
        ls_bb = intab.value(ll_r,'WERKS')
end if
Messagebox(ls_aa,ls_bb)

////////////////////////////////////////////////////////////////////////////////////

[[it] 本帖最后由 freele_china 于 2008-9-24 13:31 编辑 [/it]]
#5
永恒的红烧肉2008-11-21 09:32
这样的话会不会占用sap的用户?
#6
freele_china2009-07-18 11:09
给SAP传表没传过
确实需要占用一个SAP用户
1