ABAP 对BP进行增强后(字段扩充)后,如何通过BAPI创建BP

2020-11-30 09:55:57 浏览数 (1)

代码语言:javascript复制
*&---------------------------------------------------------------------*
*& Report  Y_ERIC_CREATE_BP
*&
*&---------------------------------------------------------------------*

REPORT  y_eric_create_bp.

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.
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 10 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-zzdate = '20070819'.

  it_custo-zztstfd = '1'.
  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'. 

0 人点赞