Help me to solve this. select statement!

hello alll
is there any functional module which gives me the BELNR(of bseg) by passing the vbeln.
yeah ...we can do tht by passing bseg table ,,,,but its taking loads of time to give me the output as its not a primary key or secondary key.....
when i m using this condition in the prog i cannot use inner join as its a cluster table . if i m writing a condition it is effecting my prog performance
this statement is really taking long time to process.
in bseg table as vbeln is not primary key or seconday key, i guess thz the reason it is taking so much time ,,,
can anyone help me to sort this out... ??
any fun mod to get the data of bseg cluster table by giving vbeln?/
or any other conditions to reduce the processing time?
clear t_vbrkvbrp.
sort t_vbrkvbrp by vbeln.
loop at t_vbrkvbrp.
at new vbeln.
select bukrs belnr vbeln
from bseg
into corresponding fields of table t_temp
where bukrs = t_vbrkvbrp-bukrs
and vbeln = t_vbrkvbrp-vbeln.
endat.
endloop.
SELECT bukrs belnr buzid koart shkzg dmbtr vbeln hkont kunnr werks
FROM bseg
INTO TABLE t_bseg
for all entries in t_temp
WHERE hkont IN s_hkont
AND bukrs = t_temp-bukrs
AND belnr = t_temp-belnr
AND buzid = ' '
AND koart = 'S'
AND shkzg = 'H'.
i need to get the g/l account number and belnr from bseg for the above condition type so i have to use bseg table
as there is no apporpriate index it is scanning the full table ,,,, so can anyone tell me how to create a index or like wise to get the data faster??

Don't use BSEG, use BKPF and fields AWTYP, AWREF which link a financial document to the application and document that generated it. (The "original document" under transaction like FB03)
<i>Example: "RMRP" + invoice number for purchase invoice</i>
In  some case you need an intermediate table
<i>Example: from EKPO, EKBE, you get the MKPF records and from them the BKPF/BSEG</i>
For a list of "referenced procedures" Look at TTYP (text table is TTYPT), you will get the code, structure used to build the key (if more than one field) and a function module used to display the origin
<i>Example :  MKPF "Material document" structure MKPF_AWKEY function module MB_DOCUMENT_SENDER_MKPF</i>
You can also look at your accounting documents found with the "slow" BSEG version of your program and establish a list of AWTYP used in you company/customer.
An other way, used in some companies, is to append a structure with EBELN field to BSIS and BSAS table, these table are filled via a MOVE-CORRESPONDING statement, so the nesw records will be filled (You may write a program to update past records) then create an index on EBELN on these fields.
Regards
PS: BSEG is a cluster table, so the only real criteria are the primary keys, if you select via EBELN, the program read the whole table, may be correct in Development, but not in Production and there it will be more and more resources consuming. So NEVER select from BSEG vithout the primary keys, use the secondary tables : BSIS/BSAS, BSIM, etc.

Similar Messages

  • Hi, when ever I'm using 3G, on my Iphone4 sim stops working and Network is lost, this started after I updated my phone with  6.0.1(10A523)version. Please help how to solve this problem.

    Hi, when ever I'm using 3G, on my Iphone4 sim stops working and network is lost, this started after I updated my phone with  6.0.1(10A523)version. Please help how to solve this problem. Thanks.

    Photos/videos in the Camera Roll are not synced. Photos/videos in the Camera Roll are not touched with the iTunes sync process. Photos/videos in the Camera Roll can be imported by your computer which is not handled by iTunes. Most importing software includes an option to delete the photos/videos from the Camera Roll after the import process is complete. If is my understanding that some Windows import software supports importing photos from the Camera Roll, but not videos. Regardless, the import software should not delete the photos/videos from the Camera Roll unless you set the app to do so.
    Photos/videos in the Camera Roll are included with your iPhone's backup. If you synced your iPhone with iTunes before the videos on the Camera Roll went missing and you haven't synced your iPhone with iTunes since they went missing, you can try restoring the iPhone with iTunes from the iPhone's backup. Don't sync the iPhone with iTunes again and decline the prompt to update the iPhone's backup after selecting Restore.

  • Please help me to solve this date comparision issue..

    Please help me to solve this issue..
    If i have some data like the following..
    ID           START DATE             END DATE
    1             20080101              20080501
    1             20080502              20080630
    2             20080631              20080801
    2             20080802              20080901
                                                 ---------------> There is a break in date over here
    2             20080930              20081029
    2             20081030              20081130
    I need to compare the End Date with the start date (These data will not be in order)
    and find out if there is any break and should get the output date : *20080930*
    I am trying to do this in SQL or PL/SQL.Please help me .
    Thanks in advance.
    phani

    Hi Frank ,
    Sorry to bug you again. I ran your code on my actual data but not gettting the expected output.Here i am posting the actual code and the output that i got when i ran your code.Please bear with me and help me to solve this..
    /* Formatted on 5/25/2009 2:27:24 PM (QP5 v5.115.810.9015) */
    SELECT   member_nbr,
             aff_nbr,
             ymdeff,
             ymdend,
             gap_before,
             COUNT (gap_after)
                OVER (PARTITION BY member_nbr, aff_nbr ORDER BY ymdend DESC)
                AS gap_cnt
      FROM   (SELECT   member_nbr,
                       aff_nbr,
                       ymdeff,
                       ymdend,
                       CASE
                          WHEN ymdeff >
                                  LEAD(ymdend)
                                     OVER (PARTITION BY member_nbr, aff_nbr
                                           ORDER BY ymdend DESC)
                                  + 1
                          THEN
                             1
                       END
                          AS gap_before,
                       CASE
                          WHEN ymdend <
                                  LAG(ymdeff)
                                     OVER (PARTITION BY member_nbr, aff_nbr
                                           ORDER BY ymdend DESC)
                                  - 1
                          THEN
                             1
                       END
                          AS gap_after
    ------------I need this SQL to filter the whole data to the data that i posted in previous post -----
                FROM   (  SELECT   ms1.member_nbr, 
                                   ms1.aff_nbr,
                                   ms1.ymdeff,
                                   ms1.ymdend,
                                   ms1.void
                            FROM   (SELECT   ms.member_nbr,
                                             ms.aff_nbr,
                                             ms.ymdeff,
                                             ms.ymdend,
                                             ms.void
                                      FROM   MEMBER mb, member_span ms
                                     WHERE   mb.member_nbr = ms.member_nbr
                                             AND (20090523 BETWEEN ms.ymdeff
                                                               AND  ms.ymdend
                                                  AND TRIM (void) IS NULL)
                                             AND mb.member_nbr = 'A1000073000 ')
                                   eff_pcp,
                                   member_span ms1
                           WHERE   ms1.member_nbr = eff_pcp.member_nbr
                                   AND (SUBSTR (eff_pcp.aff_nbr, 1, 6) =
                                           SUBSTR (ms1.aff_nbr, 1, 6))
                        ORDER BY   ms1.ymdeff DESC)
    ---------- end of my part  ----------
                table_x) got_gaps;Outputs that i got when i ran that code for each individual members..
    Sorry to bug you frank and thanks for all the help.I will post here if i get any other data.
    Thanks
    phani

  • Why this select statement is failing

    Hi to all experts.
    Im not able to understand why this select statement is not fetching the record with this parameters. When i give the same parameters in se11 table t512w.. It has one record, but here the sy-subrc Value is 4.
    select  * from t512w where molga EQ '15'
             and lgart in g_lgart01
           and endda gt pn-endda
       and begda lt pn-endda.

    Dear Mohamed,
    This Select Statement is bound to Fail. When you are doing a select * from T512W, you intend to get a single record from T512W into the work area T512W which you have declared using TABLES statement. So, here you need to use Select single instead of Select *
    If you want more data, then you declare an internal table, say gt_t512w type standard table of t512w and use "
    Select from T512W
    Into TABLE GT_T512W
    WHERE ........
    Hope this solves your problem.
    Regards,
    Amit Sharma

  • How to optimize this select statement  its a simple select....

    how to optimize this select statement  as the records in earlier table is abt i million
    and this simplet select statement is not executing and taking lot of time
      SELECT  guid  
                    stcts      
      INTO table gt_corcts
      FROM   corcts
      FOR all entries in gt_mege
      WHERE  /sapsll/corcts~stcts = gt_mege-ctsex
      and /sapsll/corcts~guid_pobj = gt_Sagmeld-guid_pobj.
    regards
    Arora

    Hi Arora,
    Using Package size is very simple and you can avoid the time out and as well as the problem because of memory.  Some time if you have too many records in the internal table, then you will get a short dump called TSV_TNEW_PAGE_ALLOC_FAILED.
    Below is the sample code.
    DATA p_size = 50000
    SELECT field1 field2 field3
       INTO TABLE itab1 PACKAGE SIZE p_size
       FROM dtab
       WHERE <condition>
    Other logic or process on the internal table itab1
    FREE itab1.
    ENDSELECT.
    Here the only problem is you have to put the ENDSELECT.
    How it works
    In the first select it will select 50000 records ( or the p_size you gave).  That will be in the internal table itab1.
    In the second select it will clear the 50000 records already there and append next 50000 records from the database table.
    So care should be taken to do all the logic or process with in select and endselect.
    Some ABAP standards may not allow you to use select-endselect.  But this is the best way to handle huge data without short dumps and memory related problems. 
    I am using this approach.  My data is much more huge than yours.  At an average of atleast 5 millions records per select.
    Good luck and hope this help you.
    Regards,
    Kasthuri Rangan Srinivasan

  • Help me to solve this

    I can't view My JSP file I am getting Error Message
    Java Compile not Found
    Unable to Compile the Source file for JSP
    I copied tools.jar to servers lib dir
    But Yet i get the same message
    Pls help me to Solve this Problem

    Most common cause of the problem: JAVA_HOME environment variable not set, or set incorrectly.
    It should point to your java directory: ie C:\java1_4\ NOT C:\java1_4\bin
    Another possible cause is spaces in the path names where you have installed applications.
    Check out this page: http://www.coreservlets.com/Apache-Tomcat-Tutorial/ for a tutorial on installing tomcat.
    If you can't sort it out on your own, we need more info:
    Where have you installed Java?
    Where have installed Tomcat?
    What is the value of JAVA_HOME environment variable?
    Good luck,
    evnafets

  • Help me to solve this assignments...

    1. Write a program to print a triangle multiplication table as shown below:
    0
    0 2
    0 3 6
    0 4 8 12
    0 5 10 15 20
    0 6 12 18 24 30
    0 7 14 21 28 35 42
    2.Write a Java program that will display the factorial of the number 10.
    3.Write a Java Program to display a four by four identity matrix
    4.Write a program to calculate the sum of the odd integers between 1 and 99 using for loop.
    kindly help me to solve this assignment.

    Am I correct in all???
    class Assignment
         public static void main(String args[])
              //This is to print the numbers in triangle
              for(int i = 1; i < 8; i++)
                   for(int j = 0; j < i; j++)
                        System.out.print(" " + i*j);
                   System.out.println("");
              //print value for 10 factorial
              int factorialvalue=1;
              int f=6;
              for(int l=f;l>1;l--)
                   factorialvalue*=l;
              System.out.println("F values is "+factorialvalue);
              //4 x 4 Matrix
              for(int s=0;s<4;s++)
                   for(int m=0;m<4;m++)
                        System.out.print("("+s+","+m+") ");
                   System.out.println("");
              //sum of odd numbers up to 99
              int h=0;
              for (int b=1;b<10;b+=2)
                   h+=b;
              System.out.println("Sum is "+h);
    selva.

  • Can  you help me to solve this problem (user-exit for xd02)

    Hi!
    can  you help me to solve this problem?
    transaction XD02
    To pass the length of the field to 7 max    for    KNA1-SORT   (Search criterion 1 )
    To pass the length of the field to 4  max   for   ADRC-SORT2  (Search criterion 2)
    It is not possible to save  the customer card as long as the search criterion is not univocal
    I seek one to use-exit .
    Thanks.

    Hi,
    Check the exit SAPMF02D.
    Regards,
    Surinder

  • Hello i have a unusual problem,anyway my iphone 4 wont turn on and when someone calls they hear ringing,but my phone doesent ring,so i open cimcas now ring off. Screen is just black,because it's turned off..Please help me to solve this problem..Thanks

    Hello i have a unusual problem,anyway my iphone 4 wont turn on and when  someone calls they hear ringing,but my phone doesent ring.So i poen simcase and now ring off. Screen is just  black,because it's turned off..Please help me to solve this  problem..Thanks

    As far as trying to power up your device, make sure it has a good charge and then hold the button on the top of the phone and the home button on the faceplate together until the apple appears on the screen.

  • Hello Experts Please help me to solve this problem.

    Hello Experts,
    I am getting a problem while installing the SOLUTION MANAGER 4.0.
    in step 17/45 IMPORT ABAP :
    the problem is :
    ERROR 2008-04-29 03:10:28.110
    CJS-30023  Process call '/usr/sap/SLM/SYS/exe/run/R3load -testconnect' exits with error code 2. For details see log file(s) R3load.exe.log.
    when i saw R3load.exe.log file it has the following contain :
    sapparam: sapargv( argc, argv) has not been called.
    sapparam(1c): No Profile used.
    sapparam: SAPSYSTEMNAME neither in Profile nor in Commandline
    /usr/sap/SLM/SYS/exe/run/R3load: START OF LOG: 20080428095833
    /usr/sap/SLM/SYS/exe/run/R3load: sccsid @(#) $Id: //bas/700_REL/src/R3ld/R3load/R3ldmain.c#13 $ SAP
    /usr/sap/SLM/SYS/exe/run/R3load: version R7.00/V1.4 [UNICODE]
    Compiled Jul 14 2007 02:19:03
    /usr/sap/SLM/SYS/exe/run/R3load -testconnect
    DbSl Trace: OCI-call 'OCIServerAttach' failed with rc=12505
    DbSl Trace: CONNECT failed with sql error '12505'
    DbSl Trace: OCI-call 'OCIServerAttach' failed with rc=12505
    DbSl Trace: CONNECT failed with sql error '12505'
    (DB) ERROR: db_connect rc = 256
    DbSl Trace: OCI-call 'OCIServerAttach' failed with rc=12505
    DbSl Trace: CONNECT failed with sql error '12505'
    DbSl Trace: OCI-call 'OCIServerAttach' failed with rc=12505
    DbSl Trace: CONNECT failed with sql error '12505'
    (DB) ERROR: DbSlErrorMsg rc = 99
    /usr/sap/SLM/SYS/exe/run/R3load: job finished with 1 error(s)
    /usr/sap/SLM/SYS/exe/run/R3load: END OF LOG: 20080428095834
    Please can any body help me to solve this problem.
    waiting for fast response, as my installtion is pending due to this problem.
    have a nice day.
    Regards,
    Shivendra.

    Hi,
    The following should be verified:
    (1) check what DB instances the listener currently is aware of.  This can be done with the command 'lsnrctl services'.
    (in case you listener does not have the default name LISTENER, then use 'lsnrctl services <listener name>' )
    (2) Perhaps there is an issue with the dynamic instance registration, even though the error code is different, you should nevertheless check the points from note #563574.
    (3) Verfiy the value of the parameter local_listener (see mentioned note). Since you have changed the listener, the parameter might still be wrong.
    In case local_listener is correcly set you should give the command
      ALTER SYSTEM REGISTER;
    a try.
    Best Regards,
    Michael

  • TS1363 My iPod Nano 7th Generation couldn't be detected by iTunes when I plugged in. I tried resolving the issue by uninstalling the iTunes and then install it back again but yet still the same problem exist. Can you please help me to solve this issue?

    My iPod Nano 7th Generation couldn't be detected by iTunes when I plugged in. I tried resolving the issue by uninstalling the iTunes and then install it back again but yet still the same problem exist. Can you please help me to solve this issue? I have already updated to the latest version of iTunes on my Windows 8 and I cannot synchronize my iPod for the time being. Please do help me to solve this problem. Thank You.

    uninstall all iTunes,5 programes,this worked for me after reinstall them

  • My Creative Cloud subscription has expired, and I assigned the monthly payment, but I can not open any progam creative cloud, I need help how to solve this problem

    my Creative Cloud subscription has expired, and I assigned the monthly payment, but I can not open any progam creative cloud, I need help how to solve this problem

    Carlos-
    Start by signing out and back in to see if it will see the subscription: 
    How to sign in and sign out of creative cloud (activate/deactivate)
    If the apps are installed fine and close after launch see this link:
    CC applications close immediately after launch
    If the problem is something different, please let us know the error you see or what is happening on the screen so we can advise  you on a solution
    Pattie

  • How to use bind variable in this select statement

    Hi,
    I have created this procedure where table name and fieldname is variable as they vary, therefore i passed them as parameter. This procedure will trim leading (.) if first five char is '.THE''. The procedure performs the required task. I want to make select statement with bind variable is there any possibility to use a bind variable in this select statement.
    the procedure is given below:
    create or replace procedure test(tablename in varchar2, fieldname IN varchar2)
    authid current_user
    is
    type poicurtype is ref cursor;
    poi_cur poicurtype;
    sqlst varchar2(250);
    THEVALUE NUMBER;
    begin
         sqlst:='SELECT EMPNO FROM '||TABLENAME||' WHERE SUBSTR('||FIELDNAME||',1,5)=''.THE ''';
         DBMS_OUTPUT.PUT_LINE(SQLST);
    OPEN POI_CUR FOR SQLST ;
    LOOP
         FETCH POI_CUR INTO THEVALUE;
              EXIT WHEN POI_CUR%NOTFOUND;
              DBMS_OUTPUT.PUT_LINE(THEVALUE);
              SQLST:='UPDATE '||TABLENAME|| ' SET '||FIELDNAME||'=LTRIM('||FIELDNAME||',''.'')';
              SQLST:=SQLST|| ' WHERE EMPNO=:X';
              DBMS_OUTPUT.PUT_LINE(SQLST);
                   EXECUTE IMMEDIATE SQLST USING THEVALUE;
    END LOOP;
    COMMIT;
    END TEST;
    Best Regards,

    So you want to amend each row individually? Is there some reason you're trying to make this procedure run as slow as possible?
    create or replace procedure test (tablename in varchar2, fieldname in varchar2)
    authid current_user
    is
       sqlst      varchar2 (250);
       thevalue   number := 1234;
    begin
       sqlst := 'update ' || tablename || ' set ' || fieldname || '= ltrim(' || fieldname || ',''.'')  where substr(' || fieldname
          || ',1,5) = ''.THE ''';
       dbms_output.put_line (sqlst);
       execute immediate sqlst;
    end test;will update every row that satisfies the criteria in a single statement. If there are 10 rows that start with '.THE ' then it will update 10 rows.

  • In how many ways we can filter this select statement to improve performance

    Hi Experts,
    This select statement taking 2.5 hrs in production, Can we filter the where condition, to improve the performance.Plz suggest with coding ASAP.
    select * from dfkkop into  table t_dfkkop
               where   vtref   like 'EPC%'        and
                   ( ( augbd      =  '00000000'   and
                       xragl      = 'X' )
                               or
                     ( augbd between w_clrfr and  w_clrto )  )  and
                       augrd      ne '03'         and
                       zwage_type in s_wtype .
    Regards,
    Sam.

    if it really takes 2.5 hours, try the followingtry to run the SQL trace and
    select *
              into table t_dfkkop
              from dfkkop
              where vtref like 'EPC%'
              and augbd = '00000000' and xragl
             and augrd ne '03'
             and zwage_type in s_wtype .
    select *
              appending table t_dfkkop
              from dfkkop
              where vtref like 'EPC%'
             and augbd between w_clrfr and w_clrto 
             and augrd ne '03'
             and zwage_type in s_wtype .
    Do a DESCRIBE TABLE after the first SELECT and after the second,
    or run an SQL Trace.
    What is time needed for both parts, how many records come back, which index is used.
    Siegfried

  • Regarding this select statement

    hi,
    i am not getting value i write like this select statement
    plz check error in this code.
    TABLES: VBAK,
    vbrk.
    TYPES: BEGIN OF TYP_VBAK,
          VBELN TYPE VBELN_VA,
          VBTYP TYPE VBTYP,
          VGBEL TYPE VGBEL,
          END OF TYP_VBAK,
           BEGIN OF TYP_VBRK,
              VBELN TYPE VBELN,
              WAERK TYPE WAERK,
              VKORG TYPE VKORG,
              KNUMV TYPE KNUMV ,
              FKDAT TYPE FKDAT,
              LAND1 TYPE LLAND,
              NETWR TYPE NETWR,
              KUNRG TYPE KUNRG,
              EXNUM TYPE EXNUM,
              MWSBK TYPE MWSBP,
              END OF TYP_VBRK.
    DATA: GT_VBAK TYPE TABLE OF TYP_VBAK,
          IT_VBRK TYPE standard TABLE OF TYP_VBRK WITH HEADER LINE.
         LS_VBRK TYPE TYP_VBRK,
      SELECT VBELN
             WAERK
             VKORG
             KNUMV
             FKDAT
             LAND1
             NETWR
             KUNRG
             EXNUM
             FROM VBRK INTO CORRESPONDING FIELDS OF TABLE IT_VBRK
             WHERE VBELN = '0090060045'.

    Check from SE16 whether vbeln = 0090060045 is present in VBRK or not.
    Regards,
    Joy.

Maybe you are looking for

  • Problem with combination of LabVIEW classes (dynamic dispatch), statechart module and FPGA module

    SITUATION: - I am developing a plug-in-based software with plug-ins based on LabVIEW classes which are instanced at run-time. The actual plug-in classes are derived from generic plug-in classes that define the interfaces to the instancing VI and may

  • ALV guide! Urgent!!!

    Does anybody has material/docs/link on ALV? How to create a report using ALV and about the ALV function modules? Please send it at: [email protected]

  • [svn] 4709: * Move id assignment to after the instance is fully created.

    Revision: 4709 Author: [email protected] Date: 2009-01-28 09:50:03 -0800 (Wed, 28 Jan 2009) Log Message: * Move id assignment to after the instance is fully created. tests Passed: checkintests, mxunit databinding Needs QA: YES Needs DOC: NO Bug fixes

  • ActiveSync:Deferred Task role provision

    Hello, During active sync I am trying to provision an IDM role in some future date (ex. 30 days) on the same date I will need to remove the current IDM role. What is the best way to accomplish this? 1) Should be done using a Deferred Task? Where I us

  • Counting horizontal value and generating date

    using oracle 9i, I have a table called test which has Eno     pct1     pct2     pct3     pct4     pct5     sal_date 101     0     100     0     100     100     03/01/2010 102     0     0     100     100     100     14/02/2010 103     0     100     10