I've to extract the data based on the sysdate...like today dd is 11,

BM_PERF is the table name and
BM_PERF_YR,BM_PERF_MONTH,BM_NOP_CT_1........BM_NOP_CT_31 are the column names.
I've to extract the data based on the sysdate...like today dd is 11
so i've to get data from BM_NOP_CT_11 and the column names changes dynamically based on the sysdate. don't use any procedures and functions.

You could always pivot it into a more convenient form for querying:
WITH t1 AS
     ( SELECT 2008 AS yr, 4 AS mnth
            , 20 AS dy1
            , 10 AS dy2
            , 15 AS dy3
            , 1  AS dy4
            , 17 AS dy5
            , 99 AS dy6
            , 55 AS dy7
            , 45 AS dy8
            , 33 AS dy9
            , 22 AS dy10
            , 74 AS dy11
            , 35 AS dy12
            , 62 AS dy13
            , 24 AS dy14
            , 85 AS dy15
       FROM dual )
   , t2 AS
     ( SELECT yr
            , mnth
            , sys.DBMS_DEBUG_VC2COLL
              (dy1,dy2,dy3,dy4,dy5,dy6,dy7,dy8,dy9,dy10,dy11,dy12,dy13,dy14,dy15)
              AS day_data
       FROM   t1 )
SELECT t2.yr, t2.mnth, sys_op_ceg(t2.day_data,5) day_value
FROM   t2;
        YR       MNTH DAY_VALUE
      2008          4 17
1 row selected.Note that SYS_OP_CEG (first discovered by Padders) is undocumented and unsupported - for production code you'd need to pick the collection row using a WHERE clause, and for that you'd need a custom object and collection type with an attribute to hold the day number.
Message was edited by:
William Robertson
...like this:
CREATE TYPE id_value_ot AS OBJECT
( id INTEGER, val NUMBER );
CREATE TYPE id_value_tt AS TABLE OF id_value_ot ;
WITH t1 AS
     ( SELECT 2008 AS yr, 4 AS mnth
            , 20 AS dy1
            , 10 AS dy2
            , 15 AS dy3
            , 1  AS dy4
            , 17 AS dy5
            , 99 AS dy6
            , 55 AS dy7
            , 45 AS dy8
            , 33 AS dy9
            , 22 AS dy10
            , 74 AS dy11
            , 35 AS dy12
            , 62 AS dy13
            , 24 AS dy14
            , 85 AS dy15
       FROM dual )
   , t2 AS
     ( SELECT yr
            , mnth
            , id_value_tt
              ( id_value_ot(1,dy1)
              , id_value_ot(2,dy2)
              , id_value_ot(3,dy3)
              , id_value_ot(4,dy4)
              , id_value_ot(5,dy5)
              , id_value_ot(6,dy6)
              , id_value_ot(7,dy7)
              , id_value_ot(8,dy8)
              , id_value_ot(9,dy9)
              , id_value_ot(10,dy10)
              , id_value_ot(11,dy11)
              , id_value_ot(12,dy12)
              , id_value_ot(13,dy13)
              , id_value_ot(14,dy14)
              , id_value_ot(15,dy15) )
              AS day_data
       FROM   t1 )
SELECT yr, mnth, dd.val
FROM   t2, TABLE(t2.day_data) dd
WHERE  dd.id = 5;
        YR       MNTH        VAL
      2008          4         17
1 row selected.

Similar Messages

  • Extract XML data based on column tag

    Dear All,
    i want to extract the XML data type based on column selection.
    For example:
    i have the below xml in my database stored as XMLTYPE() data.
    <c1>10</c1><c2>0011</c2><c3>DEBIT</c3><c4>USD</c4>
    i want to extract the column tag c2&c3 alone. Is there any query to extract the same.
    Waiting for your response.Thanks in Advance.

    Hi,
    How do I set the web service option up correctly?  The XMLs are being created behind the scenes on what data to be used but I don't know how to make the menu only pick the xml based on the menu option.
    I have one XML that populates the menu options and specific XML's that has the data that goes with each menu option. The menu population works great but it doesn't pull the other XML's to populate the charts. This is the part that I need help.
    How do I use the web service to fix this? Any help would be very much appriecated.  I could even send you my dashboard if it helps so you can see what I've gotten so far (it's not all prettied up yet since I wanted to see if it's doable first)
    I'm new to Xcelsius so I apologize if these are newbie questions.
    Thanks,
    Jay

  • How to extract the data from R/3?

    Gurus,
    I need to extract the data from R/3 to BI . Below i am giving Table name followed by field name and field description.
    I am using BI 7.0 and ECC 6.0
    I am having following doubts.
    1. Based on below information which extract method I need to use (Generic data  Extraction?)?
    2. I try to create a one view but I could not find Join between the tables. I found only few joins. how to join other tables?
    3. Without joining these table how can I collect the data ?
    4. Do i need to create multiple tables?
    SAP Table      SAP Field        Field Description
    VBAK->             VBELN->        Sales Document
    VBAP->             WERKS->        Plant
    VBAK->              AUART->            Doc Type
    VBAP->             PSTYV->        Item Category
    VBAP->             MATNR->        Material
    VBAP->             ARKTX->        Description
    MATNR->              GROES->     
    VBAP->             ZIEME->        Target Quantity UOM
    VBAP->             WAVWR->        Cost
    VBAK->             ERNAM->        Name of a person who created the object
    VBAKA->             KUNNR->        Customer Number 1
    VBAP->             BSTNK->                 Customer purchase Order no
    VBEP->             BANFN->        Purchase Requisition Number
    QMFE->             FEGRP->        Cause Code(Code Group Problem)
    QMFE->             FECOD->        Damage Code(Problem or Damage Code)
    QMEL->             QMNUM->        Notification No
    EQUI->             EQUNR->        Equipment Number
    QMEL->             QMART->        Notification Type
    QMELI->             ERDAT->        Date on Which Record Was Created
    ============================================================================================
    Gurus I will assign full points .
    Thanks

    Hi,
    I would use the standard extractor 2lis_11_vaitm and enhance it for the following fields:
    VBEP-> BANFN-> Purchase Requisition Number
    QMFE-> FEGRP-> Cause Code(Code Group Problem)
    QMFE-> FECOD-> Damage Code(Problem or Damage Code)
    QMEL-> QMNUM-> Notification No
    EQUI-> EQUNR-> Equipment Number
    QMEL-> QMART-> Notification Type
    QMELI-> ERDAT-> Date on Which Record Was Created
    regards
    Siggi

  • Extract Data Based on Year and Month

    My clients have taken an Oracle DB TimeStamp field and
    downloaded it to Access in a TEXT field format.
    Sample data: 20060401001348CS
    All I am trying to do is extract data based on year and
    month. I have equal to 200604*, 200604%. Have also tried to used
    LIKE.
    Nothing works. It just can't be that dificult. Please help.
    Thanks

    After breaking my inquiry down into bits and pieces the
    problem is not just the LIKE, it is a combination of events. The
    entire picture is this:
    User selects Year from a drop down (2006), then selects month
    from drop down (04). I then build a variable called
    EventReport Date with the statement <cfset EventReportDate
    = Session.InquiryYear & Session.InquiryMonth & "%">
    It correctly displays as 200604% - When used by itself as
    below, it works just fine.
    WORKS
    <cquery name="GetEventCount" datasource="CountyDB">
    Select count(AD_ID) as EventCount, TYCOD, TYP_ENG, CURENT,
    CDTS
    FROM aeven
    WHERE CDTS LIKE '#EventReportDate#'
    Group By AG_ID, TYCOD, TYP_ENG, CURENT, CDTS
    </cfquery>
    WORKS (additional WHERE criteria)
    <cquery name="GetEventCount" datasource="CountyDB">
    Select count(AD_ID) as EventCount, TYCOD, TYP_ENG, CURENT,
    CDTS
    FROM aeven
    WHERE ((AG_ID = '#Session.InquiryAgencyCode#') AND (CURENT =
    'T'))
    Group By AG_ID, TYCOD, TYP_ENG, CURENT, CDTS
    </cfquery>
    FAILS **** There is something wrong with the combination of
    the WHERE clause items
    <cquery name="GetEventCount" datasource="CountyDB">
    Select count(AD_ID) as EventCount, TYCOD, TYP_ENG, CURENT,
    CDTS
    FROM aeven
    WHERE ((AG_ID = '#Session.InquiryAgencyCode#') AND (CURENT =
    'T')
    AND (CDTS LIKE '#EventReportDate#'))
    Group By AG_ID, TYCOD, TYP_ENG, CURENT, CDTS
    </cfquery>
    NOTE: There is not an error message, it just comes back with
    zero records.
    MORE LOST THAN EVER! Thanks for your help
    Ron

  • I am extracting the data from ECC To bw .but Data Loading taking long tim

    Hi All,
                     i am extracting the data from ECC To BI Syatem..but Data Loading Taking Long time. from last   6 hoursinfopackage is running.still it is showing yellow.Manually i made the red.and delete again i applied repeat of the last delta.but same proble is coming .in the status job is showing bckground job is not finished at source system.we requested to basis.basis people killed that job.again we schedule the chain also again same problem is coming.how can i solve this issue.
    Thanks ,
    chandu

    Hi,
    There are different places to track your job. Once your job is triggered in BW, you can track your load job where exactly it is taking more time and why. Follow below steps:
    1) After InfoPackage is triggered, then take the request number and go to source system to check your extraction job status.
    You can get the job status by taking the request number from BW and go to transaction SM37 in ECC. Then give the request number with begining '' and ending ''.  Also give '*' to user name.
    Job name:  REQ_XXXXXX
    User Name: *
    Check the job status whether job is completed or cancelled or short dump. If the job is still running check in SM66 whether you can see any process. If not accordingly you got to check in ST22 or SM21 in ECC. If the job is complete, then the same in BW side now.
    2) Check the data arrived in PSA, if not check whether Transfer routines or start routines are having bad SQL or code. Similarly in update rules.
    3) Once it is through in Source system (ECC), Transfer rules , Update Rules, then the next task is updating the data might some time take more time which might be based on some parameters ( Number of parallel process to update database ). Check whether updating the database is taking more time and may be you got to check with the DBA guy also.
    At all the times you should see minimum of atleast once process running all the time in SM66 till the time your job gets complete. If not you will see a log in ST22.
    Let me know if you still have questions.
    Assigning points is the only way of saying thanks in SDN.
    Thanks,
    Kumar.

  • Can I extract VBAP-EAN11 based on the country Field ?

    Hello,
    Is there a way I can extract VBAP-EAN11 from a different field dependent on the country KNA1-LAND1 or any other table where I should be able to extract EAN11 based on the country.
    Please suggest, if i can extract the data with this condition or any possible conditions with which i can extract VABP-EAN11 dependent on the country field....
    Any suggestions would be appreciated!
    Thank you

    Hello Venkat,
    Thank you for your response...
    I did not understand...Can you please tell me in more detail...
    And I tried with this field below and written a sample code...Plz let me know if I can go ahead and use this field.
    Types : Begin of TY_SAMPLE,
              VBELN TYPE VBELN_VA,
              EAN11 type vbap-EAN11,
              LLAND type VKDFS-LLAND,
             END OF TY_SAMPLE.
    DATA : T_SAMPLE TYPE STANDARD TABLE OF TY_SAMPLE WITH HEADER LINE.
        SELECT A~VBELN
               A~EAN11
               B~LLAND
               INTO TABLE T_SAMPLE
               FROM VBAP AS A INNER JOIN
               VKDFS AS B
               ON AVBELN = BVBELN
               WHERE EAN11 =
      LOOP AT T_SAMPLE.
         WRITE : / T_SAMPLE-VBELN, T_SAMPLE-ean11, T_SAMPLE-LLAND.
         ENDLOOP.
    Regards,
    Developer

  • EXTRACT DATA BASED ON BUDGET YEAR

    I have a scenario where I need to extract data based on the users enter the budget year.
    Our budget year is as follow:
    September,
    October,
    November,
    December,
    January,
    February,
    March,
    April,
    May,
    June,
    July,
    August
    If the users enter the budget year as 2014, I want to extract payment records from September 2013 to August 2014.
    September 2013,
    October 2013,
    November 2013,
    December 2013,
    January 2014,
    February 2014,
    March 2014,
    April 2015,
    May 2014,
    June 2014,
    July 2014,
    August 2014
    My query below only extracts payment records created for a given year which is not what I want
    DECLARE @BudgetYear Datetime
    SET @BudgetYear = '09/01/2014'
    SELECT 'REFUND' PaymentType ,pa.CreateDate,YEAR(pa.CreateDate) CreateYear, p.PaymentAmount
    FROM tblPaymentAllocation pa
    INNER JOIN tblReturn r
    ON r.ReturnID = pa.ReturnID
    INNER JOIN tblAccount a
    ON a.AccountID = r.AccountID
    INNER JOIN tblCommunity c
    ON a.Community = c.CommunityCode
    INNER JOIN tblAccountingDate ad
    ON ad.AccountingdateID = pa.AccountingDateID
    INNER JOIN tblPayment p
    ON pa.PaymentID=p.PaymentID
    WHERE YEAR(pa.CreateDate) = YEAR(@BudgetYear )
    AND p.PaymentType <> 'amended'
    AND r.ReturnType = 'refund'
    AND NOT (p.PaymentType = 'check'
    AND pa.Status = 'reversal' AND pa.PriorCredit < 0)

    Give this a go:
    SELECT 'REFUND' PaymentType ,pa.CreateDate,YEAR(pa.CreateDate) CreateYear, p.PaymentAmount
    FROM tblPaymentAllocation pa
    INNER JOIN tblReturn r
    ON r.ReturnID = pa.ReturnID
    INNER JOIN tblAccount a
    ON a.AccountID = r.AccountID
    INNER JOIN tblCommunity c
    ON a.Community = c.CommunityCode
    INNER JOIN tblAccountingDate ad
    ON ad.AccountingdateID = pa.AccountingDateID
    INNER JOIN tblPayment p
    ON pa.PaymentID=p.PaymentID
    WHERE pa.CreateDate BETWEEN CASE WHEN MONTH(GETDATE()) < 9 THEN CONVERT(VARCHAR,YEAR(GETDATE())-2)+'-09-01' ELSE CONVERT(VARCHAR,YEAR(GETDATE())-1)+'-09-01'END AND CASE WHEN MONTH(GETDATE()) < 9 THEN CONVERT(VARCHAR,YEAR(GETDATE())-1)+'-08-31' ELSE CONVERT(VARCHAR,YEAR(GETDATE()))+'-08-31' END
    AND p.PaymentType <> 'amended'
    AND r.ReturnType = 'refund'
    AND NOT (p.PaymentType = 'check'
    AND pa.Status = 'reversal' AND pa.PriorCredit < 0)
    It calculates what the range should be on the fly.

  • How can i call ajax and extract the data?

    Hi all,
    I don't know briefly about ajax..i want to learn ajax, so my question is how can i call ajax and extract the data. for ex, i have JSON file
        "mobile": [
                "Name": "Micromax",
                "Model": A310
                "Name": "samsung",
                "Model": grand 2
    for above example how can i call ajax..please anyone explain with small example because it'll help me a lot.
    Thanks & Regards,
    Palsaran

    Hi Palsaran,
    As i understood, your requirement is to POST data from UI to backend.
    The above code you given is not correct if you want to use model based implementation.
    In UI5 you don't need to do an explicit Ajax call, for which we can use Models like OData, JSON etc.
    For your JSON example, you can use like,
    var oModel = new sap.ui.model.json.JSONModel();
    var oData = "YOUR JSON DATA";
    oModel.setData(oData)
    oModel.loadData(yourURL/Entityset,"POST");
    For ref, you can use the below link
    JsDoc Report - SAP UI development Toolkit for HTML5 - API Reference - sap.ui.model.json.JSONModel
    Thanks
    Naveenraj

  • Extract the classification data into internal table

    Hi all,
    I having requirement to extract classification data for material number.
    1) Provide the selection option for material number (MATNR).
    2) Based on the material number, then extract all that data into internal table as below layout. My problem is how to retrieve the following data from different table based on the MATNR (material number).
    Please provide the sample code for select the following data. Thanks.
    Classification table
    OBJEK  (from AUSP table)
    MAFID (from AUSP table)
    KLART (from AUSP table)
    CLASS  (from KLAH table)
    ATWRT (from AUSP table)
    MSEHI  (from CABN table)
    OBTAB (check if class type=002, set it as “MARA”)
    STDCL (from KSSK table)

    Hi,
    if I understand, you´re trying to get information from the classification system for the material. You can use the following code:
    DATA: clases LIKE TABLE OF sclass WITH HEADER LINE,
          datos LIKE TABLE OF clobjdat WITH HEADER LINE.
    CALL FUNCTION 'CLAF_CLASSIFICATION_OF_OBJECTS'
         EXPORTING
              class              = 'DESK'               "clase a buscar
              classtype          = '001'                "tipo de la clase
              features           = 'X'
              language           = sy-langu
              object             = 'PM00A000C055'       "Material
              objecttable        = 'MARA'
              key_date           = sy-datum
              initial_charact    = 'X'
              change_service_clf = 'X'
         TABLES
              t_class            = clases
              t_objectdata       = datos
         EXCEPTIONS
              no_classification  = 1
              no_classtypes      = 2
              invalid_class_type = 3
              OTHERS             = 4.
    loop at datos.
    endloop.

  • How can i extract the particular data from Base tables

    Hi
    I have some Base R/3- Tables . I need to exact the data from these base tables.
    But i need to select some type of datarecords(eg: select Material Documents from MSEG and MKPF tables based on movement types 261,262).
    Something like that . So how can i select the particular category datarecords from base tables. Anyway im going to create the Custom DataSource.
    So please let me know . how can i extarct tha particular data from base tables
    kumar

    Hi Venkat
    See i have some 5-tables . I need to extarct from these tables.
    first i need to extract the data from one table fully.
    Then i need to extarct the data from second table based on profict centers, company codes of first table.
    Then i need to extract the data from third table based on profict centers of first table and movement type = 2p,2n,2s condition.
    So how can i extarct like this data from multiple tables.
    Please let me know
    kumar

  • Not able to Retrieve Transaction Data based on the property of master data

    Hi,
    I am trying to retrieve transaction data based on property of Master Data for ACCOUNT (property  ACCTYPE = ‘EXP’)
    in BPC 10 version for netweaver.
    Transaction data is present at backend, But I am not getting data in Internal table after running RSDRI Query.
    I am using this code.
    DATA: lt_sel TYPE uj0_t_sel,
    ls_sel TYPE uj0_s_sel.
    ls_sel-dimension = 'ACCOUNT'.
    ls_sel-attribute = 'ACCTYPE'.
    ls_sel-sign = 'I'.
    ls_sel-option = 'EQ'.
    ls_sel-low = 'EXP'.
    APPEND ls_sel TO lt_sel.
    lo_query = cl_ujo_query_factory=>get_query_adapter(
    i_appset_id = lv_environment_id
    i_appl_id = lv_application_id ).
    lo_query->run_rsdri_query(
    EXPORTING
    it_dim_name = lt_dim_list " BPC: Dimension List
    it_range = lt_sel" BPC: Selection condition
    if_check_security = ABAP_FALSE " BPC: Generic indicator
        IMPORTING
    et_data = <lt_query_result>
        et_message = lt_message
    Data is coming if i use ID of ACCOUNT directly, for e.g.
    ls_sel-dimension = 'ACCOUNT'.
    ls_sel-attribute = 'ID'.
    ls_sel-sign = 'I'.
    ls_sel-option = 'EQ'.
    ls_sel-low = 'PL110.
    APPEND ls_sel TO lt_sel.
    so in this case data is coming , but it is not coming for property.
    So Please can you help me on this.
    Thanks,
    Rishi

    Hi Rishi,
    There are 2 steps you need to do,.
    1. read all the master data with the property you required into a internal table.  in your case use ACCTYPE' = EXP
    2. read transaction data with the masterdata you just selected.
    Then you will get all your results.
    Andy

  • Error while extracting the data in R/3 production system,

    Hi Team,
    We got the following error while extracting the data in R/3 production system,
    Error 7 When Sending an IDoc R3 3
    No Storage space available for extending the inter 44 R3 299
    No storage space available for extending the inter R3 299
    Error in Source System RSM 340
    Please guide us to fix the issue

    It´s very difficult to help you without knowing
    - what is going to be transferred
    - where you get this error
    - system configuration
    - actual memory usage
    - operating system
    - database and configuration etc. etc.etc. etc.
    I suggest you open an OSS call and let the support have a look on your system. It´s much easier if one has system access to find out the cause for that problem.
    Markus

  • Unable to extract the data from ECC 6.0 to PSA

    Hello,
    I'm trying to extract the data from ECC 6.0 data source name as 2LIS_11_VAHDR into BI 7.0
    When i try to load Full Load into PSA , I'm getting following error message
    Error Message: "DataSource 2LIS_11_VAHDR must be activated"
    Actually the data source already active , I look at the datasource using T-code LBWE it is active.
    In BI  on datasource(2LIS_11_VAHDR) when i right click selected "Manage"  system is giving throughing below error message
    "Invalid DataStore object name /BIC/B0000043: Reason: No valid entry in table RSTS"
    If anybody faced this error message please advise what i'm doing wrong?
    Advance thanks

    ECC 6.0 side
    Delete the setup tables
    Fill the data into setup tables
    Schedule the job
    I can see the data using RSA3 (2LIS_11_VAHDR) 1000 records
    BI7.0(Service Pack 15)
    Replicate the datasource in Production in Backgroud
    Migrate Datasource 3.5 to 7.0 in Development
    I did't migrate 3.5 to 7.0 in Production it's not allowing
    When i try to schedule the InfoPakage it's giving error message "Data Source is not active"
    I'm sure this problem relate to Data Source 3.5 to 7.0 convertion problem in production. In Development there is no problem because manually i convert the datasource 3.5 to 7.0
    Thanks

  • Report for extracting the Expiratin date of the material

    Hi gurus,
    Is there any way We can extract the list of materials with SLED?
    Any standard T code?
    Regards
    Shashi

    Hi Sashi,
    First of I assumes that your materials are Batch Managed.
    Now go to any any of the Transaction where you can execute the report using option of Batch Field.
    For Example MB52, MB51.Go to To MB52 go to Batch Field. Press F4 and use selection criteria
    *Search for Batches with Expiry Date*
    Select required Field like Plant , Material etc and enter you will find list of Materials with Batches and its Expiry Date.
    And if you want to download it then just press right key of mouse, you will find the option for Download this report.
    Regards.
    Dhaval

  • I ran my iphone over but need to access my contacts/info/pics. I have a up to date backup of my whole phone in iTunes but need to know how to extract the data and load it to my new desktop since it will be a bit before I can afford a new phone.

    I accidentally ran my iPhone over and can't afford another one for a few weeks. Until then I need to find a way to extract the data from my last backup in itunes. I can either put it on my computer or I've set up a cloud account that I was hoping could open it. So far I haven't had any luck with either. if anyone can help me out. I would love to get my pictures/videos, messages and contacts off there. The rest I don't care so much about. If someone could let me know if this is possible I would apprciate it!

    Thanks. I messed up with my husbands iphone because I was told the wrong thing. Now everytime I sync his phone it makes it look just like the other phone I had. Do you know how I can fix taht for his phone? Any settings I can turn off that will prevent all of my apps/contacts, etc from auto populating his phone?

Maybe you are looking for