调用bapi:BAPI_ACC_DOCUMENT_POST创建凭证时,因为部分字段不存在,不可输入,这时可以通过EXTENSION2传入,但需要在使用badi:ACC_DOCUMENT进行增强。
参考链接:http://blog.csdn.net/longgerr/article/details/5958210
在badi的change方法进行编辑:
method IF_EX_ACC_DOCUMENT~CHANGE. DATA: wa_extension TYPE bapiparex,
ext_value(960) TYPE c,
wa_accit TYPE accit,
l_ref TYPE REF TO data.
FIELD-SYMBOLS: <l_struc> TYPE ANY,
< l_field> TYPE ANY.
SORT c_extension2 BY structure.
LOOP AT c_extension2 INTO wa_extension.
AT NEW structure.
CREATE DATA l_ref TYPE (wa_extension-structure). ASSIGN l_ref->* TO <l_struc>.
ENDAT.
CONCATENATE wa_extension-valuepart1 wa_extension-valuepart2
wa_extension-valuepart3 wa_extension-valuepart4
INTO ext_value. MOVE ext_value TO <l_struc>.
ASSIGN COMPONENT ‘POSNR‘ OF STRUCTURE <l_struc> TO <l_field>.
READ TABLE c_accit WITH KEY posnr = <l_field>
INTO wa_accit.
IF sy-subrc IS INITIAL.
MOVE-CORRESPONDING <l_struc> TO wa_accit.
MODIFY c_accit FROM wa_accit INDEX sy-tabix.
ENDIF.
ENDLOOP.
endmethod.
|
BAPI_ACC_DOCUMENT_POST相关增强的实现,布布扣,bubuko.com
BAPI_ACC_DOCUMENT_POST相关增强的实现