当前位置:网站首页>SAP ABAP BAPI_ACC_DOCUMENT_POST 创建会计凭证
SAP ABAP BAPI_ACC_DOCUMENT_POST 创建会计凭证
2022-07-13 18:03:00 【请输入昵称膨胀的馒头】
标准功能函数无非输入输出
Standard Function Is Just Input And Output
写在前面 At first
SE19增强实现ACC_DOCUMENT
SE19 to enhance and implement ACC_DOCUMENT
将BAPI_ACC_DOCUMENT_POST 的参数表 EXTENSION2 传入系统表
Transport EXTENSION2 of BAPI_ACC_DOCUMENT_POST to system table
SE11创建一个结构用于记录记账码等信息(不是必要的)
SE11 to create a structure to record information of BSCHL(Not Necessary)
关于输入 About Input
EXPORTING
documentheader 总账信息
TABLES
accountgl 贷方
accountreceivable 借方
currencyamout 金额数量
extension2 扩展字段
关于输出 About Input
TABLES
return 返回
关于数据 About Data
首先创建变量来存储以上输入输出的值
At first, to create variables to store the value of input and output
直接参照函数所需字段的类型
Refer the type of function demanded directly
" 输入 Input
DATA:
ls_documentheader TYPE bapiache09, " 总账信息
lt_accountgl TYPE STANDARD TABLE OF bapiacgl09, " 贷方
ls_accountgl TYPE bapiacgl09,
lt_currencyamount TYPE STANDARD TABLE OF bapiaccr09, " 金额数量
ls_currencyamount TYPE bapiaccr09,
lt_extension2 TYPE STANDARD TABLE OF bapiparex, " 扩展字段
ls_extension2 TYPE bapiparex,
ls_extension TYPE zxxxv0001.
" 输出
DATA:
lt_return TYPE STANDARD TABLE OF bapiret2, " 返回值
ls_return TYPE bapiret2.
给变量赋值
Make variables active
" DOCUMENTHEADER 总账信息
ls_documentheader-doc_type = 'SA'. " 凭证类型
ls_documentheader-doc_date = '20210407'. " 凭证中的凭证日期
ls_documentheader-pstng_date = '20210407'. " 凭证中的记账日期
ls_documentheader-comp_code = '1000'. " 公司代码
ls_documentheader-header_txt = 'TEST'. " 凭证抬头文本
ls_documentheader-username = sy-uname. " 用户名
" ACCOUNTGL 贷方
ls_accountgl-itemno_acc = '0000000010'. " 会计凭证行项目编号
ls_accountgl-gl_account = '9999999999'. " 总分类账科目
ls_accountgl-profit_ctr = '9999999999'. " 利润中心
APPEND ls_accountgl TO lt_accountgl.
CLEAR ls_accountgl.
ls_accountgl-itemno_acc = '0000000020'. " 会计凭证行项目编号
ls_accountgl-gl_account = '9999999999'. " 总分类账科目
ls_accountgl-profit_ctr = '9999999999'. " 利润中心
APPEND ls_accountgl TO lt_accountgl.
" CURRENCYAMOUNT 金额数量
ls_currencyamount-itemno_acc = '0000000010'. " 行项目编号
ls_currencyamount-amt_doccur = '999'. " 金额
ls_currencyamount-currency = 'CNY'. " 货币
APPEND ls_currencyamount TO lt_currencyamount.
CLEAR ls_currencyamount.
ls_currencyamount-itemno_acc = '0000000020'. " 行项目编号
ls_currencyamount-amt_doccur = '-999'. " 金额
ls_currencyamount-currency = 'CNY'. " 货币
APPEND ls_currencyamount TO lt_currencyamount.
" EXTENSION2 扩展字段
ls_extension-posnr = '0000000020'. " 凭证行项目
ls_extension-bschl = '40'. " 记账码
ls_extension2-structure = 'ZXXXXV0001'. " 自定义结构
ls_extension2-valuepart1 = ls_extension.
APPEND ls_extension2 TO lt_extension2.
" 调用BAPI函数
CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
EXPORTING
documentheader = ls_documentheader " 总账信息
TABLES
accountgl = lt_accountgl " 贷方,应收
accountreceivable = lt_accountreceivable " 借方,应付
currencyamount = lt_currencyamount " 借贷的金额
return = lt_return " 返回值
extension2 = lt_extension2. " 扩展字段
READ TABLE lt_return INTO ls_return WITH KEY type = 'E'.
IF sy-subrc NE 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
ENDIF.
注:在过账的时候一定要保证所有行项目的金额之和为0
Tips: Sure the sum of money is zero while calling
边栏推荐
- AVL tree - binary lookup tree with equilibrium condition
- Hardware course design: small game of multi-function player based on stm32
- unity3d-Camera
- Leetcode lecture - 1252 Number of odd cells (difficulty: simple)
- (一)OSI模型
- unity3d-代码管理模板(单例初级写法)
- 我这边已经把101.132.179.94加到oracle的白名单里了,仍然ping失败,请问一下该怎
- Use of rounding, rounding down, rounding up
- MySQL——数据页
- 硬件课程设计:基于STM32的多功能播放器之图片浏览
猜你喜欢

Implementation of binarysearchtree (BST) class template for binary search tree

Hardware course design: sensor device of multi-function player based on stm32

Go seckill system 1 -- Erlang environment installation.

unity官方案例RubyAdventure

redis基础知识——菜鸟教程

Go秒杀系统3--项目结构搭建,商品模型开发。

男人要“强”,不要“软”“弱”,“虚”得一匹

Unity基础到入门-导航系统(Navigation)

AVL tree - binary lookup tree with equilibrium condition

unity3d-记录案例小点
随机推荐
unity3d-Transform组件
硬件课程设计:基于STM32的多功能播放器之聊天功能
Hardware course design: sensor device of multi-function player based on stm32
unity3d~坦克AI(小练习)
PuTTY for veket
【优先队列(堆)】二叉堆类模板的实现
368. 最大整除子集 动态规划
散列表HashTable
MyCli之多行模式
Unity3d code management template (primary writing method of single example)
week3
English words used by unity
ES6-ES11新特性(这一篇就够了)
说一下接口
LeetCode精讲——676. 实现一个魔法字典(难度:中等)
【6月4号学习进度】
进行重绘图形
Implementation of list class template of bidirectional linked list
Go秒杀系统3--Work模式,Publish模式
redis基础知识——菜鸟教程