*&---------------------------------------------------------------------*
*& Report Z_GHW_CREATE_BP *
*& *
*&---------------------------------------------------------------------*
*& 对BP进行增强后(字段扩充)后,如何通过BAPI创建BP *
*& 2007.05.31 Gong huiwen
**
*&---------------------------------------------------------------------*
REPORT z_ghw_create_bp .
TABLES:bapibus1006_central.
DATA: it_header TYPE bapibus1006_head OCCURS 0 WITH HEADER LINE.
DATA: it_centr TYPE bapibus1006_central OCCURS 0 WITH HEADER LINE.
DATA: g_bp LIKE bapibus1006_head-bpartner.
"1 个人
"2 组织
"3 组
DATA: g_cat LIKE bapibus1006_head-partn_cat VALUE '1'.
DATA: it_guid LIKE bus000___i OCCURS 0 WITH HEADER LINE.
DATA: it_custo LIKE bus000_eew OCCURS 0 WITH HEADER LINE.
DATA: i_centraldataperson LIKE bapibus1006_central_person OCCURS 0 WITH
HEADER LINE.
DATA: t_centraldataperson LIKE bapibus1006_central_person OCCURS 0 WITH
HEADER LINE.
DATA: i_times TYPE n LENGTH 3 VALUE 1.
DO 1 TIMES.
i_centraldataperson-firstname = 'xxxxxxxxxx'.
CONCATENATE i_centraldataperson-firstname i_times INTO
i_centraldataperson-firstname.
i_centraldataperson-lastname = 'yyyyyyyy'.
CONCATENATE i_centraldataperson-lastname i_times INTO
i_centraldataperson-lastname.
APPEND i_centraldataperson.
i_times = i_times + 1.
ENDDO.
LOOP AT i_centraldataperson.
CLEAR t_centraldataperson.
REFRESH t_centraldataperson.
MOVE-CORRESPONDING i_centraldataperson TO t_centraldataperson.
APPEND t_centraldataperson.
CALL FUNCTION 'BAPI_BUPA_CREATE_FROM_DATA'
EXPORTING
partnercategory = g_cat
centraldata = it_centr
centraldataperson = t_centraldataperson
IMPORTING
businesspartner = g_bp.
CALL FUNCTION 'BUP_MEMORY_BUT000_GET'
EXPORTING
iv_partner = g_bp
IMPORTING
es_but000 = it_guid.
READ TABLE it_guid INDEX 1.
CLEAR it_custo.
REFRESH it_custo.
it_custo-partnr_guid = it_guid-partner_guid.
it_custo-zzzghw01 = '50010'.
APPEND it_custo.
CALL FUNCTION 'BUPA_CENTRAL_CI_CHANGE'
EXPORTING
is_bus000_eew = it_custo
* IS_BUS000_EEW_X =
* IV_XSAVE = 'X'
* IMPORTING
* ET_RETURN =
.
WRITE: / g_bp.
ENDLOOP.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'. "可以写在loop里面
阅读(1251) | 评论(0) | 转发(0) |