Skip to Content
0
Former Member
Jun 02, 2009 at 10:35 AM

Not able to Update BUT000 Table.

195 Views

Hi All,

My requirement is to add one more field in BUT000 table. This filed should be a timestamp field which is created out of existing fields CHDAT and CHTIM. So i have added new timestamp field using Append Structure in BUT000 table and used BADI: PARTNER_UPDATE to pouplate the timestamp field. following is logic coded in above BADI.

METHOD if_ex_partner_update~change_before_update.

DATA: lt_but000_new TYPE TABLE OF but000,

lt_but000_new1 TYPE TABLE OF but000,

ls_but000_new TYPE but000,

lv_timestamp TYPE tzntstmps,

lv_date TYPE bu_chdat,

lv_time TYPE bu_chtim.

CONSTANTS: lc_timezone TYPE tznzone VALUE 'UTC'.

CALL FUNCTION 'BUPA_GENERAL_CALLBACK'

TABLES

  • ET_BUT000_OLD =

et_but000_new = lt_but000_new

  • ET_BUT000_TD_NEW =

  • ET_BUT000_TD_OLD =

.

READ TABLE lt_but000_new INTO ls_but000_new INDEX 1.

IF NOT ls_but000_new-chdat IS INITIAL.

CONVERT DATE ls_but000_new-chdat TIME ls_but000_new-chtim

INTO TIME STAMP lv_timestamp TIME ZONE sy-zonlo.

ELSE.

CONVERT DATE ls_but000_new-crdat TIME ls_but000_new-crtim

INTO TIME STAMP lv_timestamp TIME ZONE sy-zonlo.

ENDIF.

*TRY.

CALL METHOD cl_abap_tstmp=>systemtstmp_utc2syst

EXPORTING

utc_tstmp = lv_timestamp

IMPORTING

syst_date = lv_date

syst_time = lv_time.

  • CATCH cx_parameter_invalid_range.

*ENDTRY.

CONVERT DATE lv_date TIME lv_time

INTO TIME STAMP ls_but000_new-zutctstmps TIME ZONE lc_timezone.

APPEND ls_but000_new TO lt_but000_new1.

UPDATE but000 FROM TABLE lt_but000_new1.

ENDMETHOD.

But i am not able to Update the timestamp data in BUT000 table.

Please help.

Regrads,

S K