프로그래밍/SAP ABAP

[SAP/FI] S4/HANA 버전에서 BSID 테이블 업데이트하기

2022. 2. 4. 15:55

S4/HANA 버전에서는 BSID, BSIK 테이블이 View 로 되어 있기 때문에

해당 테이블에 update 하는 로직을 만들 수가 없다. 

 => source 에서 syntax error 발생함.

The database view "BSID" is read-only and cannot be changed.

The database view "BSIK" is read-only and cannot be changed.

 

=> 해결방법 : FB02 에서 변경 처리가 되도록 BDC Function 을 이용함.

 

<참고 소스>

 

DATA: ls_bseg   TYPE bseg,

      lt_errdoc TYPE tpit_t_errdoc,

      lt_fname  TYPE tpit_t_fname,

      lt_buztab TYPE tpit_t_buztab.

 

* Field name to be changed

APPEND 'CESSION_KZ' TO lt_fname.

 

* New field value

ls_bseg-cession_kz = 'AB'.

 

* Selection of items to be changed

* Only select customer items to avoid problems in batch input

SELECT bukrs belnr gjahr buzei koart umskz bschl mwart mwskz

  FROM bseg

  INTO CORRESPONDING FIELDS OF TABLE lt_buztab

  WHERE belnr = '1400000000' AND

        bukrs = '1000' AND

        koart = 'D'. "Customers

 

CALL FUNCTION 'FI_ITEMS_MASS_CHANGE'

  EXPORTING

    s_bseg     = ls_bseg

  IMPORTING

    errtab     = lt_errdoc[]

  TABLES

    it_buztab  = lt_buztab

    it_fldtab  = lt_fname

  EXCEPTIONS

    bdc_errors = 1

    OTHERS     = 2.

 

IF sy-subrc <> 0.

  MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.