如何使用BAPI_OUTB_DELIVERY_CHANGE参数EXTENSION2更新Z字段



如何使用EXTENSION2BAPI_OUTB_DELIVERY_CHANGE更新Z字段?

我试图使用BAPI更新LIKP表中的一些Z字段以更新交付,但在调用它之后,没有进行任何更改。

有什么建议吗?

我找到了BAdI-SMOD_V50B0001。我进行了一个增强实现,并在方法EXIT_SAPLV50I_010(更改为Outbound Delivery的用户出口BAPI(中设置了以下代码。

METHOD if_ex_smod_v50b0001~exit_saplv50i_010.
CONSTANTS: lc_vbkok    TYPE char5  VALUE 'VBKOK',           "Enhance the structure for more z fields in LIKP
lc_vbpok    TYPE char5  VALUE 'VBPOK',           "Enhance the structure for more z fields in LIPS
lc_cs_vbkok TYPE char8  VALUE 'CS_VBKOK'.
DATA: lv_item TYPE posnr_vl.
FIELD-SYMBOLS: <lfs_fieldname> TYPE any.
LOOP AT extension2 INTO DATA(lw_extension2).
CASE lw_extension2-param.
"As a structure in row 0
WHEN lc_vbkok. "Fields for LIKP
ASSIGN (lc_cs_vbkok) TO FIELD-SYMBOL(<lfs_vbkok>).
IF <lfs_vbkok> IS ASSIGNED.
ASSIGN COMPONENT lw_extension2-field OF STRUCTURE <lfs_vbkok> TO <lfs_fieldname>.
IF <lfs_fieldname> IS ASSIGNED.
<lfs_fieldname> = lw_extension2-value.
ENDIF.
ENDIF.
"As a table from row 1 to n
WHEN lc_vbpok. "Fields for LIPS
MOVE lw_extension2-row TO lv_item.
READ TABLE ct_vbpok ASSIGNING FIELD-SYMBOL(<lfs_vbpok>) WITH KEY posnr_vl = lv_item.
IF sy-subrc = 0.
ASSIGN COMPONENT lw_extension2-field OF STRUCTURE <lfs_vbpok> TO <lfs_fieldname>.
IF <lfs_fieldname> IS ASSIGNED.
<lfs_fieldname> = lw_extension2-value.
ENDIF.
ENDIF.
ENDCASE.
ENDLOOP.
ENDMETHOD.

将结构VBKOK和LIKP与appen结构结合以添加新的z场,并出于相同目的增强结构VBPOK和LIPS。

还可以查看程序LV50LF01,并需要实现一个额外的增强点来保持这些值。

在这之后,我想我明白了。

METHOD m_update_delivery.
DATA: lw_header_data    TYPE bapiobdlvhdrchg,
lw_header_control TYPE bapiobdlvhdrctrlchg,
lw_extension2     TYPE bapiext.
DATA: li_extension2 TYPE TABLE OF bapiext,
li_return     TYPE TABLE OF bapiret2.
DATA: lv_delivery TYPE bapiobdlvhdrchg-deliv_numb.
lw_header_data-deliv_numb = p_w_output-delivery.
lw_header_control-deliv_numb = p_w_output-delivery.
lv_delivery = p_w_output-delivery.
lw_extension2-param = 'VBKOK'.
lw_extension2-field = 'ZZEXIDV'.
lw_extension2-value = p_w_output-value.
APPEND lw_extension2 TO li_extension2.
" Call BAPI to update delivery
CALL FUNCTION 'BAPI_OUTB_DELIVERY_CHANGE'
EXPORTING
header_data    = lw_header_data
header_control = lw_header_control
delivery       = lv_delivery
TABLES
extension2     = li_extension2
return         = li_return.
READ TABLE li_return INTO DATA(lw_return)
WITH KEY type = c_e.
IF sy-subrc <> 0.
COMMIT WORK AND WAIT.
ENDIF.
ENDMETHOD.

您需要在BAPI功能模块后添加BAPI_COMMIT

相关内容

  • 没有找到相关文章

最新更新