Performance tuning for extraction of data from MSEG table

Hello experts,
I m trying to extract data via select query from MSEG table based on non-primary keys, which affects my performance.
Below is my select query  :
SELECT SINGLE menge
FROM mseg
INTO w_rejqty
WHERE ebeln = it_mseg-ebeln AND
      ebelp = it_mseg-ebelp AND
      bwart = '122'.   
Kindly suggest some alternative way for it apart from creating secondary index on table MSEG which would be my last option because already four secondary index are created in my present situation and also is it advisable to create fifth secondary index for my problem?? Would it affect my database performance?
Thanks in advance
Raj

Hi Raj,
is that possible to use this query below ? You might ask to Functional whether is possible or not.
SELECT SINGLE belnr gjahr buzei INTO w_ekbe FROM ekbe
    WHERE ebeln = it_mseg-ebeln
    AND     ebelp = it_mseg-ebelp
SELECT SINGLE menge FROM mseg INTO w_rejqty
   WHERE mblnr EQ w_ekbe-belnr
   AND   mjahr EQ w_ekbe-gjahr
   AND   zeile EQ w_ekbe-buzei
Best Regards
Fernand

Similar Messages

  • FM to read data from MSEG table

    Hi all,
    can any one provide me the Function Module to fetch data from MSEG table by giving inputs
    1) materail doc number (MBLNR)
    2) MJAHR Doc year.
    or is there any other method to fetch data with high performance.

    itabh is mkpf header table.
    if not itabh is initial.
    SELECT fielname(s)
    INTO TABLE ITAB FROM MSEG
    FOR ALL ENTRIES IN ITABH
    WHERE MBLNR EQ ITABH-MBLNR
    AND MJAHR EQ ITABH-MJAHR
    AND WERKS EQ PR_WERKS
    AND LGORT IN PR_LGORT
    AND BWART IN ('261','262')
    and AUFNR IN S_AUFNR
    endif.
    Avoid using select * try to mention the field name which are required.
    try to use all key fields.
    and before writing FOR ALL ENTRIES make sure the table ITABH is not empty.

  • Gui_download for transferring the data from internal table to excel sheet.

    hi all,
    i am using gui_download for transferring the data from internal table to excel sheet.
    I have a internal table with 3 columns col1,col2,col3 and I am getting the file at the specified path,but my problem is that,in the excel sheet(path specified) all the 3 columns values are printed in one column.Please help me.
    Thanks in advance.

    Hi Venkata,
    plz use FM 'SAP_CONVERT_TO_XLS_FORMAT' :
      call function 'SAP_CONVERT_TO_XLS_FORMAT'
        exporting
    *   I_FIELD_SEPERATOR          =
    *   I_LINE_HEADER              =
          i_filename                 = p_file
    *   I_APPL_KEEP                = ' '
        tables
          i_tab_sap_data             = t_mbew
    * CHANGING
    *   I_TAB_CONVERTED_DATA       =
    * EXCEPTIONS
    *   CONVERSION_FAILED          = 1
    *   OTHERS                     = 2
      if sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      endif.
    Hope this helps,
    Erwan

  • Error occured while extracting the data from BSIK Table

    Hi Experts,
    I am trying to extract the data from "BSIK"  by using generic extraction by table, I am getting the error "Invalid extractiion Structure template BSIK of Data source XXXXXX", But when i am trying the same by using VIEW, i am able to do it,
    I am getting same problem while extracting the data from other tables like "BSIK, BSAK.........."
    can some one explain me why it is throughing some error when i am doing generic extraction by using Table,
    Thanks,

    Hi,
    Can you check below link:
    Invalid extract structure template ZBW_VW_EKES of DataSource ZBW_SCN_VENDOR
    Hope this answer your question!
    Regards,
    Nilima

  • Can we get the raw materials for a classified Material from MSEG table?

    Hi All,
    Can we get the raw materials for a classified Material from MSEG table using Order number?
    If yes How we can find it out for Past month only? As well how we can get the std price for this raw material.
    Please help me out,
    Thanks,
    Ravi

    Field STPRS (Standard price) From Table MBEW.
    Kanagaraja L

  • Extraction of data from different tables

    hi,
    i have requirment as following .
    I have tables EKET,EKKO,EKPO,EKKI,EKPA for all the tables there is common primary key (EBELN,EBELP),but i want to bring the all the data from all tables by using join,how to bring  all the data can any body give me the idea.
    Thanks,
    Rammohan.

    hi,
    search for exisintg views with: se11-search
    and fill primary and base table
    or create your own view
    A.
    Message was edited by: Andreas Mann

  • Extraction of data from shared tables

    Hello All,
        I have a scenario where I have two different software systems (SAP and xyz systems), where a intermediate table will be created in between the two systems that is shared. Data will be updated by the xyz systems into this shared table. Now, my questions regarding this shared table.
       1) Can we write some program or something to get the data from shared table to update the SAP?
       2) If possible send me the suggestions
       3) Please also send me the sample code to get the data from the shared table
    Thanks in advance,
      SDN powered

    Hi,
    1. Push mechanism
        Write a RFC  on SAP side to insert entries into the table.
        Call the RFC from xyz application passing the data you want to insert.
    2. Pull mechanism
        Write a ABAP Program, where you can somehow read the data of the xyz application and insert data into the table.
    3. Flat file
       Dump the data from xyz application into the file.
       Write a ABAP program to read the file and update the table.
    Regards,
    Ravi
    Note - Please mark all the helpful answers

  • Set up for Extraction the data from SAP ECC system

    Hi!
    I would like to analyze the transaction and master data from SAP ECC system into SAP BI system.
    I have created the connection (entry for SAP ECC system) within SAP NetWeaver System.
    Unfortunately when I try to load the transaction data for Info source the process does not end successfully.
    There are no information within SM58 on source system.
    The ST22 does not contain some suitable information.
    Question:
    Which settings do I miss and how can solve my problem?
    (user authorization, etc.)
    Thank you very much!
    regards
    Holger

    Hi!
    many thanks for your reply.
    The error I get:
    Errors while sending packages from OLTP to BI
    Diagnosis
    No IDocs could be sent to BI using RFC.
    System Response
    There are IDocs in the source system ALE outbox that did not arrive in the ALE inbox of BI.
    Further analysis:
    Check the TRFC log.
    You can access this log using the wizard or the menu path "Environment -> Transact. RFC -> In source system".
    Error handling:
    If the TRFC is incorrect, check whether the source system is fully connected to BI. In particular, check the authorizations of the background user in the source
    Can you please help me to identify the error?
    Thank you!

  • Error for datawindow get data from temp table with SP

    I create a SP to produce results. In this SP, results recorded in a temp table #mytemp. The final sql in this sp is like:
    select * from #mytemp
    Then I create datawindow to display data from this sp and got following error:
    Number 277 Select Error: there was a transactin active when exiting the stored procedure 'myproc'. The temporary table '#mytemp' was dropped in this transaction either explicitly or implicitly. This transaction has been aborted to prevent database corruption.
    How to resolve this problem?

    Sorry but could not reproduce the problem with the following products:
    PB 12.5.2 build 5652
    ASE client 15.7 EBF22688
    ASE server 15.7 EBF 19496
    Tested with ASE and SYC database profiles
    // Profile ASE
    SQLCA.DBMS = "ASE Adaptive Server Enterprise"
    SQLCA.Database = "repro"
    SQLCA.LogPass = <**********>
    SQLCA.ServerName = ""
    SQLCA.LogId = "sa"
    SQLCA.AutoCommit = False
    SQLCA.DBParm = ""
    // Profile SYC
    SQLCA.DBMS = "SYC Adaptive Server Enterprise"
    SQLCA.Database = "repro"
    SQLCA.LogPass = <**********>
    SQLCA.ServerName = "xxxxxxxx"
    SQLCA.LogId = "sa"
    SQLCA.AutoCommit = False
    SQLCA.DBParm = "Release='15'"
    Below is the source of my stored procedure.
    Prior to run the script, execute a data pipeline to create ASA tables (EAS Demo DB V12.5) department and employees into your ASE server
    CREATE PROCEDURE mySP
    AS
        BEGIN
           create table #employee_working (
             emp_id  int not null,
             manager_id  int null,
             emp_fname   varchar(20)    not null,
             emp_lname   varchar(20)    not null,
             dept_id int not null,
             dept_name varchar(40) not null )
          insert into #employee_working
             select employee.emp_id, employee.manager_id, employee.emp_fname, employee.emp_lname, employee.dept_id, department.dept_name
             from employee , department
             where employee.dept_id = department.dept_id
        select #employee_working.emp_id, #employee_working.manager_id, #employee_working.emp_fname, #employee_working.emp_lname,
        #employee_working.dept_id, #employee_working.dept_name
            from #employee_working
        END
    Jacob

  • Performance tuning for ABAP Query (created from t-cd SQ01)

    Hello all,
    We created ABAP Query report from transaction SQ01.
    But the generated report has an appropriate SQL statement which causes performance problem.
    To solve this issue, I guess the easiest way is;
    0. Give up to use it.
    1. Copy it to another object in the customer namespace.
    2. Ajust SQL statement.
    But I'm wondering if there're appropriate ways to adjust SQL statement of Query.
    Could anybody give me any better idea?
    Thank you
    Yuko

    You can try this: Create 2 ranges, for objnr and cdtcode and fill like:
    ra_objnr-sign = 'I'.
    ra_objnr-option = 'CP'.
    ra_objnr-low = 'OR*'.
    append ra_objnr.
    ra_code-sign = 'I'.
    ra_code-option = 'CP'.
    ra_code-low = 'CO*'.
    append ra_code.
    SELECT objnr udate utime
    FROM jcds
    INTO TABLE it_jcds
    WHERE objnr IN ra_objnr
    AND stat = l_tj02t
    AND cdtcode IN ra_code
    AND inact = space
    Regards,
    John.

  • Qurey for pulling out data from three tables... Pls help me out.

    Hi..
    I have three tables linkdetails, wingdetails and vendordetails. A link is connecting two wings... and link is provided by a vendor.. So the fields of linkdetails are---- linkdetails: linkid , linkname, vendorid,wing_a_id,wing_b_id
    vendordetails: vendorid, vendorname, contactnumber
    wingdetails: wingid,wingname,city
    So i want a query that retrieves all the fields from linkdetails, vendorname from vendordetails wingname corresponding to wing_a_id, wingname corresponding to wing_b_id from wingdetails for a particular linkid..
    Thanks in advance

    maybe something like:
      select ld.*,
             vd.vendorname,
             wda.wingid   wingid_a,
             wda.wingname wingname_a,
             wdb.wingid   wingid_b,
             wdb.wingname wingname_b
        from linkdetails   ld,
             vendordetails vd,
             wingdetails   wda,
             wingdetails   wdb
       where ld.vendor_id = vd.vendorid
         and ld.wing_a_id = wda.wingid
         and ld.wing_b_id = wdb.wingid
         and ld.linkid    = &linkid;

  • Need to extract the data from the CRM table : SCAPPTSEG

    Hi BW Experts,
    I want to extract the Data from CRM Table "SCAPPTSEG" to BW. The dates are stored in UTC Format.So for getting the date in CET format, we have used the Function Module "IB_CONVERT_FROM_TIMESTAMP".
    I want to create a datasource for extracting the data from "SCAPPTSEG" table and i need to use the function module for getting the date in CET Format.
    Can i achieve this action through Generic Extraction.
    please provide me the steps to achieve this.
    Thanks,
    Shahina.A

    not answered

  • FM code for extracting data from 10 tables

    Hi All,
    I have a requirement, where i need to extract the data from 10 tables using FM which is further used to create a data source in SAP R3.
    The fields are almost similar in all the tables but yet i have to fetch the data from all the tables.
    My approach:
    1. I have created a structure with all the fields in it from all the tables that comes to 35 fields.
    2. create a structure of each table and loop it into an internal table and work area.
    3. writing a read statement based on a key value from all the work areas and populate the same into my final structure.
    Note: there is a key field that need to be considered when updating the data into final stucture.
    All help on the code / logic would be appreciated.
    Thanks
    Moderator message : Spec/requirements dumping not allowed, show the work you have already done.  Thread locked.
    Edited by: Vinod Kumar on Feb 28, 2012 8:35 PM

    Hi All,
    I have a requirement, where i need to extract the data from 10 tables using FM which is further used to create a data source in SAP R3.
    The fields are almost similar in all the tables but yet i have to fetch the data from all the tables.
    My approach:
    1. I have created a structure with all the fields in it from all the tables that comes to 35 fields.
    2. create a structure of each table and loop it into an internal table and work area.
    3. writing a read statement based on a key value from all the work areas and populate the same into my final structure.
    Note: there is a key field that need to be considered when updating the data into final stucture.
    All help on the code / logic would be appreciated.
    Thanks
    Moderator message : Spec/requirements dumping not allowed, show the work you have already done.  Thread locked.
    Edited by: Vinod Kumar on Feb 28, 2012 8:35 PM

  • Extraction of data from ECC to 3rd Party systems

    Hi All,
    I want to know all the options available for extracting data from ECC to a 3rd party system (custom datawarehouse like Teradata, hyperion etc). Also, I want know if there is a best practice documentation available for extraction of data from ECC to any 3rd party system?
    Thanks,
    SB.

    Hi SB,
    Check the following link
    http://expertisesapbi.blogspot.com/2010/06/how-to-transfer-data-from-sap-system-to.html
    Ranganath.

  • Help needed in  extracting data from PCD tables

    Hi Friends
    I Have a requiremnt for creating custom portal activity report ,even though
    we have  standard report, the extraced data will be used to create bw reports later.
    my part is to find a way to extract the data from PCD tables for creating
    custom portal activity reports
    i have selected the following  tables for the data extraction
    WCR_USERSTAT,WCR_WEBCONTENTSTAT,WCR_USERFIRSTLOGON,
    WCR_USERPAGEUSAGE.
    My questions are
    1.Did i select the Exact PCD tables?
    2.Can i use UME api  for  accessing the data from those tables?
    3.can i use  the data extracted  from PCD tables in JSPdynpage  or
    webdynpro apps?
    4.can i Querry  the  PCD tables from  JSPDynpage or Webdynpro
    Please help me in finding a solution for this
    Thanks
    Ashok Battula

    Hi daniel
    Can u tell  me weather i can develop the following  custom reports from those WCR tables
         Report Type
    1     Logins
          - Unique Count
          - Total Count
          - Most Active Users (by Partner Name)
          - Most Active Users (by Contact Name)
          - Entry Point (by page name)
          - Session Time
          - Hourly Traffic Analysis
    2     Login Failures
          - Total Count
          - Count by error message
          - Credentials Entered (by user name and password)
    3     Content Views (by File Name)
          - Unique Count
          - Total Count
          - Most requested Files
          - Most requested Pages
          - File Not Found
    4     Downloads (by File Name)
          - Unique Count
          - Total Count
          - Most requested Files
          - File Not Found
    5     Portal Administration
          - Site Content (by file name)
          - Site Content (by page name)
          - Latest Content (by file name)
          - Expired Content (by file name)
          - Subscriptions Count (by file name)
    6     Login History (by Partner, Contact Name)
          - No Login
          - First Login
          - Duration between registration and first login
          - Most Recent Login
          - Average Number of Logins
    plz  help me in find ing a way
    thanks
    ashok

Maybe you are looking for