Supported by

Lock data in Z-tables without a locking object

If I needed to create locking entries in a ZCOISO table I had created, up to two days ago I would have gone to SE11 to create a locking object for the ZCOISO table so that I could then use the function module generated by the locking object to lock the data.

But not anymore.

Because now I know that function module ENQUEUE_E_TABLE exists.
This FM allows locking entries to be created for any table, whether a Z-table or not, without having to create a specific locking object for the table.

  data: l_tablename type tabname,
          l_varkey type vim_enqkey,
          lw_zcoiso type zcoiso.

  lw_zcoiso-kunnr = '12345'.
  l_varkey = lw_zcoiso.
  l_tabname = 'ZCOISO'.

  call function 'ENQUEUE_E_TABLE'
            tabname = l_tabname
            varkey = l_varkey
            foreign_lock = 1
            system_failure = 2
            others = 3.

Done. A locking entry is created for table ZCOISO, for the ‘12345’ table key.

Thanks to Michael Opoczynski for this tip.

Greetings from Abapinho.

3 comentários a “Lock data in Z-tables without a locking object”

  1. Vantuil Carneiro Diz:

    Valeu, obrigado pela dica, me foi muito útil.

    Usei sem informar o parâmetro varkey, pois precisava bloquear toda a tabela.


  2. Nuno Godinho Diz:

    Que bom, ainda bem! Abraço

  3. Rogério Agostinho Diz:


Deixe um comentário

About Abapinho
Abapinho runs on WordPress
Articles (RSS) e Comments (RSS).