‎2008 Dec 16 10:39 PM
Hi All,
On the user interface screen I have two flags OCflag(1) and Delflag(1), I have Ocfchg(12) and delchg(12) fields for user name who changed the flags. I have to capture the uname who changed the particular flag.
There are only few users who can change. For other users it should not change.
Can someone please help me. I wrote the following code but DELCHG and OCFCHG both are getting uname if only one of it is changed.
CASE SY-UCOMM.
WHEN 'SAVE'.
wa-kunnr = zsdcoop-kunnr.
wa-pfnum = zsdcoop-pfnum.
wa-trnum = zsdcoop-trnum.
wa-coopind = zsdcoop-coopind.
wa-subdate = zsdcoop-subdate.
wa-deldate = zsdcoop-deldate.
wa-reason = zsdcoop-reason.
wa-actdate_from = zsdcoop-actdate_from.
wa-actdate_to = zsdcoop-actdate_to.
wa-cyear = zsdcoop-cyear.
wa-actcode = zsdcoop-actcode.
wa-matnr = zsdcoop-matnr.
IF ( SY-UNAME = 'SANGL' ) OR ( SY-UNAME = 'CHANJ' ) OR ( SY-UNAME = 'HAYESL' ) OR ( SY-UNAME = 'TONIR' ).
wa-delflag = zsdcoop-delflag.
wa-DELCHG = sy-uname.
ENDIF.
IF ( SY-UNAME = 'SANGL' ) OR ( SY-UNAME = 'CHANJ' ) OR ( SY-UNAME = 'HAYESL' ) OR ( SY-UNAME = 'TONIR' ).
wa-ocflag = zsdcoop-ocflag.
wa-OCFCHG = sy-uname.
ENDIF.
MODIFY zsdcoop FROM wa.
Thanks,
Veni.
‎2008 Dec 16 10:50 PM
Do you see any difference in both If statements?
IF ( SY-UNAME = 'SANGL' ) OR ( SY-UNAME = 'CHANJ' )
OR ( SY-UNAME = 'HAYESL' ) OR ( SY-UNAME = 'TONIR' ).
Obviously both would satisfied same time.
‎2008 Dec 16 10:50 PM
Do you see any difference in both If statements?
IF ( SY-UNAME = 'SANGL' ) OR ( SY-UNAME = 'CHANJ' )
OR ( SY-UNAME = 'HAYESL' ) OR ( SY-UNAME = 'TONIR' ).
Obviously both would satisfied same time.
‎2008 Dec 16 11:00 PM
Hi,
No, but only these users are allowed to change the flag and if one of the user chages a flag then I have to capture that uname and in the chg by name field of that flag. How do I know if a flag is changed.
Thanks,
Veni.
‎2008 Dec 16 11:18 PM
Does these Flags [ (OCflag(1) and Delflag(1) ] changes the value from X or ' ' ?
Check with Debugging.
‎2008 Dec 16 11:34 PM
Hi,
Yes. Initially the flgs will be ' ' and when user wants to cancel that transaction they can put 'X' on the user interface screen and save it. Same for OCflag also.
Thanks,
veni.
‎2008 Dec 16 11:40 PM
You have written the code that way to pass sy-uname only if one is changed . You need to check the value before updating the field.
IF ( SY-UNAME = 'SANGL' ) OR ( SY-UNAME = 'CHANJ' ) OR ( SY-UNAME = 'HAYESL' ) OR ( SY-UNAME = 'TONIR' ).
if zsdcoop-flag = 'X'.
wa-delflag = zsdcoop-delflag.
wa-DELCHG = sy-uname.
endif.
if zsdcoop-ocflag = 'X'.
wa-ocflag = zsdcoop-ocflag.
wa-OCFCHG = sy-uname.
endif.
ENDIF.
‎2008 Dec 16 11:41 PM
>
>How do I know if a flag is changed.
Initially store the values of both flags in some temp variable.
Than the check these flags IF 'X' means user changed the flag.
if flag = 'X'
"Store Sy-uname here in wa.
endif.Update Ztable now.
In short you must play around these flag values,and do some work around this.
‎2008 Dec 17 12:01 AM
‎2008 Dec 17 12:46 AM
He would Resign Before Auditing, so he need not to worry much.
But atleast he save(As of now) himself by doing the hard-coding the Sy-uname
‎2008 Dec 17 12:50 AM