Skip to Content
0
Former Member
Aug 24, 2012 at 09:50 PM

Table Maintenance Events

20 Views

Hi Friends,

I have 3 z tables and each has one view created.

Tables

1.ZTT_RGA_DISPCODE -fields--Cost center,created on,createdby,changed on ,changedby

2.ZTT_RGA_RSN_CODE

-fields--Cost center,created on,createdby,changed on ,changedby

3.

ZTT_RGA_MTRL_CON

-fields--Cost center,created on,createdby,changed on ,changedby

Using event Create New entry ,i have a routine.

Issue:

When i am entrying a new entry in sm30 ,cost center does not exist,but the entry is available in the CSKS table.the Created on ,createdby should automatically populate..

Do i need to change any thing in the code below.

Please let me know any if you are not clear about my question.

FORM create_new.

ztt_rga_dispcode-created_on = sy-datum.

ztt_rga_dispcode-created_by = sy-uname.

ztt_rga_dispcode-changed_on = sy-datum.

ztt_rga_dispcode-changed_by = sy-uname.

MODIFY ztt_rga_dispcode.

ENDFORM. "CREATE_NEW

*&---------------------------------------------------------------------*

*& Form CONTENT_CHANGE

*&---------------------------------------------------------------------*

*

*----------------------------------------------------------------------*

FORM content_change.

BREAK-POINT.

ztt_rga_dispcode-changed_on = sy-datum.

ztt_rga_dispcode-changed_by = sy-uname.

MODIFY ztt_rga_dispcode.

ENDFORM. "CONTENT_CHANGE

*&---------------------------------------------------------------------*

*& Form CREATE_NEW1

*&---------------------------------------------------------------------*

* Event for Material number conversion:ZTT_RGA_MTRL_CON

*----------------------------------------------------------------------*

FORM CREATE_NEW1.

ZTT_RGA_MTRL_CON-created_on = sy-datum.

ZTT_RGA_MTRL_CON-created_by = sy-uname.

ZTT_RGA_MTRL_CON-changed_on = sy-datum.

ZTT_RGA_MTRL_CON-changed_by = sy-uname.

ENDFORM. "CREATE_NEW1

*&---------------------------------------------------------------------*

*& Form CREATE_NEW2

*&---------------------------------------------------------------------*

* Events for Reason code table:ZTT_RGA_RSN_CON

*----------------------------------------------------------------------*

FORM CREATE_NEW2.

data: gs_data TYPE ZTT_RGA_RSN_CODE.

ZTT_RGA_RSN_CODE-created_on = sy-datum.

ZTT_RGA_RSN_CODE-created_by = sy-uname.

ZTT_RGA_RSN_CODE-changed_on = sy-datum.

ZTT_RGA_RSN_CODE-changed_by = sy-uname.

data: lv_index TYPE sy-tabix VALUE '1'.

read TABLE extract INDEX sy-tabix.

IF sy-subrc is INITIAL.

gs_data-changed_on = sy-datum.

gs_data-changed_by = sy-uname.

modify ZTT_RGA_RSN_CODE from gs_data .

ENDIF.