MSSQL Query/View Single Line Output For Combined Multiple Data Elements - Possible Pivot Table?

HELLO...
I hope you experts out there can help me.  Consider the following (2) Tables in MSSQL:
1. TENDERED --> Primary Key = DATE / DOC_NO / PAYMENT_SEQ_NO
DATE
DOC_NO
PMNT_SEQ_NO
PAYCODE_TYPE
AMOUNT
2. TENDERED_CR_CARD -->Primary Key = DATE / DOC_NO / PAYMENT_SEQ_NO
DATE
DOC_NO
PMNT_SEQ_NO
CR_CARD_NO_MASKED
CR_CARD_NAME
CR_CARD_EXP_DATE
These two tables are certainly related, based on their Primary Key values.
Now, consider the following data in those two tables:
DATE            
DOC_NO      PMNT_SEQ_NO              
PAYCODE_TYPE               
AMOUNT
03/10/2014         100001 
1             
CASH            
100.00
03/10/2014         100001 
2             
CASH                             
-9.75
03/10/2014         100002 
1             
CASH                             
50.00
03/10/2014         100002 
2             
VISA                             
100.00
03/10/2014         100002 
3             
VISA             
               250.00
03/10/2014         100003 
1             
                        MC
125.00
03/10/2014         100003 
2             
AMEX           
75.00
DATE          
DOC_NO PMNT_SEQ_NO  CR_CARD_MASKED     
NAME            
CR_CARD_EXP
03/10/2014  100002   2                       4225******801289  
MARY JONES   2016/08/31
03/10/2014  100002   3                       4121******637442  
JOHN DOE      2015/04/30
03/10/2014  100003   1                       5428******971134  
MIKE BAKER   2018/09/30
03/10/2014  100003   2                       3732*****344756    
LINDA LIU      2017/07/31
OK...so what we NEED...is a Combined, SINGLE RECORD Audit Report type query. 
The resulting query should show, based on the Data from above, the SINGLE LINE represented in the Attached Spreadsheet. 
NOTE...what's important to point out here..is that ONLY the 'CASH' Tender gets "summed"...EACH INDIVIDUAL Credit Card record MUST have its own Field...as represented in the corresponding Columns of the Spreadsheet (i.e. PMT_TYP_1, AMT_1, PMT_TYP_2,
AMT_2, and so forth).
PLEASE HELP!  Any suggestions/advice would be most appreciated! 
Thank You!...Mark

I would not do this in SQL if I could possibly avoid it.  Instead do it in the front end.
If you must do it in SQL, this is a dynamic pivot on multiple columns.  Naomi Nosonovsky has a blog at
http://blogs.lessthandot.com/index.php/DataMgmt/DataDesign/dynamic-pivot-on-multiple-columns/ on how to do that.  Look especially at her second example using the claims table.  Of course, you must do some manipulation even before you do the multi-column
pivot, since you must first combine all the cash entries.
So one way to do it would be to build a temp table with all the entries you have except the cash entries combined into one payment sequence number.  To do that you may need specifications that are not clear to me from what you have given us.  For
example, if PMT SEQ 1 is VISA,  PMT SEQ 2 is CASH, PMT SEQ 3 is VISA, PMT SEQ 4 is CASH, and PMT SEQ 5 is VISA, you want to combine the two cash payments.  So they become PMT SEQ 2?  If so, what happens to PMT SEQ 4 - is it left N/A or does
PMT SEQ 5 become PMT SEQ 4?
But once you have this temp table with the cash payments combined in the algorithm you need, then you can use Naomi's method to do the multi-column pivot.  Note that Naomi uses the code
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_Name = 'Claims'
to get the column names from the permanent table Claims.  To get the column names from a temp table use code like the following.  To find the column names in a temp table named #MyTempTable, do
From tempdb.sys.columns
Where object_id = OBJECT_ID('#MyTempTable')
But as I say, if feasible, I would do this in the front end, not in SQL.  T-SQL is a very good language for storing and retrieving data, not so good at formatting it. 
Tom

Similar Messages

  • SIngle row output for a multiple values

    Create table test_table ( metric_name varchar2(30), dt date, value number) ;
    insert into test_table values ('METRIC_1', to_date('12/31/2013 08:00:00','mm/dd/yyyy hh24:mi:ss'), 10) ;
    insert into test_table values ('METRIC_1', to_date('12/31/2013 08:00:00','mm/dd/yyyy hh24:mi:ss'), 20) ;
    insert into test_table values ('METRIC_1', to_date('12/31/2013 08:00:00','mm/dd/yyyy hh24:mi:ss'), 30) ;
    insert into test_table values ('METRIC_2', to_date('12/31/2013 08:00:00','mm/dd/yyyy hh24:mi:ss'), 11) ;
    insert into test_table values ('METRIC_2', to_date('12/31/2013 08:00:00','mm/dd/yyyy hh24:mi:ss'), 22) ;
    insert into test_table values ('METRIC_2', to_date('12/31/2013 08:00:00','mm/dd/yyyy hh24:mi:ss'), 33) ;
    commit;
    alter session set nls_date_format='mm/dd/yyyy hh24:mi:ss' ;
    SQL> select * from test_table ;
    METRIC_NAME                    DT                       VALUE
    METRIC_1                       12/31/2013 08:00:00         10
    METRIC_1                       12/31/2013 09:00:00         20
    METRIC_1                       12/31/2013 10:00:00         30
    METRIC_2                       12/31/2013 08:00:00         11
    METRIC_2                       12/31/2013 09:00:00         22
    METRIC_2                       12/31/2013 10:00:00         33
    But I need output in following format:
    METRIC_NAME   12/31/2013 08:00:00        12/31/2013 09:00:00        12/31/2013 10:00:00       
    METRIC_1                   10                                     20                                  30
    METRIC_2                    11                                    22                                  33
    -Thanks

    Hi,
    943750 wrote:
    Create table test_table ( metric_name varchar2(30), dt date, value number) ;
    insert into test_table values ('METRIC_1', to_date('12/31/2013 08:00:00','mm/dd/yyyy hh24:mi:ss'), 10) ;
    insert into test_table values ('METRIC_1', to_date('12/31/2013 08:00:00','mm/dd/yyyy hh24:mi:ss'), 20) ;
    insert into test_table values ('METRIC_1', to_date('12/31/2013 08:00:00','mm/dd/yyyy hh24:mi:ss'), 30) ;
    insert into test_table values ('METRIC_2', to_date('12/31/2013 08:00:00','mm/dd/yyyy hh24:mi:ss'), 11) ;
    insert into test_table values ('METRIC_2', to_date('12/31/2013 08:00:00','mm/dd/yyyy hh24:mi:ss'), 22) ;
    insert into test_table values ('METRIC_2', to_date('12/31/2013 08:00:00','mm/dd/yyyy hh24:mi:ss'), 33) ;
    commit;
    alter session set nls_date_format='mm/dd/yyyy hh24:mi:ss' ;
    SQL> select * from test_table ;
    METRIC_NAME                    DT                       VALUE
    METRIC_1                       12/31/2013 08:00:00         10
    METRIC_1                       12/31/2013 09:00:00         20
    METRIC_1                       12/31/2013 10:00:00         30
    METRIC_2                       12/31/2013 08:00:00         11
    METRIC_2                       12/31/2013 09:00:00         22
    METRIC_2                       12/31/2013 10:00:00         33
    But I need output in following format:
    METRIC_NAME   12/31/2013 08:00:00        12/31/2013 09:00:00        12/31/2013 10:00:00   
    METRIC_1                   10                                     20                                  30
    METRIC_2                    11                                    22                                  33
    -Thanks
    All the dts INSERTed were 08:00:00; why are some displayed as 09:00:00 or 10:00:00?  I assume there are typos in the INSERT statements, and the results above are correct.
    Taking data from 1 column on N rows, and displaying it as N columns on 1 row is called Pivoting.  Search for "pivot" for details.
    If you know the exact dts for which you want to check, you can do something like this:
    SELECT    *
    FROM      test_table
    PIVOT     (    MIN (value)
              FOR  dt  IN ( TO_DATE ('12/31/2013 08:00:00', 'mm/dd/yyyy hh24:mi:ss')  AS hr_08
                          , TO_DATE ('12/31/2013 09:00:00', 'mm/dd/yyyy hh24:mi:ss')  AS hr_09
                          , TO_DATE ('12/31/2013 10:00:00', 'mm/dd/yyyy hh24:mi:ss')  AS hr_10                  )
    ORDER BY  metric_name
    I hope this answers your question.
    If not, post  a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
    Point out where the query above is giving the wrong results, and explain, using specific examples, how you get the correct results from the given data in those places.  If you changed the query at all, post your code.
    Always say which version of Oracle you're using (e.g., 11.2.0.2.0).
    See the forum FAQ: https://forums.oracle.com/message/9362002

  • Query - Sharing single Input/output  FRS  across multiple CMS Cluster

    Hi,
    I have two BOE XI R2 SP3 servers on windows 2003r2 x64 which are with one BOE clustered, sharing file repository (FRS) on common NAS storage folders. Objective is to vertically scale BOE servers by adding more clusters on these two BOE servers. I wish to add few more clusters by adding CMS through CCM wizard option pointing to separate CMS db sachems.
    Can multiple CMS cluster share same FRS component with separate folder structure OR do I have to duplicate each BOE component per cluster basis.
    Regards,
    G.

    Hi
    Thanks for your response.
    Hardware allocated for BOE is only 2 servers, and design is to maintain 3 separate environments( One change should not affect other). We wish to share Production, Testing and support BOE environments on same hardware.
    Only objective of maintaining multiple BOE cluster on same hardware is to provide non inter dependent BOE service to various user groups.
    Suggest needful
    Regards,

  • Single line item for multiple line item payment.

    Hi
    I have booked the 3 vendor invoices (in FB60) for a single vendor. Now today i paid (with F-53) all the three invoices together. One payment document number was generated.
    However when i saw the vendor line item, i saw that three debit line items was generated for the clearing the open invoices (i..e 3 credit line items). so when i say vendor line item report, there were total 6 cleared line items (3 for credit i.e invoice and 3 for debit i.e. payments)
    But is it possible to get  single debit line item for all the three invoices cleared. If yes, please let me know how i can get it.
    If i will have one single line item for payment, vendor report would be simpler. Please help

    Hi,
    1. If you do payment through F-53, then each invoice have separate payment line item. This is not avoidable. If you do payment through F110, then you can group the line items for payment, so there only one payment line item for many number of invoices.
    2. While clearing through F-44, system is generating automatic line items because, there are exchange rate fluctuations. You can't avoid these line items, as these automatic line items only match Debit and Credit amounts in order to post the document.
    Rgds
    Murali. N

  • Need a JavaScript to enable/view Multi-line option for Text fields.

    Hello All,
    I need a JavaScript to enable/view Multi-line option for all the Text fields in PDF Form.
    Assume that I have a PDF form of Fields from F1 to F100 and it contains 25 Checkboxes, 25 Combo Box and 50 Text Fields. Now i need a javascript for which i need to enable Multiline for only Text Fields. So Is there any JS for which i can enable the Multiline option for only Text fields and not for ComboBox or Checkbox.

    Hi timo,
    Thanks for your help. iam trying to use the iteraor approch to do this. but i don't know how to fetch the data entered in the form that was built by the iterator. can you please tell me .
    thanks

  • Single line item for multiple open items in app

    we have three open items   to vendor x  100001000010000
    But we are paying to vendor only 10000100005000
    At the time of entry system showing
    Vendor account 25000
                 To    Bank account       20000
                 To    Bank account         5000(here we paying partial amount of 3rd open item)
    But my Clint requirement is system should post only single line item for bank account 25000 for reconcilation purpose
    Would you please suggest where we need to do customization?

    Hi Anantha,
    How are you making the payment which transaction you are using ? Both Manual & Automatic payment
    the suggested solution is go for split payment terms. configure using OBB8 and OBB9
    Hope this helps
    pbb

  • Can we combine multiple data sources in single report?

    <span style="font-size: 10pt; font-family: Verdana">Can we combine multiple data sources in single report?</span>

    If you can&#39;t do this at the Metalayer (BVs or Universe) - then subreports and shared variables are the method for CR to use multiple datasources in the same report.

  • Can anyone confirm the date used for pushing the data into AR interface table? Is it abse don Actual ship date or scheduled ship date?

    Can anyone confirm the date used for pushing the data into AR interface table? Is it abse don Actual ship date or scheduled ship date? We are facing a scenario where trx date is lower than the actual ship to which logically sounds incorrect.
    Appreciate any quick response around this.

    Hi,
    Transaction date  will be your autoinvoice master program submission level date (If you haven't setup any logic.
    Please check the program level default date, if user enter old date ststem will pick the same.
    Customer is trying to set the value of the profile OM:Set receivables transaction date as current date for non-shippable lines at the responsiblity level. System does not set the transaction date to current date in ra_interface_lines_all.
    CAUSE
    Customer has used the functionality in R11i. But after the upgrade to R12, the system functions differently than R11i.
    SOLUTION
    1.Ensure that there are no scheduled workflow background process run.
    2.Set the profile "OM: Set Receivables Transaction Date as Current Date for Non-Shippable Lines"  at Responsibility level only as Yes.
    3.Now switch the responsibility to which the profile is set.
    4.Create order for Non-Shippable Lines and progress it to invoicing.
    5.Ensure that the 'workflow background process' concurrent program is run in the same responsibility and this line is considered in it.
    6.Now check if the 'SHIP_DATE_ACTUAL' is populated to ra_interface_lines_all

  • Command line command for combine jpeg files into a pdf file

    I want to learn if we have any command line sentence to combine jpg files.
    normally from the windows explorer window
    i can select all jpg files and when i click on right button on the window they shows Combine supported files in acrobat and then i check if single file is selected and i clicked on combine files button.
    and then i put name of the file and press the save button.
    But i want to process this steps via command line commands.
    Can you show any answer to me.

    You don't say what version of Acrobat you are using, but I expect you could do it with Acrobat XI's Actions feature. Maybe even in 10.0. Since this is an enterprise deployment forum, I suggest you find a better forum and ask about Actions and Batch Processing.
    hth,
    Ben

  • Problem:ABAp list to pdf :downaloading single line item instead of multiple

    Hi all,
             my requirement is converting the report output as pdf and download. if user enter multiple vendors, we have to download vendor data based up on vendor as separate pdf file. for this i used NEW PAGE PRINT ON. everything i'm downaloding fine.but my problem is when vendor have multiple line items ,it is downloading only one line item that is lastline item. but i need total line items have to download.I'm pasting my code here. Can Anyone suggest.
    TYPES: BEGIN OF type_data,
           lifnr TYPE ekko-lifnr,
           matnr TYPE lips-matnr,
           vgbel TYPE lips-vgbel,
           vgpos TYPE lips-vgpos,
           mfrgr TYPE lips-mfrgr,
           vbeln TYPE ekes-vbeln,
           erdat TYPE ekes-erdat,
           lfdat TYPE ekes-eindt,
           lgort TYPE lips-lgort,
           verur TYPE ekes-xblnr,
           lfuhr TYPE ekes-uzeit,
           lfimg TYPE lips-lfimg,
           meins TYPE lips-meins,
           posnr TYPE lips-posnr,
           kdmat TYPE lips-kdmat,
           dabmg TYPE ekes-dabmg,
           eindt TYPE eket-eindt,
    * Add by liza DEVK989704
           park TYPE ZPO_PARK-menge,
    * End by liza DEVK989704
           END OF type_data.
    DATA: gt_data TYPE STANDARD TABLE OF type_data.
    DATA: gw_data LIKE LINE OF gt_data.
    Data : BEGIN OF t_data OCCURS 0,
           lifnr like ekko-lifnr,
           matnr like lips-matnr,
           maktx like makt-maktx,
           vgbel like lips-vgbel,
           vgpos(6),      " like lips-vgpos,
           mfrgr like lips-mfrgr,
           vbeln like ekes-vbeln,
           erdat like ekes-erdat,
           lfdat like ekes-eindt,
           lgort like lips-lgort,
           verur like ekes-xblnr,
           lfuhr like ekes-uzeit,
           lfimg(15) type p decimals 0,    "like lips-lfimg,
           meins(3),     " like lips-meins,
           posnr(6),     "like lips-posnr,
           kdmat like lips-kdmat,
           dabmg(15) type p decimals 0,    " like ekes-dabmg,
           menge(15) type p decimals 0,
           eindt like eket-eindt,
           adv(3),
           adrnr type lfa1-adrnr,
           EMAIL type zmamm_dt1002-EMAIL,
    * Add by liza DEVK989704
           PARK(15) type p decimals 0,
    * End by liza DEVK989704
           END OF t_data.
    FORM FM_DOWNLOAD_DATA .
      data: wa_pri_params like pri_params.
    data: w_valid(1).
    data: w_tabix type c.
    data: w_rqident type rspoid.
      data: list_name like PRI_PARAMS-PLIST.
          l_x = 'X'.
      caLL FUNCTION 'GET_PRINT_PARAMETERS'
       EXPORTING
         NO_DIALOG                      = L_X
       IMPORTING
         OUT_PARAMETERS                 = wa_pri_params
         VALID                          = w_VALID
      IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
       wa_pri_params-PAART = 'X_65_80'.
          wa_pri_params-LINSZ = '185'.
    IF w_valid EQ 'X'.
    * WAIT UP TO 1 SECONDS.
    CONCATENATE 'E'
    w_tabix
    sy-datum+4(4)
    sy-uzeit INTO
    wa_pri_params-plist.
    ENDIF.
      DATA: lv_maktx   TYPE makt-maktx,
            lv_adv(01) TYPE c.
      DATA: lv_menge TYPE zomm_t0104m-menge.
    *-- Set titles
      title1 = 'Panasonic HA Air-Conditioning (M) Sdn Bhd, Shah Alam'.
      title2 = '(Formerly Known As Matsushita Industrial Corp. Sdn. Bhd.)'.
      title3 = sy-title.
      IF NOT pa_fax IS INITIAL.
        NEW-PAGE LINE-SIZE 120 LINE-COUNT 44.
        title3 = 'Outstanding shipping notifications by supplier'.
      ENDIF.
      SORT gt_data BY lifnr lfdat matnr vgbel vgpos eindt.
      LOOP AT gt_data INTO gw_data.
    NEW-PAGE PRINT ON NO DIALOG PARAMETERS wa_pri_params.
        AT NEW lifnr.
          NEW-PAGE.
          sy-pagno = 1.
    *-- Get the vendor name
          CLEAR: gv_name1,
                 gv_telf1,
                 gv_telfx.
          SELECT SINGLE name1 telf1 telfx
                 INTO (gv_name1, gv_telf1, gv_telfx)
                 FROM lfa1
                 WHERE lifnr = gw_data-lifnr.
    ENDAT.
    at new matnr.
    *-- Get the material description
          CLEAR lv_maktx.
          SELECT SINGLE maktx INTO lv_maktx
                 FROM makt
                 WHERE matnr = gw_data-matnr
                   AND spras = sy-langu.
    endat.
    *-- If "only pending shipping notifications" is selected, remove all
    *   entries with no pending quantity
        IF gw_data-lfimg LE gw_data-dabmg AND
           pa_pend = 'X'.
          CONTINUE.
        ENDIF.
    *-- Highlight entries where the SN delivery date is before the PO
    *   delivery date
        IF gw_data-lfdat < gw_data-eindt.
          FORMAT INTENSIFIED ON.
          lv_adv = 'X'.
        ELSE.
          FORMAT INTENSIFIED OFF.
          CLEAR lv_adv.
        ENDIF.
        lv_menge = gw_data-lfimg - gw_data-dabmg.
    * Add by liza DEVK989704
        clear: PARKING, T_PARK.
        refresh: T_PARK.
        Select * from ZPO_PARK into T_PARK
        where vbeln = gw_data-vbeln
        and lifnr = gw_data-lifnr
        and matnr =  gw_data-matnr.
          Append T_PARK.
        Endselect.
        Loop at T_PARK.
          PARKING = PARKING + T_PARK-menge.
        Endloop.
        gw_data-park = PARKING.

    IF pa_fax IS INITIAL.
          WRITE:/2(18) gw_data-matnr,
                  (40) lv_maktx,
                       gw_data-vgbel,
                       gw_data-eindt,
                  (04) gw_data-mfrgr,
                  (18) gw_data-verur,
                       gw_data-vbeln,
                       gw_data-lfdat,
                  (07) gw_data-lfimg UNIT gw_data-meins,
                  (07) gw_data-dabmg UNIT gw_data-meins,
                  (07) lv_menge UNIT gw_data-meins,
                       gw_data-lgort,
                       gw_data-erdat,
                  (01) lv_adv,
    * Add by liza DEVK989704
                  (08) gw_data-park.
    * End by liza DEVK989704
        ELSE.
          WRITE:/2(12) gw_data-matnr,
                  (26) lv_maktx,
                       gw_data-vgbel,
                  (16) gw_data-verur,
                       gw_data-vbeln,
                       gw_data-lfdat,
                  (07) gw_data-lfimg UNIT gw_data-meins,
                  (07) gw_data-dabmg UNIT gw_data-meins,
                  (07) lv_menge UNIT gw_data-meins,
                       gw_data-lgort.
        ENDIF.
        PERFORM write_vline.
    *    AT END OF lifnr.
           If pa_dtim NE '000000'.
            ULINE.
            SKIP.
            WRITE:/12 TS_VEND.
            WRITE:/12 TS_ATT.
            WRITE:/12 TS_FROM.
            SKIP.                                               "D01K934099
            WRITE:/12'DELIVERY TIME:',pa_dtim.                  "D01K934099
            SKIP.                                               "D01K934099
            WRITE:/12 TS_TEXT1.
            WRITE:/12 TS_TEXT2.
            WRITE:/12 TS_TEXT3.
            WRITE:/12 TS_TEXT4.
          Else.
            ULINE.
            SKIP.
            WRITE:/12 TS_VEND.
            WRITE:/12 TS_ATT.
            WRITE:/12 TS_FROM.
            WRITE:/12 TS_TEXT1.
            WRITE:/12 TS_TEXT2.
            WRITE:/12 TS_TEXT3.
            WRITE:/12 TS_TEXT4.
          Endif.
        move-corresponding gw_data to t_data.
        move : lv_maktx  to t_data-maktx,
               lv_menge  to t_data-menge,
               lv_adv    to t_data-adv,
    * Add by liza DEVK989704
               parking   to t_data-park.
    * End by liza DEVK989704
        append t_data.
      IF sy-subrc NE 0.
        MESSAGE i999(sa) WITH 'No data found'.
      ENDIF.
    NEW-PAGE PRINT OFF.
    * To fetch the spool number from TSP01 table
      sELECT rqident
    FROM tsp01
    INTO w_rqident
    *UP TO 1 ROWS
    WHERE rq2name = wa_pri_params-plist.
    ENDSELECT.
    * /*--------Convert Spool to PDF-----------/
      IF wa_pri_params-PDEST IS INITIAL.
        wa_pri_params-PDEST = 'LOCL'.
      ENDIF.
      CONCATENATE P_DEST T_DATA-LIFNR '.PDF' INTO G_FILENAME.
      CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
        EXPORTING
          SRC_SPOOLID                    = w_RQIDENT
         NO_DIALOG                      = SPACE
       IMPORTING
         PDF_BYTECOUNT                  = G_BYTECOUNT
       TABLES
         PDF                            = T_PDF
       EXCEPTIONS
         ERR_NO_ABAP_SPOOLJOB           = 1
         ERR_NO_SPOOLJOB                = 2
         ERR_NO_PERMISSION              = 3
         ERR_CONV_NOT_POSSIBLE          = 4
         ERR_BAD_DESTDEVICE             = 5
         USER_CANCELLED                 = 6
         ERR_SPOOLERROR                 = 7
         ERR_TEMSEERROR                 = 8
         ERR_BTCJOB_OPEN_FAILED         = 9
         ERR_BTCJOB_SUBMIT_FAILED       = 10
         ERR_BTCJOB_CLOSE_FAILED        = 11
         OTHERS                         = 12
      IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    *   /*---------download to specified folder--------/
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          BIN_FILESIZE            = G_BYTECOUNT
          FILENAME                = G_FILENAME
          FILETYPE                = 'BIN'
        TABLES
          DATA_TAB                = T_PDF
        EXCEPTIONS
          FILE_WRITE_ERROR        = 1
          NO_BATCH                = 2
          GUI_REFUSE_FILETRANSFER = 3
          INVALID_TYPE            = 4
          NO_AUTHORITY            = 5
          UNKNOWN_ERROR           = 6
          HEADER_NOT_ALLOWED      = 7
          SEPARATOR_NOT_ALLOWED   = 8
          FILESIZE_NOT_ALLOWED    = 9
          HEADER_TOO_LONG         = 10
          DP_ERROR_CREATE         = 11
          DP_ERROR_SEND           = 12
          DP_ERROR_WRITE          = 13
          UNKNOWN_DP_ERROR        = 14
          ACCESS_DENIED           = 15
          DP_OUT_OF_MEMORY        = 16
          DISK_FULL               = 17
          DP_TIMEOUT              = 18
          FILE_NOT_FOUND          = 19
          DATAPROVIDER_EXCEPTION  = 20
          CONTROL_FLUSH_ERROR     = 21
          OTHERS                  = 22.
      IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    endloop.
    ENDFORM.

  • Report/Widget for combined performance data

    Hello.
    I have created a dashboard view in SCOM 2012 R2 for power consumption of a number of servers. These servers are all part of a group. The power consists of a couple of different performance monitors (VMWare-sensor for VMs and Power Meter from the Power
    Consumption MP)
    The dashboard view works well, however I am after a total figure for each server in the group. Ideally this figure would be on the dashboard view as well.
    E.g. if I have 3 servers with the below power draw
    Server 1 – 150 Watts
    Server 2 – 200 Watts
    Server 3 – 300 Watts
    I would like a box stating total power 650 Watts
    If this is not available in a dashboard view, a report would be okay
    Thanks

    Hi,
    As far as I know, there is no direct way, you may create a sql query and sum the value for each server.
    You may refer to the helpful article below:
    http://blogs.technet.com/b/drewfs/archive/2014/08/17/scom-performance-data-and-power-view.aspx
    Regards,
    Yan Li
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact [email protected]

  • No data for Parent-child hierarchy column in Pivot table view

    Hi all,
    I used OBIEE 11.1.1.6.2 Version.
    I drag one Parent-child hierarchy column and one measure and show result with a pivot table view.
    But when I click "+" icon to show detail level data,
    It messaged that: "*the layout of this view combined with the data,selections,drills,or prompt values chosen resulted in no data*."
    But it can show every-level data when I used table view.
    It was so strange..
    Did anybody meet this before?
    Thanks in advance.
    regards,
    Anne

    Hi,
    Yes, I have the same problem with pivot table for hierarchy dimension.
    If you use a normal table (not pivot) it seem to work. Unfortunatley with restrictions as normal table view have.
    Same problem still exist in 11.1.1.6.5
    I have logged a SR to Oracle about this.

  • Date query doesn't show results for today's date

    Hello everyone. I use Jdeveloper 11.1.1.3.0 with ADF and I have a view named query with just one field, Date. The operator it is using is equal to a value written in the field. The problem is that when I insert a row into the table (the date is automatically set to the current date on insertion) and I look for today's date it returns nothing. However if I leave the field empty it will find me the row. I tried doing this with the timestamp option but it's not very user friendly as the user would have to type in the time the row was inserted in order to find it, or use the between operator for two fields which is something I want to avoid if at all possible
    The requirement is one field query that lets the user choose a date from a calendar and shows all rows inserted on that date (even if the date is today and the row was inserted a few minutes before).
    Edited by: Dino2dy on Apr 6, 2011 2:50 AM

    Dino2dy,
    My guess is that the data being stored in the DB has a time component associated with it (as it would if you were using something like SYSDATE to populate it). When you are trying to look for data with today's date, you are checking just for the date - which in Oracle is the equivalent of midnight on the start of the date. The dates don't match because the time is different.
    Either store the date with no time component (use TRUNC to remove the time), use a BETWEEN comparison, or TRUNC the date when comparing.
    John

  • How to query a item stock quantity for a given date

    Hi there,
    I need to query the stock quantity of an item for a given date. For example, i want to know how many pieces of A i have on stock at the 20th of march 2009.
    I know there is a report, but i need the value for a subquery.
    Regards Steffen

    Sorry Gordon,
    Your query is not wrong, far from me to insult your work. It does indeed make full sense if the business process allows the item description to change.
    If not, we can avoid a "inner join"  = smaller, cleaner and (theoritically) faster query
    Here is your code with the little review:
    SELECT T0.ItemCode, T0.Dscription, sum(T0.InQty - T0.OutQty) as 'On Hand'
    FROM DBO.OINM T0
    WHERE T0.DocDate <= '[%0]' and T0.ItemCode = '[%1]'
    GROUP BY T0.ItemCode, T0.Dscription
    Cheers
    tested on 2007 SP00 PL46

  • TSQL query to calculate Count / Sum grouping by date on a Pivot Table

    Hi All
    I need help to group the pivot table output to group by dates and sum/count the values. I have a table like shown below.
    Date
    Student 
    Subject
    Hunt
    Marks
    18/02/2014
    Sam 
    Maths
    1
    20
    18/02/2014
    Sam 
    Maths
    1
    10
    18/02/2014
    Sam 
    Maths
    2
    30
    18/02/2014
    Luke
    Science
    1
    50
    17/02/2014
    Sam 
    Maths
    2
    50
    17/02/2014
    Luke
    Science
    2
    60
    16/02/2014
    Luke
    Science
    2
    20
    16/02/2014
    Luke
    Science
    3
    20
    I want to Group by dates and move the Hunt to columns calculating their counts and sum their marks too. Like given below.
    I wrote a pivot query like below but If i group it with dates and calculate the total marks it throws aggregate errors.
    Create Table Student_Log ([Date] datetime ,Student varchar (20), Subject varchar (20) ,Hunt int ,Marks int )
    Go
    INSERT INTO Student_Log ([Date],Student, [Subject],Hunt,Marks) VALUES('2014-02-18 15:00:00.000','Sam ','Maths','1','20')
    INSERT INTO Student_Log ([Date],Student, [Subject],Hunt,Marks) VALUES('2014-02-18 15:00:00.000','Sam ','Maths','1','10')
    INSERT INTO Student_Log ([Date],Student, [Subject],Hunt,Marks) VALUES('2014-02-18 15:00:00.000','Sam ','Maths','2','30')
    INSERT INTO Student_Log ([Date],Student, [Subject],Hunt,Marks) VALUES('2014-02-18 15:00:00.000','Luke','Science','1','50')
    INSERT INTO Student_Log ([Date],Student, [Subject],Hunt,Marks) VALUES('2014-02-17 15:00:00.000','Sam ','Maths','2','50')
    INSERT INTO Student_Log ([Date],Student, [Subject],Hunt,Marks) VALUES('2014-02-17 15:00:00.000','Luke','Science','2','60')
    INSERT INTO Student_Log ([Date],Student, [Subject],Hunt,Marks) VALUES('2014-02-16 15:00:00.000','Luke','Science','2','20')
    INSERT INTO Student_Log ([Date],Student, [Subject],Hunt,Marks) VALUES('2014-02-16 15:00:00.000','Luke','Science','3','20')
    Go
    select * from Student_Log
    select [DATE] , [Student], [Subject] ,[1],[2],[3],[4],Total =([1]+[2]+[3]+[4])
    from
    ( select [Date], [Student], [Subject],[Hunt],[Marks] from Student_Log
    )x
    pivot
    count ( [Hunt]) for [Hunt]
    in ([1],[2],[3],[4])
    )p
    order by [Date] desc
    I have done this far only. More than this I need to enhance it with the Percentage of Hunts for each Student.
    ie like below table.
    On 18th Sam in Maths he had 2 rows on 1st hunt  and 1 row on 2nd hunt. So On the Pivot table is it possible to represent it on percentage using the Total Attempts column.
    Thanks a lot in advance.
    Its runnung in SQL 2000 Server.

    Create Table Student_Log ([Date] datetime ,Student varchar (20), Subject varchar (20) ,Hunt int ,Marks int )
    Go
    INSERT INTO Student_Log ([Date],Student, [Subject],Hunt,Marks) VALUES('2014-02-18 15:00:00.000','Sam ','Maths','1','20')
    INSERT INTO Student_Log ([Date],Student, [Subject],Hunt,Marks) VALUES('2014-02-18 15:00:00.000','Sam ','Maths','1','10')
    INSERT INTO Student_Log ([Date],Student, [Subject],Hunt,Marks) VALUES('2014-02-18 15:00:00.000','Sam ','Maths','2','30')
    INSERT INTO Student_Log ([Date],Student, [Subject],Hunt,Marks) VALUES('2014-02-18 15:00:00.000','Luke','Science','1','50')
    INSERT INTO Student_Log ([Date],Student, [Subject],Hunt,Marks) VALUES('2014-02-17 15:00:00.000','Sam ','Maths','2','50')
    INSERT INTO Student_Log ([Date],Student, [Subject],Hunt,Marks) VALUES('2014-02-17 15:00:00.000','Luke','Science','2','60')
    INSERT INTO Student_Log ([Date],Student, [Subject],Hunt,Marks) VALUES('2014-02-16 15:00:00.000','Luke','Science','2','20')
    INSERT INTO Student_Log ([Date],Student, [Subject],Hunt,Marks) VALUES('2014-02-16 15:00:00.000','Luke','Science','3','20')
    Go
    select * from Student_Log
    ;with mycte as
    Select [Date], [Student], [Subject] ,
    Count(CASE WHEN [Hunt]=1 Then Hunt End) as Hunt1,
    Count(CASE WHEN [Hunt]=2 Then Hunt End) as Hunt2,
    Count(CASE WHEN [Hunt]=3 Then Hunt End) as Hunt3,
    Count(CASE WHEN [Hunt]=4 Then Hunt End) as Hunt4,
    Count(CASE WHEN [Hunt]=1 Then Hunt End)
    +Count(CASE WHEN [Hunt]=2 Then Hunt End)
    +Count(CASE WHEN [Hunt]=3 Then Hunt End)+
    +Count(CASE WHEN [Hunt]=4 Then Hunt End) as Total,
    ISNULL(SUM(CASE WHEN [Hunt]=1 Then Marks End),0) as Mark1,
    ISNULL(SUM(CASE WHEN [Hunt]=2 Then Marks End),0) as Mark2,
    ISNULL(SUM(CASE WHEN [Hunt]=3 Then Marks End),0) as Mark3,
    ISNULL(SUM(CASE WHEN [Hunt]=4 Then Marks End),0) as Mark4
    from Student_Log
    Group By [Date], [Student], [Subject]
    Select [Date], [Student], [Subject]
    , Cast(Hunt1*1./Total*100 as int) as [1]
    , Cast(Hunt2*1./Total*100 as int) as [2]
    ,Cast(Hunt3*1./Total*100 as int) as [3]
    ,Cast(Hunt4*1./Total*100 as int) as [4]
    ,Total,Marks=( Mark1+Mark2+Mark3+Mark4)
    from mycte
    order by [Date] DESC, Student desc
    drop table Student_Log

Maybe you are looking for

  • Just double-checking - a question re. right configuration

    Hi all, I would like to ask the experts whether my following network setup is configured correctly (or ideally for that matter). We have a flat with a lot of walls between the rooms, so one router is not enough to ensure wifi reception in every room.

  • How to restore an iphone 5

    Hi, I have to restore (wrong password to unlock). Now it asks me for the unlock pass but it doesnt recognize the correct one. what should I do? I can't find a "I forgot unlock" thank you

  • Printing right-justification problem

    I have tried to use several methods to accurately determine the rendered width of a string in order to position it at (right_edge - width) --that is, right-justified.  The problem is, all of the methods I have tried seem to under-report the length, r

  • PO Output for Communication landscape PDF printing sideways issue

    Hi, I created a custom pdf template which uses the Standard Purchase Order Data Source (PO_STANDARD_PO) data definition. The requirement was to change the look of the standard po report and also to make it landscape. I was able to successfully create

  • OS X web rendering issue

    Hi, I'm trying to track down a rendering issue in all browsers on osx where white text on a dark background causes the text to go very bold and cannot be lightened, I can only find a couple other examples of this on the internet and no solutions. Wou