壹佰网|ERP100 - 企业信息化知识门户

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 1002|回复: 2

[FI] 求教过帐后SAP写表BSEG,FAGLFLEXT的标准代码

[复制链接]
发表于 2012/6/14 20:42:44 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。如果您注册时有任何问题请联系客服QQ: 83569622  。

您需要 登录 才可以下载或查看,没有帐号?注册

x
我用的是ECC6.0的系统.
用TCODE:F-02做一笔凭证,
点保存后,各个字段自动写入表BSEG和总帐表FAGLFLEXT中.

我听同事说功能范围是根据成本中心字段自动带出来的(如果CSKS表有配置功能范围的话).
我写找字段"功能范围"是怎么写入的.
能帮我找找SAP标准程序的这段代码吗?感激不尽!
发表于 2012/6/15 16:31:05 | 显示全部楼层
帮你顶起。。。。。
发表于 2013/1/1 10:13:04 | 显示全部楼层
F-02是在SAP标准程序 MF05AFA0_ANLAGENPOSITIONEN_ERG 的 form anlagenpositionen_ergaenzen. 中保存字段"功能范围"的.但估计对你没什么用,并不是你想象的那样子.还是使用标准BAPI BAPI_ACC_GL_POSTING_POST 或 BAPI_ACC_DOCUMENT_POST 吧.
  1. data:
  2. obj_type like bapiache02-obj_type,
  3. obj_key like bapiache02-obj_key,
  4. obj_sys like bapiache02-obj_sys,
  5. documentheader like bapiache08,

  6. accountgl like bapiacgl08
  7. occurs 0 with header line,
  8. currencyamount like bapiaccr08
  9. occurs 0 with header line,
  10. return like bapiret2
  11. occurs 0 with header line,
  12. extension1 like bapiextc
  13. occurs 0 with header line,

  14. t_edidd like edidd occurs 0 with header line,
  15. bapi_retn_info like bapiret2 occurs 0 with header line.
  16. data: error_flag.

  17. *documentheader-obj_type = 'BKPFF'.
  18. *documentheader-obj_key = '18000000002002004'.
  19. *documentheader-obj_type = 'BKPFF'.
  20. *documentheader-obj_key = '180000000010002004'.

  21. *documentheader-obj_sys = 'RD1CLNT200'.


  22. documentheader-username = sy-uname.
  23. documentheader-header_txt = 'Test using BAPI'.
  24. documentheader-comp_code = '1000'.

  25. *documentheader-ac_doc_no
  26. *documentheader-fisc_year = '2005'.

  27. documentheader-doc_date = sy-datum.
  28. documentheader-pstng_date = sy-datum.

  29. *documentheader-trans_date
  30. *documentheader-fis_period

  31. documentheader-doc_type = 'SA'.


  32. *documentheader-ref_doc_no
  33. *documentheader-compo_acc
  34. *documentheader-reason_rev



  35. accountgl-itemno_acc = '1'.
  36. accountgl-gl_account = '0000160100'.
  37. accountgl-comp_code = '1000'.
  38. accountgl-pstng_date = sy-datum.
  39. accountgl-doc_type = 'SA'.
  40. accountgl-profit_ctr = '0000010000'.
  41. append accountgl.

  42. accountgl-itemno_acc = '2'.
  43. accountgl-gl_account = '0000160100'.
  44. accountgl-comp_code = '1000'.
  45. accountgl-pstng_date = sy-datum.
  46. accountgl-doc_type = 'SA'.
  47. accountgl-profit_ctr = '0000010000'.
  48. append accountgl.


  49. *AC_DOC_NO
  50. *FISC_YEAR
  51. *FIS_PERIOD
  52. *accountgl-STAT_CON = 'X'.
  53. *REF_KEY_1
  54. *REF_KEY_2
  55. *REF_KEY_3
  56. *CUSTOMER
  57. *VENDOR_NO
  58. *ALLOC_NMBR
  59. *ITEM_TEXT
  60. *BUS_AREA
  61. *COSTCENTER
  62. *ACTTYPE
  63. *ORDERID
  64. *ORIG_GROUP
  65. *COST_OBJ
  66. *PROFIT_CTR
  67. *PART_PRCTR
  68. *WBS_ELEMENT
  69. *NETWORK
  70. *ROUTING_NO
  71. *ORDER_ITNO


  72. currencyamount-itemno_acc = '1'.
  73. currencyamount-currency = 'GBP'.
  74. currencyamount-amt_doccur = '100.00'.
  75. append currencyamount.

  76. currencyamount-itemno_acc = '2'.
  77. currencyamount-currency = 'GBP'.
  78. currencyamount-amt_doccur = '-100.00'.
  79. append currencyamount.



  80. call BAPI-function in this system
  81. call function 'BAPI_ACC_GL_POSTING_POST'
  82. exporting
  83. documentheader = documentheader

  84. importing
  85. obj_type = obj_type
  86. obj_key = obj_key
  87. obj_sys = obj_sys
  88. tables
  89. accountgl = accountgl
  90. currencyamount = currencyamount
  91. return = return
  92. extension1 = extension1
  93. exceptions
  94. others = 1.
  95. if sy-subrc 0.
  96. message e999(re) with 'Problem occured'.
  97. else.
  98. loop at return.
  99. if not return is initial.
  100. clear bapi_retn_info.
  101. move-corresponding return to bapi_retn_info.
  102. if return-type = 'A' or return-type = 'E'.
  103. error_flag = 'X'.
  104. endif.
  105. append bapi_retn_info.
  106. endif.
  107. endloop.
  108. if error_flag = 'X'.
  109. message e999(re) with 'Problem occured'.
  110. rollback work.
  111. else.
  112. commit work.
  113. endif.
  114. endif.
复制代码
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|小黑屋|手机版|壹佰网 ERP100 ( 京ICP备19053597号-2 )

Copyright © 2005-2012 北京海之大网络技术有限责任公司 服务器托管由互联互通
手机:13911575376
网站技术点击发送消息给对方83569622   广告&合作 点击发送消息给对方27675401   点击发送消息给对方634043306   咨询及人才点击发送消息给对方138011526

GMT+8, 2025/11/30 04:22 , Processed in 0.018895 second(s), 19 queries , File On.

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表