Application Development 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: 

Re:ABAP

Former Member
0 Kudos

Hi,

I have created one log table , my requirement is when i modify some fields say four fields the old values and new values should store in the fields of the logtable, how to do this, iam changing my value in the table control and clicking modify button

WHEN 'MODIFY'.

REFRESH I_ZSDSHR14.

CLEAR OKCODE.

LOOP AT T_ZSDSHR14.

CLEAR ZSDSHR14.

SELECT SINGLE * FROM ZSDSHR14 WHERE ZCCODE = T_ZSDSHR14-ZCCODE AND

ZSOLD = T_ZSDSHR14-ZSOLD AND

ZPACKLISTFLAG = T_ZSDSHR14-ZPACKLISTFLAG AND

ZPROFORMADOFLAG = T_ZSDSHR14-ZPROFORMADOFLAG AND

ZSHIPALERTFLAG = T_ZSDSHR14-ZSHIPALERTFLAG AND

ZEMAILFORMAT = T_ZSDSHR14-ZEMAILFORMAT.

IF ZSDSHR14-ZPACKLISTFLAG <> T_ZSDSHR14-ZPACKLISTFLAG OR

ZSDSHR14-ZPROFORMADOFLAG <> T_ZSDSHR14-ZPROFORMADOFLAG OR

ZSDSHR14-ZSHIPALERTFLAG <> T_ZSDSHR14-ZSHIPALERTFLAG OR

ZSDSHR14-ZEMAILFORMAT <> T_ZSDSHR14-ZEMAILFORMAT.

T_ZSDSHR14-ZUPDATE = SY-DATUM.

T_ZSDSHR14-ZUPDTIME = SY-UZEIT.

T_ZSDSHR14-ZUPDATEBY = SY-UNAME.

ZSDSHR14_LOG-Z_ACTION = 'MODIFIED '. -


> inserting into log table

ZSDSHR14_LOG-ZUSER = SY-UNAME.

ZSDSHR14_LOG-ZUZEIT = SY-UZEIT.

ZSDSHR14_LOG-ZDATUM = SY-DATUM.

INSERT ZSDSHR14_LOG.

1 REPLY 1

Former Member
0 Kudos

I feel you need to add new entry to table ZSDSHR14_LOG with modification details as well as old and new values.

Now after SELECT, when you compare old and new values, if any of the value is changed, you need to populate all entries for ZSDSHR14_LOG record which will be inserted.

If you want to modify existing record of the table ZSDSHR14_LOG with new values, you need to use MODIFY instead of INSERT.