Update Master Data attribute via ABAP – Example program

*&———————————————————————*
*& Report  ZTST_RSDMD_WRITE_ATTRI
*&
*&———————————————————————*
*&
*&
*&———————————————————————*

REPORT  ZTST_RSDMD_WRITE_ATTRI.

PARAMETERS:
p_wbs type /bi0/oiwbs_elemt.

data:
lt_idocstate type RSARR_T_IDOCSTATE,
l_subrc type sy-subrc,
ls_pwbs_elemt type /bi0/pwbs_elemt,
lt_pwbs_elemt type table of /bi0/pwbs_elemt,
ls_attr type RSD_s_IOBJNM,
lt_attr type RSD_T_IOBJNM.

ls_attr-iobjnm = ‘ISTARTDAT’.
append ls_attr to lt_attr.

ls_pwbs_elemt-wbs_elemt = p_wbs.
ls_pwbs_elemt-/bic/istartdat = ‘19690301’.
append ls_pwbs_elemt to lt_pwbs_elemt.

CALL FUNCTION ‘RSDMD_WRITE_ATTRIBUTES_TEXTS’
EXPORTING
i_iobjnm                     = ‘0WBS_ELEMT’
i_tabclass                   = ‘M’
I_T_ATTR                     = lt_attr
*   I_S_MINFO                    =
*   I_REQUNR                     =
*   I_DATAPAKID                  =
*   I_MONITORING                 =
*   I_CREATE_STATISTICS          = RS_C_TRUE
IMPORTING
E_T_IDOCSTATE                = lt_idocstate
E_SUBRC                      = l_subrc
TABLES
i_t_table                    = lt_pwbs_elemt
EXCEPTIONS
ATTRIBUTE_NAME_ERROR         = 1
IOBJ_NOT_FOUND               = 2
GENERATE_PROGRAM_ERROR       = 3
OTHERS                       = 4.
.
IF sy-subrc <> 0.
* Implement suitable error handling here
exit.
ENDIF.

CALL FUNCTION ‘RSDMD_MD_ACTIVATE’
EXPORTING
i_chabasnm       = ‘0WBS_ELEMT’.

Leave a Reply