Need to Fetch data between 2 dates

Dear All,
Requirement : On the Bex selection screen a key date will be entered I need to fetch all those records which are in between start date & end date- Means
Start Date < = Key date=> End date
Start date & end date field exists in Cube, But the Key date does not exists. Key date will be a random date.
Can any one please help me how to achieve this?
Can this be done using virtual Chraracteristis? Not sure if the Virtual Char will be applicable for the date field.
I have tried doing it in the following way.
Create 2 formula KF populate it wilh a formula variable which is of processing type replacement path which takes value from start date & end date Charateristics IO.
I created a formula variable KEYDATE (user entry/ready for input) and created a condition
Start date ( KF) <= Key date
End date (KF)> = Key date
But this does not seem to work.
Can any pls help?
Thanks & Regards
Shree

Hi Shree,
Try creating a variable for the date infoobject with intervals option and use customer exit to calculate the starting and ending dates. And now create a new Key date variable, using the replacement path replace it with the first variable that you created. Try this options and let me know how it goes.
Regards,
Hima

Similar Messages

  • Is it XML I need to fetch data from a table in a file?

    I am newbie and I have no idea how to do this. I have a table
    (Excel File) about 1000 rows and 3 columns.
    I want to load this table to the Flash and then be able to
    fetch data by referring to its first column.
    I am grateful for a tip to how to this. Thanx

    Answered here:
    http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=15&catid=294&threadid =1233559&enterthread=y

  • Urgent:Logic needed to fetch data from Internal Table

    Here i have an internal table having Emp no,Emp name,Salary fields....
    With unique Emp no.
    My requirement is i want to fetch all the details of the employees(like empno,emp name, emp address..) whose salary is the third highest salary.
    Note: Many employees can have unique salary.
    I need the logic for that,
    helpfull ans ill be rewarded.

    suppose ur table has three fields like
    types : begin of typ_emp,
                 num type i ,
                 name type char20 ,
                 salary type char10 ,
               end of typ_emp.
    data : it_emp type table of typ_emp ,
             it1_emp TYPE TABLE OF typ_emp ,
            wa_emp type typ_emp .
    DATA : count TYPE i ,
               w_salary type i .
    code is
    SORT it_emp BY salary ASCENDING .
    it1_emp = it_emp .
    Take the all data to another table and delete all adjacent duplicates .
    DELETE ADJACENT DUPLICATES FROM it_emp COMPARING salary .
       READ TABLE IT_EMP INTO WA_EMP INDEX 3.
    MOVE  WA_EMP-SALARY TO W_SALARY .
    now the third highest salary will come into w_salary .
    and now again process your internal table and retrieve whose salary is equal to w_salary ...
    thanks
    reward if helpfull..............
    Edited by: sam k on May 27, 2008 12:43 PM
    Edited by: sam k on May 27, 2008 12:55 PM

  • Need to fetch data from 2 reports in tabstrip

    Hi to all,
    I have an requirement. I have 2 reports for which the selection criteria is date only. I need to have a single report for that. I will have a selection screen with date field and 2 checkbox for the 2 reports. in output I will have tabstrip which will display both the reports in separate tab.
    I donot want to do any recode for this. Is it possible not to create the custom container again in tabstrip?
    Can someone suggest me how can I get output from the 2 reports in the tabstrips?
    Edited by: Suchender Dagar on Aug 29, 2011 3:08 PM

    Hi,
    take a look to this blog:
    /people/glen.simpson/blog/2011/07/07/gain-programmatic-access-to-data-of-sapgui-alv-reportsSDNWeblogs_Abap%2528SAPNetworkWeblogs%253A+ABAP%2529
    expecially in the paragraph "Introducing Class CL_SALV_BS_RUNTIME_INFO"
    Maybe it can be useful for you.
    Regards
    Andrea

  • 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

  • How to fetch data from a SAP BW Cube via Perl/PHP on a Linux machine?

    Hi all,
    here's the scenario:
    I need to fetch data from a cube of a remote SAP NetWeaver 7.  The data will later be used in a web application based on  Linux and  Perl/PHP. (I'd prefer using perl for the backend and doing the business logic of the web application.)
    I have:
    A Linux system with all its on-board tools and scripting languages.
    A user for the SAP BW which allows me to logon (very,very limited user rights, no se37,no se80,no rsaX and so on)
    Access to http://<SAP BW Server>:<Port>/sap/bw/xml/soap/xmla with the above mentioned user.
    My questions:
    - Could you please push me into the right direction how I can realize this? E.g. by pointing to tutorials / HowTos / sample code / CPAN modules etc..  (Most information I found so far referred to software based on a different operating system and on remote function calls using custom functions.)
    - I'm aware of the  SAPNW::RFC CPAN module, but do I necessarily have to perform a remote function call? ( If so, is there a "standard" function I could call for accessing a cube?)
    Thanks a lot in advance!

    You can take through the RFCS .check for some system function modules...but why do you need to route it through XI?How huge z the files?

  • How to use for all entires clause while fetching data from archived tables

    How to use for all entires clause while fetching data from archived tables using the FM
    /PBS/SELECT_INTO_TABLE' .
    I need to fetch data from an Archived table for all the entries in an internal table.
    Kindly provide some inputs for the same.
    thanks n Regards
    Ramesh

    Hi Ramesh,
    I have a query regarding accessing archived data through PBS.
    I have archived SAP FI data ( Object FI_DOCUMNT) using SAP standard process through TCODE : SARA.
    Now please tell me can I acees this archived data through the PBS add on FM : '/PBS/SELECT_INTO_TABLE'.
    Do I need to do something else to access data archived through SAP standard process ot not ? If yes, then please tell me as I am not able to get the data using the above FM.
    The call to the above FM is as follows :
    CALL FUNCTION '/PBS/SELECT_INTO_TABLE'
      EXPORTING
        archiv           = 'CFI'
        OPTION           = ''
        tabname          = 'BKPF'
        SCHL1_NAME       = 'BELNR'
        SCHL1_VON        =  belnr-low
        SCHL1_BIS        =  belnr-low
        SCHL2_NAME       = 'GJAHR'
        SCHL2_VON        =  GJAHR-LOW
        SCHL2_BIS        =  GJAHR-LOW
        SCHL3_NAME       =  'BUKRS'
        SCHL3_VON        =  bukrs-low
        SCHL3_BIS        =  bukrs-low
      SCHL4_NAME       =
      SCHL4_VON        =
      SCHL4_BIS        =
        CLR_ITAB         = 'X'
      MAX_ZAHL         =
      tables
        i_tabelle        =  t_bkpf
      SCHL1_IN         =
      SCHL2_IN         =
      SCHL3_IN         =
      SCHL4_IN         =
    EXCEPTIONS
       EOF              = 1
       OTHERS           = 2
       OTHERS           = 3
    It gives me the following error :
    Index for table not supported ! BKPF BELNR.
    Please help ASAP.
    Thnaks and Regards
    Gurpreet Singh

  • Fetching data from two tables

    Hi friends,
    I've two similar tables A and B with one more column in table B that is "Active Flag".
    Table A
    Rowid----Fname----Lname
    101-----AF1----------AL1
    102----AF2-----------AL2
    103-----AF3---------AL3
    104-----AF4---------AL4
    Table B
    Rowid-----Fname---Lname---Flag
    101-----BF1----------BL1--------Y
    102-----BF2----------BL2---------N
    103-----BF3----------BL3--------N
    104-----BF4----------BL4-------Y
    I need to fetch data in Table C with column rowid, Fname and Lname.
    If Flag is Y in Table B, this record should come to table C otherwise the record from table A will come to C. Rowid is the primary key.
    Table C should be like this..
    Rowid-----Fname---Lname
    101-----BF1----------BL1
    102-----AF2----------AL2
    103-----AF3----------AL3
    104-----BF4----------BL4
    Thanks in advance

    Hi,
    try this
    QL> With T As
    2       (
    3          Select 101 Id, 'BF1' fname, 'BL1' lname, 'Y' flag
    4            From DUAL
    5          Union All
    6          Select 102, 'BF2', 'BL2', 'N'
    7            From DUAL
    8          Union All
    9          Select 103, 'BF3', 'BL3', 'N'
    10            From DUAL
    11          Union All
    12          Select 104, 'BF4', 'BL4', 'Y'
    13            From DUAL),
    14       T1 As
    15       (
    16          Select 101 Id, 'BF1' fname, 'BL1' lname
    17            From DUAL
    18          Union All
    19          Select 102, 'AF2', 'AL2'
    20            From DUAL
    21          Union All
    22          Select 103, 'AF3', 'AL3'
    23            From DUAL
    24          Union All
    25          Select 104, 'BF4', 'BL4'
    26            From DUAL)
    27  Select T1.Id, T1.fname, T1.lname
    28    From T, T1
    29   Where T.Id = T1.Id
    30     And T.flag='Y'
    31  /
           ID FNA LNA
          101 BF1 BL1
          104 BF4 BL4and rowid is oracle reserved word. you should be aware of oracle reserved word, kindly refer this v$reserved_words
    Edited by: user291283 on Sep 7, 2009 10:18 PM

  • Fetch data from Table

    Hi all,
    I am using function module through Call fucntion.
    There i am getting <b>Table Name</b> as import Parameter.
    Now i need to fetch data from that table (Which name we got througfh function module).
    Is there any point to know how can we fetch data from runtime table .
    i need some sample code for this.
    Thanks inn advance,
    Regards,
    Bhaskar

    Hello Bhaskar,
    I don't have an SCM system, so I cannot test out that FM
    However, I modified the above code to update the table as well
    *& Report  ZKRIS_DYNAMIC_TABLE_READ_MOD
    REPORT  ZKRIS_DYNAMIC_TABLE_READ_MOD LINE-SIZE 256.
    DATA : LV_FIELD_DESC TYPE STRING.
    DATA : LV_DATA1 TYPE STRING.
    DATA : LV_DETAIL(128).
    DATA : COMMA TYPE C VALUE ','.
    DATA : LV_TNAME LIKE DD02L-TABNAME.
    DATA : LV_DBTAB1 LIKE DD02L-TABNAME.
    DATA : DREF TYPE REF TO DATA.
    DATA : FLAG_MODIFIED.  " determines if database needs to be updated
    FIELD-SYMBOLS: <ITAB> TYPE ANY TABLE, " used to store dynamic tables
                   <WA>    TYPE ANY,      " used to store record data
                    <WA1> TYPE ANY .      " used to store field data
    * call Fm /SAPAPO/TS_PA_COPY_TABLE_GET here
    LV_DBTAB1 = 'ZGSTSET'. " <-- put your table name here
    DATA: IT_FIELDS TYPE X031L OCCURS 0.
    DATA: WA_FIELDS LIKE LINE OF IT_FIELDS.
    CALL FUNCTION 'DDIF_NAMETAB_GET'
      EXPORTING
        tabname           = LV_DBTAB1
    *   ALL_TYPES         = ' '
    *   LFIELDNAME        = ' '
    *   GROUP_NAMES       = ' '
    *   UCLEN             =
    * IMPORTING
    *   X030L_WA          =
    *   DTELINFO_WA       =
    *   TTYPINFO_WA       =
    *   DDOBJTYPE         =
    *   DFIES_WA          =
    *   LINES_DESCR       =
    TABLES
       X031L_TAB         = IT_FIELDS
    *   DFIES_TAB         =
    EXCEPTIONS
       NOT_FOUND         = 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.
    * we do not know the sized of the table that must be generated beforehand
    * hence we use field symbols to dynamically generate the internal table
      CREATE DATA DREF TYPE STANDARD TABLE OF (LV_DBTAB1)
                                WITH NON-UNIQUE DEFAULT KEY.
      ASSIGN DREF->* TO <ITAB> .
    * selects all data
      SELECT * FROM (LV_DBTAB1) INTO TABLE <ITAB> .
      LOOP AT <ITAB> ASSIGNING <WA>.
        FLAG_MODIFIED = ''.
        LOOP AT IT_FIELDS INTO WA_FIELDS.
          ASSIGN COMPONENT WA_FIELDS-FIELDNAME OF STRUCTURE <WA>
            TO <WA1>.
          IF WA_FIELDS-FIELDNAME = 'FIRSTNAME'. " fieldname in the table you wish to modify
            IF <WA1> = 'Kris'. " old value
              <WA1> = 'NewName'. " new value
              MODIFY TABLE <ITAB> FROM <WA>.
              FLAG_MODIFIED = 'X'.
            ENDIF.
          ENDIF.
          WRITE <WA1>. " comment this line to remove the display
        ENDLOOP.
        IF FLAG_MODIFIED = 'X'. " updates database only if the record was changed
          UPDATE (LV_DBTAB1) FROM <WA>.
    *     note that if the field you choose is a key field, sy-subrc will be set to 4
        ENDIF.
    *   display
        NEW-LINE.
      ENDLOOP.

  • Facing  problem in fetching data

    hello everyone ,
    can anyone help me out  frm the problem , i need to fetch  data in alv  report (  likp-vbeln  ,lips-vgbel , likp-kunnr , vbpa-lifnr , vbrp-vgbel,vbuk-fkstk,vbrk-kunrg, vbrk-fkart and lfa1-name1 )  using  input parameter lips-vbeln or likp-vbeln .every time  i stuck in  select querries  for  fetching fieds  of   vbpa vbrk  vbrp vbuk and lfa1 .
    i am new to this forum excuse for  any mistake  regarding the rules and restriction .
    ranjan

    Moderator message - Welcome to SCN.
    Please read Please read "The Forum Rules of Engagement" before posting!  HOT NEWS!! and How to post code in SCN, and some things NOT to do... and [Asking Good Questions in the Forums to get Good Answers|/people/rob.burbank/blog/2010/05/12/asking-good-questions-in-the-forums-to-get-good-answers] before posting again.
    Thread locked.
    Rob

  • Fetch data from different tables print them is assigned places

    Hi Friends,
    I have designed one SMART-Form (Receipt).
    I need to fetch data from different tables and the data must be print in assigned places. Please help me how to achieve this requirement. Thanks for your help.
    Best regards,
    Manju.
    Edited by: Alvaro Tejada Galindo on Feb 12, 2008 10:20 AM

    U're right.
    When it creates a smartform it needs to decide when the main data have to be extracted:
    - or in driver program
    - or in smartforms
    The difference can be in the performance, because the program can select the data only once, the smartforms needs to extract them everytime it's called.
    I prefer to use a complex structure for the smartform interface as so all data I need are in only one structure, the problem is the complex structure is harder to be managed.
    Max

  • Help needed to insert data from different database

    Hi ,
    I have a requirement where i need to fetch data from different database through database link .Depending on user request , the dblink needs to change and data from respective table from mentioned datbase has to be fetched and populated .Could i use execute immediate for this, would dblink work within execute immediate .If not , could pls let me know any other approach .

    What does "the dblink needs to change" mean?
    Are you trying to dynamically create database links at run-time? Or to point a query at one of a set of pre-established database links at run-time?
    Are you sure that you really need to get the data from the remote database in real time? Could you use materialized views/ Streams/ etc to move the data from the remote databases to the local database? That tends to be far more robust.
    Justin

  • Does apex allow using external DB to fetch data ?

    Hi,
    I need to build a small Internal Application that show reports in tabular and/or graphical form.
    Using Apex can I build an application that uses a realtime database (already hosted on one of server and is populated by different api's), as I will need to fetch data from this database to generate my reports. Is it achievable using Apex ?
    Thanks
    Amit

    If I remember correctly:
    If you use DB Links, you can't use bind variables (apex items). The query is not run inside your DB so the bind variables can't be interpreted.
    ex.:
    SELECT null
    FROM my_db_linked_table
    WHERE 1 = :P1_ITEM
    Louis-Guillaume
    Blog
    [Apex Web 2.0 demos|http://www.insum.ca/jquery]

  • Need to fetch documents from filenet to SAP ?

    Hi,
    Here is the scenario..,
    The physical documents such as pdf, word documents etc.. are available in filenet/P8.
    These documents need to get fetched & displayed in SAP.
    For a prticular document id, all the related documents need to get displayed...
    Is there any function module or class to do so?
    Thanks.

    > I need to fetch data from SAP system to SQL, I know to fetch it from SQL to SAP using DBConnect but don't know to do this stuff, can any one please help me out with this.
    You can use the same way.
    Markus

  • Need ABAP program logic to fetch datas from four tables

    Hi Friends,
    I have to develop a print program for purchase requisition.
    when a program is executed it has to accept the PR number,and it has to display the purchase requisition informations,also it has to display the address of the plant in the header.
    I have to fetch datas from EBAN,T001W,ADR2,ADR3 and ADR6.so i need all your help in writing the best select query for this program to work efficiently.
    Thanks in advance.

    Please don't just unload your specification here and expect others to do your work.
    Thread locked.
    Thomas
    P.S. "Total questions: 231 (191 unresolved)" is a lousy track record, please close your open questions properly, leaving a final comment only when it adds value.

Maybe you are looking for