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

原来为了你

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

 
 
 

日志

 
 
 
 

BAPI_ACC_DOCUMENT_POST 创建收款单  

2011-05-27 17:26:57|  分类: 默认分类 |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |
  form frm_create_bkpf using i_bukrs i_kunnr i_wrbtr i_saknr.
  datalwa_documentheader    type bapiache09,
        lit_accountgl         type table of bapiacgl09,"G/L account item
        lwa_accountgl         type bapiacgl09,
        lit_accountreceivable type table of bapiacar09,"Customer Item
        lwa_accountreceivable type bapiacar09,
        lit_currencyamount    type table of bapiaccr09,"Currency Items
        lwa_currencyamount    type bapiaccr09,
        lit_return            type table of bapiret2,
        lwa_return            type bapiret2,
        lit_extension2        type table of bapiparex,
        lwa_extension2        type bapiparex,
        l_obj_type            type bapiache09-obj_type,
        l_obj_key             type bapiache09-obj_key,
        l_obj_sys             type bapiache09-obj_sys,
        lc_msg_temp           type string.

*---组织Bapi header 参数
  lwa_documentheader-bus_act    'RFBU'.                     "业务事务
  lwa_documentheader-username   sy-uname.                   "用户
  lwa_documentheader-comp_code  i_bukrs.                    "公司代码全部都是1000,不是按照销售订单中销售组织获取的公司


  lwa_documentheader-doc_date   sy-datum.                   "凭证中的凭证日期
  lwa_documentheader-pstng_date sy-datum.                   "凭证中的记帐日期
  lwa_documentheader-doc_type   'DZ'.                       "凭证类型,DZ:客户付款
  lwa_documentheader-header_txt '报货平台收款单创建'.        "凭证抬头文本,这个必须要带上才能创建成功

*---组织Bapi item 参数
  perform frm_process_itemdata tables lit_accountgl lit_accountreceivable lit_currencyamount lit_extension2
                               using i_kunnr i_wrbtr i_saknr.

*---call bapi
  call function 'BAPI_ACC_DOCUMENT_POST'
    exporting
      documentheader    lwa_documentheader
    importing
      obj_type          l_obj_type
      obj_key           l_obj_key
      obj_sys           l_obj_sys
    tables
      accountgl         lit_accountgl
      accountreceivable lit_accountreceivable
      currencyamount    lit_currencyamount
      return            lit_return
      extension2        lit_extension2.

*---处理BAPI返回结果
  loop at lit_return into lwa_return.
    if lc_msg_temp is initial.
      concatenate lwa_return-type ':' lwa_return-message into lc_msg_temp.
    else.
      concatenate lc_msg_temp ';'lwa_return-type ':' lwa_return-message into lc_msg_temp.
    endif.
  endloop.
  "获取消息类别:成功还是失败
  delete lit_return where type 'S' or type 'I' or type 'W'.
  if lit_return is initial."成功
    call function 'BAPI_TRANSACTION_COMMIT'
      exporting
        wait 'X'.

  else."失败
    call function 'BAPI_TRANSACTION_ROLLBACK'.
  endif.

endform.                    " FRM_CREATE_BKPF

*&---------------------------------------------------------------------*
*&      Form  frm_process_itemdata
*&---------------------------------------------------------------------*
form frm_process_itemdata tables    f_t_accountgl         structure bapiacgl09
                                    f_t_accountreceivable structure bapiacar09
                                    f_t_currencyamount    structure bapiaccr09
                                    f_t_extension2        structure bapiparex
                          using i_kunnr i_wrbtr i_saknr.
  datalwa_accountgl         type bapiacgl09,
        lwa_accountreceivable type bapiacar09,
        lwa_currencyamount    type bapiaccr09,
        lwa_extension2        type bapiparex,
        lwa_field_enhance     type zfi_e_001.


*---process Customer Item
  lwa_accountreceivable-itemno_acc 1.                         "行项目
  lwa_accountreceivable-customer   i_kunnr.                   "客户编号gwa_ztsd007-kunnr
  lwa_accountreceivable-bline_date sy-datum.                  "付款基准日期
  append lwa_accountreceivable to f_t_accountreceivable.

*---process Currency Items
  lwa_currencyamount-itemno_acc 1.                            "行项目
  lwa_currencyamount-currency   'CNY'.                        "货币
  lwa_currencyamount-amt_doccur i_wrbtr.                  "金额gwa_ztsd007-zjine_action
  append lwa_currencyamount to f_t_currencyamount.

*---process G/L Item
  lwa_accountgl-itemno_acc 2.                                 "行项目
  lwa_accountgl-gl_account i_saknr.                           "总帐科目gwa_ztsd007-saknr
  append lwa_accountgl to f_t_accountgl.

*---process Currency Items
  lwa_currencyamount-itemno_acc 2.                            "行项目
  lwa_currencyamount-currency 'CNY'.                          "货币
  lwa_currencyamount-amt_doccur i_wrbtr.                      "金额gwa_ztsd007-zjine_action
  append lwa_currencyamount to f_t_currencyamount.

*---process EXTENSION2 (总帐行项目中需要增加现金流量码)
  lwa_field_enhance-posnr 2.
  lwa_field_enhance-zz0001 '1101'.

  lwa_extension2-structure 'ZFI_E_001'.      "创建此结构如下图1
  lwa_extension2-valuepart1 lwa_field_enhance.
  append lwa_extension2 to f_t_extension2.

endform" frm_process_itemdata
BAPI_ACC_DOCUMENT_POST 创建收款单 - 2006057145 - 原来为了你
  评论这张
 
阅读(1993)| 评论(0)

历史上的今天

评论

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

页脚

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