‎2007 Jan 31 2:06 AM
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
‎2007 Jan 31 2:22 AM
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
‎2007 Jan 31 2:11 AM
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
‎2007 Jan 31 2:18 AM
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
‎2007 Jan 31 2:22 AM
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
‎2007 Feb 01 2:13 AM
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
‎2007 Feb 01 2:15 AM
Still one issue to be resolved in this...Please help
Please see my query in the new thread