COLLECTION ITERATOR PICKLER FETCH along with XMLSEQUENCEFROMXMLTYPE

Hi All,
We have Oracle database 10.2.0.4 on solaris 10.
I found some xml queries which are consuming CPU and memory highly, below is the execution plan for one of this xml sql.
PLAN_TABLE_OUTPUT
SQL_ID  gzsfqp1mkfk8t, child number 0
SELECT B.PACKET_ID FROM CM_PACKET_ALT_KEY B, CM_ALT_KEY_TYPE C, TABLE (XMLSEQUENCE (EXTRACT (:B1 ,
'/AlternateKeys/AlternateKey'))) T WHERE B.ALT_KEY_TYPE_ID = C.ALT_KEY_TYPE_ID AND C.ALT_KEY_TYPE_NAME = EXTRACTVALUE
(VALUE (T), '/AlternateKey/@keyType') AND B.ALT_KEY_VALUE = EXTRACTVALUE (VALUE (T), '/AlternateKey') AND NVL
(B.CHILD_BROKER_CODE, '6209870F57C254D6E04400306E4A78B0') = NVL (EXTRACTVALUE (VALUE (T), '/AlternateKey/@broker'),
'6209870F57C254D6E04400306E4A78B0')
Plan hash value: 855909818
PLAN_TABLE_OUTPUT
| Id  | Operation                           | Name                   | Rows  | Bytes | Cost (%CPU)| Time     | Pstart| Pstop |
|   0 | SELECT STATEMENT                    |                        |       |       | 16864 (100)|          |       |       |
|*  1 |  HASH JOIN                          |                        |    45 |  3240 | 16864   (2)| 00:03:23 |       |       |
|   2 |   TABLE ACCESS FULL                 | CM_ALT_KEY_TYPE        |     5 |   130 |     6   (0)| 00:00:01 |       |       |
|*  3 |   HASH JOIN                         |                        |   227 | 10442 | 16858   (2)| 00:03:23 |       |       |
|   4 |    COLLECTION ITERATOR PICKLER FETCH| XMLSEQUENCEFROMXMLTYPE |       |       |            |          |       |       |
|   5 |    PARTITION HASH ALL               |                        |    10M|   447M| 16758   (2)| 00:03:22 |     1 |    16 |
|   6 |     TABLE ACCESS FULL               | CM_PACKET_ALT_KEY      |    10M|   447M| 16758   (2)| 00:03:22 |     1 |    16 |
PLAN_TABLE_OUTPUT
Predicate Information (identified by operation id):
   1 - access("B"."ALT_KEY_TYPE_ID"="C"."ALT_KEY_TYPE_ID" AND
              "C"."ALT_KEY_TYPE_NAME"=SYS_OP_C2C(EXTRACTVALUE(VALUE(KOKBF$),'/AlternateKey/@keyType')))
   3 - access("B"."ALT_KEY_VALUE"=EXTRACTVALUE(VALUE(KOKBF$),'/AlternateKey') AND
              NVL("B"."CHILD_BROKER_CODE",'6209870F57C254D6E04400306E4A78B0')=NVL(EXTRACTVALUE(VALUE(KOKBF$),'/AlternateKey/@broker'
              ),'6209870F57C254D6E04400306E4A78B0'))Seems due to
1.COLLECTION ITERATOR PICKLER FETCH along with XMLSEQUENCEFROMXMLTYPE which i think is due to usage of table( XMLSEQUENCE() )
2.Conversion taking place according to SYS_OP_C2C function as shown in Predicate Information.
3.Table is not using xmltype datatype to store XML
4.Wilcards have been used (/AlternateKey/@keyType)
Could anyone please help me in tuning this query as i know very less about XML DB
Including one more sql which also use to consume huge CPU and memory, these tables are also not hving any column with xmltype datatype.
SELECT /*+  INDEX(e) */ XMLAGG(XMLELEMENT ( "TaggingCategory", XMLATTRIBUTES (G.TAG_CATEGORY_CODE AS
"categoryType"), XMLELEMENT ("TaggingValue", XMLATTRIBUTES (C.IS_PRIMARY AS "primary", H.ORIGIN_CODE AS
"origin"), XMLAGG (XMLCONCAT (XMLELEMENT ("Value", XMLATTRIBUTES (F.TAG_LIST_CODE AS "listType"),
E.TAG_VALUE), CASE WHEN LEVEL = 1 THEN :B4 ELSE NULL END))) )) FROM TABLE (CAST (:B1 AS
T_TAG_MAP_HIERARCHY_TAB)) A, TABLE (CAST (:B2 AS T_ENUM_TAG_TAB)) C, REM_TAG_VALUE E, REM_TAG_LIST F,
REM_TAG_CATEGORY G, CM_ORIGIN H WHERE E.TAG_VALUE_ID = C.TAG_VALUE_ID AND F.TAG_LIST_ID = E.TAG_LIST_ID
AND G.TAGGING_CATEGORY_ID = F.TAGGING_CATEGORY_ID AND H.ORIGIN_ID = C.ORIGIN_ID AND C.ENUM_TAG_ID =
A.MAPPED_ENUM_TAG_ID GROUP BY G.TAG_CATEGORY_CODE, C.IS_PRIMARY, H.ORIGIN_CODE START WITH
A.MAPPED_ENUM_TAG_ID = HEXTORAW (:B3 ) CONNECT BY PRIOR A.MAPPED_ENUM_TAG_ID = A.ENUM_TAG_ID
Plan hash value: 2393257319
| Id  | Operation                                    | Name             | Rows  | Bytes | Cost (%CPU)| Time     |
|   0 | SELECT STATEMENT                             |                  |       |       | 16455 (100)|          |
|   1 |  SORT AGGREGATE                              |                  |     1 |   185 | 16455   (1)| 00:03:18 |
|   2 |   SORT GROUP BY                              |                  |     1 |   185 | 16455   (1)| 00:03:18 |
|*  3 |    CONNECT BY WITH FILTERING                 |                  |       |       |            |          |
|*  4 |     FILTER                                   |                  |       |       |            |          |
|   5 |      COUNT                                   |                  |       |       |            |          |
|*  6 |       HASH JOIN                              |                  |   667K|   117M| 16413   (1)| 00:03:17 |
|   7 |        COLLECTION ITERATOR PICKLER FETCH     |                  |       |       |            |          |
|*  8 |        HASH JOIN                             |                  |  8168 |  1459K| 16384   (1)| 00:03:17 |
|   9 |         TABLE ACCESS FULL                    | REM_TAG_CATEGORY |    25 |   950 |     5   (0)| 00:00:01 |
|* 10 |         HASH JOIN                            |                  |  8168 |  1156K| 16378   (1)| 00:03:17 |
|  11 |          TABLE ACCESS FULL                   | REM_TAG_LIST     |   117 |  7137 |     5   (0)| 00:00:01 |
|  12 |          NESTED LOOPS                        |                  |  8168 |   670K| 16373   (1)| 00:03:17 |
|  13 |           MERGE JOIN                         |                  |  8168 |   215K|    27   (4)| 00:00:01 |
|  14 |            TABLE ACCESS BY INDEX ROWID       | CM_ORIGIN        |     2 |    50 |     2   (0)| 00:00:01 |
|  15 |             INDEX FULL SCAN                  | PK_CM_ORIGIN     |     2 |       |     1   (0)| 00:00:01 |
|* 16 |            SORT JOIN                         |                  |  8168 | 16336 |    25   (4)| 00:00:01 |
|  17 |             COLLECTION ITERATOR PICKLER FETCH|                  |       |       |            |          |
|  18 |           TABLE ACCESS BY INDEX ROWID        | REM_TAG_VALUE    |     1 |    57 |     2   (0)| 00:00:01 |
|* 19 |            INDEX UNIQUE SCAN                 | PK_REM_TAG_VALUE |     1 |       |     1   (0)| 00:00:01 |
|* 20 |     HASH JOIN                                |                  |       |       |            |          |
|  21 |      CONNECT BY PUMP                         |                  |       |       |            |          |
|  22 |      COUNT                                   |                  |       |       |            |          |
|* 23 |       HASH JOIN                              |                  |   667K|   117M| 16413   (1)| 00:03:17 |
|  24 |        COLLECTION ITERATOR PICKLER FETCH     |                  |       |       |            |          |
|* 25 |        HASH JOIN                             |                  |  8168 |  1459K| 16384   (1)| 00:03:17 |
|  26 |         TABLE ACCESS FULL                    | REM_TAG_CATEGORY |    25 |   950 |     5   (0)| 00:00:01 |
|* 27 |         HASH JOIN                            |                  |  8168 |  1156K| 16378   (1)| 00:03:17 |
|  28 |          TABLE ACCESS FULL                   | REM_TAG_LIST     |   117 |  7137 |     5   (0)| 00:00:01 |
|  29 |          NESTED LOOPS                        |                  |  8168 |   670K| 16373   (1)| 00:03:17 |
|  30 |           MERGE JOIN                         |                  |  8168 |   215K|    27   (4)| 00:00:01 |
|  31 |            TABLE ACCESS BY INDEX ROWID       | CM_ORIGIN        |     2 |    50 |     2   (0)| 00:00:01 |
|  32 |             INDEX FULL SCAN                  | PK_CM_ORIGIN     |     2 |       |     1   (0)| 00:00:01 |
|* 33 |            SORT JOIN                         |                  |  8168 | 16336 |    25   (4)| 00:00:01 |
|  34 |             COLLECTION ITERATOR PICKLER FETCH|                  |       |       |            |          |
|  35 |           TABLE ACCESS BY INDEX ROWID        | REM_TAG_VALUE    |     1 |    57 |     2   (0)| 00:00:01 |
|* 36 |            INDEX UNIQUE SCAN                 | PK_REM_TAG_VALUE |     1 |       |     1   (0)| 00:00:01 |
Predicate Information (identified by operation id):
   3 - access(SYS_OP_ATG(VALUE(KOKBF$),1,2,2)=PRIOR NULL)
   4 - filter(SYS_OP_ATG(VALUE(KOKBF$),2,3,2)=HEXTORAW(:B3))
   6 - access(SYS_OP_ATG(VALUE(KOKBF$),1,2,2)=SYS_OP_ATG(VALUE(KOKBF$),2,3,2))
   8 - access("G"."TAGGING_CATEGORY_ID"="F"."TAGGING_CATEGORY_ID")
  10 - access("F"."TAG_LIST_ID"="E"."TAG_LIST_ID")
  16 - access("H"."ORIGIN_ID"=SYS_OP_ATG(VALUE(KOKBF$),3,4,2))
       filter("H"."ORIGIN_ID"=SYS_OP_ATG(VALUE(KOKBF$),3,4,2))
  19 - access("E"."TAG_VALUE_ID"=SYS_OP_ATG(VALUE(KOKBF$),7,8,2))
  20 - access(SYS_OP_ATG(VALUE(KOKBF$),1,2,2)=PRIOR NULL)
  23 - access(SYS_OP_ATG(VALUE(KOKBF$),1,2,2)=SYS_OP_ATG(VALUE(KOKBF$),2,3,2))
  25 - access("G"."TAGGING_CATEGORY_ID"="F"."TAGGING_CATEGORY_ID")
  27 - access("F"."TAG_LIST_ID"="E"."TAG_LIST_ID")
  33 - access("H"."ORIGIN_ID"=SYS_OP_ATG(VALUE(KOKBF$),3,4,2))
       filter("H"."ORIGIN_ID"=SYS_OP_ATG(VALUE(KOKBF$),3,4,2))
  36 - access("E"."TAG_VALUE_ID"=SYS_OP_ATG(VALUE(KOKBF$),7,8,2))-Yasser
Edited by: YasserRACDBA on Feb 24, 2010 8:30 PM
Added one more sql..

Looking at the second query, it too has a lot of bind variables... Can you find out the types and values of each BIND. Also, I'm suspcious about the use of XMLCONCAT.. Can you found out why the developer is using it..
SELECT /*+  INDEX(e) */  XMLAGG
                            XMLELEMENT
                               "TaggingCategory",
                               XMLATTRIBUTES (G.TAG_CATEGORY_CODE AS "categoryType"),
                               XMLELEMENT
                                 "TaggingValue",
                                 XMLATTRIBUTES (C.IS_PRIMARY AS "primary", H.ORIGIN_CODE AS "origin"),
                                 XMLAGG
                                    XMLCONCAT
                                      XMLELEMENT
                                        "Value",
                                        XMLATTRIBUTES (F.TAG_LIST_CODE AS "listType"),
                                        E.TAG_VALUE
                                      CASE WHEN LEVEL = 1
                                          THEN :B4
                                          ELSE NULL
                                      END
FROM TABLE (CAST (:B1 AS T_TAG_MAP_HIERARCHY_TAB)) A,
      TABLE (CAST (:B2 AS T_ENUM_TAG_TAB)) C,
      REM_TAG_VALUE E,
      REM_TAG_LIST F,
      REM_TAG_CATEGORY G,
      CM_ORIGIN H
WHERE E.TAG_VALUE_ID = C.TAG_VALUE_ID
  AND F.TAG_LIST_ID = E.TAG_LIST_ID
  AND G.TAGGING_CATEGORY_ID = F.TAGGING_CATEGORY_ID
  AND H.ORIGIN_ID = C.ORIGIN_ID
  AND C.ENUM_TAG_ID = A.MAPPED_ENUM_TAG_ID
GROUP BY G.TAG_CATEGORY_CODE, C.IS_PRIMARY, H.ORIGIN_CODE
      START WITH A.MAPPED_ENUM_TAG_ID = HEXTORAW (:B3 )
      CONNECT BY PRIOR A.MAPPED_ENUM_TAG_ID = A.ENUM_TAG_IDEdited by: mdrake on Feb 24, 2010 8:11 AM

Similar Messages

  • How to tune COLLECTION ITERATOR CONSTRUCTOR FETCH

    Hi Gurus
    I explained a plan for an SQL.
    it has "COLLECTION ITERATOR CONSTRUCTOR FETCH" and consumes more time and cost. Please share your tips or tricks to at-least improve little bit time or cost.
    Thanks

    Agreed, Cardinality hint is not safe to use as its undocumented.
    But Tom says :
    one of the few 'safe' undocumented things to use.
    Because it's use will not lead to data corruption, wrong answers, unpredictable outcomes. If it works - it will influence a query plan, if it doesn't - it won't. That is all - it is rather 'safe' in that respect.
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:2233040800346569775
    Cheers,
    Manik.

  • Printing Grand Totals in Footer along with page total

    Hi
    I have a report which prints PO Header and PO Lines. For each page while iterating thru PO Lines I print page total in the footer.
    Once all PO Lines are printed with page totals in the footer of each page, I want to print Grand total in the last page in the footer along with last page total. Currently my XML data has pre-computed grand total in the PO Header block.
    The problem
    I have wrapped header and lines inside <?start:body?> and <?end:body?> which allows me to print page totals outside the <?end:body?> tag.
    I print page totals and "Continue" next to it in the footer. But
    Finally when grand total comes into picture in the outer loop I want to replace "Continue" text with grand total value in the last page and print it as footer.
    I tried to use xdoxlt:set_variable() function to flag a variable value to 1 when iteration happens in HEADER block and set it to 2 in inner loop of lines block. But the scope of the variable is confined between <?start:body?> and < ?end:body? and is not visible outside the <?end:body?> tag.
    The logic I want to accomplish is
    if var = 1 then
    print page total and "Continue"
    elsif var = 2 then
    print page total and Grand Total.
    end if
    This logic doest work as the value of var is not visible outside the body tag.
    I want to use this variable value to print footer which lies outside <?end:body?> tag with grand totalor page total
    Please suggest if there is any other way I can accomplish this functionality. Can we use parameter and update it. Syntax for update parameter value is not clear in user guide.
    Any help would be appreciated.
    thanks
    sukarna

    thanks for the info, i was trying to avoid this but had already reached the same conclusion.
    everything else seems to be very time consuming and may not work correctly in the end.
    we're on Oracle Applications : 11.5.10.2 which has just been converted to utf-8 and is an Oracle On-Demand installation.
    do you know if 5.6.3 of the publisher is supported and any ideas on how difficult it is to get it installed?
    cheers
    ellen

  • Using aggregate function along with for all entries: sugest alternative

    My requirement:
    For each record in i_vbap for which 'charg' is initial, need to determine batch using the following logic:
    For the material (MATNR) in i_vbap, select the batch (CHARG) which has the largest (MAX) unrestricted inventory quantity (CLABS) from MCHB table.
    How do I implement this logic without using select statement inside a loop as I cannot use MAX ( CLABS ) function along with FOR ALL ENTRIES in a SELECT?
    Suggest an alternative.

    For each record in i_vbap for which 'charg' is initial ,fetch all the existing 'clabs' value.
    [ Remember to include all the key fields in selct ]
    Sort the new table .
    Put a loop,use at end of 'charg' and append to another table. U get ur solution
    I think this should be the most economic way to do so.

  • Exporting macro along with data - BEx web

    Hi,
    I have to send BEx web data along with a macro. The purpose is every report user down loads in his desktop gets an unique macro along with the data. The user can later use that macro for further analysis of the downloaded data.
    I was reading through the How to Use Web Printing with Microsoft Excel document which details about various objects such as Packages and ABAP classes. The ABAP class ZCL_RSR_XLS_ITEM_TEMPLATE contains methods such as SET_ITEM,RENDER_DATA,LOAD_TEMPLATE_FROM_DB,GET_TEMPLATE...etc. My question is whether these class and mehtods can it be enhanced to include a macro ???
    Any suggestions is eagerly awaited,
    Regs
    D Bret

    Hi Arun,
    How do you access / write excel macros using jave scripts ? can please send me an example ? In the mean time let me explain you my requirement again...
    My end users are not happy with Web printing so they have decided to go with exporting web report an excel sheet. But once the data been collected in excel sheet many of the users wld like to have some mechanism to strip that exported excel data into multiple sheets. so that is the reason its been decided to send the generic macro to end users who exports the BEx report to an excel sheet and process it....
    thanking you in advance,
    D Bret

  • How to raise pop up window along with radio buttons in module pool program

    how to raise pop up window along with radio buttons in module pool program

    FUNCTION zscheme_determination.
    *"*"Local Interface:
    *"  IMPORTING
    *"     REFERENCE(I_KUNNR) TYPE  KUNNR
    *"  EXPORTING
    *"     REFERENCE(E_VALUE) TYPE  NETWR_AK
    *"  TABLES
    *"      G_ITEM_DATA_ITAB STRUCTURE  ZITEM_DATA
    *  TYPES: BEGIN OF ty_sord,
    *         include type ZSD_SCHEME_DTL,
    *         END   OF ty_sord.
    *  data : gt_sord type standard table of ZSD_SCHEME_DTL,
    *         wa_sord type ZSD_SCHEME_DTL.
    *  select * from ZSD_SCHEME_DTL into table
    *  gt_sord
    *  where matnr = i_matnr.
    *  T_ITEM_DATA
    *********Data Declarations
       DATA:
             salesdocumentin LIKE bapivbeln-vbeln,
             orderheaderin LIKE bapisdhd1,
             orderheaderinx LIKE bapisdhd1x,
             sender LIKE bapi_sender,
             binaryrelationshiptype LIKE bapireltype-reltype,
             intnumberassignment LIKE bapiflag-bapiflag,
             behavewhenerror LIKE bapiflag-bapiflag,
             logicswitch LIKE bapisdls,
             testrun LIKE bapiflag-bapiflag,
             convert LIKE bapiflag-bapiflag,
             return LIKE bapiret2 OCCURS 0,
             orderitemsin LIKE bapisditm OCCURS 0,
             orderitemsinx LIKE bapisditmx OCCURS 0,
             orderpartners LIKE bapiparnr OCCURS 0,
             orderschedulesin LIKE bapischdl OCCURS 0,
             orderschedulesinx LIKE bapischdlx OCCURS 0,
             orderconditionsin LIKE bapicond OCCURS 0,
             orderconditionsinx LIKE bapicondx OCCURS 0,
             ordercfgsref LIKE bapicucfg OCCURS 0,
             ordercfgsinst LIKE bapicuins OCCURS 0,
             ordercfgspartof LIKE bapicuprt OCCURS 0,
             ordercfgsvalue LIKE bapicuval OCCURS 0,
             ordercfgsblob LIKE bapicublb OCCURS 0,
             ordercfgsvk LIKE bapicuvk OCCURS 0,
             ordercfgsrefinst LIKE bapicuref OCCURS 0,
             orderccard LIKE bapiccard OCCURS 0,
             ordertext LIKE bapisdtext OCCURS 0,
             orderkeys LIKE bapisdkey OCCURS 0,
             extensionin LIKE bapiparex OCCURS 0,
             partneraddresses LIKE bapiaddr1 OCCURS 0.
       DATA : wa_orderpartners LIKE bapiparnr,
              wa_orderitemsin LIKE bapisditm,
              wa_orderitemsinx LIKE bapisditmx,
              wa_orderschedulesin LIKE bapischdl,
              wa_orderschedulesinx LIKE bapischdlx,
              wa_orderconditionsin LIKE bapicond,
              wa_orderconditionsinx LIKE bapicondx,
              wa_return LIKE bapiret2,
              lv_value TYPE netwr_ak.
       DATA : lv_dtyp TYPE char45,
              lv_sorg TYPE vkorg,
              lv_sdch TYPE vtweg,
              lv_sdiv TYPE spart.
       TYPES : BEGIN OF ty_sord,
               zsdscheme TYPE comt_scheme_id,
               posnr TYPE posnr_va,
               matnr TYPE matnr,
               disc_type TYPE rebate_disc_type,
               calc_type TYPE catyp,
               qty_from TYPE kwmeng,
               qty_to TYPE kwmeng,
               spart TYPE spart,
               custcondgrp TYPE kdkg1,
               werks TYPE werks_d,
               matmn TYPE matnr,
               END   OF ty_sord.
       DATA : gt_sord   TYPE STANDARD TABLE OF ty_sord,
              gt_sordd  TYPE STANDARD TABLE OF ty_sord,
              wa_sord TYPE ty_sord,
              wa_knvv TYPE knvv,
              lv_cal_foc TYPE p DECIMALS 3,
              lv_cal_dis TYPE p DECIMALS 3,
              lv_new_qty TYPE kwmeng,
              lv_posmat TYPE posnr_va,
              lv_posfoc TYPE posnr_va.
       DATA:lv_diff TYPE kwmeng.
    ******Schemes Selection Logic
    * Get Valid Schemes
    * Validate Scheme for validity Period, Material, Customer Type and Plant
       TYPES : BEGIN OF ty_rtab,
               sign   TYPE c LENGTH 1,
               option TYPE c LENGTH 2,
               low    LIKE mara-matnr,
               high   LIKE mara-matnr,
             END OF ty_rtab.
    *  TYPES : ty_matnr TYPE RANGE OF ty_rtab.
       DATA : it_matnr TYPE TABLE OF ty_rtab,
              wa_matnr TYPE ty_rtab,
              wa_it    TYPE zitem_data,
             wa_tab TYPE zitem_data.
    *order table declaration
       TYPES:
             BEGIN OF ty_order,
               zsdscheme TYPE comt_scheme_id,
               matnr     TYPE matnr,
               kwmeng    TYPE kwmeng,
             END OF ty_order,
       BEGIN OF ty_scheme,
        zsdscheme TYPE comt_scheme_id,
    *                matnr     TYPE matnr,
        kwmeng    TYPE kwmeng,
      END OF ty_scheme.
       DATA:
             gt_order      TYPE TABLE OF ty_order,
             gt_scheme     TYPE TABLE OF ty_scheme,
              wa_scheme    TYPE ty_scheme,
              wa_order     TYPE  ty_order.
       DATA:i_kwmeng TYPE kwmeng.
    * Transfer all the material received from order to internal table
       LOOP AT g_item_data_itab INTO wa_it.
         MOVE : wa_it-matnr TO wa_matnr-low,
                'I'          TO wa_matnr-sign,
                'EQ'         TO wa_matnr-option.
         APPEND wa_matnr TO it_matnr.
         CLEAR wa_it.
       ENDLOOP.
    * Get the Valid Schemes based on given criteria
       SELECT
               zsd_scheme_dtl~zsdscheme
               zsd_scheme_dtl~posnr
               zsd_scheme_dtl~matnr
               zsd_scheme_dtl~disc_type
               zsd_scheme_dtl~calc_type
               zsd_scheme_dtl~qty_from
               zsd_scheme_dtl~qty_to
               zsd_scheme~spart
               zsd_scheme_hdr~custcondgrp
               zsd_scheme_hdr~werks
               zsd_scheme_hdr~matnr
       FROM zsd_scheme_hdr
       INNER JOIN zsd_scheme ON zsd_scheme~zsdscheme = zsd_scheme_hdr~zsdscheme
       INNER JOIN zsd_scheme_dtl ON zsd_scheme_dtl~zsdscheme = zsd_scheme_hdr~zsdscheme
       INTO TABLE  gt_sord
       WHERE  zsd_scheme_dtl~matnr IN it_matnr
    *    zsd_scheme_hdr~matnr IN it_matnr
    *    AND zsd_scheme_hdr~werks = '1509'
         AND zsd_scheme_hdr~werks = '1529'
         AND zsd_scheme_hdr~custcondgrp = '01'
         AND zsd_scheme~datuv LE sy-datum
         AND zsd_scheme~datub GE sy-datum.
       SORT gt_sord BY zsdscheme ASCENDING.
    *  LOOP AT gt_sord INTO wa_sord.
    *    READ TABLE g_item_data_itab INTO wa_it WITH  KEY matnr = wa_sord-matnr.
    *    wa_order-zsdscheme = wa_sord-zsdscheme.
    *    wa_order-matnr = wa_it-matnr.
    *    wa_order-kwmeng = wa_it-kwmeng.
    *    COLLECT wa_order INTO gt_order.
    *    CLEAR wa_order.
    *  ENDLOOP.
       LOOP AT g_item_data_itab INTO wa_it.
         READ TABLE gt_sord INTO wa_sord WITH  KEY matnr = wa_it-matnr.
         wa_order-zsdscheme = wa_sord-zsdscheme.
         wa_order-matnr = wa_it-matnr.
         wa_order-kwmeng = wa_it-kwmeng.
         COLLECT wa_order INTO gt_order.
         MOVE : wa_sord-zsdscheme  TO wa_scheme-zsdscheme,
                wa_it-kwmeng  TO wa_scheme-kwmeng.
         COLLECT wa_scheme INTO gt_scheme.
         CLEAR : wa_order, wa_scheme.
       ENDLOOP.
       CLEAR wa_scheme.
       DATA w_line TYPE sy-tabix.
    * Updating table based on Schemes
       LOOP AT gt_scheme INTO wa_scheme.
         CLEAR w_line.
         gt_sordd[] = gt_sord[].
    *    DELETE gt_sordd WHERE zsdscheme NE wa_scheme-zsdscheme and disc_type NE 'FOC'.
         DELETE gt_sordd WHERE zsdscheme NE wa_scheme-zsdscheme AND disc_type NE 'F'.
         DELETE ADJACENT DUPLICATES FROM gt_sordd COMPARING zsdscheme matnr.
         DESCRIBE TABLE gt_sordd LINES w_line.
         IF w_line GT 1.
    * popup message to select one foc type.
         ELSE.
           CLEAR wa_sord.
           READ TABLE gt_sordd INTO wa_sord INDEX 1.
           IF sy-subrc EQ 0.
             i_kwmeng = wa_scheme-kwmeng.
             lv_cal_foc = i_kwmeng DIV wa_sord-qty_from.
             lv_cal_dis = i_kwmeng MOD wa_sord-qty_from.
             MOVE : lv_cal_foc TO wa_it-kwmeng,
                    wa_sord-matnr TO wa_it-matnr.
             APPEND  wa_it TO g_item_data_itab.
             SORT gt_order BY kwmeng DESCENDING.
             LOOP AT gt_order INTO wa_order WHERE zsdscheme = wa_scheme-zsdscheme.
               IF lv_cal_dis GT 0.
    *        LOOP AT gt_order INTO wa_order WHERE zsdscheme = wa_scheme-zsdscheme
    *                                             AND lv_cal_dis GT 0.
    *                  LOOP AT gt_order INTO wa_order WHERE zsdscheme = wa_scheme-zsdscheme.
    *                LOOP AT g_item_data INTO wa_item_data WHERE matnr EQ wa_order-matnr.
                         LOOP AT g_item_data_itab INTO wa_tab WHERE matnr EQ wa_order-matnr.
                           wa_orderconditionsin-itm_number = wa_tab-posnr.
    *                  wa_orderconditionsin-itm_number = wa_item_data-posnr.
                           wa_orderconditionsin-cond_st_no = '001'.
    *                  IF gt_sordd-calc EQ ‘post AND disc_type EQ ‘percentage’.
                           IF wa_sord-calc_type EQ 'O' AND wa_sord-disc_type EQ 'P'.
                             wa_orderconditionsin-cond_type = 'ZTPB'.   "'ZREG'.
    *                  ELSEIF gt_sordd-calc EQ ‘pre’ AND disc_type EQ ‘percentage’
                           ELSEIF wa_sord-calc_type EQ 'E' AND wa_sord-disc_type EQ 'P'.
                             wa_orderconditionsin-cond_type = 'ZTPP'.   "'ZREG'.
                           ENDIF.
                           wa_orderconditionsin-currency = 'INR'.
                           wa_orderconditionsin-conpricdat = sy-datum.
                           APPEND wa_orderconditionsin TO orderconditionsin.
                           CLEAR wa_orderconditionsin.
    *Update Discount Conditon
                         ENDLOOP.
    *                  ENDLOOP.
    *Modify balance of Item
                 CLEAR wa_tab.
                 READ TABLE g_item_data_itab INTO wa_tab WITH KEY matnr = wa_order-matnr.
                 IF sy-subrc EQ 0.
                   lv_diff = wa_tab-kwmeng - lv_cal_dis.
                   IF lv_diff GT 0.
                     wa_tab-kwmeng  = wa_tab-kwmeng - lv_cal_dis.
    *            MODIFY g_item_data TRANSPORTING kwmeng  index sy-tabix.
                     MODIFY g_item_data_itab INDEX sy-tabix FROM wa_tab TRANSPORTING kwmeng  .
                   ELSE.
                     wa_tab-kwmeng  =  lv_cal_dis.
                     lv_cal_dis  = lv_diff.
                     MODIFY g_item_data_itab INDEX sy-tabix FROM wa_tab TRANSPORTING kwmeng .
    *            MODIFY G_ITEM_DATA_ITAB TRANSPORTING kwmeng index sy-tabix.
                   ENDIF.
                   gt_sordd[] = gt_sord[].
                   DELETE gt_sordd WHERE zsdscheme NE wa_scheme-zsdscheme AND disc_type EQ 'F'.
                   DESCRIBE TABLE gt_sordd LINES w_line.
                   IF w_line GT 1.
                     SORT gt_sordd BY zsdscheme DESCENDING.
    *              SORT gt_sordd BY quantity DESCENDING.
                     CLEAR wa_sord.
    *              LOOP AT gt_sordd WHERE quantity_from LT wa_shceme-kwmeng AND quantity_to GT wa_shceme-kwmeng.
                     LOOP AT gt_sordd INTO wa_sord  WHERE qty_from LT wa_scheme-kwmeng AND qty_to GT wa_scheme-kwmeng.
    *             LOOP AT gt_order INTO wa_order WHERE scheme = wa_scheme-scheme.
                       LOOP AT gt_order INTO wa_order WHERE zsdscheme = wa_scheme-zsdscheme.
    *                LOOP AT g_item_data INTO wa_item_data WHERE matnr EQ wa_order-matnr.
                         LOOP AT g_item_data_itab INTO wa_tab WHERE matnr EQ wa_order-matnr.
                           wa_orderconditionsin-itm_number = wa_tab-posnr.
    *                  wa_orderconditionsin-itm_number = wa_item_data-posnr.
                           wa_orderconditionsin-cond_st_no = '001'.
    *                  IF gt_sordd-calc EQ ‘post AND disc_type EQ ‘percentage’.
                           IF wa_sord-calc_type EQ 'O' AND wa_sord-disc_type EQ 'P'.
                             wa_orderconditionsin-cond_type = 'ZDPD'.   "'ZREG'.
    *                  ELSEIF gt_sordd-calc EQ ‘pre’ AND disc_type EQ ‘percentage’
                           ELSEIF wa_sord-calc_type EQ 'E' AND wa_sord-disc_type EQ 'P'.
                             wa_orderconditionsin-cond_type = 'ZDPD'.   "'ZREG'.
                           ENDIF.
                           wa_orderconditionsin-currency = 'INR'.
                           wa_orderconditionsin-conpricdat = sy-datum.
                           APPEND wa_orderconditionsin TO orderconditionsin.
                           CLEAR wa_orderconditionsin.
    *Update Discount Conditon
                         ENDLOOP.
                       ENDLOOP.
                     ENDLOOP.
                   ELSE.
                   ENDIF.
                 ENDIF.
               ENDIF.
             ENDLOOP.
           ENDIF.
         ENDIF.
       ENDLOOP.
    *  select
    *          ZSD_SCHEME_DTL~ZSDSCHEME
    *          ZSD_SCHEME_DTL~POSNR
    *          ZSD_SCHEME_DTL~matnr
    *          ZSD_SCHEME_DTL~DISC_TYPE
    *          ZSD_SCHEME_DTL~CALC_TYPE
    *          ZSD_SCHEME_DTL~QTY_FROM
    *          ZSD_SCHEME_DTL~QTY_TO
    *          ZSD_SCHEME~SPART
    *          ZSD_SCHEME_HDR~CUSTCONDGRP
    *          ZSD_SCHEME_HDR~WERKS
    *          ZSD_SCHEME_HDR~MATNR
    *  from ZSD_SCHEME_DTL
    *  inner join ZSD_SCHEME on ZSD_SCHEME~ZSDSCHEME = ZSD_SCHEME_DTL~ZSDSCHEME
    *  inner join ZSD_SCHEME_HDR on ZSD_SCHEME_HDR~ZSDSCHEME = ZSD_SCHEME_DTL~ZSDSCHEME
    *  into table
    *  gt_sord
    *  where ZSD_SCHEME_DTL~matnr = i_matnr and
    *        ZSD_SCHEME~DATUV LE sy-datum and
    *        ZSD_SCHEME~DATUB GE sy-datum.
    *  break-point.
    * Process Common Logic for Schemes Processcing
       CLEAR wa_sord.
    * Convert FOC Quantity and Materials
    *  LOOP AT gt_sord INTO wa_sord.
    **   lv_cal = i_kwmeng / wa_sord-QTY_FROM.
    *    lv_cal_foc = i_kwmeng DIV wa_sord-qty_from.
    *    lv_cal_dis = i_kwmeng MOD wa_sord-qty_from.
    *  ENDLOOP.
    *lv_new_qty = i_kwmeng - lv_cal_dis.
    * Get the Sales Document Type
       SELECT SINGLE low
    FROM tvarvc
    INTO  lv_dtyp WHERE
    name = 'SD_DOC_TYPE'.
       SELECT SINGLE * FROM knvv INTO wa_knvv WHERE kunnr = i_kunnr.
       IF sy-subrc = 0.
         lv_sorg = wa_knvv-vkorg.
         lv_sdch = wa_knvv-vtweg.
         lv_sdiv = wa_knvv-spart.
       ENDIF.
    * Give the Popup for schemes with multiple FOC
    * Schemes Specific Processing
    * Schemes Specific Processing
       orderheaderin-doc_type = lv_dtyp.
       orderheaderin-sales_org = lv_sorg.
       orderheaderin-distr_chan = lv_sdch.
       orderheaderin-division = lv_sdiv.
       wa_orderpartners-partn_role = 'AG'.
       wa_orderpartners-partn_numb = i_kunnr.
       APPEND wa_orderpartners TO orderpartners.
    *    wa_ORDERPARTNERS-PARTN_ROLE = 'WE'.
    *    wa_ORDERPARTNERS-PARTN_NUMB = p_ship.
    *    append wa_ORDERPARTNERS to ORDERPARTNERS.
    * Item number begin
       CLEAR : lv_posmat.
       lv_posmat = lv_posmat + 10.
       wa_orderitemsin-itm_number = lv_posmat.
       wa_orderitemsin-material = wa_sord-matmn.  "i_matnr.
       wa_orderitemsin-target_qty = lv_new_qty.
    *  wa_ORDERITEMSIN-TARGET_QU = i_VRKME.
       APPEND wa_orderitemsin TO orderitemsin.
       wa_orderitemsinx-itm_number = lv_posmat.
       wa_orderitemsinx-material = 'X'.
       wa_orderitemsinx-target_qty = 'X'.
       wa_orderitemsinx-target_qu = 'X'.
       APPEND wa_orderitemsinx TO orderitemsinx.
       wa_orderschedulesin-itm_number = lv_posmat.
       wa_orderschedulesin-sched_line = lv_posmat.
       wa_orderschedulesin-req_qty = lv_new_qty.
       APPEND wa_orderschedulesin TO orderschedulesin.
       wa_orderschedulesinx-itm_number = lv_posmat.
       wa_orderschedulesinx-sched_line = lv_posmat.
       wa_orderschedulesinx-req_qty  = 'X'.
       wa_orderschedulesinx-updateflag = 'X'.
       APPEND wa_orderschedulesinx TO orderschedulesinx.
       wa_orderconditionsin-itm_number = lv_posmat.
       wa_orderconditionsin-cond_st_no = '001'.
       wa_orderconditionsin-cond_type = 'ZDPD'.   "'ZREG'.
       wa_orderconditionsin-currency = 'INR'.
       wa_orderconditionsin-conpricdat = sy-datum.
       APPEND wa_orderconditionsin TO orderconditionsin.
       wa_orderconditionsinx-itm_number = lv_posmat.
       wa_orderconditionsinx-cond_st_no = '001'.
       wa_orderconditionsinx-cond_type = 'ZDPD'. "'ZREG'.
       wa_orderconditionsinx-updateflag = 'X'.
       wa_orderconditionsinx-cond_value ='X'.
       wa_orderconditionsinx-currency = 'X'.
       APPEND wa_orderconditionsinx TO orderconditionsinx.
    ****18/06Beg
    *  if not lv_cal_dis is initial.
    *    lv_posmat = lv_posmat + 10.
    *    wa_ORDERITEMSIN-ITM_NUMBER = lv_posmat.
    *    wa_ORDERITEMSIN-MATERIAL = WA_SORD-MATMN.  "i_matnr.
    *    wa_ORDERITEMSIN-TARGET_QTY = lv_cal_dis.
    **  wa_ORDERITEMSIN-TARGET_QU = i_VRKME.
    *    append wa_ORDERITEMSIN to ORDERITEMSIN.
    *    wa_ORDERITEMSINX-ITM_NUMBER = lv_posmat.
    *    wa_ORDERITEMSINX-MATERIAL = 'X'.
    *    wa_ORDERITEMSINX-TARGET_QTY = 'X'.
    *    wa_ORDERITEMSINX-TARGET_QU = 'X'.
    *    append wa_ORDERITEMSINX to ORDERITEMSINX.
    *    wa_ORDERSCHEDULESIN-ITM_NUMBER = lv_posmat.
    *    wa_ORDERSCHEDULESIN-SCHED_LINE = lv_posmat.
    *    wa_ORDERSCHEDULESIN-REQ_QTY = lv_cal_dis.
    *    append wa_ORDERSCHEDULESIN to ORDERSCHEDULESIN.
    *    wa_ORDERSCHEDULESINX-itm_number = lv_posmat.
    *    wa_ORDERSCHEDULESINX-sched_line = lv_posmat.
    *    wa_ORDERSCHEDULESINX-req_qty  = 'X'.
    *    wa_ORDERSCHEDULESINX-updateflag = 'X'.
    *    append wa_ORDERSCHEDULESINX to ORDERSCHEDULESINX.
    *  endif.
    *  lv_posmat = lv_posmat + 10.
    *  wa_ORDERITEMSIN-ITM_NUMBER = lv_posmat.
    *  wa_ORDERITEMSIN-MATERIAL = i_matnr.  "WA_SORD-MATMN.
    *  wa_ORDERITEMSIN-TARGET_QTY = LV_CAL_FOC.
    *  wa_ORDERITEMSIN-ITEM_CATEG = 'ZDGN'.
    **  wa_ORDERITEMSIN-TARGET_QU = i_VRKME.
    *  append wa_ORDERITEMSIN to ORDERITEMSIN.
    *  wa_ORDERITEMSINX-ITM_NUMBER = lv_posmat.
    *  wa_ORDERITEMSINX-MATERIAL = 'X'.
    *  wa_ORDERITEMSINX-TARGET_QTY = 'X'.
    *  wa_ORDERITEMSINX-TARGET_QU = 'X'.
    *  wa_ORDERITEMSINX-ITEM_CATEG = 'X'.
    *  append wa_ORDERITEMSINX to ORDERITEMSINX.
    *  wa_ORDERSCHEDULESIN-ITM_NUMBER = lv_posmat.
    *  wa_ORDERSCHEDULESIN-SCHED_LINE = lv_posmat.
    *  wa_ORDERSCHEDULESIN-REQ_QTY = LV_CAL_FOC.
    *  append wa_ORDERSCHEDULESIN to ORDERSCHEDULESIN.
    *  wa_ORDERSCHEDULESINX-itm_number = lv_posmat.
    *  wa_ORDERSCHEDULESINX-sched_line = lv_posmat.
    *  wa_ORDERSCHEDULESINX-req_qty  = 'X'.
    *  wa_ORDERSCHEDULESINX-updateflag = 'X'.
    *  append wa_ORDERSCHEDULESINX to ORDERSCHEDULESINX.
    ****18/06End
    * Item number end
    * Switch off dialog (BAPIs always run without)
       CALL FUNCTION 'DIALOG_SET_NO_DIALOG'.
       CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
         EXPORTING
    *     SALESDOCUMENTIN               =
         order_header_in               = orderheaderin
    *     ORDER_HEADER_INX              =
    *     SENDER                        =
    *     BINARY_RELATIONSHIPTYPE       =
    *     INT_NUMBER_ASSIGNMENT         =
    *     BEHAVE_WHEN_ERROR             =
    *     LOGIC_SWITCH                  =
    *     TESTRUN                       =
    *     CONVERT                       = ' '
    *   IMPORTING
    *     SALESDOCUMENT                 =
       TABLES
         return                        = return
         order_items_in                = orderitemsin
         order_items_inx               = orderitemsinx
         order_partners                = orderpartners
         order_schedules_in            = orderschedulesin
         order_schedules_inx           = orderschedulesinx
         order_conditions_in           = orderconditionsin
         order_conditions_inx          = orderconditionsinx
    *     ORDER_CFGS_REF                =
    *     ORDER_CFGS_INST               =
    *     ORDER_CFGS_PART_OF            =
    *     ORDER_CFGS_VALUE              =
    *     ORDER_CFGS_BLOB               =
    *     ORDER_CFGS_VK                 =
    *     ORDER_CFGS_REFINST            =
    *     ORDER_CCARD                   =
    *     ORDER_TEXT                    =
    *     ORDER_KEYS                    =
    *     EXTENSIONIN                   =
    *     PARTNERADDRESSES              =
    *    commit work.
       CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    *     EXPORTING
    *       WAIT          =
    *     IMPORTING
    *       RETURN        =
       LOOP AT return INTO wa_return.
         WRITE:/ wa_return-message.
       ENDLOOP.
    ENDFUNCTION.
    *& Include ZSD_SO_CHANGES2_TOP                               Module Pool      ZSD_SO_CHANGES2
    PROGRAM  ZSD_SO_CHANGES2.
    ***&SPWIZARD: DATA DECLARATION FOR TABLECONTROL 'ITEM_DATA'
    *&SPWIZARD: DEFINITION OF DDIC-TABLE
    TABLES:   VBAP,kna1.
    *&SPWIZARD: TYPE FOR THE DATA OF TABLECONTROL 'ITEM_DATA'
    TYPES: BEGIN OF T_ITEM_DATA,
              POSNR LIKE VBAP-POSNR,
              MATNR LIKE VBAP-MATNR,
              KWMENG LIKE VBAP-KWMENG,
              VRKME LIKE VBAP-VRKME,
            END OF T_ITEM_DATA.
    *&SPWIZARD: INTERNAL TABLE FOR TABLECONTROL 'ITEM_DATA'
    DATA:     G_ITEM_DATA_ITAB   TYPE T_ITEM_DATA OCCURS 0,
               G_ITEM_DATA_WA     TYPE T_ITEM_DATA. "work area
    DATA:     G_ITEM_DATA_COPIED.           "copy flag
    *&SPWIZARD: DECLARATION OF TABLECONTROL 'ITEM_DATA' ITSELF
    CONTROLS: ITEM_DATA TYPE TABLEVIEW USING SCREEN 4000.
    DATA:GV_NUM TYPE I VALUE 1,
           GV_NUM2 TYPE I.
    DATA:     G_T_YREC_TAB_LINES  LIKE SY-LOOPC.***********top*************
    *& Include ZSD_SO_CHANGES2_TOP                               Module Pool      ZSD_SO_CHANGES2
    PROGRAM  ZSD_SO_CHANGES2.
    ***&SPWIZARD: DATA DECLARATION FOR TABLECONTROL 'ITEM_DATA'
    *&SPWIZARD: DEFINITION OF DDIC-TABLE
    TABLES:   VBAP,kna1.
    *&SPWIZARD: TYPE FOR THE DATA OF TABLECONTROL 'ITEM_DATA'
    TYPES: BEGIN OF T_ITEM_DATA,
              POSNR LIKE VBAP-POSNR,
              MATNR LIKE VBAP-MATNR,
              KWMENG LIKE VBAP-KWMENG,
              VRKME LIKE VBAP-VRKME,
            END OF T_ITEM_DATA.
    *&SPWIZARD: INTERNAL TABLE FOR TABLECONTROL 'ITEM_DATA'
    DATA:     G_ITEM_DATA_ITAB   TYPE T_ITEM_DATA OCCURS 0,
               G_ITEM_DATA_WA     TYPE T_ITEM_DATA. "work area
    DATA:     G_ITEM_DATA_COPIED.           "copy flag
    *&SPWIZARD: DECLARATION OF TABLECONTROL 'ITEM_DATA' ITSELF
    CONTROLS: ITEM_DATA TYPE TABLEVIEW USING SCREEN 4000.
    DATA:GV_NUM TYPE I VALUE 1,
           GV_NUM2 TYPE I.
    DATA:     G_T_YREC_TAB_LINES  LIKE SY-LOOPC.
    ************************pbo*******************
    *&  Include           ZSD_SO_CHANGES2_PBO
    *&SPWIZARD: OUTPUT MODULE FOR TC 'ITEM_DATA'. DO NOT CHANGE THIS LINE!
    *&SPWIZARD: COPY DDIC-TABLE TO ITAB
    MODULE ITEM_DATA_INIT OUTPUT.
       IF G_ITEM_DATA_COPIED IS INITIAL.
    *&SPWIZARD: COPY DDIC-TABLE 'VBAP'
    *&SPWIZARD: INTO INTERNAL TABLE 'g_ITEM_DATA_itab'
    *    SELECT * FROM VBAP
    *       INTO CORRESPONDING FIELDS
    *       OF TABLE G_ITEM_DATA_ITAB.
    *    G_ITEM_DATA_COPIED = 'X'.
         REFRESH CONTROL 'ITEM_DATA' FROM SCREEN '4000'.
       ENDIF.
       ITEM_DATA-LINES = G_T_YREC_TAB_LINES + 15.
    ENDMODULE.
    *&SPWIZARD: OUTPUT MODULE FOR TC 'ITEM_DATA'. DO NOT CHANGE THIS LINE!
    *&SPWIZARD: MOVE ITAB TO DYNPRO
    MODULE ITEM_DATA_MOVE OUTPUT.
       MOVE-CORRESPONDING G_ITEM_DATA_WA TO VBAP.
    ENDMODULE.
    *&      Module  STATUS_4000  OUTPUT
    *       text
    MODULE STATUS_4000 OUTPUT.
       SET PF-STATUS 'APAR'.
    *  REFRESH G_ITEM_DATA_ITAB.
        GV_NUM = 1.
    *  SET TITLEBAR 'xxx'.
    ENDMODULE.                 " STATUS_4000  OUTPUT

  • Expensive Queries along with Program_name its belong

    We need to find expensive queries along with "Program_name" it's belong.
    We can easily find expensive queries using DMVs (sys.dm_exec_query_stats, sys.dm_exec_sql_text)
    but I am not able to link it with "Program_name" they belong, where as I have setup Data Collection and there I can see Program_name(see in green color), please help me to find the same without setup the Data Collection as it add load to
    the server.

    The Program_name field is available in exec_sessions DMV, where it list all active users connections and internal tasks unless you store these details in som e table and join based on the text with dm_exec_query_stats.
    SELECT
    r.session_id,
    command,
    s.text,es.program_name,
    SUBSTRING(s.text, ( r.statement_start_offset / 2 ) + 1, ( ( CASE WHEN r.statement_end_offset <= 0 THEN DATALENGTH(s.text)
    ELSE r.statement_end_offset END - r.statement_start_offset ) / 2 ) + 1) AS statement_text FROM sys.dm_exec_requests r inner join sys.dm_exec_sessions es on es.session_id = r.session_id CROSS APPLY sys.dm_exec_sql_text(r.sql_handle) s
    Store the data periodically in some table 
    SELECT TOP 10
    total_worker_time/execution_count AS Avg_CPU_Time
    ,execution_count
    ,total_elapsed_time/execution_count as AVG_Run_Time
    ,(SELECT
    SUBSTRING(text,statement_start_offset/2,(CASE
    WHEN statement_end_offset = -1 THEN LEN(CONVERT(nvarchar(max), text)) * 2
    ELSE statement_end_offset
    END -statement_start_offset)/2
    ) FROM sys.dm_exec_sql_text(sql_handle)
    ) AS statement_text
    FROM sys.dm_exec_query_stats
    You can try this. There is no straight forward approach to get such details unless you are capturing in depth details at frequent intervals of time.
    --Prashanth

  • Populating our log message along with standard sap log in ck11n.

    Hi all,
    I have developed a user exit which is used in costing of material using ck11n.
    Here i have to show our custom log message along with the standard log shown by standard sap system after costing run is complete.
    I got one FM-- CM_F_MESSAGE  which is used by SAP. But i want the message along with SAP messages and not separately.
    Can u help me out for this. its very urgent.
    Thanks in advance.

    Hi
    I'm not sure because I don't know that trx, but I seem the function group of that function manages a log, so you can try.
    This is an extract of abap code of SAPLCKDI where that fm is used:
    CALL FUNCTION 'CM_F_MESSAGE'
       EXPORTING
         ARBGB = Y_CMF-CK
         MSGNR = '327'
         MSGTY = Y_CMF-W
         MSGV1 = SICHT
         MSGV2 = KLVAR.
    So I suppose you should call it by this way:
    CALL FUNCTION 'CM_F_MESSAGE'
       EXPORTING
         ARBGB = <your message class>
         MSGNR = <message number>
         MSGTY = <message type>
         MSGV1 = <text 1>
         MSGV2 = <text 2>
         MSGV3 = <text 3>
    I think MSGV* is optional parameter.
    Max

  • Report on Open Items along with Qty & Value for LA confirmed items

    Hi,
    I would like to know a report of Open POs(No Goods receipt made) but LA confirmed Items along with Values(Amount)
    i.e
    List of confirmed,unsent items along with Values for plant wise or vendor wise or PO Number wise.
    Regards,
    Vengat

    Hi,
    Any other inputs?
    Our client's requirement is to know how many (Both Qty & Value) of items for the input LA confirmed(ASN received) but no GR Made
    Regards,
    Vengat

  • Moving LR5 catalog (Irdata & Ircat) to a new hard drive and photos. Lost all meta data - How do I move meta data along with catalog?

    I moved LR5 catalog (Irdata & Ircat) to a new hard drive and photos. Lost all meta data - How do I move meta data along with catalog?
    The meta data for each image is missing.
    I have over 2,000 images. I don't want to go back through each image and add meta data.
    Is there some way to move everything?

    No, do not re-import your images. I assume you can see the thumbnails in the library module, just cannot access the full images, right? If this is the case there should be an exclamation mark in the top right corner of every one of your pictures and you only have to tell LR where the images are now.
    Click the exclamation mark of one of the images and a dialog window should pop-up, telling you that LR cannot find the file, but with an option to locate it. Press "Locate" and navigate to the folder on your new HD where the file is. If in the new external HD you kept the same folder structure that you had on the internal disk, LR will be able to find all your images and re-link them to the database without further intervention.

  • Unable to install SQL Server 2012 along with BIDS & VS 2012 on Windows 7

    Unable to install SQL Server 2012 along with BIDS & VS 2012 on Windows 7 professional.
    I get the below error
    Could not find vsjitdebugger.exe
    Blogs say anti-virus is stopping but I dont have one on the system.
    Note: I had used SQL 2008 on the system previously and has a refresh i have deleted all the software to speed up the system.
    Now i could not install both the software.
    Can I get some help regarding this?

    Hi Nandu,
    As your description, you come across an error(vsjitdebugger.exe cannot be found). Please confirm if the error occurs during the installation of SQL Server 2012.  If so, please help post SQL Server setup logs. By default, SQL Server setup log file locates
    in C:\Program Files\Microsoft SQL Server\110\Setup Bootstrap\Log.
    Base on my research, this error could be caused by that the previous uninstallation is improper and vsjitdebugger.exe file could be mistakenly deleted.
    To troubleshoot the issue, you could start your computer into Safe Mode and fix your problem with one of the following methods. For more information, please refer to the article:
    http://www.fixerrorkit.com/fix-error/fix-vsjitdebugger.exe-error.html.
    1. You could execute the sfc /scannow command following steps below.
    a. Press "Windows+R", type in cmd and then right click "Run as administrator"
    b. Type in sfc /scannow (There's a space between sfc and /scannow) into the dialog and hit Enter key and click ok.
    c. Wait until the System File Checker finishes the check.
    2. You could use a Windows repair installation, also known as a Startup Repair to repair your Windows system files.
    3. You could install the latest Windows updates to fix vsjitdebugger.exe error. Microsoft often releases new service packs and system patches to replace or update some DLL files of Windows system.
    4. You could use third-party tool such as Automatic Error Fix Tool to fix your vsjitdebugger.exe error. However, Microsoft cannot make any representations regarding the quality, safety, or suitability of any third-party software or information found there.
    In addition, if you are unable to install  Visual Studio, I suggest you post your question in Visual Studio Setup and Installation forum at
    https://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=vssetup  . It is appropriate and more experts will assist you.
    Regards,
    Michelle Li

  • Confused if i need the enterprise DPS along with enterprise license from Apple

    Do I need to buy the Enterprise DPS if I already have a Enterprise developers license with Apple? I want to develope in-house apps with indesign but everywhere i read no body gives a straight answer.
    I have "creative cloud membership" which includes a single edition DPS already so I have single edition DPS now. I want to build an app using indesign and dps but host it on my own server. Can I do this with my single edition along with my enterprise developer licnese from Apple? Or do I have to buy the enterprise DPS to go along with my enterprise developers license from Apple?
    thank you for your time
    Darian

    You will need an Enterprise DPS account along with the Enterprise Apple account. There is nothing ambiguous about this.
    And you really need to read Apple’s license very carefully about private distribution. They are very strict about anything not going through the app strore.

  • Using NonCatalogLogger along with the LogMBean

    Hi anybody
    According to the API, the NonCatalogLogger class provides application services
    for logging error messages to the weblogic server log. The name, location and
    other properties of the logfile are determined by the LogMBean for the server.
    Now, I have the instance of the LogMBean running in the server and using this
    instance I am able to configure our weblogic server's logging configuration from
    any client machine. But I am not able to log any message from a client machine
    into the server's log file. That is I am not able to use the LogMBean object along
    with the NonCatalogLogging object.
    Do you have a suggestion?
    Regards
    Zakaria Chowdhury

    http://edocs.bea.com/wls/docs60/javadocs/weblogic/management/configuration/L
    ogMBean.html
    "Rajan Annadurai" <[email protected]> wrote in message
    news:3ced8eb9$[email protected]..
    >
    hi Sanjeev,
    "in addition to FileName you can specify any LogMBean prop for a client inthe same
    manner"
    Can you please list down the LogMbean property to set rotation size. I amnot able
    to find it any where in the documentation.
    thank you,
    Rajan
    "Sanjeev Chopra" <[email protected]> wrote:
    Clients cannot log to the servers logfile. If you use NonCatalogLogger on
    the client, it creates its own file. By default however, the file is
    turned
    off. You need to turn it on by specifying the FileName prop of theLogMBean
    for that client.
    Since client config is not done thru MBeans, the way you define this is
    with
    system props i.e. -Dweblogic.log.FileName=....
    (in addition to FileName you can specify any LogMBean prop for a client
    in
    the same manner)
    "Zakaria Chowdhury" <[email protected]> wrote in message
    news:[email protected]..
    Hi anybody
    According to the API, the NonCatalogLogger class provides applicationservices
    for logging error messages to the weblogic server log. The name,
    location
    and
    other properties of the logfile are determined by the LogMBean for theserver.
    Now, I have the instance of the LogMBean running in the server and
    using
    this
    instance I am able to configure our weblogic server's loggingconfiguration from
    any client machine. But I am not able to log any message from a clientmachine
    into the server's log file. That is I am not able to use the LogMBeanobject along
    with the NonCatalogLogging object.
    Do you have a suggestion?
    Regards
    Zakaria Chowdhury

  • Transferred itunes library from Windows XP PC to new Windows 7 PC. plugged in 3rd gen Ipod. Ipod icon appears along with playlists, music etc. Songs are grayed out and won't play. Please help!

    I recently transferred itunes library from windows XP PC to new Windows 7 PC. The transfer was successful, however when I plug my 3rd gen Ipod Nano into the new PC, the Ipod icon appears along with the music, playlists, etc. The songs are shown but are 'grayed out' and wont play or sync.The 'Devices & Printers' window in new PC shows icon for Ipod driver & is OK. The icon for the Ipod appears but depicts a delta shaped warning icon that states that the Ipod is'not operating properly'. Tried troubleshooting. The troubleshooting message states the the Ipod is 'disconnecting'. Can you help me with this problem?        

    Then, I dropped the entire itunes file from the old PC (XP) into an empty external drive.
    That "itunes file from the old PC"?  Is that the iTunes folder, from the old PC, that was in the user home folder's Music folder?
    All of the library, playlists, etc. from the ipod as they always have been are shown, by they are 'grayed out' and will not open or play.
    That's on the iPod, correct?  Are all of your old playlists in iTunes, from the old PC, still there in iTunes on the new PC?  Are the songs in iTunes still playable?
    This document provides the steps to transfer a complete iTunes library between two computers.  See the section called External drive.
    iTunes: How to move your music to a new computer - Apple Support
    There are many steps, but this is a summary.  (1) On the old PC, consolidate all of your iTunes data into the iTunes folder.  (2) Copy this iTunes folder to the external drive.  (3) On the new PC (that has iTunes installed but NOT running), replace its existing iTunes folder with the one from the old PC (on the external drive).  When you run iTunes, it uses the iTunes folder from the old PC, and it should look like iTunes on the old PC (with all the playlists, ratings, play count, etc.), and your iPod will see the iTunes library as the same iTunes library (because it is the same library).
    If you did something different, and the old PC is still accessible, you may want to try it using the method from the linked document.

  • Upgrade issues OBIEE 10g to 11g along with OBIA upgrade

    Hi,
    I have to upgrade OBIEE 10.1.3.4.1 to OBIEE 11.1.1.5 along with OBIA 7.9.6.1 to 7.9.6.5(Informatica 8.6.1 to 9.0.1) at my client location and I have very little knowledge on it. and want to know/have help documents for upgrade.
    And if anyone in the forums involved in upgrade please list the errors/issues occured during upgrade and after upgrade.
    1. OBIEE 10g to 11g upgrade issues??
    2. OBIA OBIA 7.9.6.1 to 7.9.6.5 upgrade issues along with 10g to 11g??
    3. Informatica 8.6.1 to 9.0.1 upgrade issues??
    4. DAC upgrade issues??
    any response for my questions is appreciated.
    Thanks
    Jay.
    Edited by: Jay on Apr 11, 2012 9:11 AM

    HI Jay,
    We cannot explained thread list here, If you get any errors plz post me,will try to help out.
    This is oracle document link - This document has given step by step with screen shots upgration for 10g to 11g ,Please refer the below link.
    http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/bi/bi11115/upgrade/upgrade_to_11g.htm
    http://obieemanu.blogspot.in/2011/05/rpd-upgration-from-10g-to-11g.html
    http://docs.oracle.com/cd/E21764_01/upgrade.1111/e10125/ua_command_line.htm#ASMAS149
    Award points it is useful.
    Thanks,
    satya

Maybe you are looking for

  • Newbie:  In printing dialog, "Scale to" size options are greyed out

    I am in the initial stages of figuring out how to use Aperture (v1.5). I am currently trying to make a 5x7 print of a photo. In the print dialog, "Scale to" 4x6, 5x7, 8x10 size options are greyed out (only "fit image" and "fill entire page" are avail

  • Customer Consignment stock displayed as available in MD04

    Hi Experts, Customer Consignment stock displayed as available in MD04 I have few stock at customer consignemnt which displayed as available qty in MD04. Whether any parameter that controls this? some thing to do with availability check? Pls suggest T

  • How can i unlock my phone i just bought

    i just bought an used phone off ebay at&t im trying to unlock my imei how can i go about this

  • Move AP from WLC 4400 to 2500

    I have wlc 4400 running on 6.0.196.0, get new wlc 2500 with 7.0.220.0, on 4400, 12 AP only one will register onto 2500. Both 4400 and 2500 on the same subnet. how to let AP register on 2500 rather than 4400 AP model: on 4400 now:  AIR-AP1242AG-A-K9,

  • Classics book only in IBooks

    I understand that I need to have IBooks US or UK, or any other country who is actually selling books in Ibooks.   But how to do so ??  Anything that I need to change in the setting or my apple id ???  I am currently live in Indonesia. Please help. Th