使用哪个BAPI来更新ADRC表



是否有任何方法可以通过使用SAP外部的BAPI将数据写入或插入ADRC表?

最好的候选者是BAPI_ADDRESSORG_CHANGE,它可以删除/更新地址记录、电子邮件、笔记、电话等。

代码示例(来自标准帮助(:

DATA: objtype    LIKE bapi4001_1-objtype,
obj_id     LIKE bapi4001_1-objkey,
obj_id_ext LIKE bapi4001_1-extension,
context    LIKE bapi4001_1-context,
address_number LIKE adrc-addrnumber,
bapiadtel  LIKE bapiadtel OCCURS 0 WITH HEADER LINE,
bapiadtel_x LIKE bapiadtelx OCCURS 0 WITH HEADER LINE,
return     LIKE bapiret2 OCCURS 0.
* Assign the following object type and object key to a main customer address
objtype = 'KNA1'.
obj_id  = <customer number>.
obj_id_ext = ' '.
context = '0001'.
* Get existing data by calling, e.g. FM 'BAPI_ADDRESSORG_GETDETAIL'
* Enter the reference structure data
* The telephone number with serial number '002' is to be deleted and the one with serial number '003' updated
CLEAR: bapiadtel, bapiadtel_x.
bapiadtel-consnumber = '002'.
bapiadtel_x-updateflag = 'D'.
APPEND: bapiadtel, bapiadtel_x. "Delete entry
CLEAR: bapiadtel, bapiadtel_x.
bapiadtel-consnumber = '003'.
bapiadtel-extension = '77733'.
bapiadtel_x-extension = 'X'.
bapiadtel_x-updateflag = 'U'
APPEND: bapiadtel, bapiadtel_x. "Update entry
CLEAR: bapiadtel, bapiadtel_x.
bapiadtel-telephone = '06227'.
bapiadtel-extension = '11111'.
bapiadtel_x-updateflag = 'I'.
APPEND: bapiadtel, bapiadtel_x. "Insert new entry
CALL FUNCTION 'BAPI_ADDRESSORG_CHANGE'
EXPORTING
obj_type       = objtype
obj_id         = obj_id
obj_id_ext     = obj_id_ext
context        = context
IMPORTING
address_number = address_number
TABLES
bapiadtel      = bapiadtel
bapiadtel_x    = bapiadtel_x
return         = return.

相关内容

  • 没有找到相关文章

最新更新