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" //服务器IP
connection2.systemnumber = '00' //系统编号
connection2.client = '300' //客户端
connection2.user = 'wx-qpd' //RFC用户
connection2.password = 'baobei' //密码
connection2.language = 'zh' //语言
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
int li_idx,li_row
oleobject oleitem
oleitem = funct.tables("export_bom")
for li_idx = 1 to oleitem.rowcount()
li_row = dw_zbarcode_tab.event pfc_addrow()
dw_zbarcode_tab. SetItem(li_row, "ITEM_CODE", oleitem.value(li_idx,"ITEM_CODE")
dw_zbarcode_tab. SetItem(li_row, "BARCODE", oleitemvalue(li_idx,"BARCODE")
next
评论