Regarding Lock Object

Hi Experts,
Can you please guide me how i can find out the lock object name. If i know the table name. is there any table which stores the table name and lock object name for that table.
Or any function module to which i can pass table name in return i can get lock object name.
i have to do all this by coding.
Its very urgect.
Thanks in advance.
AZAD:)

Hi
Lock Objects Tables is: <b>DD25L</b>
Lock objects are use in SAP to avoid the inconsistancy at the time of data is being insert/change into database.
SAP Provide three type of Lock objects.
- Read Lock(Shared Locked)
protects read access to an object. The read lock allows other transactions read access but not write access to
the locked area of the table
- Write Lock(exclusive lock)
protects write access to an object. The write lock allows other transactions neither read nor write access to
the locked area of the table.
- Enhanced write lock (exclusive lock without cumulating)
works like a write lock except that the enhanced write lock also protects from further accesses from the
same transaction.
You can create a lock on a object of SAP thorugh transaction SE11 and enter any meaningful name start with EZ Example EZTEST_LOCK.
Use: you can see in almost all transaction when you are open an object in Change mode SAP could not allow to any other user to open the same object in change mode.
Example: in HR when we are enter a personal number in master data maintainance screen SAP can't allow to any other user to use same personal number for changes.
Technicaly:
When you create a lock object System automatically creat two function module.
1. ENQUEUE_<Lockobject name>. to insert the object in a queue.
2. DEQUEUE_<Lockobject name>. To remove the object is being queued through above FM.
You have to use these function module in your program.
check this link for example.
http://help.sap.com/saphelp_nw04s/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm
tables:vbak.
call function 'ENQUEUE_EZLOCK3'
exporting
mode_vbak = 'E'
mandt = sy-mandt
vbeln = vbak-vbeln
X_VBELN = ' '
_SCOPE = '2'
_WAIT = ' '
_COLLECT = ' '
EXCEPTIONS
FOREIGN_LOCK = 1
SYSTEM_FAILURE = 2
OTHERS = 3
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
Reward points if useful
Regards
Anji
Message was edited by:
        Anji Reddy Vangala

Similar Messages

  • Regarding Lock objects concept

    Hi,
       I am interested in knowing what is the significance of Lock objects in SAP.
       Can we co-relate SAP lock objects with Oracle.
        Frnds, I dont need any material i hav enough but i want to know the cocept behind this.
    Thanking u all.
    regards,
    suraj

    Hi,
    When you create a lock object System automatically creat two function module.
    1. ENQUEUE_<Lockobject name>. to insert the object in a queue.
    2. DEQUEUE_<Lockobject name>. To remove the object is being queued through above FM.
    http://help.sap.com/saphelp_nw04/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm
    GO TO SE11
    Select the radio button "Lock object"..
    Give the name starts with EZ or EY..
    Example: EYTEST
    Press Create button..
    Give the short description..
    Example: Lock object for table ZTABLE..
    In the tables tab..Give the table name..
    Example: ZTABLE
    Save and generate..
    Your lock object is now created..You can see the LOCK MODULES..
    In the menu ..GOTO -> LOCK MODULES..There you can see the ENQUEUE and DEQUEUE function
    Lock objects:
    http://www.sap-img.com/abap/type-and-uses-of-lock-objects-in-sap.htm
    http://help.sap.com/saphelp_nw04s/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm
    Match Code Objects:
    http://help.sap.com/saphelp_nw2004s/helpdata/en/41/f6b237fec48c67e10000009b38f8cf/content.htm
    http://searchsap.techtarget.com/tip/0,289483,sid21_gci553386,00.html
    See this link:
    http://www.sap-img.com/abap/type-and-uses-of-lock-objects-in-sap.htm
    Check these links -
    lock objects
    Lock Objects
    Lock Objects
    Regards,
    Priyanka.

  • Regarding lock objects

    Hi,
      How can we know that lock objects has been created for table or particular records..
    Naveen M.

    Hi Naveen Kumar,
    Lock Objects usually begin with the letter 'E'  -
    >  For Eg. EZLOCK
    When a lock is created or released it does with the help of some function module.
    Usually when the Lock object is created, a Funtion Module is automatically created which starts with ENQUEUE
    when the Lock object is realeased, a Funtion Module is created which  starts with DEQUEUE.
    For eg. Create a lock object EZLOCK on some ZJK_EKKO table.
    Once its activated, go to se37 and check for function module ENQUEUE_EZLOCK.
    Once v delete this lock object the function module ENQUEUE_EZLOCK is also deleted .
    To Go se84-->ABAP Dictionary > Lock Objects> Give the lock object name.
    usually the lock object wil have the table name in it.
    So if its MARA Table , Search MARA in Lock object name and it ll list out the
    Lock objects and its tables.
    Edited by: Jk on Jul 7, 2009 8:43 AM

  • Questions regarding Lock Objects.

    I am creating a custom table and I want to implement a unique ID for my table and I want to use the technique of auto-increment. I created a seperate table where to store the increments to be used as IDs. So basically, when a new data is going to be saved on my other table, the program will query the next "id" from the table for increments. I have to make sure that the updating and reading of the data from the table is accessed one at a time to rule out the possibility that there will be no duplicate IDs generated.
    I have read about shared locks and exclusive locks which would serve as a solution for my purpose. The question is: is it possible for other users to "read" from a table if it is currently in an "exclusive lock" by another user?

    >
    it2051229 wrote:
    > I am creating a custom table and I want to implement a unique ID for my table and I want to use the technique of auto-increment. I created a seperate table where to store the increments to be used as IDs. So basically, when a new data is going to be saved on my other table, the program will query the next "id" from the table for increments. I have to make sure that the updating and reading of the data from the table is accessed one at a time to rule out the possibility that there will be no duplicate IDs generated.
    >
    > I have read about shared locks and exclusive locks which would serve as a solution for my purpose. The question is: is it possible for other users to "read" from a table if it is currently in an "exclusive lock" by another user?
    No it isn't.
    When you've selected your current value with SELECT FOR UPDATE (to get the exclusive lock) then every other reader will have to wait.
    But is this really what you want?
    Putting locks on something like an increasing number that is just used for an internal ID?
    This will do nothing but turn your multiuser database application into a one-by-one slowness.
    Instead, check the documentation about SEQUENCES.
    These database objects were made for this. Lockfree increasing (or decreasing) numbers for unique ID columns.
    Easy to use. Safe to use.
    In 99.9% of all cases this is what you should use.
    regards,
    Lars

  • With regard to lock object and authority check

    hi all
    i would like to know about lock object and authority check specifically in reports. there is a coding in sap library with regard to authority check, but there is no coding to restrict user (i mean there is no user names that the object is restricting for a particular user or any user has got permission to change or display object). 
    further, the code mentions that you need an authorization in your user master record for the object, could any of u explain where is user master record.
    below is the code for authority check.
    *&      Module  USER_COMMAND_0100  INPUT
    MODULE USER_COMMAND_0100 INPUT.
      CASE OK_CODE.
        WHEN 'SHOW'.
       AUTHORITY-CHECK OBJECT 'S_CARRID'
    ID 'CARRID' FIELD '*'
    ID 'ACTVT'  FIELD '03'.
       IF SY-SUBRC NE 0. MESSAGE E009. ENDIF.
       MODE = CON_SHOW.
       SELECT SINGLE * FROM  SPFLI
        WHERE  CARRID      = SPFLI-CARRID
        AND    CONNID      = SPFLI-CONNID.
       IF SY-SUBRC NE 0.
    MESSAGE E005 WITH SPFLI-CARRID SPFLI-CONNID.
       ENDIF.
       CLEAR OK_CODE.
       SET SCREEN 200.
        WHEN 'CHNG'.
       AUTHORITY-CHECK OBJECT 'S_CARRID'
    ID 'CARRID' FIELD '*'
    ID 'ACTVT'  FIELD '02'.
       IF SY-SUBRC NE 0. MESSAGE E010. ENDIF.
       MODE = CON_CHANGE.
       SELECT SINGLE * FROM  SPFLI
        WHERE  CARRID      = SPFLI-CARRID
        AND    CONNID      = SPFLI-CONNID.
       IF SY-SUBRC NE 0.
         MESSAGE E005 WITH SPFLI-CARRID SPFLI-CONNID.
       ENDIF.
       OLD_SPFLI = SPFLI.
       CLEAR OK_CODE.
       SET SCREEN 200.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    i thank u all for the help in advance.

    hi
    this might help
    REPORT YUSRLOCK NO STANDARD PAGE HEADING.
    TABLES: TRDIR, USR02.
    DATA: MARK,CNTR TYPE I,
          ACCNT LIKE USR02-ACCNT, ERDAT LIKE USR02-ERDAT,
          ANAME LIKE USR02-ANAME, CLI(3) VALUE 'AAA', SZIN TYPE I,
          SYDATUM LIKE SY-DATUM, FLAG(3).
    TABLES: UINFO.
    DATA: OPCODE TYPE X VALUE 2.
    DATA: BEGIN OF USR_TABL OCCURS 10.
            INCLUDE STRUCTURE UINFO.
    DATA: END OF USR_TABL.
    START-OF-SELECTION.
      CALL 'ThUsrInfo' ID 'OPCODE' FIELD OPCODE
        ID 'TAB' FIELD USR_TABL-SYS.
      SELECT * FROM USR02 CLIENT SPECIFIED ORDER BY MANDT BNAME.
        IF USR02-MANDT <> CLI.
          SZIN = SZIN + 1. SZIN = SZIN MOD 2.
          CLI = USR02-MANDT.
        ENDIF.
        IF USR02-UFLAG = 0.
          MARK = ' '.
        ELSE.
          MARK = 'X'.
        ENDIF.
        CLEAR FLAG.
        LOOP AT USR_TABL.
          IF USR_TABL-BNAME = USR02-BNAME AND USR_TABL-MANDT = USR02-MANDT.
            FLAG = '!!!'.
          ENDIF.
        ENDLOOP.
        SYDATUM = SY-DATUM - 30.
        IF SYDATUM < USR02-TRDAT.
          IF SZIN = 0.
            WRITE:/ ' ', MARK AS CHECKBOX,' ', USR02-BNAME COLOR 2,
                  ' ',USR02-MANDT COLOR 2,
                  '   ',USR02-USTYP COLOR 2,
                  ' ',USR02-TRDAT COLOR 2, USR02-LTIME COLOR 2,
                  ' ',FLAG COLOR 6.
          ELSE.
            WRITE:/ ' ', MARK AS CHECKBOX,' ', USR02-BNAME COLOR 3,
                  ' ',USR02-MANDT COLOR 2,
                  '   ',USR02-USTYP COLOR 2,
                  ' ',USR02-TRDAT COLOR 2, USR02-LTIME COLOR 2,
                  ' ',FLAG COLOR 6.
          ENDIF.
        ELSE.
          IF SZIN = 0.
            WRITE:/ ' ', MARK AS CHECKBOX,' ', USR02-BNAME COLOR 2,
                  ' ',USR02-MANDT COLOR 2,
                  '   ',USR02-USTYP COLOR 2,
                  ' ',USR02-TRDAT COLOR 4, USR02-LTIME COLOR 4,
                  ' ',FLAG COLOR 6.
          ELSE.
            WRITE:/ ' ', MARK AS CHECKBOX,' ', USR02-BNAME COLOR 3,
                  ' ',USR02-MANDT COLOR 2,
                  '   ',USR02-USTYP COLOR 2,
                  ' ',USR02-TRDAT COLOR 4, USR02-LTIME COLOR 4,
                  ' ',FLAG COLOR 6.
          ENDIF.
        ENDIF.
        HIDE: USR02-BNAME, USR02-MANDT.
      ENDSELECT.
      CLEAR USR02.
    TOP-OF-PAGE.
    WRITE:/ 'LOCK   USER         CLIENT  TYPE     LAST lOGIN     ' COLOR 6.
      SKIP.
    AT USER-COMMAND.
      IF SY-UCOMM = 'SEL'.
        DO.
          CLEAR MARK.
          READ LINE SY-INDEX FIELD VALUE MARK.
          IF SY-SUBRC NE 0.  EXIT. ENDIF.
          IF USR02-BNAME IS INITIAL.CONTINUE.ENDIF.
          SELECT SINGLE * FROM USR02 CLIENT SPECIFIED WHERE
          MANDT = USR02-MANDT AND BNAME = USR02-BNAME.
          IF MARK = 'X' AND USR02-UFLAG = 0.
            USR02-UFLAG = 64.
            UPDATE USR02 CLIENT SPECIFIED SET: UFLAG = 64 WHERE
            MANDT = USR02-MANDT AND
            BNAME = USR02-BNAME.
            COMMIT WORK.
          ENDIF.
          IF MARK = ' ' AND USR02-UFLAG = 64.
            USR02-UFLAG = 0.
            UPDATE USR02 CLIENT SPECIFIED SET: UFLAG = 0 WHERE
            MANDT = USR02-MANDT AND
            BNAME = USR02-BNAME.
            COMMIT WORK.
          ENDIF.
        ENDDO.
        CLEAR USR02.
      ENDIF.
    regards
    Arun

  • Error while lock object creation

    Hi
    When I tried to create a lock object, I get the following error.
    Error: "Total length of lock argument for table XXXXXXXXX longer than 150"
    I have 3 tables in which Table1 is the check table for the value tables (Table2 & Table3). During the process of deletion of a record from Table1 (CT) I need the lock tobe established on value tables and then I delete all the corresponding entries in value tables are also deleted.
    Would like to know If there is any other std ways of doing this ? and
    Solution to overcome the error.
    Regards
    Karthick

    Hi,
    I think the error is becoz you have given too many LOCK parameters in the lock object. the total length of the PARAMTERS of lock object should not exceed 150.
    By default all the KEY fields will be taken as Lock paramters, so your table key's length is more than 150.
    Also why dont you create 3 lock objects for each table and then use only KEY's of each table as LOCK PARAMETERS.
    Then Lock T1 record first then lock T2 and T3 records, then delete records from T2 and T3.
    Then you delete T1 record.
    The execute DEQUEUE_ALL.
    Regards,
    Sesh

  • Report to find Locked objects in sap system

    Hi All,
    does anyone know the report to find out the locked objects in an sap system?
              or
    name of the table that stores locked objects ?
    or any other way through which we can find the number of locked objects ?
    Thanks and regards
    Abdul Hadi

    Hi,
    You can unlock locked objects in transaction SE03.
    Click on Display Repaired objects.
    You can see all the objects that are locked.
    To unlock you can select the particular object and click on Unlock.
    Do reward points if the answer to your question is met.
    Regards
    Suhas

  • Create lock object with fun command

    Hallo,
    Is it possible to create a lock object with the fun command? I tried to use:
    FUN ( ENQUEUE _<lockobject> , <interface> ).
    When I fill the importing parameters, execute the script and afterwards refresh the interace than the import parameters are empty. Is there a way to create a lock object with the fun command or at least with inline abap?
    regards,
    Wolfgang

    Hi Wolfgang,
    in general your way of including the FUN command was correct.
    The loss of import parameter values must have been caused by some other reason, not related to the invoke of enqueue. Maybe try it again.
    If, for any reason, using FUN is not possible, it's always an alternative to use ABAP. .... ENDABAP. with correct ABAP coding inbetween (e.g. CALL FUNCTION ...).
    Nevertheless regarding enqueue you need to consider, that the lock you set by running eCATT test scripts in this way, will last (only) as long as the session in which the function was called is active. Means, it lasts as long as you do not close the SECATT transaction (/n or similar) and not use commands like RESCON in your test script. Check your locks with transaction sm12.
    Be aware, that interfering with an applications lock handling and strategy might also harm running transactions or the data processed by this transactions. Usually there is no need to call the enqueue modules from a test.
    Best Regards
    Jens

  • Help in lock object

    HI All
    i am want to handle lock object for instance if i want to lock some object and it's already locked i want to do some loop on it for 5 times .
    1. i need to know if what i was doing is OK since this is my first time .
    2. what should i use i parameter wait can it help me ?
    Kind Regards
    Chris
    iv_try_x_times = 5. "this value on the method signature
      DO iv_try_x_times TIMES.
        lv_count = lv_count + 1.
        CALL FUNCTION ENQUEUE_USR_DATA
        EXPORTING
        mandt = sy-mandt
        userid = mv_userid
        x_for_user            = iv_is_exact 
        _wait                 = iv_is_wait
      EXCEPTIONS
        foreign_lock = 1
        system_failure = 2
        OTHERS = 3.
        IF sy-subrc = 0.
          RETURN.
        ENDIF.
        IF lv_count < iv_try_x_times.
          WAIT UP TO 1 SECONDS.
        ENDIF.
      ENDDO

    Hi Chris,
    Such a code piece might help you;
    data: is_locked type c,
             lv_counter type i.
    is_locked = ''.
    lv_counter = 0.
    while is_locked = '' and lv_counter < 5.
      lv_counter = lv_counter + 1.
        CALL FUNCTION ENQUEUE_USR_DATA
        EXPORTING
        mandt = sy-mandt
        userid = mv_userid
        x_for_user            = iv_is_exact 
        _wait                 = iv_is_wait
      EXCEPTIONS
        foreign_lock = 1
        system_failure = 2
        OTHERS = 3.
        IF sy-subrc = 0.
          is_locked = 'X'.
       else.
          wait  up to 1 seconds.
       endif.
    endwhile.
    Regards;
    Ozcan.

  • Enqueue: Elem.lock 0 contains unpermitted lock mode . lock object EZBEV_BO

    Hello Guru's,
    we have a unusual problem in the syslog of our ERP System.
    Enqueue: Elem.lock 0 contains unpermitted lock mode . lock object EZBEV_BO
    We can't found any note or forum entry to solve this.
    We checked SAP Notes: 1324099, 891372, 606425, 447242, 1260601 and searched in the forum, but nothing helpful found.
    System Data:
    ERP 6.0 / NW7.01 with EHP4
    SAP Kernel :  701_REL
    created on  :  Jan 18 2010 21:47:07
    Kernel Patch number : 77
    Source ID  :  0.077
    DBSL Patch No. : 075
    Database
    ORACLE 10.2.0.2
    Operating System
    AIX 5.3
    Can someone help?
    regards
    Chris

    developer error

  • Lock object for Purchase Order

    Dear Experts.
    I am searching the function module "ENQUEUE_   " , which is for locking & Unlocking
    the Purchase order(ekko-ebeln).
    Please help me.
    Thanks in advance,
    Regards,
    Rahul.

    Hi,
    Use the Lock object EMEKKOE to Lock and Unloack the Purchase orders
    Use this FM to lock
    MM_ENQUEUE_DOCUMENT
    This is also used in the standard program. While enqueing,
    if there is any error (sy-subrc 0), then it means,
    that particular purchase order is already locked
    Use Fm DEQUEUE_ALL to release all lock at the end of report execution.
    Regards,
    Shamma
    Edited by: Shamma Firdous on Aug 20, 2009 10:22 AM

  • Lock object funtion module for afpo table

    Hii,
    I have designed a screen and maintained batch field as mandatory field in that screen. and when i give batch number and hit enter the order number related to that batch number is automatcially picked. order and batch field's i am taking from AFPO table.now i want to lock this batch or order  field so that no 2 user's can use same batch  or order number while making entries.
    can anyone let me know what is the function module i should use for enqueue and dequeue technics for these 2 fields.
    Regards,
    Venkat.
    Edited by: venkat akella on Jun 29, 2010 1:40 PM

    Hi Venkat,
    For your requierment, you have to create a lock object for table AFPO using T code SE11.
    The name of the Lock object should be start with EZ.
    Then use the FM DEQUEUE_EZ**** & ENQUEUE_EZ**** For unlock and lock of the order.
    Regards
    DKS

  • Lock object for KONV table/Cluster table ??

    Hi All,
    Is it possible to set Lock/Enqueue cluster tables or in my case table:KONV (KNUMV field) ?.
    OSS provided some programs without locks so was hoping if I could add before performing data manipulation.
    Regards,
    Neeth

    Hi Nameeth,
    you can use generic lock object E_TABLE with function modules ENQUEUE_E_TABLE, DEQUEUE_E_TABLE for locking and unlocking with parameters table name and key field.
    Regards,
    Satya

  • Lock object

    Hi,
    In a program to update the database table I need to lock the table Is this correct to use enqueue functional module before the modify & commit statement
    and dequeue functional module after
    modify & commit statement.

    Hi,
    We can use the function modules ENQUEUE_E_TABLE for locking tables and the function module DEQUEUE_E_TABLE for unlocking tables. With this method, we don't need to lock objects in order to lock the tables. In other words, any table can be locked/unlocked using these function modules.
    report zsubhas_enqueue.
    * testing the locking of tables...
    data:
    varkey like rstable-varkey.
    varkey = sy-mandt.
    * locking the tables............................
    call function 'ENQUEUE_E_TABLE'
    exporting
    * MODE_RSTABLE = 'E'
    tabname = 'MARA'
    varkey = varkey
    * X_TABNAME = ' '
    * X_VARKEY = ' '
    * _SCOPE = '2'
    * _WAIT = ' '
    * _COLLECT = 'X'
    exceptions
    foreign_lock = 1
    system_failure = 2
    others = 3
    case sy-subrc.
    when 1.
    message i184(bctrain) with 'Foreignlock'.
    when 2.
    message i184(bctrain) with 'system failure'.
    when 0.
    message i184(bctrain) with 'success'.
    when others.
    message i184(bctrain) with 'others'.
    endcase.
    * unlocking the table...............
    call function 'DEQUEUE_E_TABLE'
    exporting
    * MODE_RSTABLE = 'E'
    tabname = 'MARA'
    varkey = varkey
    * X_TABNAME = ' '
    * X_VARKEY = ' '
    * _SCOPE = '3'
    * _SYNCHRON = ' '
    * _COLLECT
    Regards
    Sudheer

  • Lock object not working.

    Hi,
    I am trying to create a lock object.
    Having following doubts:
    1) In one program, ENQUEUE function for that lock object But DEQUEUE function is not called. So the record on which the ENQUEUE function is called will remain locked for ever or only till the program ends?
    2) 1 program ZXYZ has ENQUEUE function on one record...But it has not DEQUEUE function in it....... second program ZXYZ1 is trying to edit that record....what should happen??
    According to me, that second program should not be able to edit it until the table has given record to DEQUEUE function. Correct me if I am wrong.
    But in these programs, Second program is able to edit the record locked by the first program. This is true if Lock Mode of the Lock object is Read Lock/Write Lock /Exclusive, Not cumulative.
    Please let me know your valuable inputs.
    Regards,
    Pooja

    Hi ,
    Thanks for all your replies.
    Please find below both the programs. SY-SUBRC is zero in both the programs.
    Let me know if anything is wrong in the code. Commit work is not used anywhere in the program explicitly.
    *First Program: *
    REPORT  ztestxyz.
    TABLES: zcrossref.
    DATA: wa_zcrossref TYPE zcrossref.
    wa_zcrossref-business_unit = 'TOPS'.
    wa_zcrossref-conversion_type = 'KS'.
    wa_zcrossref-legacy_code = '0314'.
    wa_zcrossref-sap_code = '0314'.
    CALL FUNCTION 'ENQUEUE_EZTEST'
      EXPORTING
        mode_zcrossref    = 'E'
        client            = sy-mandt
        business_unit     = wa_zcrossref-business_unit
        conversion_type   = wa_zcrossref-conversion_type
        legacy_code       = wa_zcrossref-legacy_code
        x_business_unit   = ' '
        x_conversion_type = ' '
        x_legacy_code     = ' '
        _scope            = '2'
        _wait             = ' '
        _collect          = ' '
      EXCEPTIONS
        foreign_lock      = 1
        system_failure    = 2
        OTHERS            = 3.
    IF sy-subrc <> 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ELSE.
      WRITE: 'Sucessful.' .
      UPDATE zcrossref FROM wa_zcrossref.
      WAIT UP TO 20 SECONDS.
    ENDIF..
    Second program:
    REPORT  ztestxyz1.
    *DATA: wa_loan TYPE zloandeposit.
    *wa_loan-xblnr = 'FWD3939'.
    *wa_loan-doctyp = 'AB'.
    *MODIFY zloandeposit FROM wa_loan.
    Data: wa_zcrossref type zcrossref.
    wa_zcrossref-business_unit = 'TOPS'.
    wa_zcrossref-conversion_type = 'KS'.
    wa_zcrossref-legacy_code = '0314'.
    wa_zcrossref-sap_code = 'XYZ2'.
    UPDATE zcrossref FROM wa_zcrossref.
    IF sy-subrc = 0.
      WRITE: 'Succesful.!!'.
    ELSE.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    Regards,
    Pooja

Maybe you are looking for