Problem while Fetching BSAD

Hi to all ,
I' ve problem while fetching bsad for a report , in t-code se30 i've seen that it takes %89,1 performance of overall.
SELECT belnr buzei dmbtr  blart budat augdt augbl sgtxt
   into table odemelerg
          FROM bsad
          WHERE bukrs EQ bukrs
            AND kunnr EQ kunnr
            AND ( umsks EQ space OR umsks IS NULL )
            AND ( umskz EQ space OR umskz IS NULL )
            AND augbl EQ i_augbl
            AND augdt GE i_budat
            AND gjahr EQ gjahr
            AND belnr NE i_belnr
            AND bsadbelnr NE bsadaugbl
            AND ( blart EQ blart_bt OR blart EQ blart_hf
                  OR blart EQ blart_mi ).
here : blart_bt is declared as a constant type and its value is 'BT'. such as blart_hf, blart_mi
How can I make this Select query working in a better performance
Kind regards,
Caglar

Hi
If you know the bill number:
-1) Search FI document:
Get header data
select * from bkpf where AWTYP = 'VBRK'
                     and AWKEY = BILL NUMBER.
EXIT.
ENDSELECT.
Get items data
SELECT * FROM BSEG INTO TABLE T_BSEG
                       WHERE BUKRS = BKPF-BUKRS
                         AND BELNR = BKPF-BELNR
                         AND GJAHR = BKPF-GJAHR
                         AND KOART = 'D'.
Payment:
LOOP AT T_BSEG WHERE AUGDT <> '00000000'.
IF T_BSEG-AUGBL <> _BKPF-BELNR
    T_BSEG-AUGDT <> _BKPF-BUDAT.
SELECT * FROM BKPF INTO _BKPF
                    WHERE BUKRS = T_BSEG-BUKRS
                      AND BELNR = T_BSEG-AUGBL
                      AND BUDAT = T_BSEG-AUGDT.
   EXIT.
ENDSELECT.
SELECT * FROM BSEG APPENDING TABLE T_PAYMENT
                       WHERE BUKRS = _BKPF-BUKRS
                         AND BELNR = _BKPF-BELNR
                         AND GJAHR = _BKPF-GJAHR
                         AND KOART = 'D'.
ENDIF.
ENDLOOP.
Partial payment
SELECT * FROM BSAD INTO TABLE WHERE BUKRS = BKPF-BUKRS
                                AND KUNNR = T_BSEG-KUNNR
                                AND REBZG = BKPF-BELNR
                                AND REBZJ = BKPF-GJAHR.
Max

Similar Messages

  • Can anyone pls. help me : facing problem while fetching the data from BAPI

    Hi all,
        we have installed xMII in a new server. In this new server I am trying to fetch data from a BAPI & write it into a file thru a transaction, but i cant see the data in the tracer, & neither is the file created. But with the same configuration & connection am able to get the data in the old server. Can anyone pls. tell me wat could be the problem?? or is there anything else that we might have forgotten while installing xMII in the new server.
    ur help would be greatly appreciated.
    Thanks,
    Sushma.

    Hi Ravi,
           no am not able to see the table structure also. This is what it is showing in the tracer :
       [INFO ]: Execution Started At: 17:24:17
    [DEBUG]: 00000.03100 Begin Transaction 'TMP99A51958-5BAE-CDE0-0DB5-A3A8C72BC297'
    [DEBUG]: 00000.03100 Begin Sequence Sequence : ()
    [DEBUG]: 00000.03100 Begin Action SAPJCOInterface_0 : (SAP JCO Interface)
    [DEBUG]: 00006.43700 Connection Took 6406 mS
    [DEBUG]: 00009.82800 Function Creation Took 3391 mS
    [DEBUG]: 00010.25000 Execution Took 422 mS
    [DEBUG]: 00010.25000 End Action SAPJCOInterface_0 : (SAP JCO Interface)
    [DEBUG]: 00010.25000 Begin Sequence Sequence_0 : ()
    [DEBUG]: 00010.25000 Begin Action Repeater_0 : (Repeater)
    [DEBUG]: 00010.26600 End Action Repeater_0 : (Repeater)
    [DEBUG]: 00010.26600 End Sequence Sequence_0 : ()
    [DEBUG]: 00010.26600 End Sequence Sequence : ()
    [DEBUG]: 00010.26600 End Transaction 'TMP99A51958-5BAE-CDE0-0DB5-A3A8C72BC297'
    [INFO ]: Execution Completed At: 17:24:28 Elapsed Time was 10235 mS
    I doubt the repeater is not working, becoz i checked the JCO connection & thats fine..
    Thanks,
    Sushma.

  • Problem while fetching more records in SAP ABAP report program

    Hello Frinds,
    I have SAP ABAP report program which fetches data from usr02 table
    Now, program is working fine with less number of records, bot in production there are more than 200000 records and either report gets timed out or there is run time error like buffer area not available.
    Below is the fetch statement
    SELECT bname FROM usr02 INTO TABLE lt_user
    So, do I need to take records in small chunks, I do not think it is needed as I have worked on number of othere databases where there are number of records in single fetch statement and database itself take care of this.
    Please provide me some approach to resolve this problem.

    This will be very difficult for you.....
    Since you are getting a time out error....it looks like, you are runnning this report in foreground....................
    Try running it in background it will work...
    ELSE....you have to fetch in small chunks....but the question is how will you do it. Since the USR02 only has BNAME as primary key...
    Either put the BNAME as part of selection screen and fetch the data.....it will solve your problem....
    Only fetch for those BNAME which is entered in the selection screen...
    Hope it helps!

  • Problem while reading the file from FTP server

    Hi Friends,
    I have a problem while fetching files from FTP server.
    I used FTP_Connect, FTP_COMMAND function modules. I can able to put the files into FTP server.
    but I cant able to pick the files from FTP server.
    anyone have faced similar issues kindly let me know.
    Thanks
    Gowrishankar

    Hi,
    try this way..
    for reading the file using FTP you need to use different unix command ..
    Prabhuda

  • Problem while selecting BELNR from BSEG

    Hi Experts,
    I have a report performance problem while fetching BELNR from BSEG table.
    I have to print latest BELNR from BSEG where BUZID = ‘M’ but at the time of execution of report, It is taking too much time (More that hour and sometimes it gets hanged).
    I have also gone through the comments provided by experts for previous problems asked in this forum e.g. BSEG is a cluster table that is why data retrieval takes long time etc.
    Can any one has any other idea or suggestion  or any other way to solve this problem
    Regards,
    Neeraj

    Hi,
    1) Try to create an index on BUZID field
    2) Don't use SELECT/ENDSELECT statement. Instead of that extract all the concerned entries from BSEG into an internal table :
    select belnr from bseg appending table itab where buzid = 'M'.
    then do this :
    sort itab by belnr.
    describe itab lines n.
    read table itab index n.
    Please reward if helpful.
    Regards,
    Nicolas.

  • Swing Applet in JSP: problem with fetching data from database

    i am facing a problem while fetching data from database using Swing Applet plugged in a JSP page.
    // necessary import statements
    public class NewJApplet extends javax.swing.JApplet {
    private JLabel jlblNewTitle;
    private Vector vec;
    public static void main(String[] args) {
    JFrame frame = new JFrame();
    NewJApplet inst = new NewJApplet();
    frame.getContentPane().add(inst);
    ((JComponent)frame.getContentPane()).setPreferredSize(inst.getSize());
    frame.pack();
    frame.setVisible(true);
    public NewJApplet() {
    super();
    initGUI();
    private void initGUI() {
    try {
    this.setSize(542, 701);
    this.getContentPane().setLayout(null);
    jlblTitle = new JLabel();
    this.getContentPane().add(jlblTitle);
    jlblTitle.setText("TITLE");
    jlblTitle.setBounds(197, 16, 117, 30);
    jlblTitle.setFont(new java.awt.Font("Dialog",1,20));
    jlblNewTitle = new JLabel();
    this.getContentPane().add(jlblNewTitle);
    Vector vecTemp = getDBDatum(); // data fetched fm DB r stored here.
    jlblNewTitle.setText(vecTemp.get(1).toString());
    jlblNewTitle.setBounds(350, 16, 117, 30);
    jlblNewTitle.setFont(new java.awt.Font("Dialog",1,20));
    } catch (Exception e) {
    e.printStackTrace();
    }//end of initGUI()
    private Vector getDBDatum() {
    // fetches datum from oracle database and stores it in a vector
    return lvecData;
    }//end of getDBDatum()
    }//end of class
    in index.jsp page i have included the following code for calling this applet:
    <jsp:plugin type="applet" code="NewJApplet.class" codebase="applets"
    width="600" height="300">
    <jsp:fallback>Could not load applet...</jsp:fallback>
    </jsp:plugin>
    if i view it in using AppletViewer it runs perfectly and display the data in JLabel. (ie, both jlblTitle and jlblNewTitle).(ie, DATA FETCHES FROM db AND DISPLAYS PROPERLY)
    BUT IF I CLICK ON INDEX.JSP, ONLY jlblTitle APPEARS. jlblnNewTitle WILL BE BLANK(this label name is supposed to fetch from database)
    EVERY THING IS DISPAYING PROPERLY EXCEPT DATA FROM DATABASE!!!
    i signed the applet as follows :
    grant {
    permission java.security.AllPermission;
    Can any body help me to figure out the problem?

    This is the Swing Applet java code
    import java.awt.Dimension;
    import java.sql.Connection;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Statement;
    import java.util.Vector;
    import javax.swing.tree.DefaultMutableTreeNode;
    import javax.swing.JScrollPane;
    import javax.swing.JApplet;
    import javax.swing.JButton;
    import javax.swing.JComponent;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JTree;
    import javax.swing.ScrollPaneConstants;
    import javax.swing.SwingConstants;
    public class HaiApplet extends javax.swing.JApplet {
         private JLabel     jlblTitle;
         private JLabel     jlblNewTitle;
         private Vector     vec;
         * main method to display this
         * JApplet inside a new JFrame.
         public static void main(String[] args) {
              JFrame frame = new JFrame();
              NewJApplet inst = new NewJApplet();
              frame.getContentPane().add(inst);
              ((JComponent)frame.getContentPane()).setPreferredSize(inst.getSize());
              frame.pack();
              frame.setVisible(true);
         public HaiApplet() {
              super();
              initGUI();
         private void initGUI() {
              try {               
                   this.setSize(542, 701);
                   this.getContentPane().setLayout(null);
                        jlblTitle = new JLabel();
                        this.getContentPane().add(jlblTitle);
                        jlblTitle.setText("OMMS");
                        jlblTitle.setBounds(197, 16, 117, 30);
                        jlblTitle.setFont(new java.awt.Font("Dialog",1,20));
                        jlblTitle.setHorizontalAlignment(SwingConstants.CENTER);
                        jlblTitle.setForeground(new java.awt.Color(0,128,192));
                        jlblNewTitle = new JLabel();
                        this.getContentPane().add(jlblNewTitle);
                        Vector vecTemp = getDBDatum();
                        jlblNewTitle.setText(vecTemp.get(1).toString());
                        jlblNewTitle.setBounds(350, 16, 117, 30);
                        jlblNewTitle.setFont(new java.awt.Font("Dialog",1,20));     
              } catch (Exception e) {
                   e.printStackTrace();
         }//end of initGUI()
         private Vector getDBDatum() {
              Vector lvecData = new Vector(10,5);
              Connection lcon = null;
              Statement lstmt = null;
              ResultSet lrsResults = null;
              String lstrSQL = null;
              String lstrOut = null;
              try {
                   OmmsDBConnect db = new OmmsDBConnect();
                   lcon = db.connectDb();
                   lstmt = lcon.createStatement(lrsResults.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
                   lstrSQL = "select DT_ID from P_DATATABLES";
                   lrsResults = lstmt.executeQuery(lstrSQL);        
                   int i = 0;
                   lrsResults.last();
                   int length = lrsResults.getRow();
                   System.out.println(length);
                   lrsResults.beforeFirst();
                   int recCount = 0;
                   while (lrsResults.next()) {
                        recCount++;
                        lvecData.addElement(new String(lrsResults.getString("DT_ID")));
                   //     System.out.println("ID :  " + lrsResults.getString(1));
                        i++;
                   }System.out.println("here 3 out fm while");
              catch(SQLException e) {
                   System.out.print("SQLException: ");
                   System.out.println(e.getMessage());
              catch(Exception ex) {
                   lstrOut = "Exception Occured " + ex.getMessage();
              finally {
                   try {
                        lrsResults.close();
                        lstmt.close();
                        lcon.close();
                        System.out.println("[DONE]");
                   catch(Exception e) {
                        System.out.println(e);
             }//end of finally
              return lvecData;
         }//end of getDBDatum()
    }//end of classOfcourse the above code compiles and runs well. in Applet Viewer
    I plugged the above Swing Applet in a JSP page index.jsp
    <jsp:plugin type="applet" code="NewJApplet.class" codebase="applets"
                   width="600" height="300">
         <jsp:fallback>Could not load applet...</jsp:fallback>
    </jsp:plugin>Every thing is working fine in AppletViewer...But if i view this in any browser, then only the jlblTitle is displaying. jlblNewTitle is not displaying(this label name is actually fetching from thedatabase)
    can any body help me regarding this matter.? Thx in Advance.

  • Problem while incrementing a variable in Jasper Reports

    Hi
    I am using Jasper Reports for designing reports. These reports will be used by my Java application.
    But there is problem while I am trying to increment a variable depending on some condition.
    Requirement: I have to display information about all the residents in a hospital in a single report. Resident information will be fetched from the XML file. When a resident ID is found in the XML, then the variable(resno) shoud be incremented. I have set the initial value to 1.
    Problem: Only for the first resident, resno is showing as 1. For all the remaining residents, its showing as 0 (zero).The variable 'resno' is not incrementing for each resident.
    Even the ResidentID is not null. All the ResidentID's exists in the XML file.
    Please find the code below.
    <variable name="resno" class="java.lang.Integer" incrementType="Group" incrementGroup="residentbrk" calculation="Count">
    <initialValueExpression><![CDATA[new Integer(1)]]></initialValueExpression>
    </variable>
    <group name="residentbrk" isStartNewPage="true">
    <groupExpression><![CDATA[$F{ResidentID}]]></groupExpression>
    <groupHeader>
    <band height="16">
    <textField hyperlinkType="None">
    <reportElement positionType="Float" x="0" y="-1" width="96" height="17"/>
    <textElement>
    <font isBold="true"/>
    </textElement>
    <textFieldExpression class="java.lang.String"><![CDATA[$R{residentno}]]></textFieldExpression>
    </textField>
    <textField hyperlinkType="None">
    <reportElement positionType="Float" x="96" y="-2" width="64" height="18"/>
    <textElement/>
    <textFieldExpression class="java.lang.Integer"><![CDATA[$V{resno}]]></textFieldExpression>
    </textField>
    </band>
    </groupHeader>
    </group>
    Could you please provide a solution for this.

    Not clear at all. May be like this
    declare
    v_temp varchar2(100);
    v_final number;
    begin
    --loop
    v_temp:='sun';
    v_temp:=translate(lower(v_temp), '1abcdefghijklmnopqrstuvwxyz', '1');
    dbms_output.put_line('Temp:'||v_temp);
    v_temp := v_temp || 'Mon5.1';
    v_temp:=translate(lower(v_temp), '1abcdefghijklmnopqrstuvwxyz', '1');
    dbms_output.put_line('Temp:'||v_temp);
    v_temp:= v_temp || 'Tue';
    v_temp:=translate(lower(v_temp), '1abcdefghijklmnopqrstuvwxyz', '1');
    dbms_output.put_line('Temp:'||v_temp);
    v_final:=to_number(v_temp);
    dbms_output.put_line('v_final'||v_final);
    --coalesce
    --end loop;
    end;
    /

  • Problem while retrving data from a view

    Hi Friends
      i have a problem while retriving data from a view <b>v_t685a</b>.
    the error message is :""" "V_T685A" is not defined in the ABAP Dictionary as a table, projection view or database view."""
    i wrote : select single VTEXT1 from V_T685A into w_cst_jin1 where
                        KSCHL = 'JIN1' and
                        KAPPL = 'V'.
    how to retrive the data.
    waiting for quick response
    Regards
    Mukesh

    Hi
    This is a Maintenance View, not a Database View
    SO can't fetch data using select statement.
    You can use the Table <b>T685</b> directly to fetch the condition Types data straight away instead of the view. write the same select for this table and use.
    Regards
    Anji
    Message was edited by:
            Anji Reddy Vangala

  • Interoperability problem in fetching cursor b/w oracle 8.1.7 and oracle 9i

    I have got the problem while executing the Fetch
    cursor statement (The statement is used to fetch
    record from the table by using cursor) through PROC
    from Oracle 9i(client) on one m/c to Oracle
    8i(server)version 8.1.7 on the other m/c
    The Operating system is HP-UX 11.0.
    We are getting the Oracle Errno as -932 ie
    "inconsistent datatypes".
    The code is given as follows
    #include <stdio.h>          /* UNIX */
    #include <string.h> /* System include header files */
    #include <stdlib.h>
    EXEC SQL INCLUDE sqlca;
    EXEC SQL begin declare section;
    VARCHAR uid[20];
    VARCHAR pwd[40];
    VARCHAR dbname[40];
    VARCHAR tblname[40];
    char a_szSqlString[1024];
    int h_nCount;          /* balance */
    EXEC SQL end declare section;
    int main()
         strcpy ((char *)uid.arr,"user");
         uid.len=strlen((char *)uid.arr);
         strcpy ((char *)pwd.arr,"pass");
         pwd.len=strlen((char *)pwd.arr);
         strcpy ((char *)dbname.arr,"net1");
         dbname.len=strlen((char *)dbname.arr);
         strcpy ((char *)tblname.arr,"ctltbl");
    tblname.len=strlen((char *)tblname.arr);
         fprintf(stdout," B4 CONNECTING\n");
         fflush(stdout);
         EXEC SQL CONNECT :uid IDENTIFIED BY :pwd USING :dbname;
         fprintf(stdout," AFTER CONNECTING\n");
         fflush(stdout);
         if ( sqlca.sqlcode != 0 )
    printf("Sqlconnect return code = %d\n", sqlca.sqlcode);
    fflush(stdout);
    return;
         fprintf(stdout," AFTER CONNECT STATEMENT\n");
         fflush(stdout);
         sprintf(a_szSqlString, "%s%s%s%s ","select count(*) into :h_nCount from tab "," where TNAME=UPPER('", tblname,"') " );
         EXEC SQL DECLARE sCheckTblName STATEMENT;
         if ( sqlca.sqlcode != 0 )
    printf("Sqlat = %d\n", sqlca.sqlcode);
    fflush(stdout);
    return;
         EXEC SQL PREPARE sCheckTblName from :a_szSqlString;     
         if ( sqlca.sqlcode != 0 )
    printf("Sqlprep = %d\n", sqlca.sqlcode);
    fflush(stdout);
    return;
         fprintf(stdout," AFTER PREPARE STATEMENT\n");
    fflush(stdout);
         EXEC SQL DECLARE cCheckTblName CURSOR FOR sCheckTblName;
         if ( sqlca.sqlcode != 0 )
    printf("Sqldec = %d\n", sqlca.sqlcode);
    fflush(stdout);
    return;
         fprintf(stdout," AFTER CURSOR DECLARE STATEMENT\n");
    fflush(stdout);
         EXEC SQL OPEN cCheckTblName;
         if ( sqlca.sqlcode != 0 )
    printf("Sqlopen = %d\n", sqlca.sqlcode);
    fflush(stdout);
    return;
         fprintf(stdout," AFTER CURSOR OPEN STATEMENT\n");
    fflush(stdout);
         printf("THE VALUE OF COUNT is %d\n",h_nCount);
         EXEC SQL FETCH cCheckTblName INTO :h_nCount;
         if ( sqlca.sqlcode != 0 )
    printf("Sqlfetch = %d\n", sqlca.sqlcode);
    fflush(stdout);
    return;
         fprintf(stdout," AFTER CURSOR FETCH STATEMENT\n");
    fflush(stdout);
         EXEC SQL CLOSE cCheckTblName;
         * If the return code is not ok and first_time is true, no data
         * existed.
         EXEC SQL AT :dbname COMMIT WORK RELEASE;
         /*EXEC SQL COMMIT WORK RELEASE;*/
    The Makefile contents is as follows
    proc sqlcheck=full define=_PROC userid=user/pass@net1 CHAR_MAP=VARCHAR2, DBM
    S=V9 iname=srini1.pc include=/back/app/oracle/rdbms/demo include=/back/app/oracl
    e/plsql/public include=/back/app/oracle/network/public include=/back/app/oracle/
    precomp/public
    cc -g -o sri srini1.c -I/back/app/oracle/precomp/public -I/back/app/oracle/rdbm
    s/demo -I/back/app/oracle/network/public -I/back/app/oracle/plsql/public -I/opt/
    mqm/inc -L/back/app/oracle/lib32 -lclntsh
    Please treat this as an very urgent one!!!!!!!!!!
    V.arunachalam and J.srinivasan

    hi,
    try deleting the into :... from the statement
    that you are parsing as the cursor
    rgds

  • Error while fetching data into collection type.

    Hi all,
    I'm facing a problem while i'm fetching data into a table type.
    Open c1;
    open c2;
    loop
    Fetch c1 into partition_name_1;
    fetch c2 into partition_name_2;
    exit when c1%notfound or c2%notfound;
    open C1_refcursor for 'select a.col1,b.col2 from table1 partition('||partition_name_1||') a, table2 partition('||partition_name_2) b
    where a.col2=b.col2';
    loop
    fetch c1_refcursor BULK COLLECT into v1,v2 <-----This is the line where i'm getting the error as "ORA-01858: a non-numeric character was found where a numeric was expected"
    limit 100000;
    exit when v1.count=0;
    forall i in 1..v1.count
    end loop;
    i also checked the data type of the table variable its same as the column selected in the refcursor.
    Please help me out.
    Message was edited by:
    Sumit Narayan

    Ok I see that, but I don't think you can use associative arrays in this manner then, because you cannot select data directly into an associative_array.
    As far as I'm aware, they must be assigned an index and the error suggests to me that its missing an index.
    You can select directly into records and maybe this is where you need to go.

  • Eliminate duplicate while fetching data from source

    Hi All,
    CUSTOMER TRANSACTION
    CUST_LOC     CUT_ID          TRANSACTION_DATE     TRANSACTION_TYPE
    100          12345          01-jan-2009          CREDIT
    100          23456          15-jan-2000          CREDIT
    100          12345          01-jan-2010          DEBIT
    100          12345          01-jan-2000          DEBITNow as per my requirement, i need to fetch data from CISTOMER_TRANSACTION table for those customer which has transaction in last 10 years. In my above data, customer 12345 has transaction in last 10 years, whereas for customer 23456, does not have transaction in last 10 years so will eliminate it.
    Now, CUSTOMER_TRANSACTION table has approximately 100 million records. So, we are fectching data in batches. Batching is divided into months. Total 120 months. Below is my query.
    select *
    FROM CUSTOMER_TRANSACTION CT left outer join
    (select distinct CUST_LOC, CUT_ID FROM CUSTOMER_TRANSACTION WHERE TRANSACTION_DATE >= ADD_MONTHS(SYSDATE, -120) and TRANSACTION_DATE < ADD_MONTHS(SYSDATE, -119) CUST
    on CT.CUST_LOC = CUST.CUST_LOC and CT.CUT_ID = CUST.CUT_IDThru shell script, months number will change. -120:-119, -119:-118 ....., -1:-0.
    Now the problem is duplication of records.
    while fetching data for jan-2009, it will get cust_id 12345 and will fetch all 3 records and load it into target.
    while fetching data for jan-2010, it will get cust_id 12345 and will fetch all 3 records and load in into target.
    So instead of having only 3 records, for customer 12345 it will be having 6 records. Can someone help me on how can i eliminate duplicate records from getting in.
    As of now i have 2 ways in mind.
    1. Fetch all records at once. Which is impossible as it will give space issue.
    2. After each batch, run a procedure which will delete duplicate records based on cust_loc, cut_id and transaction_date. But again it will have performance problem.
    I want to eliminate it while fetching data from source.
    Edited by: ace_friends22 on Apr 6, 2011 10:16 AM

    You can do it this way....
    SELECT DISTINCT cust_doc,
                    cut_id
      FROM customer_transaction
    WHERE transaction_date >= ADD_MONTHS(SYSDATE, -120)
       AND transaction_date < ADD_MONTHS(SYSDATE, -119)However please note that - if want to get the transaction in a month like what you said earlier jan-2009 and jan-2010 and so on... you might need to use TRUNC...
    Your date comparison could be like this... In this example I am checking if the transaction date is in the month of jan-2009
    AND transaction_date BETWEEN ADD_MONTHS(TRUNC(SYSDATE,'MONTH'), -27)  AND LAST_DAY(ADD_MONTHS(TRUNC(SYSDATE,'MONTH'), -27)) Your modified SQL...
    SELECT *
      FROM customer_transaction 
    WHERE transaction_date BETWEEN ADD_MONTHS(TRUNC(SYSDATE,'MONTH'), -27)  AND LAST_DAY(ADD_MONTHS(TRUNC(SYSDATE,'MONTH'), -27))Testing..
    --Sample Data
    CREATE TABLE customer_transaction (
    cust_loc number,
    cut_id number,
    transaction_date date,
    transaction_type varchar2(20)
    INSERT INTO customer_transaction VALUES (100,12345,TO_DATE('01-JAN-2009','dd-MON-yyyy'),'CREDIT');
    INSERT INTO customer_transaction VALUES (100,23456,TO_DATE('15-JAN-2000','dd-MON-yyyy'),'CREDIT');
    INSERT INTO customer_transaction VALUES (100,12345,TO_DATE('01-JAN-2010','dd-MON-yyyy'),'DEBIT');
    INSERT INTO customer_transaction VALUES (100,12345,TO_DATE('01-JAN-2000','dd-MON-yyyy'),'DEBIT');
    --To have three records in the month of jan-2009
    UPDATE customer_transaction
       SET transaction_date = TO_DATE('02-JAN-2009','dd-MON-yyyy')
    WHERE cut_id = 12345
       AND transaction_date = TO_DATE('01-JAN-2010','dd-MON-yyyy');
    UPDATE customer_transaction
       SET transaction_date = TO_DATE('03-JAN-2009','dd-MON-yyyy')
    WHERE cut_id = 12345
       AND transaction_date = TO_DATE('01-JAN-2000','dd-MON-yyyy');
    commit;
    --End of sample data
    SELECT *
      FROM customer_transaction 
    WHERE transaction_date BETWEEN ADD_MONTHS(TRUNC(SYSDATE,'MONTH'), -27)  AND LAST_DAY(ADD_MONTHS(TRUNC(SYSDATE,'MONTH'), -27));Results....
    CUST_LOC     CUT_ID TRANSACTI TRANSACTION_TYPE
          100      12345 01-JAN-09 CREDIT
          100      12345 02-JAN-09 DEBIT
          100      12345 03-JAN-09 DEBITAs you can see, there are only 3 records for 12345
    Regards,
    Rakesh
    Edited by: Rakesh on Apr 6, 2011 11:48 AM

  • Issue while fetching the file through *.extension by FTP sender file adapte

    Hello Experts,
    I am facing a issue while fetching the data through sender File adapter with  ' *.file extension' .I am illustarting the scenario as below .
    It is a simple scenarion of File to File inboumd scenarion.Here file is getting picked up from a third party system
    through FTP sender chanel and stored in a temp folder of PI through NFS rceiver file adapter .
        The problem is however I am getting, while picking the file with file name as "*.exo"(where exo is the file extension).
    But while fetching the file with particular name like"abcd_10032011*.exo"(file naming has been done by combination of abcd(always same)_currentdate(change according to current date)),file picked successfully .
    So here ,in the prior case file not getting picked up,but in later case it dose .
    Can anyone please let me know what might be the issue?

    Hi Sunit,
    Connect from your PI System to 3rd Party System (where are placed the Source Files)
    FTP <PartySystemHostName>
    eg. FTP 10.2.3.456 (then insert Username & Password to Login)
    Go to source directory
    cd \<SourceDirectory>
    eg. cd \donaldduck\directory\
    Execute a File List command
    ls -la *.<extension>
    eg. ls -la *.exo
    In this way you should be able to view all files with this extension (*.exo), the same action that Sap XI perform to pickup the file.
    Then, try to copy that file to your Local PI System (to check if there're some permissions issue):
    mget <filename>.exo
    eg. mpget File1_01012011.exo

  • Problem while using ranges

    Hi everyone,
    In my report i have to restrict some personal subgroup, say E1,E2,E3,E4 ...M7, CT,CX,CU etc.
    So what im doing is im giving it in ranges as
    R_PERSK-OPTION = 'NE'.
      R_PERSK-SIGN = 'I'.
      R_PERSK-LOW  = 'E1'.
      R_PERSK-HIGH = 'M7'.
      APPEND R_PERSK.
      CLEAR R_PERSK-HIGH.
    R_PERSK-LOW = 'TM'.
    APPEND R_PERSK.
      R_PERSK-LOW = 'TN'.
      APPEND R_PERSK.
      R_PERSK-LOW = 'TH'.
      APPEND R_PERSK.
      R_PERSK-LOW = 'CT'.
      APPEND R_PERSK.
      R_PERSK-LOW = 'CX'.
      APPEND R_PERSK.
      R_PERSK-LOW = 'CU'.
      APPEND R_PERSK.
      R_PERSK-LOW = 'TE'.
      APPEND R_PERSK.
      R_PERSK-LOW = 'TF'.
      APPEND R_PERSK.
      R_PERSK-LOW = 'TG'.
      APPEND R_PERSK.
      R_PERSK-LOW = 'TK'.
      APPEND R_PERSK.
      R_PERSK-LOW = 'TA'.
      APPEND R_PERSK.
      R_PERSK-LOW = 'Z1'.
      APPEND R_PERSK.
      CLEAR R_PERSK.
      SELECT A~PERNR INTO CORRESPONDING FIELDS OF TABLE IT_DETAIL
       FROM ( PA0000 AS A INNER JOIN PA0001 AS B
       ON APERNR = BPERNR ) INNER JOIN PA0002 AS C
       ON APERNR = CPERNR
       WHERE APERNR IN S_PERNR   AND BBUKRS = P_BUKRS
       AND   BWERKS IN S_WERKS   AND BBTRTL IN S_BTRTL
       AND   BPERSK IN R_PERSK   AND BORGEH IN S_ORGEH
       AND   B~ABKRS IN S_ABKRS
       AND   C~GESCH IN  P_GENDER
       AND   AENDDA = '99991231' AND ASTAT2 = '3'
       AND   B~ENDDA = '99991231'.
    Problem is its picking all the datas that i  have assigned to R_PERSK. I have to
    restrict all those subgroup while fetching the data.
    Its urgent ,Plz
    thanks in advance,
    Stanley

    The problem I feel is in the code below:
    R_PERSK-OPTION = 'NE'.
    R_PERSK-SIGN = 'I'.
    R_PERSK-LOW = 'E1'.
    R_PERSK-HIGH = 'M7'.
    APPEND R_PERSK.
    CLEAR R_PERSK-HIGH.
    When we are giving a range 'E1' to 'M7', NE wont work.
    Instead u can give here like this :
    R_PERSK-OPTION = 'BT'.
    R_PERSK-SIGN = 'E'.
    R_PERSK-LOW = 'E1'.
    R_PERSK-HIGH = 'M7'.
    APPEND R_PERSK.
    CLEAR R_PERSK-HIGH.
    Then again set the Option as 'NE' and Sign as 'I'.
    Try this . It shud wrk.
    Regards,
    Himanshu

  • Problem while working with function module RFC_READ_TABLE

    Dear Experts,
                     I am facing a problem while working on the FM RFC_READ_TABLE, in which there is a tables parameter options which is of table type, to which I am passing the condition of selection.  In the debugg mode I found the select quiry in the source code of function module is not executing the condition passed in the options parameter.
    My actual requirement is to fetch all the custom programs in a remote server, the code I have written is below.
    TYPES :
             BEGIN OF ty_tadir,
               pgmid  TYPE pgmid,
               object TYPE  trobjtype,
               obj_name  TYPE  sobj_name,
             END OF ty_tadir.
    DATA : it_tadir TYPE STANDARD TABLE OF ty_tadir,
            wa_tadir TYPE ty_tadir.
      data: stmp_dokhl  like TAB512       occurs 100000 with header line.
      data: options1    like rfc_db_opt occurs     10 with header line.
    data: wa_options1 like line of options1.
      data: nametab1    like rfc_db_fld  occurs     10 with header line.
    START-OF-SELECTION.
    DATA : W_VALUE(5)  TYPE C,
           W_VALUE1(20) TYPE C.
    W_VALUE1 =  'OBJ_NAME like'.
    W_VALUE = 'z*'.
    CONCATENATE 'OBJ_NAME LIKE' ' ''' W_VALUE '''' INTO OPTIONS1-TEXT.
    CONCATENATE W_VALUE1 W_VALUE INTO wa_OPTIONS1-TEXT SEPARATED BY SPACE.
    APPEND wa_OPTIONS1 to OPTIONS1.
    CLEAR wa_OPTIONS1.
        call function 'RFC_READ_TABLE'
             destination                'zard'
             exporting
                  query_table          = 'TADIR' "'ZBANK_GUARANTEE'
             tables
                  options              = options1
                  fields               = nametab1
                  data                 = stmp_dokhl
             exceptions
                  table_not_available  = 1
                  table_without_data   = 2
                  option_not_valid     = 3
                  field_not_valid      = 4
                  not_authorized       = 5
                  data_buffer_exceeded = 6
                  others               = 7 .
    Please give me some inputs on this,
    With warm regards,
    Murthy.
    Edited by: pr murthy on Sep 18, 2008 1:49 PM
    Edited by: pr murthy on Sep 18, 2008 2:14 PM

    Hi
    I have tried this and with small change this is working fine.
    TYPES :
    BEGIN OF ty_tadir,
    pgmid TYPE pgmid,
    object TYPE trobjtype,
    obj_name TYPE sobj_name,
    END OF ty_tadir.
    DATA : it_tadir TYPE STANDARD TABLE OF ty_tadir,
    wa_tadir TYPE ty_tadir.
    data: stmp_dokhl like TAB512 occurs 100000 with header line.
    data: options1 like rfc_db_opt occurs 10 with header line.
    data: wa_options1 like line of options1.
    data: nametab1 like rfc_db_fld occurs 10 with header line.
    START-OF-SELECTION.
    DATA : W_VALUE(5) TYPE C,
    W_VALUE1(20) TYPE C.
    W_VALUE1 = 'OBJ_NAME LIKE ''Z%'''.
    wa_options1-text = w_value1.
    APPEND wa_OPTIONS1 to OPTIONS1.
    CLEAR wa_OPTIONS1.
    call function 'RFC_READ_TABLE'
    *destination 'zard'
    exporting
    query_table = 'TADIR' "'ZBANK_GUARANTEE'
    tables
    options = options1
    fields = nametab1
    data = stmp_dokhl
    exceptions
    table_not_available = 1
    table_without_data = 2
    option_not_valid = 3
    field_not_valid = 4
    not_authorized = 5
    data_buffer_exceeded = 6
    others = 7 .

  • Problem in fetching rows

    Hi
    I have a table which contains one foreign key(say function_id) and I made a composite primary key in my table which is the combination of two fields (say function_id,groups)..so I dont use any automatic generated id in this table..I did not have any problem in inserting the details...But I got a problem in updating the details..i.e I want to fetch the details(group,function_id)...the problem is that I got 'no data found error' while fetching...can anyone say what condition have I to give to fetch the details....
    Thanks in advance
    Fazila

    Hi
    I have a table which contains one foreign key(say function_id) and I made a composite primary key in my table which is the combination of two fields (say function_id,groups)..so I dont use any automatic generated id in this table..I did not have any problem in inserting the details...But I got a problem in updating the details..i.e I want to fetch the details(group,function_id)...the problem is that I got 'no data found error' while fetching...can anyone say what condition have I to give to fetch the details....
    Thanks in advance
    Fazila

Maybe you are looking for

  • How to do 2-sided printing

    how to do 2-sided printing on my hp envy printer ?

  • How to set a filter in DTP?

    Dear Gurus, I'm trying to load some selective data based on the Sales Order Number from DSrc to a DSO.  I'm trying to set a filter in the DTP.  Can someone please guide me how to set a filter in DTP? Thanks & Regards, Ashmeel.

  • Pictures not printing?

    I downloaded a knitting package with 50 pages.  It has several pics on each page.  The document prints but the pics won't come in.  Any ideas.  I have tried to reach the publisher to no avail. 

  • Logistics smartforms

    I have been looking for the SAP std smartforms for the following. Please let me know if you have more information on all these. Delivery: (Std output type- LD00, Application-V2) Std sapscript - SD_PACKING_LIST Std sapscript print prog - SDPACKLI Std

  • Clean install Lion first?

    I just want check it is best to do a clean installation or write over SL with Lion, before I install my upgrade from CS5 to CS6 standard? Please kindly advice me. It would be nice to say why and why not?