Problem for Accessing the Table BDCP..CDPOS..CDHDR..

Hi Guys,
i have the problem of accessing the BDCP table.it is working fine in development and testing server.it is taking more time in background in Production server..can anyone help me to optimize this code and please suggest me if i can change anyof the below logic..
Thanks a lot in advance.
LOOP AT t_cdobjid.
    objectid-low  = t_cdobjid-cdobjid.
    objectid-sign = 'I'.
    objectid-option = 'EQ' .
    APPEND objectid.
    CLEAR  objectid.
    count = count + 1.
    IF count = 50.
      CLEAR count.
      SELECT * FROM bdcp APPENDING TABLE t_bdcp
      WHERE cretime IN r_cretime AND
            tabname = 'DMEAN' AND
            fldname = 'KEY' AND
      cdobjid IN objectid.
      CLEAR : objectid.
      REFRESH: objectid.
    ENDIF.
  ENDLOOP.
  IF NOT objectid[] IS INITIAL.
    SELECT * FROM bdcp APPENDING TABLE t_bdcp
      WHERE cretime IN r_cretime AND
            tabname = 'DMEAN' AND
            fldname = 'KEY' AND
    cdobjid IN objectid.
    CLEAR : objectid.
    REFRESH: objectid.
  ENDIF.
  IF NOT t_bdcp[] IS INITIAL.
    t_bdcp_val[] = t_bdcp[].
    DESCRIBE TABLE t_bdcp_val LINES l_lines.
    l_max = 50.
    l_mod = l_lines MOD l_max.
    IF l_mod > 0.
      l_loopcount = ( l_lines DIV l_max ) + 1.
    ELSE .
      l_loopcount = l_lines DIV l_max.
    ENDIF.
    DO l_loopcount TIMES.
      CLEAR t_bdcp_emt.
      REFRESH t_bdcp_emt.
      IF sy-index = l_loopcount.
        t_bdcp_emt[] = t_bdcp_val[].
      ELSE.
        APPEND LINES OF t_bdcp_val FROM 1 TO l_max TO t_bdcp_emt.
        DELETE t_bdcp_val FROM 1 TO l_max.
      ENDIF.
      SELECT * FROM cdpos APPENDING TABLE t_cdpos_upc
          FOR ALL ENTRIES IN t_bdcp_emt
                   WHERE
                   objectclas = 'MATERIAL' AND
                   objectid   = t_bdcp_emt-cdobjid AND
                   changenr   = t_bdcp_emt-cdchgno  AND
                   tabname IN ('DMEAN', 'MARA' ) AND
                   fname   IN ('KEY', 'EAN11' ) .
    ENDDO.
    CLEAR   : l_lines ,
              l_mod ,
              l_loopcount.
       IF sy-subrc EQ 0.
    IF NOT t_cdpos_upc[] IS INITIAL.
      t_cdpos_del[] = t_cdpos_upc[] .
      DELETE t_cdpos_del WHERE tabname EQ 'MARA' .
      SORT t_cdpos_del BY changenr .
      LOOP AT t_cdpos_upc .
        READ TABLE t_cdpos_del WITH KEY
                   changenr = t_cdpos_upc-changenr
                   BINARY SEARCH .
        IF sy-subrc EQ 0  AND
          t_cdpos_upc-chngind = 'U' .
          DELETE t_cdpos_upc WHERE changenr = t_cdpos_upc-changenr
                              AND  chngind  = 'D' .
        ENDIF.
        t_upc_matnr-matnr = t_cdpos_upc-objectid .
        APPEND t_upc_matnr .
      ENDLOOP.
      SORT t_upc_matnr BY matnr .
      DELETE ADJACENT DUPLICATES FROM t_upc_matnr COMPARING matnr .
      IF NOT t_cdpos_upc[] IS INITIAL.
        t_cdpos_upc_val[] = t_cdpos_upc[].
        DESCRIBE TABLE t_cdpos_upc_val LINES l_lines.
        l_max = 50.
        l_mod = l_lines MOD l_max.
        IF l_mod > 0.
          l_loopcount = ( l_lines DIV l_max ) + 1.
        ELSE .
          l_loopcount = l_lines DIV l_max.
        ENDIF.
        DO l_loopcount TIMES.
          CLEAR t_cdpos_upc_emt.
          REFRESH t_cdpos_upc_emt.
          IF sy-index = l_loopcount.
            t_cdpos_upc_emt[] = t_cdpos_upc_val[].
          ELSE.
            APPEND LINES OF t_cdpos_upc_val FROM 1 TO l_max TO
                                                t_cdpos_upc_emt.
            DELETE t_cdpos_upc_val FROM 1 TO l_max.
          ENDIF.
          SELECT * FROM cdhdr APPENDING TABLE it_cdhdr_upc
                           FOR ALL ENTRIES IN t_cdpos_upc_emt
                            WHERE objectclas EQ 'MATERIAL'
                           AND   objectid  = t_cdpos_upc_emt-objectid
                           AND   changenr  = t_cdpos_upc_emt-changenr.
        ENDDO.
      ENDIF.
Prabhu

Use the PACKAGE SIZE oprion of the SELECT statement:
LOOP AT t_cdobjid.
  objectid-low = t_cdobjid-cdobjid.
  objectid-sign = 'I'.
  objectid-option = 'EQ' .
  APPEND objectid.
  CLEAR objectid.
ENDLOOP.
SELECT * FROM bdcp APPENDING TABLE t_bdcp
  PACKAGE SIZE 5000
  WHERE cretime IN r_cretim AND
        tabname = 'DMEAN'   AND
        fldname = 'KEY'     AND
        cdobjid IN objectid.
ENDSELECT.
IF NOT objectid[] IS INITIAL.

Similar Messages

  • Problem in accessing the table

    Hi,
    My database in 10g (10.2.0.4), I have created one user TEST and given insert,update,delete on ABC table to TEST from XYZ user.
    Also,
    Grant select any table to test;
    but when i connect with test and accessing tables of xyz it is showing error 'table or view does not exist' and i select the table with xyz.abc then i can select the table of xyz.
    I do not want to create any synonyms for this table. Can you please help while accessing the table from TEST user without username.tablename
    Anand

    Anand Vyas wrote:
    Actually i have given the example of one table but i have given grant on many table to TEST user.
    Also end user uses these tables in application and he can not agree to set alter session in his application.
    Is there any way to access the tables of XYZ which i have given the grant to TEST without username.tablename means xyz.abc
    Thanks in advance.
    AnandGiven your other requirements/restrictions, your only option is to create a synonym. Why do you not want to do that? If you have many of them, you can "write a sql to write a sql"
    spool doit.sql
    select 'create or replace public synonym ' ||
               table_name ||
               '  for xyz.' ||
               table_name ||
    from dba_tables
    where owner = 'XYZ';
    spool off

  • Problem in accessing mseg table using MSEG~M Index.

    Hi Experts,
    I am facing problem in accessing mseg table using MSEG~M Index. I used same sequence of fields and i tried with mandt field also. but it is not taking the Index and it is going for TImeout ABAP dump.
    This are my codes used in different ways
    1.  SELECT  mjahr
             bwart
             matnr
             lifnr
             dmbtr
             kostl
             aufnr
             bukrs
             FROM mseg CLIENT SPECIFIED INTO TABLE t_mseg2
                      WHERE mandt EQ sy-mandt      AND
                            matnr NE SPACE         AND
                            werks EQ p_werks       AND
                            lgort NE '0000'        AND
                            bwart IN (122,201,262) AND
                            sobkz NE '0'
                            %_HINTS ORACLE 'INDEX("MSEG" "MSEG~M")'.
    2.   SELECT  mjahr
             bwart
             matnr
             lifnr
             dmbtr
             kostl
             aufnr
             bukrs
             FROM mseg  INTO TABLE t_mseg2
                      WHERE matnr NE SPACE         AND
                            werks EQ p_werks       AND
                            lgort NE '0000'        AND
                            bwart IN (122,201,262) AND
                            sobkz NE '0'
                            %_HINTS ORACLE 'INDEX("MSEG" "MSEG~M")'.
    3.   SELECT  mjahr
             bwart
             matnr
             lifnr
             dmbtr
             kostl
             aufnr
             bukrs
             FROM mseg INTO TABLE t_mseg2
                      WHERE matnr NE SPACE         AND
                            werks EQ p_werks       AND
                            lgort NE '0000'        AND
                            bwart IN (122,201,262) AND
                            sobkz NE '0'.                   
    The above all code is not at all taking the index in Quality server .but in Development it is taking .In Quality server it is reading all datas without using the index and going Timeout ABAP dmup
    Please, Suggest me some solutions.
    Thanks in Advance.
    Regards,
    Nandha

    Hi,
    Without NE also not working out. i am facing same problem still.
    SELECT  bwart
             matnr
             lifnr
             dmbtr
             kostl
             aufnr
             FROM mseg CLIENT SPECIFIED INTO TABLE t_mseg
                      WHERE mandt EQ sy-mandt      AND
                            werks EQ p_werks       AND
                            bwart IN (122,201,262) AND
                            mjahr EQ p_year        AND
                            bukrs EQ p_cc
                            %_HINTS ORACLE 'INDEX("MSEG" "MSEG~M")'.
    Please,check and help me out from this issue.
    Regards,
    Nandha

  • TS1811 Hi!! I am a user of i Pod 5g 32GB....I got the same problem for which the solution is given above....but the thing is that.......in my laptop I have a windows operating system....that is windows 7....so can you explain how to do settings in Windows

    Hi!! I am a user of i Pod 5g 32GB....I got the same problem for which the solution is given above  "
    iTunes for Mac reports error -50 when trying to authorize iTunes Store purchases
    "....but the thing is that.......in my laptop I have a windows operating system....that is windows 7....so can you explain how to do settings in Windows 4 same

    Archived - iTunes for Mac reports error -50 when trying to authorize iTunes Store purchases
    Products Affected
    iTunes 7 for Mac, iTunes 8 for Mac, iTunes 9 for Mac
    This article has been archived and is no longer updated by Apple. 
    Symptoms
    After installing the Mac OS X 10.4.9 Update, iTunes may be unable to properly authorize your computer to play your iTunes Store purchases.
    Resolution
    The following steps will delete your network preferences. Most broadband connections do not require any special settings to connect, but if your connection does or if you are not sure, please contact your ISP or network administrator for further assistance.
    Important: You must be logged in as an Administrator.
    Click the Finder icon in the Dock.
    Choose Go to Folder from the Go menu.
    Type /Library/Preferences/SystemConfiguration
    Click Go.
    In the Finder window, locate the file named NetworkInterfaces.plist.
    Drag this file to the Trash.
    Restart the computer.
    Once your computer has restarted. You will not be able to connect to the Internet. Now you will need to refresh your network settings to be able to connect again.
    Choose System Preferences from the Apple menu.
    Choose Network from the View menu.
    To refresh your network settings, from the Location pop-up menu, choose New Location.
    Type a name for your location and click OK.
    Click the Apply Now at the bottom right to accept the changes.
    If your network connection requires any special settings, you will need to put them back in at this point. Once you have made these changes you should be able to connect to the Internet again and authorize your computer to play your iTunes Store purchases.

  • Recordcount for all the tables in my user

    How I will get recordcount for all the tables in my user
    with a single query??
    Plz help.
    Thanx in advance.

    Not possible. As there can be any number of tables with any names, this requires dynamic SQL.
    SQL given to the Oracle SQL Engine cannot be dynamic ito scope and references - it must be static. For example, one cannot do this:
    SELECT count(*) FROM :table
    For the SQL Engine to parse the SQL, determine if it is valid, determine the scope and security, determine an execution plan, it needs to know the actual object names. Objects like tables and columns and functions cannot be variable.
    You will therefore need to write a user function (in PL/SQL) that dynamically creates a [SELECT COUNT] SQL for a table, execute that SQL and return the row count - and then use SQL to iterate through USER_TABLES for example and sum the results of this function.
    Note that object tables are not listed in USER_TABLES - thus a more comprehensive list of all table objects in your schema can be found in USER_OBJECTS.

  • Problem in accessing the ejbs

    HI ,
    I am New to EJB. Here i am getting a problem n accessing the resoucess which are deployed in weblogic. Here i want to access the resoucess from a jsp. So i declared a web.xml. In that what i need to write. can anybody help me what i can specify in web.xml
    Thank you.

    Stop asking the same question again and again. It will decrease your chances of actually getting some help, because your rudeness will make people angry and less inclined to help.
    Your whole approach sounds wrong, but that's your problem. I'm betting that you don't need EJBs. You shouldn't write JSPs without JSTL. Totally, utterly wrong.
    But if you insist, I would recommend that you actually get a book or some documentation that shows you how to call an EJB from a web app. Since you're using WebLogic, maybe reading their documentation will help:
    http://edocs.bea.com/wls/docs70/webapp/components.html
    %

  • What are the Jar files required,that for accessing the Type 4 Drivers.

    what are the Jar files required,that for accessing the Type 4 Drivers.
    Regards,

    Well it is Database Specific.
    Howevr there are few 3rd party .jar (Derby) which you can use it for accesing some standard databases.

  • How can I make "No Proxy" the default for accessing the internet?

    How can I make "No Proxy" the default for accessing the internet?

    *Tools > Options > Advanced > Network : Connection > Settings
    If you do not need to use a proxy to connect to internet then try to select "No Proxy" if "Use the system proxy settings" or one of the others do not work properly.
    See "Firefox connection settings":
    *https://support.mozilla.org/kb/Firefox+cannot+load+websites+but+other+programs+can

  • Problems for measures the distance in my ipod nano 6 generation.

    Problems for measures the distance in my ipod nano 6 generation.
    I test take the ipod en my waist, in my wrist (clock), and i have calibrated the ipod often.
    Any solution for this problem?
    Many thanks.

    He iPod most likely died or broke on its own

  • When I go through the 'import favorites' from Internet Explorer, everything seems to progress correctly. However, when I click on Bokkmarks, there is no option in the menu for accessing the imported items form EI. Is there a fix for this?

    When I go through the 'import favorites' from Internet Explorer, everything seems to progress correctly. However, when I click on Bokkmarks, there is no option in the menu for accessing the imported items form EI. Why would this option be missing and is there a fix for this?

    Hello Nigel.
    Are you sure the Bookmarks you important are nowhere to be found? They should be stored in your bookmark manager, somewhere. To access the bookmark manager, go into ''Bookmarks > Organize Bookmarks...''. Try searching there.
    You can change their place from there too.

  • How can i access the table GL_CODE_COMBINATIONS  !!

    I'm sorry ~ My English is poor ~~ understand me ^^
    I execute procedure APPS.GL_TEST but error occured
    ORA-00904:"GL_TEST";invalid identifier.
    but it execute well at orange (program that like toad)
    May be i can't access GL_CODE_COMBINATIONS table ~~
    I have to execute APPS.GL_CODE_COMBINATIONS_PKG.INSERT_ROW(
    X_ROWID => X_ROWID,
    X_CODE_COMBINATION_ID => X_CCID,
    it have GL_CODE_COMBINATIONS table
    so have to make account ccid
    How can i access the table GL_CODE_COMBINATIONS !!
    Thank you ^^
    --CREATE OR REPLACE PROCEDURE APPS.GL_TEST(EFFBUF OUT VARCHAR2, RETCODE OUT NUMBER)
    IS
    V_VAL NUMBER;
    BEGIN
    UPDATE GL_CODE_COMBINATIONS
    SET SEGMENT7 = 'TEST'
    WHERE CODE_COMBINATION_ID = 1169;
    END GL_TEST;
    Message was edited by:
    jake

    ORA-00904:"GL_TEAT";invalid identifier.spelling mistake?
    Is user APPS owner of the table GL_CODE_COMBINATIONS?
    If not, you need to grant the necessary privilege directly and not through a role

  • URL for accessing the web shop in crm2007

    Hi all,
    Please help me access the web shop which i created recently.
    What is the standard URL in CRM 2007 for accessing the web shop in b2c scenario?
    Regards
    Apoorva Asthana

    Hi
    If RFC for TREX is working fine and catalog replication log shows successful, clear TREX cache bfore logon to shop.
    Step1: http://<ip>:<port>/b2b/admin/index.jsp
    Step2: Application Cache Statistics
    Step3: TREXNameServerCache
    Step4: Clear
    Step5: Logon to shop
    Note: if you want to see the replicated product catalog data use report TREX_RFC_AE_EXAMPLE
    Regards,
    Pavan

  • How can I restrict more then one user to access the table?

    Hi !
    I have a problem and two solutions and I am a bit confused as to
    which one is the best one and/or can there be any better way of
    handling the problem ?
    Problem : I have to update a key field of a table when I update
    it in the form 5.0 screen. I am basically doing a maintenance of
    a table and if a certain field is updated then the change has to
    be reflected in two more tables. But the issue is that the field
    is a part of the key in those two tables. So all I can think of
    is that I need to insert new set or rows for that new value of
    the field and delete the old set of records for old values of
    the field.
    There are two ways of doing it;
    1.One option can be to explicitely define two cursors separately
    and fetch the values in them one by one and then insert the new
    records and then delete the old records in both the tables. This
    I feel will be a cumbersome process both in terms of processing
    time and the coding.
    2.Second option I was thinking can be to create two flat tables
    (without keys) and insert the values in them and update the
    changed field there and then insert the rows in the respective
    tables. Delete the old records in the main tables and delets the
    records in these flat tables. This is a bit more faster and
    easier to predict and code. This seems to be a better option for
    me.
    Any comments on these ?
    In both the cases I was thinking of making some provision so
    that more then one person can't update the table simultaneously.
    Since if there are more then one persons doing the processing
    then some inconsistency might creep into the whole process.
    This is easier to do in the second process as if I check the
    data in the flat tables and if there is some data then I can
    presume that some one is doing the processing and I can ask the
    other person to hold for a while. But in this case how can I
    stop more then two people to simultaneously check for the empty
    table and start inserting the record ?
    I was just thinking of having a sepatare table having only one
    field and this will be a key field and as the process begins the
    process will insert a fix value say 'Y' in the key field and at
    the end of the process the record will be deleted and this way
    we can restrict the user to access the process more then one at
    a time..? Since you can't have same value of the key in a table
    more then once.
    Any better way of handling it will be deeply appreciated.
    How about locking the table at the begining and releasing the
    lock at the end ? Will there be any issue in that? since I am
    inserting and deleting the rows in the same transaction.
    Comments welcome,
    Shobhit
    null

    How about performing the update IN the database using a stored
    procedure?
    By using non-database fields on your form to get the
    information, you can then call the procedure in the database to
    perform the updates. If an error occurs in the procedure you
    rollback, if necessary, and send a message or status back to the
    form. If it succeeds you might wish to commit and then re-
    execute the form's query -- using either the original key values
    or the new key values...
    null

  • Joining the Tables VBAK and CDHDR

    Hi All,
    I am a novice to SAP, and probably have the most basic question. I need to join the two tables VBAK and CDHDR and I dont see any common fields between them.
    I would need to do this for as generating a custom report that lists all the valid contracts created or changed within the period of selection. I also need to show the old value and the new value, the user ID of who made the change/creation and the date of the change.
    Anyhelp in this regard is highly appreciated and will be rewarded appropriately.
    Many thanks in anticipation.

    CDHDR is used for each and every table of SAP, so don't look for common key with your table.
    Look for records in CDHDR with OBJECTCLAS = 'VERKBELEG' and OBJECTID = VBAK-VBELN, and then in CDPOS with keys of CDHDR and tabname = 'VBAK'  and tabkey = VBAK-VBELN. (You also get VBAP and other tables under the same Id)
    Take a look at report RVSCD100
    Regards

  • Standalone Program for Accessing MDM Table

    Hi,
      I am trying access to MDM table using standalone java program but it is giving error. Is it possible?
    If it is possible means tell me the steps or post sample codes.
    Thanks in advance
    Regards
    Suresh

    Hello:
    I have a piece of code here, even tough I believe it would be easier if you could explain a little more about your problem.
    First I create properties for connection. I'm using strings however this can be done also setting properties directly:
    String server = "MDMServer";
    int port  = 2005;
    String user = "admin";
    String password = "thePassword";
    String language = "Spanish [MX]"; // languaje and local you want to use
    // THen you choose the region and attempt to login. Please note that even tough I choose region US, I log as a MX user, as provided by the language property
    CatalogData mdmBridge = new CatalogData();     
    mdmBridge.SetCodeRegion("English [US]");          mdmBridge.Login(server,port,user,password,language);
    // also note that the catalogData object is the main entrance, now create an array for MDMTables:
    CMTableInfoArray tables = null;
    // and attempt to get them:
    AttributeInfoArray fields = mdmBridge.GetLinkedAttributesForTaxonomy("Categories",6,false);
    System.out.println("Counts: " + fields.GetCount());
    // Traverse:
    for (int i = 0; i < fields.GetCount(); i++)
         AttributeInfo att = fields.GetAttributeInfoAt(i);
         System.out.println("NAME: " + att.GetName());
    // In this case I'm getting a taxonomy table, such as "Categories". However you could use any other type of tables. Finally I get the contents of this table:
    // Attempt to get the categories               A2iStringArray array = new A2iStringArray();
                   array.Add("Filter");
    ResultSetDefinition rsd = new ResultSetDefinition("Categories");
    rsd.AddField("Id");
    A2iResultSet rs = mdmBridge.GetRecordsByValue(array,rsd,"Id");               
    for(int i = 0; i < rs.GetRecordCount(); i++)               {
       Value v = rs.GetValueAt(i,0);
       System.out.println(v.GetStringValue());
    Please review the MDM API for java for further info.
    I hope that helps
    Alejandro

Maybe you are looking for