当前位置:   article > 正文

生产订单组件新增 修改 删除_saplcobc中的resb_bt

saplcobc中的resb_bt

  1. 如果CO_XT_COMPONENT_ADD缺少需要的字段
  2. 可以拷贝出来,
  3. 在ZCO_XT_COMPONENT_ADD
  4. 添加字段例如:I_TEST 和 I_TESTX
  5. 或者memory id传值
  6. 220行左右添加代码后调用BAPI即可
  7. if i_testx is not initial.
  8. ls_resbd_new-TEST = I_TEST.
  9. endif.
  10. 也可以调用bapi后直接修改
  11. (SAPLCOBC)RESB_BT[]
  12. 内的对应字段

1.创建

  1. data:is_order_key type coxt_ord_key,
  2. i_material type coxt_material,
  3. is_storage_location type coxt_s_storage_location,
  4. is_storage_locationx type coxt_s_storage_locationx,
  5. is_requ_quan type coxt_s_quantity,
  6. i_operation type afvc-aplzl,
  7. i_posno type cif_r3res-positionno,
  8. ls_return type coxt_bapireturn,
  9. lv_error type c.
  10. data:
  11. lv_matnr type mara-matnr,
  12. lv_aufnr type afpo-aufnr,
  13. lv_sortf type resb-sortf,
  14. lv_sortfx type c,
  15. lv_posnr type char4.
  16. types: begin of ty_resb_bt.
  17. include type resbb.
  18. types: indold type syst_tabix.
  19. types: no_req_upd type syst_datar.
  20. types: end of ty_resb_bt.
  21. types tt_resb_bt type table of ty_resb_bt.
  22. field-symbols: <ft_resb_bt> type tt_resb_bt,
  23. <fs_resb_bt> type ty_resb_bt.
  24. data:begin of lt_aufnr occurs 0,
  25. aufnr type afpo-aufnr,
  26. end of lt_aufnr.
  27. refresh lt_aufnr.
  28. loop at gt_data1 assigning <fs_data1> where check eq 'X'
  29. and cellcolor is initial
  30. and icon ne icon_led_green.
  31. lt_aufnr-aufnr = <fs_data1>-aufnr.
  32. append lt_aufnr.
  33. clear lt_aufnr.
  34. endloop.
  35. sort lt_aufnr.
  36. delete adjacent duplicates from lt_aufnr.
  37. loop at lt_aufnr.
  38. loop at gt_data1 assigning <fs_data1> where aufnr eq lt_aufnr-aufnr.
  39. clear:lv_matnr,lv_aufnr,lv_posnr,is_requ_quan,is_storage_location,is_storage_locationx,
  40. ls_return,lv_error,lv_sortf,lv_sortfx.
  41. unassign:<ft_resb_bt>,<fs_resb_bt>.
  42. lv_aufnr = <fs_data1>-aufnr.
  43. lv_matnr = <fs_data1>-matnr.
  44. call function 'CONVERSION_EXIT_ALPHA_INPUT'
  45. exporting
  46. input = lv_aufnr
  47. importing
  48. output = lv_aufnr.
  49. call function 'CONVERSION_EXIT_ALPHA_INPUT'
  50. exporting
  51. input = lv_matnr
  52. importing
  53. output = lv_matnr.
  54. is_order_key = lv_aufnr.
  55. i_material = lv_matnr.
  56. is_requ_quan-quantity = <fs_data1>-menge.
  57. is_storage_location-werks = <fs_data1>-werks.
  58. is_storage_locationx-werks = 'X'.
  59. if <fs_data1>-lgort is not initial.
  60. is_storage_location-lgort = <fs_data1>-lgort.
  61. is_storage_locationx-lgort = 'X'.
  62. endif.
  63. call function 'CO_XT_COMPONENT_ADD'
  64. exporting
  65. is_order_key = is_order_key
  66. i_material = i_material
  67. is_requ_quan = is_requ_quan
  68. i_operation = i_operation
  69. is_storage_location = is_storage_location
  70. is_storage_locationx = is_storage_locationx
  71. i_postp = 'L'
  72. i_posno = i_posno
  73. importing
  74. es_bapireturn = ls_return
  75. e_error_occurred = lv_error.
  76. if lv_error is initial.
  77. assign ('(SAPLCOBC)RESB_BT[]') to <ft_resb_bt>.
  78. data(line) = lines( <ft_resb_bt> ).
  79. loop at <ft_resb_bt> assigning <fs_resb_bt>.
  80. "新增行数据处理
  81. if sy-tabix = line.
  82. if <fs_data1>-posnr is not initial.
  83. <fs_resb_bt>-posnr = <fs_data1>-posnr.
  84. else.
  85. select single max( posnr )
  86. into <fs_resb_bt>-posnr
  87. from resb
  88. where aufnr eq lv_aufnr.
  89. <fs_resb_bt>-posnr = <fs_resb_bt>-posnr + 1.
  90. lv_posnr = <fs_resb_bt>-posnr.
  91. endif.
  92. call function 'CONVERSION_EXIT_ALPHA_INPUT'
  93. exporting
  94. input = <fs_resb_bt>-posnr
  95. importing
  96. output = <fs_resb_bt>-posnr.
  97. if <fs_data1>-sortf is not initial.
  98. <fs_resb_bt>-sortf = <fs_data1>-sortf.
  99. endif.
  100. if <fs_resb_bt>-xwaok is initial.
  101. <fs_resb_bt>-xwaok = 'X'.
  102. endif.
  103. endif.
  104. endloop.
  105. call function 'CO_XT_ORDER_PREPARE_COMMIT'
  106. importing
  107. es_bapireturn = ls_return
  108. e_error_occurred = lv_error.
  109. if ( ls_return-type = 'S' or ls_return-type = 'W' or ls_return-type = 'I' ) or
  110. ls_return is initial.
  111. call function 'BAPI_TRANSACTION_COMMIT'
  112. exporting
  113. wait = 'X'.
  114. call function 'CO_XT_ORDER_INITIALIZE'.
  115. <fs_data1>-mseg = '新增成功'.
  116. * <fs_data1>-color = 'C500'.
  117. <fs_data1>-icon = icon_led_green.
  118. perform save_history_add using <fs_data1> lv_posnr.
  119. else.
  120. call function 'BAPI_TRANSACTION_ROLLBACK'.
  121. <fs_data1>-mseg = ls_return-message.
  122. <fs_data1>-icon = icon_led_red.
  123. endif.
  124. else.
  125. call function 'BAPI_TRANSACTION_ROLLBACK'.
  126. <fs_data1>-mseg = ls_return-message.
  127. <fs_data1>-icon = icon_led_red.
  128. endif.
  129. wait up to 1 seconds.
  130. endloop.
  131. endloop.

2.修改

  1. data:lt_resb like table of resb with header line.
  2. data:lv_message type string,
  3. lv_matny type mara-matnr.
  4. data:ft_return type table of bapiret2 with header line.
  5. data:lt_return type table of bapiret2 with header line.
  6. data:ls_return type coxt_bapireturn,
  7. ls_return2 type bapiret2,
  8. error type c.
  9. data:order type coxt_ord_key,
  10. compkey type coxt_s_ord_comp_key,
  11. ret type coxt_bapireturn,
  12. bapiret type coxt_t_bapireturn.
  13. data : is_order_key type coxt_ord_key,
  14. is_order_component_key type coxt_s_ord_comp_key,
  15. is_requirement_quantity type coxt_s_quantity,
  16. is_requirement_quantityx type coxt_s_quantityx,
  17. is_confirmed_quantity type coxt_s_quantity,
  18. is_confirmed_quantityx type coxt_s_quantityx,
  19. i_material type coxt_material,
  20. i_materialx type coxt_materialx,
  21. is_order_operation_key type coxt_s_ord_opr_key,
  22. is_order_operation_keyx type coxt_s_ord_opr_keyx,
  23. is_requirement_date type coxt_s_date,
  24. is_requirement_datex type coxt_s_datex,
  25. is_storage_location type coxt_s_storage_location,
  26. is_storage_locationx type coxt_s_storage_locationx,
  27. i_batch type coxt_batch,
  28. i_batchx type coxt_batchx,
  29. i_mi_configuration_object type coxt_config_object,
  30. i_mi_configuration_objectx type coxt_config_objectx.
  31. data :wa_resb type resb,
  32. es_bapireturn type coxt_bapireturn,
  33. e_error_occurred type c.
  34. data:begin of lt_aufnr occurs 0,
  35. aufnr type afpo-aufnr,
  36. end of lt_aufnr.
  37. refresh:lt_aufnr,lt_return.
  38. loop at gt_data2 assigning <fs_data2> where check eq 'X'
  39. and cellcolor is initial
  40. and icon ne icon_led_green.
  41. lt_aufnr-aufnr = <fs_data2>-aufnr.
  42. append lt_aufnr.
  43. clear lt_aufnr.
  44. endloop.
  45. sort lt_aufnr.
  46. delete adjacent duplicates from lt_aufnr.
  47. loop at lt_aufnr.
  48. clear is_order_key.
  49. is_order_key = lt_aufnr-aufnr.
  50. call function 'CONVERSION_EXIT_ALPHA_INPUT'
  51. exporting
  52. input = is_order_key
  53. importing
  54. output = is_order_key.
  55. loop at gt_data2 assigning <fs_data2> where aufnr eq lt_aufnr-aufnr.
  56. clear:lv_matny,ft_return[],ft_return,lv_message.
  57. lv_matny = <fs_data2>-matny.
  58. call function 'CONVERSION_EXIT_ALPHA_INPUT'
  59. exporting
  60. input = lv_matny
  61. importing
  62. output = lv_matny.
  63. if <fs_data2>-potx1 is initial and p_bf ne 'X'.
  64. select *
  65. into corresponding fields of table lt_resb
  66. from resb
  67. where aufnr eq is_order_key
  68. and matnr eq lv_matny
  69. and xloek ne 'X'.
  70. else.
  71. select *
  72. into corresponding fields of table lt_resb
  73. from resb
  74. where aufnr eq is_order_key
  75. and matnr eq lv_matny
  76. and xloek ne 'X'
  77. and potx1 eq <fs_data2>-potx1.
  78. endif.
  79. if lt_resb[] is initial.
  80. <fs_data2>-mseg = '无该原物料可替换'.
  81. <fs_data2>-icon = icon_led_red.
  82. continue.
  83. endif.
  84. loop at lt_resb.
  85. clear:ls_return,ls_return2,is_order_component_key,
  86. is_requirement_quantity,is_requirement_quantityx,
  87. is_storage_location,is_storage_locationx,i_material,i_materialx,
  88. is_storage_location,is_storage_locationx,lv_message,error.
  89. move-corresponding lt_resb to is_order_component_key.
  90. if <fs_data2>-matnr is initial.
  91. i_material = <fs_data2>-matny.
  92. else.
  93. i_material = <fs_data2>-matnr.
  94. endif.
  95. call function 'CONVERSION_EXIT_ALPHA_INPUT'
  96. exporting
  97. input = i_material
  98. importing
  99. output = i_material.
  100. i_materialx = 'X'.
  101. is_storage_location-werks = lt_resb-werks.
  102. is_storage_locationx-werks = 'X'.
  103. if <fs_data2>-menge is not initial.
  104. is_requirement_quantity-quantity = <fs_data2>-menge.
  105. is_requirement_quantityx-quantity = 'X'.
  106. endif.
  107. if <fs_data2>-lgort is not initial.
  108. is_storage_location-lgort = <fs_data2>-lgort.
  109. is_storage_locationx-lgort = 'X'.
  110. endif.
  111. clear lv_zcomp.
  112. if <fs_data2>-matnr is initial."新物料号为空 组件为原物料号
  113. concatenate lt_resb-posnr lt_resb-matnr into lv_zcomp separated by '/'.
  114. else."新物料号不为空 修改的是新物料号的 数量和库区
  115. concatenate lt_resb-posnr <fs_data2>-matnr into lv_zcomp separated by '/'.
  116. endif.
  117. call function 'CO_XT_COMPONENT_CHANGE'
  118. exporting
  119. is_order_key = is_order_key
  120. is_order_component_key = is_order_component_key
  121. is_requirement_quantity = is_requirement_quantity
  122. is_requirement_quantityx = is_requirement_quantityx
  123. is_confirmed_quantity = is_confirmed_quantity
  124. is_confirmed_quantityx = is_confirmed_quantityx
  125. i_material = i_material
  126. i_materialx = i_materialx
  127. is_storage_location = is_storage_location
  128. is_storage_locationx = is_storage_locationx
  129. i_batch = i_batch
  130. i_batchx = i_batchx
  131. i_mi_configuration_object = i_mi_configuration_object
  132. i_mi_configuration_objectx = i_mi_configuration_objectx
  133. importing
  134. es_bapireturn = ls_return
  135. e_error_occurred = error.
  136. if error is initial.
  137. call function 'CO_XT_ORDER_PREPARE_COMMIT'
  138. importing
  139. e_order_key = is_order_key
  140. es_bapireturn = ret
  141. e_error_occurred = error.
  142. if ( ret-type = 'S' or ret-type = 'W' or ret-type = 'I' ) or ret is initial.
  143. data :lt_resb_get type table of resbdget,
  144. lw_resb_get like line of lt_resb_get.
  145. clear:lt_resb_get[],lw_resb_get.
  146. call function 'CO_BC_RESBD_OF_ORDER_GET'
  147. exporting
  148. aufnr_act = is_order_key
  149. * GET_OLD = ' '
  150. * NO_MAKTX = 'X'
  151. * NO_STATX = 'X'
  152. * CHECK_DELETED = ' '
  153. * NO_READ = ' '
  154. * CHECK_VBKZ_DEL = 'X'
  155. * I_ARCHIVE = ' '
  156. tables
  157. * ARESB_EXP =
  158. resbd_get = lt_resb_get[].
  159. loop at lt_resb_get into lw_resb_get where rsnum = lt_resb-rsnum
  160. and rspos = lt_resb-rspos
  161. and rsart = lt_resb-rsart..
  162. if <fs_data2>-sortf is not initial.
  163. lw_resb_get-sortf = <fs_data2>-sortf.
  164. endif.
  165. modify lt_resb_get from lw_resb_get index sy-tabix.
  166. endloop.
  167. call function 'CO_BC_UPDATE_CMP_OF_ORDERS'
  168. * EXPORTING
  169. * FLG_BANF_UPD = YX
  170. * FLG_CALC_CHK = YX
  171. * FLG_LVS_CHK = YX
  172. * IMPORTING
  173. * FLG_LVS =
  174. tables
  175. resbd_get = lt_resb_get[].
  176. call function 'BAPI_TRANSACTION_COMMIT'
  177. exporting
  178. wait = 'X'.
  179. call function 'CO_XT_ORDER_INITIALIZE'.
  180. endif.
  181. else.
  182. call function 'BAPI_TRANSACTION_ROLLBACK'.
  183. endif.
  184. wait up to 1 seconds.
  185. endloop.
  186. endloop.
  187. endloop.

3.删除

  1. data:lt_resb type table of resb with header line.
  2. data:lt_return type coxt_t_bapireturn with header line.
  3. data:ls_return type bapiret2.
  4. data it_resb type coxt_t_resbdel with header line .
  5. data:lv_matnr type mara-matnr,
  6. lv_aufnr type afko-aufnr,
  7. lv_message type string,
  8. lv_error type c.
  9. data:ft_return type table of bapiret2 with header line.
  10. data:begin of lt_aufnr occurs 0,
  11. aufnr type afpo-aufnr,
  12. end of lt_aufnr.
  13. refresh lt_aufnr.
  14. loop at gt_data3 assigning <fs_data3> where check eq 'X'
  15. and cellcolor is initial
  16. and icon ne icon_led_green.
  17. lt_aufnr-aufnr = <fs_data3>-aufnr.
  18. append lt_aufnr.
  19. clear lt_aufnr.
  20. endloop.
  21. sort lt_aufnr.
  22. delete adjacent duplicates from lt_aufnr.
  23. loop at lt_aufnr.
  24. clear:lt_resb[],lt_resb,lv_message,ft_return[],ft_return,ls_return,lv_error,
  25. lt_return[],lt_return,it_resb[],it_resb.
  26. loop at gt_data3 assigning <fs_data3> where aufnr eq lt_aufnr-aufnr.
  27. clear:lv_matnr,lv_aufnr.
  28. lv_matnr = <fs_data3>-matnr.
  29. lv_aufnr = <fs_data3>-aufnr.
  30. call function 'CONVERSION_EXIT_ALPHA_INPUT'
  31. exporting
  32. input = lv_matnr
  33. importing
  34. output = lv_matnr.
  35. call function 'CONVERSION_EXIT_ALPHA_INPUT'
  36. exporting
  37. input = lv_aufnr
  38. importing
  39. output = lv_aufnr.
  40. if <fs_data3>-potx1 is initial and p_bf ne 'X'.
  41. select rsnum rspos matnr posnr sortf aufnr
  42. into corresponding fields of table lt_resb
  43. from resb
  44. where aufnr eq lv_aufnr
  45. and matnr eq lv_matnr
  46. and xloek ne 'X'.
  47. else.
  48. select rsnum rspos matnr posnr sortf aufnr
  49. into corresponding fields of table lt_resb
  50. from resb
  51. where aufnr eq lv_aufnr
  52. and matnr eq lv_matnr
  53. and xloek ne 'X'
  54. and potx1 eq <fs_data3>-potx1.
  55. endif.
  56. if lt_resb[] is initial.
  57. <fs_data3>-mseg = '无该物料可删除'.
  58. <fs_data3>-icon = icon_led_red.
  59. continue.
  60. endif.
  61. endloop.
  62. call function 'CO_XT_COMPONENTS_DELETE'
  63. exporting
  64. it_resbkeys_to_delete = it_resb[]
  65. tables
  66. ct_bapireturn = lt_return
  67. exceptions
  68. delete_failed = 1
  69. others = 2.
  70. if lt_return[] is initial.
  71. *刷新变量
  72. perform change_flag_set(saplcozv).
  73. *数据更新到DB
  74. call function 'CO_XT_ORDER_PREPARE_COMMIT'
  75. importing
  76. es_bapireturn = ls_return
  77. e_error_occurred = lv_error.
  78. if ( ls_return-type = 'S' or ls_return-type = 'W' or ls_return-type = 'I' )
  79. or ls_return is initial.
  80. *DB COMMMIT
  81. call function 'BAPI_TRANSACTION_COMMIT'
  82. exporting
  83. wait = 'X'.
  84. *刷新变量
  85. call function 'CO_XT_ORDER_INITIALIZE'.
  86. loop at gt_data3 assigning <fs_data3> where aufnr eq lt_aufnr-aufnr.
  87. <fs_data3>-mseg = '删除成功'.
  88. <fs_data3>-icon = icon_led_green.
  89. endloop.
  90. else.
  91. clear: lv_error,ls_return.
  92. call function 'BAPI_TRANSACTION_ROLLBACK'.
  93. endif.
  94. else.
  95. call function 'BAPI_TRANSACTION_ROLLBACK'.
  96. loop at gt_data3 assigning <fs_data3> where aufnr eq lt_aufnr-aufnr.
  97. <fs_data3>-mseg = lv_message.
  98. <fs_data3>-icon = icon_led_red.
  99. endloop.
  100. clear lv_message.
  101. endif.
  102. endloop.

增、改生产订单组件BAPI BAPI_ALM_ORDER_MAINTAIN

USE BAPI_ALM_ORDER_MAINTAIN TO CREATE OR CHANGE PM WORK ORDER

最近做一个sap和外部程序的接口,外部应用程序需要创建PM订单,于是我找到了BAPI_ALM_ORDER_MAINTAIN,然后做了一些测试,这是个能够创建、修改PM订单的BAPI。它需要的一些参数如下:

IT_METHODS    LIKE    BAPI_ALM_ORDER_METHOD
处理方法,必选项,存储CREATE CREATETONOTIF CHANGE DELETE RELEASE TECHNICALCOMPLETE ATPCHECK CALCULATE SCHEDULE DELELTEDSEX ADD SAVE DIALOG TRACE这些处理动作。
IT_HEADER    LIKE    BAPI_ALM_ORDER_HEADERS_I
订单的header信息
IT_HEADER_UP    LIKE    BAPI_ALM_ORDER_HEADERS_UP
修改的订单的header信息,如果是对订单header的修改,需要将对应字段置X
IT_HEADER_SRV    LIKE    BAPI_ALM_ORDER_SRVDAT_E
对象服务信息
IT_HEADER_SRV_UP    LIKE    BAPI_ALM_ORDER_SRVDAT_UP
IT_USERSTATUS    LIKE    BAPI_ALM_ORDER_USRSTAT
用户状态信息
IT_PARTNER    LIKE    BAPI_ALM_ORDER_PARTN_MUL
合作伙伴信息
IT_PARTNER_UP    LIKE    BAPI_ALM_ORDER_PARTN_MUL_UP
IT_OPERATION    LIKE    BAPI_ALM_ORDER_OPERATION
工序信息
IT_OPERATION_UP    LIKE    BAPI_ALM_ORDER_OPERATION_UP
IT_RELATION    LIKE    BAPI_ALM_ORDER_RELATION
IT_RELATION_UP    LIKE    BAPI_ALM_ORDER_RELATION_UP
IT_COMPONENT    LIKE    BAPI_ALM_ORDER_COMPONENT
组件信息
IT_COMPONENT_UP    LIKE    BAPI_ALM_ORDER_COMPONENT_UP
IT_TEXT    LIKE    BAPI_ALM_TEXT
IT_TEXT_LINES    LIKE    BAPI_ALM_TEXT_LINES
EXTENSION_IN    LIKE    BAPIPAREX
RETURN    LIKE    BAPIRET2
返回消息
ET_NUMBERS    LIKE    BAPI_ALM_NUMBERS
返回订单编码信息

1、创建一个带工序的订单
  CLEAR IT_METHODS.
  IT_METHODS-REFNUMBER = '1'.”对应下面header表中相应行的数据
  IT_METHODS-OBJECTTYPE = 'HEADER'.”需要操作的对象类型
  IT_METHODS-METHOD = 'CREATE'.”相应动作
  IT_METHODS-OBJECTKEY = '%00000000001'.”PM订单号,我们用的系统内部给号,此处使用临时编码'%00000000001',bapi结束时,会返回真正的订单号
  APPEND IT_METHODS.
  CLEAR IT_METHODS.
  IT_METHODS-REFNUMBER = '1'.”对应下面OPERATION表中相应行的数据
  IT_METHODS-OBJECTTYPE = 'OPERATION'.”需要操作的对象类型
  IT_METHODS-METHOD = 'CREATE'.”相应动作
  IT_METHODS-OBJECTKEY = '%00000000001'.”PM订单号,我们用的系统内部给号,此处使用临时编码'%00000000001',bapi结束时,会返回真正的订单号
  APPEND IT_METHODS.”多个工序时,要加入多条数据,REFNUMBER 对应OPERATION的行数
  CLEAR IT_METHODS.
  IT_METHODS-METHOD = 'SAVE'.”最后要插入一个save或dialog方法,否则bapi会报错
  APPEND IT_METHODS.”IT_METHODS已经填充完毕

"填充header数据 
  IT_HEADER-ORDERID = '%00000000001'.”临时订单号
  IT_HEADER-ORDER_TYPE = 'PM11'..”订单类型
  IT_HEADER-EQUIPMENT = ‘JB200101’.
  IT_HEADER-SHORT_TEXT= 'PM ORDER TEXT'.
  .........
  APPEND IT_HEADER

"填充工序数据表
  IT_OPERATION-ACTIVITY = ‘0010’.”operation num
  IT_OPERATION-DESCRIPTION = ‘operation text’.
  IT_OPERATION-CONTROL_KEY = 'PM01'.”control key
APPEND IT_OPERATION."多个工序加入多条,要和IT_method对应。

CALL FUNCTION 'BAPI_ALM_ORDER_MAINTAIN'
    TABLES
      IT_METHODS             = IT_METHODS
      IT_HEADER              = IT_HEADER
*   IT_HEADER_UP           =
*   IT_HEADER_SRV          =
*   IT_HEADER_SRV_UP       =
*   IT_USERSTATUS          =
*   IT_PARTNER             =
*   IT_PARTNER_UP          =
      IT_OPERATION           = IT_OPERATION
*   IT_OPERATION_UP        =
*   IT_RELATION            =
*   IT_RELATION_UP         =
*   IT_COMPONENT           =
*   IT_COMPONENT_UP        =
*   IT_TEXT                =
*   IT_TEXT_LINES          =
*   EXTENSION_IN           =
   RETURN                 = RETURN
   ET_NUMBERS             = ET_NUMBERS
            .
然后判断RETURN中的消息,做BAPI_TRANSACTION_COMMIT或者BAPI_TRANSACTION_ROLLBACK,这样就创建了一个PM订单。

2、修改一个PM订单的组件信息。
  CLEAR IT_METHODS.
  IT_METHODS-REFNUMBER = '1'.
  IT_METHODS-OBJECTTYPE = 'COMPONENT'."
  IT_METHODS-METHOD = 'CHANGE'.
  IT_METHODS-OBJECTKEY = ‘90012343’.“订单号
  APPEND IT_METHODS.”如果修改多个组件,要加入多条
  CLEAR IT_METHODS.
  IT_METHODS-METHOD = 'SAVE'.
  APPEND IT_METHODS.
    CLEAR IT_COMPONENT.
    IT_COMPONENT-RESERV_NO = ‘18933‘.“预留号
    IT_COMPONENT-RES_ITEM = ’1‘.预留项目
    IT_COMPONENT-WITHDRAWN = 'X'.“最后发货标识,要修改这个字段
    APPEND IT_COMPONENT.”如果修改多个组件,要加入多条
    IT_COMPONENTUP-WITHDRAWN = 'X'.“最后发货标识,要修改哪个字段,需要在UP表中将该字段值为X
    APPEND IT_COMPONENTUP.”如果修改多个组件,要加入多条

  CALL FUNCTION 'BAPI_ALM_ORDER_MAINTAIN'
    TABLES
      IT_METHODS             = IT_METHODS
*     IT_HEADER              =
*     IT_HEADER_UP           =
*     IT_HEADER_SRV          =
*     IT_HEADER_SRV_UP       =
*     IT_USERSTATUS          =
*     IT_PARTNER             =
*     IT_PARTNER_UP          =
*     IT_OPERATION           =
*     IT_OPERATION_UP        =
*     IT_RELATION            =
*     IT_RELATION_UP         =
     IT_COMPONENT           = IT_COMPONENT
     IT_COMPONENT_UP        = IT_COMPONENTUP
*     IT_TEXT                =
*     IT_TEXT_LINES          =
*     EXTENSION_IN           =
     RETURN                 = RETURN
     ET_NUMBERS             = ET_NUMBERS
            .
然后做transaction commit或rollback操作就OK了

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Cpp五条/article/detail/323819
推荐阅读
相关标签
  

闽ICP备14008679号