REPORT.
* Field TSTC-CINFO is 8-byte hexadecimal value where each bit is a flag.
* To determine if a transaction is locked, you need to test the bit that
* indicates that t is locked: x'20', ie. binary '00100000'.
* You have to use the and 'N' and or 'O' logical comparison to test the bit
* values.
TABLES tstc.
DATA x20 TYPE x VALUE '20'."eg.20 + 80 = A0.
PARAMETERS : p_tcode LIKE tstc-tcode OBLIGATORY.
START-OF-SELECTION.
SELECT SINGLE * FROM tstc WHERE tcode = p_tcode.
IF tstc-cinfo O x20. "已经被锁定, 'o': == ?
tstc-cinfo = tstc-cinfo - x20.
CALL FUNCTION 'RSAU_WRITE_SM01_LOG'
EXPORTING
tcode = p_tcode
unlock = 'X'.
ELSE. "未锁定
tstc-cinfo = tstc-cinfo + x20.
CALL FUNCTION 'RSAU_WRITE_SM01_LOG'
EXPORTING
tcode = p_tcode
lock = 'X'.
ENDIF.
MODIFY tstc.
评论