Perform DB lcoking on custom table

Hi, I have written a program that uses an Editable ALV grid to update entries in a custom table.  But I wnat to be able to lock users from performing updates when another user is in the transaction.  Can you tell me how best to do this?

Moderator message - Please do not ask basic questions - thread locked
Rob

Similar Messages

  • Performance for join 9 custom table with native SQL ?

    Hi Expert,
    I need your opinion regarding performance to join 9 tables with native sql. Recently i have to tunning some customize extraction cost  report. This report extract about 10 million cost of material everyday.
    The current program actually, try to populate the condition data and insert into customize table and join all the table to get data using native sql.
    SELECT /*+ ordered use_hash(mst,pg,rg,ps,rs,dpg,drg,dps,drs) */
                mst.werks, ....................................
    FROM
                sapsr3.zab_info mst,
                sapsr3.zab_pc pg,
                sapsr3.zab_rc rg,
                sapsr3.zab_pc ps,
                sapsr3.zab_rc rs,
                sapsr3.zab_g_pc dpg,
                sapsr3.zab_g_rc drg,
                sapsr3.zab_s_pc dps,
                sapsr3.zab_s_rc drs
            WHERE mst.zseq_no = :p_rep_run_id
            AND mst.werks = :p_werks
            AND mst.mandt = rg.mandt(+)
            AND mst.ekorg = rg.ekorg(+)
            AND mst.lifnr = rg.lifnr(+)
            AND mst.matnr = rg.matnr(+)
            ...............................................   unitl all table (9 tables)
            AND ps.mandt = dps.mandt(+)
            AND ps.knumh = dps.knumh(+)
            AND ps.zseq_no = dps.zseq_no(+)
            AND COALESCE (dps.kbetr, drs.kbetr, dpg.kbetr, drg.kbetr) <> 0
    It seems the query ask for database to using hashed table. would that be it will burden the database ? and impacted to others sap process ?
    Please advise
    Thank You and Best Regards

    you can only argue coming from measurements and that is not the case.
    Coming from the code, I see only that you do not understand it at all, so better leave it as it is. It is not a hash table, but a hash join on these table.

  • Performance issue in a custom table

    Hi All,
    I have  a ztable used in a program wherin I have a doubt of performance issue in selection.Its like :
        SELECT ship_no invoice_no
          INTO TABLE it_ship_no_hist
          FROM zco_cust_hist
          FOR ALL ENTRIES IN it_freight
          WHERE ship_no = it_freight-tknum.
    there are 7 key fields in this table out of which one ( tknum ) is used in a where condition.The table is without any index.
       For performance purpose should I create an index with the very field 'tknum' in the index..can I do that or index should be created only along with non key fields.

    Hi,
    a table has - besides a few exceptions - always one index that is the primary key. The fields are the key fields in the same order as in the table.
    The primary key is always there and therefore not displayed under the botton 'index'.
    Is tknum a key field? What are the key fields in correct order? If it is in the key and maybe the first one, then it does not make sense that you create an index.
    Siegfried

  • Not Updating Customized Table when System having Performance Issue

    Hi,
    This is actually the same topic as "Not Updating Customized Table when System having Performance Issue" which is posted last December by Leonard Tan regarding the user exit EXIT_SAPLMBMB_001.
    Recently we changed the program function module z_mm_save_hide_qty to update task. However this causes more data not updated. Hence we put back the old version (without the update task).  But now it is not working as it used to be (e.g. version 1 - 10 records not updated, version 2 with update task - 20 records not updated, back to version 1 - 20 records not updated).
    I tried debugging the program, however whenever I debugged, there is nothing wrong and the data is updated correctly.
    Please advise if anyone has any idea why is this happening. Many thanks.
    Regards,
    Janet

    Hi Janet,
    you are right. This is a basic rule not to do any COMMIT or RFC calls in a user exit.
    Have a look at SAP note 92550. Here they say that exit EXIT_SAPLMBMB_001 is called in the update routine MB_POST_DOCUMENT. And this routine is already called in UPDATE TASK from  FUNCTION 'MB_UPDATE_TASKS' IN UPDATE TASK.
    SAP also tells us not to do any updates on SAP system tables like MBEW, MARD, MSEG.
    Before the exit is called, now they call 'MB_DOCUMENT_BADI' with methods MB_DOCUMENT_BEFORE_UPDATE and MB_DOCUMENT_UPDATE. Possibly you have more success implementing the BADI.
    I don't know your situation and goal so this is all I can tell you now.
    Good luck!
    Regards,
    Clemens

  • User exit/BADI for updating custom table in MB1B transaction-

    Dear All,
    When performing a material to material conversion in MB1B transaction for  batch managed materials,system is creating a new batch by copying the characteristics of issuing material/batch.The details of the new batch created are updated in standard batch tables(MCH1,MCHA,MCHA).
    The requirement is when the new batch is created,the batch details and characteristics has to be stamped in a custom table.
    Kindly suggest a user exit/BAIi available for updating the same in the custom table.
    Regards,
    Deepak

    Deepak, Exits for MB1B are
    MBCF0002            Customer function exit: Segment text in material doc. item
    MBCF0005            Material document item for goods receipt/issue slip
    MBCF0006            Customer function for WBS element
    MBCF0007            Customer function exit: Updating a reservation
    MBCF0009            Filling the storage location field
    MBCF0010            Customer exit: Create reservation BAPI_RESERVATION_CREATE1
    MBCF0011            Read from RESB and RKPF for print list in  MB26
    MB_CF001            Customer Function Exit in the Case of Updating a Mat. Doc.

  • Changing Non key field to Key field in a custom table

    Hello Abap gurus:
    I have a requirement in which i need to change a non key field in my custom table(Z TABLE) to key field.
    For example; i have field sequence as
    field 1  key field
    field 2 key field
    field 3 key field
    field 4 non-key field
    field 5 non-key field
    field 6 non-key field
    field 7 non-key field.
    i want to change field 7 as key field.
    Can i do perform operation??
    when i am tryingto perform bove operation it is taking long time to get the table activated.
    Could any one please help me in getting this resolved.
    regards,
    Sravanthi.

    Use DB Utility (se14) to perform alter table or conversion. The latter is used when atemps to perform first operation fails. Which one is used, really depends on system and current DB table state (i.e. if has any content and what is being adjusted).
    The way Max suggested is similar to [conversion process|http://help.sap.com/saphelp_nw04/helpdata/EN/cf/21f1b8446011d189700000e8322d00/content.htm] which system takes care of itself.
    Refer [Adjusting Database Structures|http://help.sap.com/saphelp_nw04/helpdata/EN/cf/21f1ab446011d189700000e8322d00/content.htm] and already given link to conversion.
    Please also consider potential errors while doing conversion . This can lead to data loss, so you should think of some backup to prevent that.
    Regards
    Marcin

  • Urgent help needed in inserting data into a custom table in oracle WorkFlow

    Hi
    I am trying to get data from the WF and insert into a custom table..
    I read that workflow procedures WONT allow commits...
    Oracle Workflow will not support autonomous commits in any procedure it calls directly. If you need to perform commits, then embed your SQL in a subprocedure and declare it as an autonomous block. This subprocedure must be capable of being rerun. Additionally, note that Oracle Workflow handles errors by rolling back the entire procedure and setting its status to ERROR. Database updates performed by autonomous commits cannot be rolled back, so you will need to write your own compensatory logic for error handling
    Have anyone did this..
    Please give me some idea ...It is urgent
    I am getting data using getitemattribute..and try to insert it into a custom table
    thanks
    kp

    Pl do not post duplicate threads - insert dont work in Workflow
    Srini

  • Insert delete or update entry in Custom table from KONV entry changed

    Hi All,
    I have custom table ZKONV with only few required columns and should have same number of records as KONV has at any point in time.
    KONV is a cluster table so its not readable from ORACLE level. So ZKONV is created. But I dont know how to keep these both tables in sync.
    I need to perform insert delete or update entry in Custom table if insert delete or update happens on cluster table KONV from any transactions.
    As KONV is a cluster table and does not have changed time stamp I am not able to know the number of records changed in perticulat time period.
    Thanks,

    Thanks for reply,
    There is a Outside SAP system which needs to read KONV data to feed into their system, but as KONV is cluster table they are not able to read it from ORACLE level.
    To solve this we are thinking to create a transparent Z-table and will fill it with KONV and catch Update, delete or Insert statement and do same on ZKONv.
    Is this possible some how? by some database event or something....

  • Custom Table Entry not in Sync between Different Environment

    Hi All,
    we have different environment like Dev System, Quality system, performance testing system etc... these are all environment customs table entry not in syn .. Table entry should be syn. How to make it syn all the entry between all environment without do any manual work. Kindly help on this.
    Thanks

    Hello Mohammed,
    It depends on what type of tables you are referring to. If you have a table of type 'Customizing', you have to transport your table entries across different environments and they will be in Sync.
    If you are referring to tables of type 'Master Data', they have to be maintained in all environments.
    Table of type 'Transaction Data' by default have different records based on your day to day transactions.
    You cannot have all custom tables with same data in all environments. Hope this helps.
    Rgds,
    Vijay.

  • Fetch in a custom table - ECC 6.0

    Hi,
    There is a custom table, which has got nearly 50 lakhs entries. The report's performance was fine in 4.7 version. After SAP upgradation to ECC 6.0, the execution of the query takes more than 5 hrs, which was just 600 sec in 4.7 system. What could be the problem?
    Note: Primary key is not passed in the select query's WHERE condition.
    Thanks,
    Dhanalakshmi M S

    Hi,
    was the database been upgraded as well? Have the statistics been updated after the upgrade?
    As Thomas said, please post more details... execution plan, ST05 summary, variables, indexes, ... .
    Kind regards,
    Hermann

  • How to specify custom table name for subclasses in Kodo 3?

    I'm migrating our codes from Kodo 2.5.x to version 3.
    In Kodo 2.x, specifying the class/subclass table name uses the extension
    like this "@jdo.extension vendor-name="kodo" key="table"
    value="DyeStuffs"" when using XDoclet to generate the .jdo metadata files.
    It no longer works in Kodo 3. Following the Kodo's documentation, I have
    upgraded XDoclet to 1.2b3 and changed all doclet tags to the ones that
    XDoclet understands.
    I noticed in the documentation, to specify custom table mapping, it uses
    nested vendor extensions. E.g
    <extension vendor-name="kodo" key="jdbc-class-map" value="vertical">
    <extension vendor-name="kodo" key="table" value="TABLOID"/>
    <extension vendor-name="kodo" key="ref-column.JDOID"
    value="MAG_ID"/>
    </extension>
    So how do I specify nested extensions when using with XDoclet's tags?
    Need help as I have to complete the migration by end of the week.
    Thanks,
    Makas

    Abe White wrote:
    Makas Tzavellas wrote:
    Does it mean I have to map all classes and fields to the existing tables?As I tried to point out earlier, in 3.0 all mapping information must be
    explicit all the time. So basically everything is like mapping to an
    existing schema (only Kodo can generate those mappings for you... as
    long as you're not using XDoclet for all your mapping! :)
    It seems quite a pain to manually map all the existing tables and
    fields, especially when Kodo gave the table and field names. I don't
    mind mapping the tables, but mapping the fields will be a horror with
    105 tables. Have I missed out anything in the migration documentation
    that might help me with this process? Also does Kodo require the
    ..mapping file to work or having everything in .jdo file is sufficient
    (looking at the documentation it seems ok to have .jdo file only)?
    If I do, I prefer to regenerate all tables without the base table,
    basically having tables to include all the fields from the base table.
    And migrate all existing data to the new table structure.I'm not entirely clear on what you want. Are you saying that you want
    each subclass to have its own table and repeate the columns from its
    superclass table in its own?
    Yes, that is exactly what I want.
    If so, then this is not supported by Kodo (yet... we're working on it
    though).
    Ok, I'll settle having Kodo 3 to only map back to the original tables,
    as I believe Kodo 3 will provide some performance improvement as
    compared to 2.x.

  • For all entries on custom tables

    i have created 2 custom tables::zhospital_info n zpatient_info..
    zhospitalinfo tab fields:::_
    doc_name::prim key
    patient_name:::prim key
    place::prim key
    zpatientinfo tab fields::_
             ZDATE ::prim key
             JOINING
             MEDICINE
             PRICE
             QUANTITY
             DOC_NAME ::for key
             PATIENT_NAME::for key
             PLACE ::for key
    and inserted some values to the table contents..
    this is my logic:::
    TYPES: BEGIN OF ZHOSPITAL_INFO,
            DOC_NAME TYPE ZDOC_NAME,
            PATIENT_NAME TYPE ZPATIENT_NAME,
            PLACE TYPE ZPLACE,
           END OF ZHOSPITAL_INFO.
    DATA: W_HI TYPE ZHOSPITAL_INFO.
    DATA:T_HI TYPE STANDARD TABLE OF ZHOSPITAL_INFO.
    TYPES: BEGIN OF ZPATIENTL_INFO,
             ZDATE TYPE ZDATE,
             JOINING TYPE ZJOINING,
             MEDICINE TYPE ZMEDICINE,
             PRICE TYPE ZPRICE,
             QUANTITY TYPE ZQUANTITY,
             DOC_NAME TYPE ZDOC_NAME,
             PATIENT_NAME TYPE ZPATIENT_NAME,
             PLACE TYPE ZPLACE,
           END OF ZPATIENTL_INFO.
    DATA: W_PI TYPE ZPATIENTL_INFO.
    DATA:T_PI TYPE STANDARD TABLE OF ZPATIENTL_INFO.
    TYPES: BEGIN OF FTAB,
            DOC_NAME TYPE ZDOC_NAME,
            PATIENT_NAME TYPE ZPATIENT_NAME,
            PLACE TYPE ZPLACE,
            DATE TYPE ZDATE,
            JOINING TYPE ZJOINING,
            MEDICINE TYPE ZMEDICINE,
            PRICE TYPE ZPRICE,
            QUANTITY TYPE ZQUANTITY,
           END OF FTAB.
    DATA: W_FTAB TYPE FTAB,
          T_FTAB TYPE STANDARD TABLE OF FTAB.
    SELECT DOC_NAME
           PATIENT_NAME
           PLACE
           INTO TABLE t_hi
           FROM ZHOSPITAL_INFO .
    IF NOT t_hi IS NOT INITIAL.
    SELECT DOC_NAME
           PATIENT_NAME
           PLACE
           ZDATE
          MEDICINE*
           PRICE
           QUANTITY FROM ZPATIENTL_INFO INTO TABLE t_pi FOR ALL ENTRIES IN
    t_hi
           WHERE DOC_NAME = t_hi-doc_name.
    ENDIF.
    LOOP AT t_pi INTO w_pi.
    MOVE-CORRESPONDING: w_pi TO W_FTAB.
    READ TABLE t_hi INTO w_hi WITH KEY DOC_NAME = W_FTAB-DOC_NAME.
    MOVE: w_hi-patient_name TO W_FTAB-PATIENT_NAME,
          w_hi-place TO W_FTAB-PLACE.
          APPEND W_FTAB TO T_FTAB.
    ENDLOOP.
    LOOP AT T_FTAB INTO W_FTAB.
       WRITE:/ W_FTAB-DOC_NAME,
               W_FTAB-PATIENT_NAME,
               W_FTAB-PLACE,
               W_FTAB-DATE,
               W_FTAB-JOINING,
               W_FTAB-MEDICINE,
               W_FTAB-PRICE,
               W_FTAB-QUANTITY.
    ENDLOOP.
    req output:::when i enter doc_name the related info accr to doc_name from the both tables should be display..
    m getting no errors but i cant execute my prog..
    please check out my code...
    thanx in adv..

    Hi,
    The problem is in the select statement:
    SELECT DOC_NAME
    PATIENT_NAME
    PLACE
    ZDATE
    MEDICINE
    PRICE
    QUANTITY FROM ZPATIENTL_INFO INTO TABLE t_pi FOR ALL ENTRIES IN
    t_hi
    WHERE DOC_NAME = t_hi-doc_name.
    Change this to SELECT DOC_NAME PATIENT_NAME PLACE ZDATE MEDICINE PRICE QUANTITY FROM ZPATIENTL_INFO INTO CORRESPONDING FIELDS OF TABLE t-pi FOR ALL ENTRIES IN t_hi WHERE DOC_NAME = t_hi-doc_name.
    I hope the above code will help you...
    Also i hope to tell the following for performance issues and also a good programming practice:
    LOOP AT t_pi INTO w_pi.
    MOVE-CORRESPONDING: w_pi TO W_FTAB.
    READ TABLE t_hi INTO w_hi WITH KEY DOC_NAME = W_FTAB-DOC_NAME.
    MOVE: w_hi-patient_name TO W_FTAB-PATIENT_NAME,
    w_hi-place TO W_FTAB-PLACE.
    APPEND W_FTAB TO T_FTAB.
    ENDLOOP.
    Please do a sy-subrc check after READ statement always...
    LOOP AT t_pi INTO w_pi.
    MOVE-CORRESPONDING: w_pi TO W_FTAB.
    READ TABLE t_hi INTO w_hi WITH KEY DOC_NAME = W_FTAB-DOC_NAME.
    If sy-subrc = 0.
    MOVE: w_hi-patient_name TO W_FTAB-PATIENT_NAME,
    w_hi-place TO W_FTAB-PLACE.
    clear w_hi.
    Endif.APPEND W_FTAB TO T_FTAB.
    ENDLOOP.
    Please revert back for clarifications.
    Best Regards,
    Suresh

  • More than one check table for a field in custom table

    I created a custom table , with some fields in that , and for a field i given a check table , in that same field i want another check table because for  some data i need to refer another table . whether it is possible.....

    Hi,
    If you need to perform the checks while using a maintenance view, you can do this with modification events. e.g. just implement a form that triggers your custom checks in a "before save" event... (SE55->Environment->Event)
    Kr,
    Manu.

  • How to "auto" generate "Primary Key" in custom table?

    Hi Folks,
    Requirement:
    I need a function module or program that can create automatically a primary key.
    Scenario:
    I have a program that creates an entries and save it to a custom table at the same time, but a primary key should always be generated respective to the entries saved.
    Example:
    Material(MATNR) 4001001, Plant(WERKS) XX01, ID[Primary Key-auto generated]
    (I'm thinking of a similar concept/logic on how a unique IDOC number is being generated or how SAP standard creates a unique entry)
    I try to look for any SAP FM that can generate a PK, but there's no luck.
    Thanks.
    Regards,
    Jun

    Hi Keshu and All,
    The links are helpful, however:
    #1. I don't have authorization to create a new object in transaction SNRO, but the way I see the objects in SNRO is just for defining the length(number of characters) for the ranges that will be use if I'm not mistaken.
    #2. FM NUMBER_GET_NEXT - yes it can populate incremental unique entries but it's only occurring at runtime ?? So when the program get terminated it's not being saved nowhere.
    So after if I use FM NUMBER_GET_NEXT, I always have to look for all the last primary key in my custom table, then target it as my starting point for creating a new PK.  I think this will give a performance issue, any comments?
    For better visualization, I have scenario:
    1.  (ZQ_CREATE_PK) Create unique incremental PK for material, batch, so on..
    2.  Append line/entries to ZQ_TABLE
    3.  Repeat #1 and #2
    4.  User exits the program
    5.  Back to 1 --> At this point, I need to get the "LATEST" PK then start this as a starting point again to generate PK and append it to ZQ_TABLE
    I'm assuming that SAP has other SAP FMs related in creating this scenario.   Similar to IDOC # creation..
    Thanks.

  • Best way to update custom table

    Hello experts,
    Iu2019m writing a report program and after pulling data from a custom table Iu2019m modifying certain fields within internal table and then eventually update custom table. The way Iu2019m updating custom table is working fine. However Iu2019m concern about performance issues because Iu2019m doing update on custom table within loop.
    Here is my code for reference.
    *&      Form  update_contracts
          text
    -->  p1        text
    <--  p2        text
    FORM update_contracts .
    Update record in an internal table first
      loop at izsc_compliance into wa_zsc_compliance..
        wa_zsc_compliance-zapproval = c_accepted.
        wa_zsc_compliance-CHANGED_DT = sy-datum.
        wa_zsc_compliance-CHANGED_TM = sy-uzeit.
        wa_zsc_compliance-CHANGED_BY = sy-uname.
        modify izsc_compliance from wa_zsc_compliance index sy-tabix.
        write:/ sy-tabix, wa_zsc_compliance-vbeln_new, wa_zsc_compliance-zapproval.
        if p_test is initial.
          move wa_zsc_compliance to zsc_compliance.
          update zsc_compliance.
        endif..
      endloop.
    Write records to database
      if p_test = 'X'.
        skip.
        write:/ 'Test mode'.
      endif.
    ENDFORM.                    " update_contracts
    Iu2019m not certain if there is any better way by not doing update within loop and update custom table outside this loop.
    Many thanks in advance.

    Hi,
    Yes, there is a better way to update the custom table. That will be more performance oriented and will be a much cleaner approach. As, I am not much aware of the custom table structure which you have in your program, the best way that I can suggest is to remove the update statement from that check. I guess you are checking against the mode - test or production. Once you have done the check, put the selected entries in an internal table which is same as database table. And then in a single command - a single array operation as it is commonly called, you can update the custom table.
    Have a look at the following link
    [Overwriting Several Lines Using an Internal Table|http://help.sap.com/saphelp_bw33/helpdata/en/fc/eb3a94358411d1829f0000e829fbfe/content.htm]
    [Inserting or Changing Lines|http://help.sap.com/saphelp_bw33/helpdata/en/fc/eb3ac8358411d1829f0000e829fbfe/content.htm]
    You can also scan the forum for multiple links and references and sample examples.
    Hope this will help. The above approach will be much more performance oriented and will help to optimize. Also, check where exactly you are providing the locking feature if at applicable in your business functionality.
    Regards,
    Samantak.

Maybe you are looking for

  • How to refresh/redraw visuals in a mobile view

    I have an issue with a list properly sizing itself.  Here's my basic layout: <s:Scroller width="100%" height="100%" >         <!-- required b/c scroller can only handle one component -->         <s:Group width="100%" >             <s:layout >        

  • How to open text URL in the new tab

    Hi guys, We know that when we click on a hyperlink it will directly open the linked web site, e.g. www.bing.com But sometimes we may find some URL in plain text that we couldn't click on it, e.g. www.bing.com I'll have to select the URL and copy&past

  • Created file in illustrator then opened in photoshop but color code changed?

    I Created file in illustrator and then opened the art in photoshop but the wierd thing is that the color code changed. If you look at the image with you eye the color will look the same to the naked but if you use the eye dripper tool you can see tha

  • I have a problem with the copy option in premiere pro CC

    I have a proyec when I need to copy some video and audio clips to other secuense but if I tray to copy the clips in the other secuense the program get close.

  • Nikon D70--Why is Aperture assigning Adobe RGB to my RAW files.

    As far as I know, RAW files shouldn't have a profile until you give them one, but there it is in the EXIF Profile Name. Interestingly, I thought it might be picking it up from the fact that I have the camera set to Adobe RGB for when I shoot jpegs, B