有哪位大虾试过用VB调用SAP的函数?求教一下.(高分求)

 所属目录:Java   |   类型:技术问答   |   时间:2007-05-21
 问题:

我想通过以下一个sap的函数传参数到sap:      
     
  接口函数zphone_create_salesorder      
  输入参数:salesgroup     (char     3)     销售雇员号      
                                        ordertype     (char     4)订单类型      
  table     参数:order_partners{      
                                                partn_role(char     2)     合作伙伴功能      
                                                partn_numb(char     10)     客户号      
                                                }      
  table     参数:order_items销售凭证项目{          
                                                itm_number(num6),销售单据项目,,,      
                                                material(char18)物料号码,,,,,,,,,,      
                                                target_qty(quan13)数量,,,,,,,,,,,,,,      
                                                exchg_rate(dec9)价格      
                                                }      
     
  我通过下面的语句去调用此函数,为什么到otables(1,     "partn_role")     =     "ag"这一句会弹出"bad     index"这样的错误?怎样才是正确的方法?      
                set     fncrfc     =     sapfunction.add("zphone_create_salesorder")      
                fncrfc.exports("salesgroup")     =     "022"      
                fncrfc.exports("ordertype")     =     "zor"      
                if     fncrfc.call     then      
                set     otables     =     fncrfc.tables(1)      
                                otables(1,     "partn_role")     =     "ag"      
                                otables(1,     "partn_numb")     =     "100080"      
                set     otables     =     fncrfc.tables(2)      
                                otables(1,     "itm_number")     =     "itm_number"      
                                otables(1,     "material")     =     "ag"      
                                otables(1,     "target_qty")     =     "itm_number"      
                                otables(1,     "exchg_rate")     =     "ag"      
                     
                end     if

· 网友精彩回答:

发表者:crycoming

sapfunctions.connection   =   sapconnection  
  set   sapmaterialupd   =   sapfunctions.add("z_sd_bapi_sales_data_upd")  
  with   sapmaterialupd  
  set   exports  
            .exports("pa_glpupdlevel")   =   "s"  
            .exports("pa_vkorg")   =   "fi14"  
  append   table   row  
            .tables("it_sales_data_upd").appendrow  
            .tables("it_sales_data_upd")(1,   "vkorg")   =   "fi14"  
            .tables("it_sales_data_upd")(1,   "matnr")   =   "w_3100"  
            .tables("it_sales_data_upd")(1,   "datbi")   =   "99991231"  
            .tables("it_sales_data_upd")(1,   "datab")   =   "20041231"  
            .tables("it_sales_data_upd")(1,   "kbetr")   =   "2222"  
            .tables("it_sales_data_upd")(1,   "konwa")   =   "eur"  
  end   with  
     
  call   the   function   module  
  if   sapmaterialupd.call()   =   true   then  
          do   something   with   the   return   tables   here...else  
          debug.print   sapmaterialupd.exception  
  end   if  
 

.
处理 SSI 文件时出错
© 2006-2008 All Rights Reserved