2009 Feb 18 7:36 PM
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
2009 Feb 18 7:49 PM
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
2009 Feb 18 9:48 PM
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
2009 Feb 18 10:38 PM
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.
2009 Feb 18 10:48 PM
2009 Feb 19 4:48 PM
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
2009 Feb 23 7:41 PM
I solved the issue,
the internal table TOTAl also must be mofified with the data in extract.
Thanks for all your support
Srinivas