Chinaunix首页 | 论坛 | 博客
  • 博客访问: 710421
  • 博文数量: 145
  • 博客积分: 3446
  • 博客等级: 中校
  • 技术积分: 1567
  • 用 户 组: 普通用户
  • 注册时间: 2006-08-30 13:58
文章分类

全部博文(145)

文章存档

2021年(1)

2020年(1)

2019年(1)

2018年(6)

2017年(1)

2016年(10)

2015年(12)

2014年(10)

2013年(15)

2012年(33)

2011年(21)

2010年(9)

2009年(18)

2008年(2)

2006年(5)

我的朋友

分类: 项目管理

2012-04-26 10:40:13

使用 bapi:BAPI_BUPA_ADDRESS_CHANGE 
           其中 bapiadtel_x-updateflag   (I 插入,U 更新,D 删除),bapiadtel_x有几条数据就会处理几条数据,并且 每次只能有一个updateflag类别(不能同时存在I,U).
 
代码如下:

  1. *"----------------------------------------------------------------------
  2. *"*"Local Interface:
  3. *" IMPORTING
  4. *" REFERENCE(IV_PARTNER) TYPE BU_PARTNER
  5. *" REFERENCE(IV_MOB) TYPE AD_TLNMBR OPTIONAL
  6. *" REFERENCE(IV_TEL) TYPE AD_TLNMBR OPTIONAL
  7. *"----------------------------------------------------------------------
  8. DATA: it_return1 LIKE bapiret2 OCCURS 0 WITH HEADER LINE,
  9. it_tel TYPE bapiadtel OCCURS 0 WITH HEADER LINE,
  10. it_tel_o TYPE bapiadtel OCCURS 0 WITH HEADER LINE,
  11. it_tel_x1 TYPE bapiadtelx OCCURS 0 WITH HEADER LINE,
  12. it_tel_x TYPE bapiadtelx OCCURS 0 WITH HEADER LINE.
  13. ***********************************************
  14. CALL FUNCTION 'BAPI_BUPA_ADDRESS_GETDETAIL'
  15. EXPORTING
  16. businesspartner = iv_partner
  17. TABLES
  18. bapiadtel = it_tel_o.
  19. IF iv_tel IS NOT INITIAL OR iv_mob IS NOT INITIAL.
  20. LOOP AT it_tel_o.
  21. it_tel_x1-std_no = 'X' .
  22. it_tel_x1-updateflag = 'D'.
  23. APPEND it_tel_x1. CLEAR it_tel_x1.
  24. ENDLOOP.
  25. CALL FUNCTION 'BAPI_BUPA_ADDRESS_CHANGE'
  26. EXPORTING
  27. businesspartner = iv_partner
  28. TABLES
  29. bapiadtel = it_tel_o[]
  30. bapiadtel_x = it_tel_x1[]
  31. return = it_return1.
  32. CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
  33. EXPORTING
  34. wait = 'X'.
  35. SORT it_tel_o BY r_3_user .
  36. DELETE ADJACENT DUPLICATES FROM it_tel COMPARING r_3_user .
  37. LOOP AT it_tel_o .
  38. it_tel-telephone = it_tel_o-telephone.
  39. it_tel-r_3_user = it_tel_o-r_3_user.
  40. it_tel-std_no = it_tel_o-std_no .
  41. APPEND it_tel. CLEAR it_tel..
  42. ENDLOOP.
  43. IF iv_tel IS NOT INITIAL. "固定电话
  44. DELETE it_tel WHERE r_3_user = '1' .
  45. it_tel-telephone = iv_tel.
  46. it_tel-r_3_user = '1'.
  47. it_tel-std_no = 'X' .
  48. APPEND it_tel. CLEAR it_tel.
  49. ENDIF.
  50. IF iv_mob IS NOT INITIAL. "移动电话
  51. DELETE it_tel WHERE r_3_user = '3' .
  52. it_tel-telephone = iv_mob.
  53. it_tel-r_3_user = '3'.
  54. it_tel-std_no = 'X' .
  55. APPEND it_tel. CLEAR it_tel.
  56. ENDIF.
  57. IF it_tel[] IS NOT INITIAL.
  58. LOOP AT it_tel.
  59. it_tel_x-updateflag = 'I'.
  60. it_tel_x-telephone = 'X'.
  61. it_tel_x-r_3_user = 'X'.
  62. it_tel_x-std_no = 'X' .
  63. APPEND it_tel_x. CLEAR it_tel_x.
  64. ENDLOOP.
  65. CALL FUNCTION 'BAPI_BUPA_ADDRESS_CHANGE'
  66. EXPORTING
  67. businesspartner = iv_partner
  68. TABLES
  69. bapiadtel = it_tel[]
  70. bapiadtel_x = it_tel_x[]
  71. return = it_return1.
  72. LOOP AT it_return1 WHERE type CA 'AEX'.
  73. ENDLOOP.
  74. IF sy-subrc = 0.
  75. CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
  76. ELSE.
  77. CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
  78. EXPORTING
  79. wait = 'X'.
  80. ENDIF.
  81. ENDIF .
  82. ENDIF.

阅读(2409) | 评论(0) | 转发(0) |
0

上一篇:SAP 增强

下一篇:BP 归档

给主人留下些什么吧!~~