Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Table Maintainence Events

Former Member
0 Likes
817

I had 7 fields in my Ztable

Field 1 -


Key

Field 2 --- Non Key

Field 3 -- Non Key

CREATED_DATE,MODIFIED_DATE,CREATED_BY,MODIFIED_BY

Iam having issue with the changing an entry,But if i change an entry for the non key fields, the modified date and modified by are not updating with the new values.....I tried it by using events 18,02,01.

See my code as below.

FORM

CLEAR EXTRACT.

LOOP AT TOTAL.

CHECK <ACTION> = AENDERN.

READ TABLE EXTRACT WITH KEY TOTAL.

IF SY-SUBRC = 0.

EXTRACT+62(8) = SY-DATUM.

EXTRACT+82(12) = SY-UNAME.

ENDIF.

MODIFY EXTRACT FROM EXTRACT INDEX SY-TABIX.

ENDLOOP.

ENDFORM.

Please suggest me where iam doing wrong.

Regards

Srinivas Manda

I had 7 fields in my Ztable

Field 1 -


Key

Field 2 --- Non Key

Field 3 -- Non Key

CREATED_DATE,MODIFIED_DATE,CREATED_BY,MODIFIED_BY

Iam having issue with the changing an entry,But if i change an entry for the non key fields, the modified date and modified by are not updating with the new values.....I tried it by using events 18,02,01.

See my code as below.

FORM

CLEAR EXTRACT.

LOOP AT TOTAL.

CHECK <ACTION> = AENDERN.

READ TABLE EXTRACT WITH KEY TOTAL.

IF SY-SUBRC = 0.

EXTRACT+62(8) = SY-DATUM.

EXTRACT+82(12) = SY-UNAME.

ENDIF.

MODIFY EXTRACT FROM EXTRACT INDEX SY-TABIX.

ENDLOOP.

ENDFORM.

Please suggest me where iam doing wrong.

Regards

Srinivas Manda

6 REPLIES 6
Read only

Former Member
0 Likes
779

Hi,

would you please tell me the fields you have inserted in the field group.... because modifying the table requires the key field to search the entries... and moreover try using

MODIFY ztable FROM EXTRACT INDEX SY-TABIX.

Regards,

Siddarth

Read only

0 Likes
779

Hi Siddarth,

When i change an entry in Sm30, the field 2 and field 3 are updating in the table with the new values,

But the changed on and modified by are not getting changed.

Iam using the table maintainence event 18 .

If the event what iam using is not the right one, let me know.

Regards

Srinivas Manda

Read only

Former Member
0 Likes
779

First define your work areas as below and then you have to change both TOTAL and EXTRACT. You can use event 01 for this.


data:  begin of lwa_total occurs 0.
          include structure ZTABLE.
data:     action       type c,
         end of lwa_total.

data:  begin of lwa_extract occurs 0.
          include structure ZTABLE.
data:     action       type c,
         end of lwa_extract.

data   l_index  like sy-tabix.

loop at total into wa_total.
   l_index = sy-tabix.
   wa_total-last_changed_by  = sy-uname.
   wa_total-last_changed_dte = sy-datum.
   modify total index l_index from wa_total.
*-- Change Extract 
   read table extract index l_index into wa_extract.
   wa_extract-last_changed_by = sy-uname.
   wa_extract-last_changed_dte = sy-datum.
   modify extract index l_index from wa_extract.
endloop.

Read only

0 Likes
779

>

Hi Srinivas - long time, no see!

Rob

Read only

0 Likes
779

Hi Srinivas,

If you see my code, iiam modifying the data in the extract.

But still the modified date and changed name are not getting updated in the table.

FORM

CLEAR EXTRACT.

LOOP AT TOTAL.

CHECK <ACTION> = AENDERN.

READ TABLE EXTRACT WITH KEY TOTAL.

IF SY-SUBRC = 0.

EXTRACT+62(8) = SY-DATUM.

EXTRACT+82(12) = SY-UNAME.

ENDIF.

MODIFY EXTRACT FROM EXTRACT INDEX SY-TABIX.

ENDLOOP.

ENDFORM.

Please suggest.

Regards

Srinivas Manda

Read only

Former Member
0 Likes
779

I solved the issue,

the internal table TOTAl also must be mofified with the data in extract.

Thanks for all your support

Srinivas