cancel
Showing results for 
Search instead for 
Did you mean: 

T.code Automatic Lock and Release method

Former Member
0 Kudos
187

Hi

We want to introduce particular t.codes locking and automatic releasing based on time slot. Now we have used thro sm01 manually. Is there any possible please tell how to proceed.

Thanks in advance..

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

We have written Z programs similar to the above and also scheduled batch job based on those programs to accomplish what you wanted.

former_member192350
Active Participant
0 Kudos

Here is some code I used to lock HR transactions while payroll would run:

select * from tstc where tcode in ('PA30', 'PA40', 'PA61', 'PT69').

perform bit-set using tstc-cinfo 6. "set lock bit

update tstc.

commit work.

To unlock later, we'd use:

perform bit-reset using tstc-cinfo 6. "unset the lock bit

update tstc.

commit work.

Here are the bit-set and bit-reset forms:

FORM bit-set using hexval type x bitpos type p.

case bitpos.

when 8. if hexval o x80. else. hexval = hexval + x80. endif.

when 7. if hexval o x40. else. hexval = hexval + x40. endif.

when 6. if hexval o x20. else. hexval = hexval + x20. endif.

when 5. if hexval o x10. else. hexval = hexval + x10. endif.

when 4. if hexval o x08. else. hexval = hexval + x08. endif.

when 3. if hexval o x04. else. hexval = hexval + x04. endif.

when 2. if hexval o x02. else. hexval = hexval + x02. endif.

when 1. if hexval o x01. else. hexval = hexval + x01. endif.

when others.

endcase.

ENDFORM. " bit-set

FORM bit-reset using hexval type x bitpos type p.

case bitpos.

when 8. if hexval o x80. hexval = hexval - x80. endif.

when 7. if hexval o x40. hexval = hexval - x40. endif.

when 6. if hexval o x20. hexval = hexval - x20. endif.

when 5. if hexval o x10. hexval = hexval - x10. endif.

when 4. if hexval o x08. hexval = hexval - x08. endif.

when 3. if hexval o x04. hexval = hexval - x04. endif.

when 2. if hexval o x02. hexval = hexval - x02. endif.

when 1. if hexval o x01. hexval = hexval - x01. endif.

when others.

endcase.

ENDFORM. " bit-reset