Application Development and Automation 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: 
Read only

Lock Object

Former Member
0 Likes
577

Hi SDN's

The table which i used to create the Lock Object has 3 Key fields. But my Z transaction is totally based on a differenet non-key field. So when i create the Lock Object the FM's generated have the import parameters as the key fields of the table only. But how do i lock the transaction now based on a non-key field which is not shown in the lock object -> lock parameter tab

Regards

Pratyusha

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
540

Hi,

If it is the same key field..Then lock it once..Otherwise..

IF all the records is having unique values for the key field.

-


READ TABLE ITAB INDEX 1.

CALL FUNCTION 'ENQUEUE.....'

EXPORTING

....

IF SY-SUBRC <> 0.

MESSAGE E208(00) WITH 'Record already locked'.

ENDIF.

IF there are mulitple key field values .

-


LOOP AT ITAB.

CALL FUNCTION 'ENQUEUE.....'

EXPORTING

....

IF SY-SUBRC <> 0.

MESSAGE E208(00) WITH 'Record already locked'.

ENDIF.

ENDLOOP.

Thanks,

Naren

5 REPLIES 5
Read only

Former Member
0 Likes
540

Hi,

Get the key values for the non-key field..

Then lock those records using the key values..

I believe you cannot lock a record by giving a non-key field..

Thanks,

Naren

Read only

0 Likes
540

Yes, i cant lock it based on the non-key,

the internal table with this non-key field has many records with the same key fields

so in such cases can i use the FM inside a loop. will that be a problem on the functionality?

Thanks

Pratyusha

Read only

Former Member
0 Likes
541

Hi,

If it is the same key field..Then lock it once..Otherwise..

IF all the records is having unique values for the key field.

-


READ TABLE ITAB INDEX 1.

CALL FUNCTION 'ENQUEUE.....'

EXPORTING

....

IF SY-SUBRC <> 0.

MESSAGE E208(00) WITH 'Record already locked'.

ENDIF.

IF there are mulitple key field values .

-


LOOP AT ITAB.

CALL FUNCTION 'ENQUEUE.....'

EXPORTING

....

IF SY-SUBRC <> 0.

MESSAGE E208(00) WITH 'Record already locked'.

ENDIF.

ENDLOOP.

Thanks,

Naren

Read only

0 Likes
540

Hi Narendran,

Thanks, its working absolutely fine...

But how do i come to know whihc <b>USER</b> is already locked, coz i wnt to display the <b>User Name</b> as well with the Lock Message

Regards

Pratyusha

Read only

Former Member
0 Likes
540

Still one issue to be resolved in this...Please help

Please see my query in the new thread