Code Sample 3 Updating Extended Attributes (Storage Location)

The below program takes the User Id and the list of storage location attribute values and updates them.

The program uses the standard function module BBP_UPDATE_ATTRIBUTES to update the storage location values for the user.

Note: To update multiple values, all the values needs to be passed.

In FM BBP_UPDATE_ATTRIBUTES , when REPLACE_P parameter value is marked as 'X' then old values of attributes will be replaced by new one if not they will be added.

Program to Update Extended Attributes (Storage Location)
*&---------------------------------------------------------------------*
*& Report  ZKB_UPDATE_STORAGE_LOC
*&---------------------------------------------------------------------*
* This program is used to update the values in Extended Attributes,
*  in this example the attribute Storage Location is updated (LAG)
*&---------------------------------------------------------------------*

REPORT  zkb_update_storage_loc.

* Declaration for Internal Tables
DATA: lt_bbp_attributes TYPE TABLE OF bbp_attributes.

* Declaration for Structures
DATA: ls_bbp_attributes TYPE bbp_attributes.

* Populate the Storage Location Value
CLEAR ls_bbp_attributes.
ls_bbp_attributes-attr_id      = 'LAG'. "Storage Location
ls_bbp_attributes-value_logsys = '<BACKEND SYS>'.
ls_bbp_attributes-value(20)    = '<Storage Loc>'.
ls_bbp_attributes-value+20(10) = '<BACKEND SYS>'.
ls_bbp_attributes-value+30(4)  = '<Company Code>'.
APPEND ls_bbp_attributes TO lt_bbp_attributes.

* Function Call to Update Values
CALL FUNCTION 'BBP_UPDATE_ATTRIBUTES'
  EXPORTING
    user_id_p           = 'USER ID'
    scenario_p          = 'BBP'
    start_date_p        = sy-datum
    end_date_p          = '99991231'
  TABLES
    it_attr_p           = lt_bbp_attributes
  EXCEPTIONS
    object_id_missed    = 1
    no_active_plvar     = 2
    object_not_found    = 3
    no_attributes       = 4
    times_invalid       = 5
    inconsistent_values = 6
    update_error        = 7
    ambiguous_position  = 8
    OTHERS              = 9.
IF sy-subrc <> 0.
  MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
          WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
*  Save to DB
  COMMIT WORK AND WAIT.
ENDIF.

Labels

srm_extended_attributes srm_extended_attributes Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.