登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

原来为了你

我的人生就是要一次次的超越

 
 
 

日志

 
 
 
 

创建总账科目类型会计凭证  

2011-07-26 17:53:53|  分类: BAPI |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

datai_bukrs like t001-bukrs     value '1000',       "公司代码
      i_netwr 
like vbap-netwr     value 1,            "金额
      i_saknr 
like zsdt015-hkont  value '0066021001'"总账科目

perform frm_create_bkpf using i_bukrs i_netwr i_saknr.
*&---------------------------------------------------------------------*
*&      Form  frm_create_bkpf
*&---------------------------------------------------------------------*
form frm_create_bkpf using i_bukrs i_netwr i_saknr.

*----------------------- Data definition -------------------------------
  
datalw_documentheader    type bapiache09,           "凭证抬头
        l_obj_type           
type bapiache09-obj_type,
        l_obj_key            
type bapiache09-obj_key,
        l_obj_sys            
type bapiache09-obj_sys,

        lt_accountgl         
type table of bapiacgl09,  "总账科目项
        lw_accountgl         
type bapiacgl09,


        lt_currencyamount    
type table of bapiaccr09,  "货币项目
        lw_currencyamount    
type bapiaccr09,

        lt_return            
type table of bapiret2,
        lw_return            
type bapiret2,

        lt_extension2        
type table of bapiparex,   "参考结构
        lw_extension2        
type bapiparex,

        lc_msg_temp          
type string.
*----------------------- header ----------------------------------------
  lw_documentheader
-bus_act    'RFBU'.                     "业务事务
  lw_documentheader
-username   sy-uname.                   "用户
  lw_documentheader
-comp_code  i_bukrs.                    "公司代码

  lw_documentheader
-doc_date   sy-datum.                   "凭证中的凭证日期
  lw_documentheader
-pstng_date sy-datum.                   "凭证中的记帐日期
  lw_documentheader
-doc_type   'SA'.                       "凭证类型,DZ:客户付款,SA:总账科目凭证
  lw_documentheader
-header_txt '费用记账-收款单创建'.       "凭证抬头文本,这个必须要带上才能创建成功
*----------------------- Item ------------------------------------------
*---货币项目
  lw_currencyamount
-itemno_acc 1.                          "行项目
  lw_currencyamount
-currency   'CNY'.                      "货币
  lw_currencyamount
-amt_doccur i_netwr.                    "金额
  
append lw_currencyamount to lt_currencyamount.

  lw_currencyamount
-itemno_acc 2.                          "行项目
  lw_currencyamount
-currency 'CNY'.                        "货币
  lw_currencyamount
-amt_doccur i_netwr.                "金额
  
append lw_currencyamount to lt_currencyamount.

*---总账科目
  
clear lw_accountgl.
  lw_accountgl
-itemno_acc 1.                               "行项目
  lw_accountgl
-gl_account '0066021501'.                    "总帐科目
  lw_accountgl
-comp_code  i_bukrs.                         "公司代码
  lw_accountgl
-costcenter '1000210056'.                    "成本中心
  
append lw_accountgl to lt_accountgl.

  
clear lw_accountgl.
  lw_accountgl
-itemno_acc 2.                               "行项目
  lw_accountgl
-gl_account '0021910012'.                    "总帐科目,
  lw_accountgl
-comp_code  i_bukrs.                         "公司代码
  
append lw_accountgl to lt_accountgl.

*---扩展结构
  
datalw_field_enhance type zfi_e_001.
  lw_field_enhance
-posnr 2.
  lw_field_enhance
-zz0001 '1201'.

  lw_extension2
-structure 'ZFI_E_001'.
  lw_extension2
-valuepart1 lw_field_enhance.
  
append lw_extension2 to lt_extension2.


*---call bapi
  
call function 'BAPI_ACC_DOCUMENT_POST'
    
exporting
      documentheader 
lw_documentheader
    
importing
      obj_type       
l_obj_type
      obj_key        
l_obj_key
      obj_sys        
l_obj_sys
    
tables
      accountgl      
lt_accountgl
      currencyamount 
lt_currencyamount
      
return         lt_return
      extension2     
lt_extension2.

*---处理BAPI返回结果
  
delete lt_return where type 'S' or type 'I' or type 'W'.
  
if lt_return is initial.
    
call function 'BAPI_TRANSACTION_COMMIT'
      
exporting
        
wait 'X'.
*    p_belnr     = l_obj_key(10).
  
else.
    
call function 'BAPI_TRANSACTION_ROLLBACK'.
  
endif.

endform.                    " FRM_CREATE_BKPF

  评论这张
 
阅读(783)| 评论(0)

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2018