Chinaunix首页 | 论坛 | 博客
  • 博客访问: 685278
  • 博文数量: 194
  • 博客积分: 7067
  • 博客等级: 少将
  • 技术积分: 2008
  • 用 户 组: 普通用户
  • 注册时间: 2008-04-09 14:48
个人简介

我很好

文章分类

全部博文(194)

文章存档

2019年(1)

2018年(1)

2017年(3)

2015年(2)

2012年(2)

2011年(1)

2010年(27)

2009年(15)

2008年(142)

分类: 项目管理

2012-05-02 21:36:01

1、BDC不好使,网上找到 CALL   CALL TRANSACTION  代码,修改,批量重读PP主数据

点击(此处)折叠或打开

  1. *&---------------------------------------------------------------------*
  2. *& Report ZPPPR_RESETPPDATA
  3. *&
  4. *&---------------------------------------------------------------------*
  5. *&
  6. *&
  7. *&---------------------------------------------------------------------*
  8. REPORT zpppr_resetppdata.
  9. INCLUDE zco02.
  10. DATA:
  11. ls_bdc LIKE bdcdata,
  12. lt_bdc LIKE STANDARD TABLE OF bdcdata.
  13. DATA:
  14. w_dis_mode TYPE char1 VALUE 'E',
  15. w_upd_mode TYPE char1 VALUE 'S',
  16. w_session LIKE apqi-groupid VALUE 'SESSION1-54' .
  17. DATA:BEGIN OF gt_list OCCURS 0 ,
  18. aufnr LIKE caufvd-aufnr,
  19. plauf LIKE rc62f-plauf,
  20. aufld LIKE rc62f-aufld ,
  21. END OF gt_list.
  22. SELECTION-SCREEN BEGIN OF BLOCK bl2 WITH FRAME TITLE text-002.
  23. PARAMETERS:txtfile LIKE rlgrap-filename DEFAULT 'D:\RESET_PP_DATA.TXT'.
  24. SELECTION-SCREEN END OF BLOCK bl2.
  25. AT SELECTION-SCREEN ON VALUE-REQUEST FOR txtfile.
  26. PERFORM filename_find.
  27. START-OF-SELECTION.
  28. PERFORM sub_uploaddata_header.
  29. PERFORM fill_bdc_tab.
  30. * PERFORM set_ppdata.
  31. * PERFORM set_ppdata2.
  32. * WRITE 'OK'.
  33. *&---------------------------------------------------------------------*
  34. *& Form filename_find
  35. *&---------------------------------------------------------------------*
  36. * text
  37. *----------------------------------------------------------------------*
  38. * --> p1 text
  39. * <-- p2 text
  40. *----------------------------------------------------------------------*
  41. FORM filename_find .
  42. CALL FUNCTION 'WS_FILENAME_GET'
  43. EXPORTING
  44. def_filename = txtfile
  45. def_path = 'D:\'
  46. mask = 'C*.TXT'
  47. mode = 'O'
  48. title = 'File Name'
  49. IMPORTING
  50. filename = txtfile
  51. EXCEPTIONS
  52. inv_winsys = 1
  53. no_batch = 2
  54. selection_cancel = 3
  55. selection_error = 4
  56. OTHERS = 5.
  57. ENDFORM. " filename_find
  58. *&---------------------------------------------------------------------*
  59. *& Form sub_uploaddata_header
  60. *&---------------------------------------------------------------------*
  61. * text
  62. *----------------------------------------------------------------------*
  63. * --> p1 text
  64. * <-- p2 text
  65. *----------------------------------------------------------------------*
  66. FORM sub_uploaddata_header .
  67. CALL FUNCTION 'WS_UPLOAD'
  68. EXPORTING
  69. filename = txtfile
  70. filetype = 'DAT'
  71. TABLES
  72. data_tab = gt_list
  73. EXCEPTIONS
  74. conversion_error = 1
  75. file_open_error = 2
  76. file_read_error = 3
  77. invalid_type = 4
  78. no_batch = 5
  79. unknown_error = 6
  80. invalid_table_width = 7
  81. gui_refuse_filetransfer = 8
  82. customer_error = 9
  83. OTHERS = 10.
  84. ENDFORM. " sub_uploaddata_header
  85. *&---------------------------------------------------------------------*
  86. *& Form set_ppdata
  87. *&---------------------------------------------------------------------*
  88. * text
  89. *----------------------------------------------------------------------*
  90. * --> p1 text
  91. * <-- p2 text
  92. *----------------------------------------------------------------------*
  93. FORM set_ppdata .
  94. LOOP AT gt_list.
  95. PERFORM bdc_dynpro USING 'SAPLCOKO1' '1010'.
  96. PERFORM bdc_field USING 'BDC_CURSOR' 'CAUFVD-AUFNR'.
  97. PERFORM bdc_field USING 'BDC_OKCODE' '/00'.
  98. PERFORM bdc_field USING 'RC27M-MATNR' gt_list-aufnr.
  99. PERFORM bdc_field USING 'R62CLORD-FLG_OVIEW' 'X'.
  100. PERFORM bdc_dynpro USING 'SAPLCOKO1' '0115'.
  101. PERFORM bdc_field USING 'BDC_OKCODE' '=STAK'.
  102. PERFORM bdc_field USING 'BDC_SUBSCR' 'SAPLCOKO1 0120SUBSCR_0115'.
  103. PERFORM bdc_dynpro USING 'SAPLCOKO1' '0131'.
  104. PERFORM bdc_field USING 'BDC_OKCODE' '=ENT1'.
  105. PERFORM bdc_field USING 'BDC_CURSOR' 'RC62F-PLAUF'.
  106. PERFORM bdc_field USING 'RC62F-NEW_ROUT' 'X'.
  107. PERFORM bdc_field USING 'RC62F-PLAUF' gt_list-plauf.
  108. PERFORM bdc_field USING 'RC62F-NEW_BOM' 'X'.
  109. PERFORM bdc_field USING 'RC62F-AUFLD' gt_list-aufld.
  110. PERFORM bdc_dynpro USING 'SAPLCOKO1' '0115'.
  111. PERFORM bdc_field USING 'BDC_OKCODE' '=FREI'.
  112. PERFORM bdc_dynpro USING 'SAPLCOKO1' '0115'.
  113. PERFORM bdc_field USING 'BDC_OKCODE' '=BU'.
  114. PERFORM bdc_transaction USING 'CO02'.
  115. ENDLOOP.
  116. ENDFORM. " set_ppdata
  117. *&---------------------------------------------------------------------*
  118. *& Form open_group
  119. *&---------------------------------------------------------------------*
  120. * text
  121. *----------------------------------------------------------------------*
  122. * --> p1 text
  123. * <-- p2 text
  124. *----------------------------------------------------------------------*
  125. *&---------------------------------------------------------------------*
  126. *& Form set_ppdata2
  127. *&---------------------------------------------------------------------*
  128. * text
  129. *----------------------------------------------------------------------*
  130. * --> p1 text
  131. * <-- p2 text
  132. *----------------------------------------------------------------------*
  133. FORM set_ppdata2 .
  134. ENDFORM. " set_ppdata2
  135. *&---------------------------------------------------------------------*
  136. *& Form fill_bdc_tab
  137. *&---------------------------------------------------------------------*
  138. * text
  139. *----------------------------------------------------------------------*
  140. FORM fill_bdc_tab .
  141. LOOP AT gt_list.
  142. REFRESH:lt_bdc.
  143. PERFORM populate_bdc_tab USING:
  144. '1' 'SAPLCOKO1' '0110',
  145. '' 'BDC_CURSOR' 'CAUFVD-AUFNR',
  146. '' 'BDC_OKCODE' '/00',
  147. '' 'CAUFVD-AUFNR' gt_list-aufnr," '10302095',
  148. '' 'R62CLORD-FLG_OVIEW' 'X',
  149. '1' 'SAPLCOKO1' '0115',
  150. '' 'BDC_OKCODE' '=STAK',
  151. '' 'BDC_SUBSCR' 'SAPLCOKO1 0120SUBSCR_0115',
  152. '1' 'SAPLCOKO1' '0131',
  153. '' 'BDC_OKCODE' '=ENT1',
  154. '' 'BDC_CURSOR' 'RC62F-PLAUF',
  155. '' 'RC62F-NEW_ROUT' 'X',
  156. '' 'RC62F-PLAUF' gt_list-plauf,"'2012.03.26',
  157. '' 'RC62F-NEW_BOM' 'X',
  158. '' 'RC62F-AUFLD' gt_list-aufld,"'2012.03.26',
  159. '1' 'SAPLCOKO1' '0115',
  160. '' 'BDC_OKCODE' '=FREI',
  161. '' 'BDC_SUBSCR' 'SAPLCOKO1 0120SUBSCR_0115',
  162. '' 'BDC_CURSOR' 'CAUFVD-GAMNG',
  163. '1' 'SAPLCOKO1' '0115',
  164. '' 'BDC_OKCODE' '=BU',
  165. '' 'BDC_SUBSCR' 'SAPLCOKO1 0120SUBSCR_0115',
  166. '' 'BDC_CURSOR' 'CAUFVD-GAMNG'.
  167. CALL TRANSACTION 'CO02'
  168. USING lt_bdc
  169. MODE w_dis_mode
  170. UPDATE w_upd_mode.
  171. ENDLOOP.
  172. ENDFORM. "fill_bdc_tab
  173. *&---------------------------------------------------------------------*
  174. *& Form populate_bdc_tab
  175. *&---------------------------------------------------------------------*
  176. * text
  177. *----------------------------------------------------------------------*
  178. * -->FLAG text
  179. * -->VAR1 text
  180. * -->VAR2 text
  181. *----------------------------------------------------------------------*
  182. FORM populate_bdc_tab USING flag TYPE char1
  183. var1 TYPE any
  184. var2 TYPE any.
  185. CLEAR ls_bdc.
  186. IF flag = '1'.
  187. ls_bdc-program = var1.
  188. ls_bdc-dynpro = var2.
  189. ls_bdc-dynbegin = 'X'.
  190. ELSE.
  191. ls_bdc-fnam = var1.
  192. ls_bdc-fval = var2.
  193. ENDIF.
  194. APPEND ls_bdc TO lt_bdc.
  195. ENDFORM. "populate_bdc_tab


阅读(3433) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~