WinRM query result locale

I am testing the following scenario:
WinRM client is running on a Windows Server 2008 with German locale
Hyper-V (and WinRM service respectively) is running on Windows Server 2012 R2 with English as default locale and German locale installed in addition
Msvm_ComputerSystem instances are enumerated (sample command used: winrm e wmi/root/virtualization/v2/Msvm_ComputerSystem -r:10.10.10.10 -u:administrator -un -encoding:utf-8) 
Observed: the returned result contains values that are with English locale - Msvm_ComputerSystem.Caption is equal to "Virtual Machine" (although I can see that the wsman:Locale element is present in the WSMAN request with its xml:lang property
set to "de-DE")
Expected: the returned result should contain values that are with German locale - Msvm_ComputerSystem.Caption should be equal to "Virtueller Computer".
Note1: the behavior is inconsistent - I've been able to get result with either German or English locale values.
Note2: when I am getting a result containing values with English locale, I also see that the WSMAN response has the soap:Envelope element with its xml:lang property set to "de-DE".
Below I am providing the SOAP transactions for the following cases: 1) a WSMAN client sends a request with en-US locale; 2) a WSMAN client sends a request with de-DE locale.
============= en-US REQUEST / RESPONSE START =============
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing">
<s:Header>
<a:To s:mustUnderstand="true">http://10.23.64.3:5985/wsman</a:To>
<a:ReplyTo>
<a:Address s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address>
</a:ReplyTo>
<a:Action s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/09/enumeration/Pull</a:Action>
<a:MessageID>uuid:ED809788-36F8-4C61-8D24-4DF575936D36</a:MessageID>
<w:ResourceURI s:mustUnderstand="true" xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">http://schemas.microsoft.com/wbem/wsman/1/wmi/root/virtualization/v2/Msvm_ComputerSystem</w:ResourceURI>
<w:Locale s:mustUnderstand="false" xml:lang="en-US" xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"/>
</s:Header>
<s:Body>
<ns1053:Pull xmlns:ns1053="http://schemas.xmlsoap.org/ws/2004/09/enumeration">
<ns1053:EnumerationContext>uuid:E94B15F6-0D5D-45FC-961C-B8EF3122E416</ns1053:EnumerationContext>
</ns1053:Pull>
</s:Body>
</s:Envelope>
<s:Envelope xml:lang="en-US" xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:n="http://schemas.xmlsoap.org/ws/2004/09/enumeration" xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">
<s:Header>
<a:Action>http://schemas.xmlsoap.org/ws/2004/09/enumeration/PullResponse</a:Action>
<a:MessageID>uuid:710228F4-FC41-4EEE-B0D7-29440A72C10C</a:MessageID>
<a:To>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:To>
<a:RelatesTo>uuid:ED809788-36F8-4C61-8D24-4DF575936D36</a:RelatesTo>
</s:Header>
<s:Body>
<n:PullResponse>
<n:Items>
<p:Msvm_ComputerSystem xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://schemas.microsoft.com/wbem/wsman/1/wmi/root/virtualization/v2/Msvm_ComputerSystem" xmlns:cim="http://schemas.dmtf.org/wbem/wscim/1/common"
xsi:type="p:Msvm_ComputerSystem_Type">
<p:Caption>Virtueller Computer</p:Caption>
<p:CommunicationStatus xsi:nil="true"/>
<p:CreationClassName>Msvm_ComputerSystem</p:CreationClassName>
<p:Description>Microsoft Virtual Machine</p:Description>
<p:DetailedStatus xsi:nil="true"/>
<p:ElementName>Test VM - 2dd746be-e601-4475-bbd9-49abea182f56</p:ElementName>
<p:EnabledDefault>3</p:EnabledDefault>
<p:EnabledState>3</p:EnabledState>
<p:EnhancedSessionModeState>3</p:EnhancedSessionModeState>
<p:FailedOverReplicationType>0</p:FailedOverReplicationType>
<p:HealthState>5</p:HealthState>
<p:InstallDate>
<cim:Datetime>1601-01-01T00:00:00Z</cim:Datetime>
</p:InstallDate>
<p:InstanceID xsi:nil="true"/>
<p:LastApplicationConsistentReplicationTime>
<cim:Datetime>1601-01-01T00:00:00Z</cim:Datetime>
</p:LastApplicationConsistentReplicationTime>
<p:LastReplicationTime>
<cim:Datetime>1601-01-01T00:00:00Z</cim:Datetime>
</p:LastReplicationTime>
<p:LastReplicationType>0</p:LastReplicationType>
<p:LastSuccessfulBackupTime xsi:nil="true"/>
<p:Name>6D36FE80-3A10-4D78-A5D3-1B839C32937D</p:Name>
<p:NameFormat xsi:nil="true"/>
<p:NumberOfNumaNodes>1</p:NumberOfNumaNodes>
<p:OnTimeInMilliseconds>0</p:OnTimeInMilliseconds>
<p:OperatingStatus xsi:nil="true"/>
<p:OperationalStatus>2</p:OperationalStatus>
<p:OtherEnabledState xsi:nil="true"/>
<p:PrimaryOwnerContact xsi:nil="true"/>
<p:PrimaryOwnerName xsi:nil="true"/>
<p:PrimaryStatus xsi:nil="true"/>
<p:ProcessID xsi:nil="true"/>
<p:ReplicationHealth>0</p:ReplicationHealth>
<p:ReplicationMode>0</p:ReplicationMode>
<p:ReplicationState>0</p:ReplicationState>
<p:RequestedState>12</p:RequestedState>
<p:ResetCapability>1</p:ResetCapability>
<p:Status>OK</p:Status>
<p:StatusDescriptions>Normaler Betrieb</p:StatusDescriptions>
<p:TimeOfLastConfigurationChange>
<cim:Datetime>2014-09-01T12:25:55.500398Z</cim:Datetime>
</p:TimeOfLastConfigurationChange>
<p:TimeOfLastStateChange>
<cim:Datetime>2014-09-02T07:09:55.684323Z</cim:Datetime>
</p:TimeOfLastStateChange>
<p:TransitioningToState xsi:nil="true"/>
</p:Msvm_ComputerSystem>
</n:Items>
<n:EndOfSequence/>
</n:PullResponse>
</s:Body>
</s:Envelope>
============= en-US REQUEST / RESPONSE END =============
============= de-DE REQUEST / RESPONSE START =============
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing">
<s:Header>
<a:To s:mustUnderstand="true">http://10.23.64.3:5985/wsman</a:To>
<a:ReplyTo>
<a:Address s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address>
</a:ReplyTo>
<a:Action s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/09/enumeration/Pull</a:Action>
<a:MessageID>uuid:3AC125D2-882E-493F-B596-8EB54D8FD83D</a:MessageID>
<w:ResourceURI s:mustUnderstand="true" xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">http://schemas.microsoft.com/wbem/wsman/1/wmi/root/virtualization/v2/Msvm_ComputerSystem</w:ResourceURI>
<w:Locale s:mustUnderstand="false" xml:lang="de-DE" xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"/>
</s:Header>
<s:Body>
<ns1053:Pull xmlns:ns1053="http://schemas.xmlsoap.org/ws/2004/09/enumeration">
<ns1053:EnumerationContext>uuid:18475052-6B59-4A59-916E-9A19D6237A69</ns1053:EnumerationContext>
</ns1053:Pull>
</s:Body>
</s:Envelope>
<s:Envelope xml:lang="de-DE" xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:n="http://schemas.xmlsoap.org/ws/2004/09/enumeration" xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">
<s:Header>
<a:Action>http://schemas.xmlsoap.org/ws/2004/09/enumeration/PullResponse</a:Action>
<a:MessageID>uuid:010E31FF-00B1-48DF-AFEA-F9271DF748B5</a:MessageID>
<a:To>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:To>
<a:RelatesTo>uuid:3AC125D2-882E-493F-B596-8EB54D8FD83D</a:RelatesTo>
</s:Header>
<s:Body>
<n:PullResponse>
<n:Items>
<p:Msvm_ComputerSystem xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://schemas.microsoft.com/wbem/wsman/1/wmi/root/virtualization/v2/Msvm_ComputerSystem" xmlns:cim="http://schemas.dmtf.org/wbem/wscim/1/common"
xsi:type="p:Msvm_ComputerSystem_Type">
<p:Caption>Virtueller Computer</p:Caption>
<p:CommunicationStatus xsi:nil="true"/>
<p:CreationClassName>Msvm_ComputerSystem</p:CreationClassName>
<p:Description>Microsoft Virtual Machine</p:Description>
<p:DetailedStatus xsi:nil="true"/>
<p:ElementName>Test VM - 2dd746be-e601-4475-bbd9-49abea182f56</p:ElementName>
<p:EnabledDefault>3</p:EnabledDefault>
<p:EnabledState>3</p:EnabledState>
<p:EnhancedSessionModeState>3</p:EnhancedSessionModeState>
<p:FailedOverReplicationType>0</p:FailedOverReplicationType>
<p:HealthState>5</p:HealthState>
<p:InstallDate>
<cim:Datetime>1601-01-01T00:00:00Z</cim:Datetime>
</p:InstallDate>
<p:InstanceID xsi:nil="true"/>
<p:LastApplicationConsistentReplicationTime>
<cim:Datetime>1601-01-01T00:00:00Z</cim:Datetime>
</p:LastApplicationConsistentReplicationTime>
<p:LastReplicationTime>
<cim:Datetime>1601-01-01T00:00:00Z</cim:Datetime>
</p:LastReplicationTime>
<p:LastReplicationType>0</p:LastReplicationType>
<p:LastSuccessfulBackupTime xsi:nil="true"/>
<p:Name>6D36FE80-3A10-4D78-A5D3-1B839C32937D</p:Name>
<p:NameFormat xsi:nil="true"/>
<p:NumberOfNumaNodes>1</p:NumberOfNumaNodes>
<p:OnTimeInMilliseconds>0</p:OnTimeInMilliseconds>
<p:OperatingStatus xsi:nil="true"/>
<p:OperationalStatus>2</p:OperationalStatus>
<p:OtherEnabledState xsi:nil="true"/>
<p:PrimaryOwnerContact xsi:nil="true"/>
<p:PrimaryOwnerName xsi:nil="true"/>
<p:PrimaryStatus xsi:nil="true"/>
<p:ProcessID xsi:nil="true"/>
<p:ReplicationHealth>0</p:ReplicationHealth>
<p:ReplicationMode>0</p:ReplicationMode>
<p:ReplicationState>0</p:ReplicationState>
<p:RequestedState>12</p:RequestedState>
<p:ResetCapability>1</p:ResetCapability>
<p:Status>OK</p:Status>
<p:StatusDescriptions>Normaler Betrieb</p:StatusDescriptions>
<p:TimeOfLastConfigurationChange>
<cim:Datetime>2014-09-01T12:25:55.500398Z</cim:Datetime>
</p:TimeOfLastConfigurationChange>
<p:TimeOfLastStateChange>
<cim:Datetime>2014-09-02T07:09:55.684323Z</cim:Datetime>
</p:TimeOfLastStateChange>
<p:TransitioningToState xsi:nil="true"/>
</p:Msvm_ComputerSystem>
</n:Items>
<n:EndOfSequence/>
</n:PullResponse>
</s:Body>
</s:Envelope>
============= de-DE REQUEST / RESPONSE END =============
Stoimen

Thanks for the reply.
I think I should clarify the notes in my initial post:
Note1: I've been able to get different behaviors while testing the same scenario - I execute the winrm command and I get "Virtual Machine" value for Msvm_ComputerSystem.Caption. Then I do something else (for example restart the Hyper-V server,
or rearrange the installed locales list, but the return them to the same order when tested the first time, then restart the Hyper-V server), execute the winrm command, but this time I get "Virtueller Computer" value for Msvm_ComputerSystem.Caption.
Note2: check soap:Envelope.language and msvm:Msvm_ComputerSystem.Caption
in the *en-US RESPONSE* - note that although the former has the value 'en-US', the latter has the
value 'Virtueller Computer' which is an inconsistency and we already know that the Caption values are localized for both de-DE and en-US, so we should not have this inconsistency.
Stoimen

Similar Messages

  • How to get Query Results based on Analysis Authorization Ranges????

    Hi Experts,
    I have gone through the lot of SDN Links, however not able to find the answer to my question.
    I have an Authorization Issue, “NO Authorization “
    Error : EYE 007 ( Insufficient Authorizations )
    <b>Here is the issue:</b>
    Need to see the complete query result when I gave the range in Analysis Authorization for Controlling Area 001-005. Controlling Area is auth relevant and right now a variable is inserted in the query for it. If I select Controlling Area 001, the result for Controlling Area 001 is displayed in query. If 002 then also displayed. If I do not enter anything, then I get the <b>Eye 007 error message</b>.
    I am not sure how do I display/authorize the entire result in the query for all the Controlling Areas, I have authorized user to see??
    <b>Its really urgent, please help..!</b>
    Here are the logs:
    Authorization Check Log
    Date and Execution Time (Local Server)
    Execution Date: 06.09.2007
    Execution Time: 14:48:41
    Executed Query: 0CCA_C11/GBCCA_MP01_Q0002_AP
    Executed by User ZBI_TEST_001
    Executed with Analysis Authorizations of Another User ZBI_TEST_001
      InfoProvider Check  
    Building the Buffer...
    ...Buffer Built
    Are there authorizations for accessing InfoProvider 0CCA_C11 with activity 03?
    Authorization exists for general access to InfoProvider 0CCA_C11 with activity 03 
      InfoProvider Check  
    Authorization exists for general access to InfoProvider 0CCA_C11 with activity 03 
      Relevant Characteristics for Detailed Authorization Check  
    (Characteristics with Full Authorization Are Not Listed!)
      List of Effective Authorization-Relevant Characteristics for InfoProvider 0CCA_C11:  
    0CO_AREA 
    0TCAACTVT 
      Relevant Characteristics for Detailed Authorization Check  
    (Characteristics with Full Authorization Are Not Listed!)
      List of Effective Authorization-Relevant Characteristics for InfoProvider :  
    List Is Empty:
      There Are No Characteristics That Have to Be Checked in Detail  
      Authorization Check  
      Detail Check for InfoProvider 0CCA_C11  
      Preprocessing:  
    Selection Checked for Consistency, Preprocessed and Supplemented As Needed
    Subselection (Technical SUBNR) 1
    Check Node Definitions and Value Authorizations...
    Node- and Value Authorizations Are OK
    End of Preprocessing
    Filling the Buffer...
    ...Buffer Filled
      Main Check:  
      Subselection (Technical SUBNR) 1  
    Supplementation of Selection for Aggregated Characteristics
      No Check for Aggregation Authorization Required  
    Following Set Is Checked  Comparison with Following Authorized Set  Result  Remaining Set 
    Characteristic  Contents 
    0CO_AREA
    0TCAACTVT
    SQL Format:
    CO_AREA = '0003'
    AND TCAACTVT = '03'
    Characteristic  Contents 
    0CO_AREA  I BT 0001 0005
    0TCAACTVT  I EQ 03
    I EQ 16
    Authorized   
      Subselection (SUBNR) Is Authorized  
      Authorization Check Complete  
      Authorization Check  
      Detail Check for InfoProvider 0CCA_C11  
      Preprocessing:  
    Selection Checked for Consistency, Preprocessed and Supplemented As Needed
    Subselection (Technical SUBNR) 1
    Check Node Definitions and Value Authorizations...
    Node- and Value Authorizations Are OK
    End of Preprocessing
    Filling the Buffer...
    ...Buffer Filled
      Main Check:  
      Subselection (Technical SUBNR) 1  
    Supplementation of Selection for Aggregated Characteristics
      No Check for Aggregation Authorization Required  
    Following Set Is Checked  Comparison with Following Authorized Set  Result  Remaining Set 
    Characteristic  Contents 
    0CO_AREA
    0TCAACTVT
    SQL Format:
    TCAACTVT = '03'
    Characteristic  Contents 
    0CO_AREA  I BT 0001 0005
    0TCAACTVT  I EQ 03
    I EQ 16
    Partially or Fully Authorized (Intersection)   Characteristic  Contents 
    0CO_AREA
    0TCAACTVT
    SQL Format:
    ( CO_AREA < '0001'
    OR CO_AREA > '0005' )
    AND TCAACTVT = '03'
    Value selection partially authorized. Check of remainder at end
    Following Set Is Checked  Comparison with Following Authorized Set  Result  Remaining Set 
    Characteristic  Contents 
    0CO_AREA
    0TCAACTVT
    SQL Format:
    ( CO_AREA < '0001'
    OR CO_AREA > '0005' )
    AND TCAACTVT = '03'
    Characteristic  Contents 
    0CO_AREA  I BT 0001 0005
    0TCAACTVT  I EQ 03
    I EQ 16
    Not Authorized   
    All Authorizations Tested
      Message EYE007: You do not have sufficient authorization  
      No Sufficient Authorization for This Subselection (SUBNR)  
    Following CHANMIDs Are Affected:
    184 ( 0CO_AREA )
      Authorization Check Complete  

    Hi,
        Have you defined the vaule for 0CO_AREA as BT 001-005 in you Authorization for 0CO_AREA.Also how have you defined your Authorization Variable on the query? Have you define as select options or interval? I thing you need to define it as interval or select options.
    Hope it helps,
    Cheers,
    Balaji

  • Stepping through a query result set, replacing one string with another.

    I want to write a function that replaces the occurance of a string with another different string.  I need it to be a CF fuction that is callable from another CF function.  I want to "hand" this function an SQL statement (a string) like this:   (Please note, don't bother commenting that "there are eaiser ways to write this SQL..., I've made this simple example to get to the point where I need help.  I have to use a "sub_optimal" SQL syntax just to demonstrate the situation)
    Here is the string I want to pass to the function:
    SELECT
      [VERYLONGTABLENAME].FIRST_NAME,
      [VERYLONGTABLENAME].LAST_NAME,
      [VERYLONGTABLENAME].ADDRESSS
    FROM
      LONGTABLENAME [VERYLONGTABLENAME]
    Here is the contents of the ABRV table:
    TBL_NM,  ABRV    <!--- Header row--->
    VERYLONGTABLENAME, VLTN
    SOMEWHATLONGTALBENAME, SLTN
    MYTABLENAME, MTN
    ATABLENAME, ATN
    The function will return the original string, but with the abreviations in place of the long table names, example:
    SELECT
      VLTN.FIRST_NAME,
      VLTN.LAST_NAME,
      VLTN.ADDRESSS
    FROM
      LONGTABLENAME VLTN
    Notice that only the table names surrounded by brackets and that match a value in the ABRV table have been replaced.  The LONGTABLENAME immediately following the FROM is left as is.
    Now, here is my dum amatuer attempt at writing said function:  Please look at the comment lines for where I need help.
          <cffunction name="AbrvTblNms" output="false" access="remote" returntype="string" >
            <cfargument name="txt" type="string" required="true" />
            <cfset var qAbrvs="">  <!--- variable to hold the query results --->
            <cfset var output_str="#txt#">  <!--- I'm creating a local variable so I can manipulate the data handed in by the TXT parameter.  Is this necessary or can I just use the txt parameter? --->
            <cfquery name="qAbrvs" datasource="cfBAA_odbc" result="rsltAbrvs">
                SELECT TBL_NM, ABRV FROM BAA_TBL_ABRV ORDER BY 1
            </cfquery>
         <!--- I'm assuming that at this point the query has run and there are records in the result set --->
        <cfloop index="idx_str" list="#qAbrvs#">      <!--- Is this correct?  I think not. --->
        <cfset output_str = Replace(output_str, "#idx_str#", )  <!--- Is this correct?  I think not. --->
        </cfloop>               <!--- What am I looping on?  What is the index? How do I do the string replacement? --->
            <!--- The chunck below is a parital listing from my Delphi Object Pascal function that does the same thing
                   I need to know how to write this part in CF9
          while not Eof do
            begin
              s := StringReplace(s, '[' +FieldByName('TBL_NM').AsString + ']', FieldByName('ABRV').AsString, [rfReplaceAll]);
              Next;
            end;
            --->
        <cfreturn output_txt>
        </cffunction>
    I'm mainly struggling with syntax here.  I know what I want to happen, I know how to make it happen in another programming language, just not CF9.  Thanks for any help you can provide.

    RedOctober57 wrote:...
    Thanks for any help you can provide.
    One:
    <cfset var output_str="#txt#">  <!--- I'm creating a local
    variable so I can manipulate the data handed in by the TXT parameter.
    Is this necessary or can I just use the txt parameter? --->
    No you do not need to create a local variable that is a copy of the arguments variable as the arguments scope is already local to the function, but you do not properly reference the arguments scope, so you leave yourself open to using a 'txt' variable in another scope.  Thus the better practice would be to reference "arguments.txt" where you need to.
    Two:
    I know what I want to happen, I know how to make it happen in another programming language, just not CF9.
    Then a better start would be to descirbe what you want to happen and give a simple example in the other programming language.  Most of us are muti-lingual and can parse out clear and clean code in just about any syntax.
    Three:
    <cfloop index="idx_str" list="#qAbrvs#">      <!--- Is this correct?  I think not. --->
    I think you want to be looping over your "qAbrvs" record set returned by your earlier query, maybe.
    <cfloop query="qAbrvs">
    Four:
    <cfset output_str = Replace(output_str, "#idx_str#", )  <!--- Is this correct?  I think not. --->
    Continuing on that assumption I would guess you want to replace each instance of the long string with the short string form that record set.
    <cfset output_str = Replace(output_str,qAbrs.TBLNM,qAbrs.ABRV,"ALL")>
    Five:
    </cfloop>               <!--- What am I looping on?  What is the index? How do I do the string replacement? --->
    If this is true, then you are looping over the record set of tablenames and abreviations that you want to replace in the string.

  • Getting range of query result in 2004s

    Hi,
    I'm trying to determine range of a result area in a 2004s query using the following code :
    Dim myrange As Range
    Set myrange = Run("BEXAnalyzer.xla!SAPBEXgetResultRangeByID", "ZSKMILESTONESTEST")
    I have also tried this using the technical ID of the query as in RZSCOMPDIR.
    This causes a VB error and stops inside the SAPBEXgetResultRangeByID function and says "Object Variable or with block not set" on this line :
    Set SAPBEXgetResultRangeByID = pAddin.SAPBEXgetResultRangeByID(ActiveWorkbook.Name, queryID, charName)
    Can anyone help ?
    Cheers
    Sue

    Hi Sue,
    I know nothing about 2004s.  But, I know something about SAPBEXgetResultRangeByID.
    The function's definition (from Object Browser) is:
    Function SAPBEXgetResultRangeByID(ByVal queryID As String, Optional ByVal charName As String) As Range
    Here are two examples that work for me ...
    'This example locates query result Area using local query ID
    Sub testResultRangeByID1()
    Dim resultArea As Range, queryID As String
        queryID = "SAPBEXq0001"
        Set resultArea = Run("SAPBEX.xla!SAPBEXgetResultRangeByID", queryID)
        Application.Goto reference:=resultArea
    End Sub
    'This example locates a characteristic's filter cell
    'using local query ID and technical name of characteristic
    Sub testResultRangeByID2()
    Dim resultArea As Range, queryID As String
        queryID = "SAPBEXq0001"
        Set resultArea = Run("SAPBEX.xla!SAPBEXgetResultRangeByID", queryID, "0SHIP_TO")
        Application.Goto reference:=resultArea
    End Sub
    Hope this helps.
    - Pete

  • Query result closing prematurely, Object closed error

    Hi guys
    I've discovered an unusual behaviour when iterating through a collection
    returned from a query.
    Scenario
    The code executes a query, iterates partially through the resultset and for
    each row calls a method which creates another object. Given that there
    could be thousands of rows, I commit the new objects every n times and then
    go back to the start of the loop which re-executes the query. This code runs
    fine when
    MAX_SCHEDULES_PER_TRANS <= com.solarmetric.kodo.DefaultFetchBatchSize.
    Problem
    If the DefaultFetchBatchSize is 10, and I commit every 11 iterations, then
    during the 3rd outer loop (ie commit has succeeded twice and the query has
    been executed 3 times) an exception is thrown when calling events.next() on
    the 10th element. The stack trace is included below, but it appears that
    the query resultset is somehow being closed early.
    If I increase the DefaultFetchBatchSize to 20, then I can also increase my
    MAX_SCHEDULES_PER_TRANS to 20 without getting the error.
    Any ideas?
    Regards
    Nathan
    Kodo 2.5.3
    SQLServer 2000
    Code Snippet
    private static final int MAX_SCHEDULES_PER_TRANS = 10;
    while (!terminated) {
    Collection col = (Collection) getQuery().execute(currentDate); //
    getQuery() method Creates query object once and reused in subsequent calls
    Iterator events = col.iterator();
    int counter = 0;
    boolean committed = false;
    while (events.hasNext() && !committed && !terminated) {
    Event event = (Event) events.next();
    event.schedule()
    counter++;
    if ((counter == MAX_SCHEDULES_PER_TRANS ) || !events.hasNext()) {
    try {
    context.getPersist().commitTransaction();
    committed = true;
    catch (OptimisticLockException e) {
    context.getPersist().rollbackTransaction();
    break;
    getQuery().close(col);
    Kodo.properties
    # Kodo JDO Properties configuration
    # DEVELOPMENT
    com.solarmetric.kodo.LicenseKey: xxxxxxx
    com.solarmetric.kodo.ee.ManagedRuntimeProperties=TransactionManagerName=Tran
    sactionFactory
    javax.jdo.PersistenceManagerFactoryClass=com.solarmetric.kodo.impl.jdbc.JDBC
    PersistenceManagerFactory
    javax.jdo.option.ConnectionDriverName=com.microsoft.jdbc.sqlserver.SQLServer
    Driver
    javax.jdo.option.ConnectionUserName=xxxxx
    javax.jdo.option.ConnectionPassword=xxxx
    javax.jdo.option.ConnectionURL=jdbc:microsoft:sqlserver://devsnetsql01:1433;
    SelectMethod=cursor;DatabaseName=devsnet09
    javax.jdo.option.RetainValues=true
    javax.jdo.option.RestoreValues=true
    javax.jdo.option.Optimistic=true
    javax.jdo.option.NontransactionalWrite=false
    javax.jdo.option.NontransactionalRead=true
    javax.jdo.option.Multithreaded=true
    javax.jdo.option.MsWait=5000
    javax.jdo.option.MinPool=0
    javax.jdo.option.MaxPool=0
    javax.jdo.option.IgnoreCache=false
    com.solarmetric.kodo.FlushBeforeQueries=with-connection
    com.solarmetric.kodo.impl.jdbc.schema.DBSequenceFactory=20
    com.solarmetric.kodo.impl.jdbc.StatementCacheMaxSize=0
    com.solarmetric.kodo.impl.jdbc.WarnOnPersistentTypeFailure=true
    com.solarmetric.kodo.impl.jdbc.SequenceFactoryClass=com.solarmetric.kodo.imp
    l.jdbc.schema.DBSequenceFactory
    com.solarmetric.kodo.impl.jdbc.FlatInheritanceMapping=true
    com.solarmetric.kodo.impl.jdbc.AutoReturnTimeout=10
    com.solarmetric.kodo.Logger=stdout
    com.solarmetric.kodo.EnableQueryExtensions=true
    com.solarmetric.kodo.DefaultFetchThreshold=30
    com.solarmetric.kodo.DefaultFetchBatchSize=10
    com.solarmetric.kodo.impl.jdbc.TransactionIsolation=READ_COMMITTED
    com.solarmetric.kodo.ee.ManagedRuntimeProperties=TransactionManagerMethod=co
    m.ibm.ejs.jts.jta.TransactionManagerFactory.getTransactionManager
    com.solarmetric.kodo.ee.ManagedRuntimeClass=com.solarmetric.kodo.ee.Invocati
    onManagedRuntime
    Stack trace
    com.solarmetric.kodo.runtime.DataStoreException: java.sql.SQLException:
    [Microsoft][SQLServer 2000 Driver for JDBC]Object has been closed.
    [code=0;state=HY000]
    NestedThrowables:
    java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Object has
    been closed.
    at
    com.solarmetric.kodo.impl.jdbc.runtime.SQLExceptions.throwDataStore(SQLExcep
    tions.java:64)
    at
    com.solarmetric.kodo.impl.jdbc.runtime.LazyResultList.instantiateRow(LazyRes
    ultList.java:223)
    at
    com.solarmetric.kodo.impl.jdbc.runtime.LazyResultList.get(LazyResultList.jav
    a:142)
    at java.util.AbstractList$Itr.next(AbstractList.java:431)
    at
    com.solarmetric.kodo.runtime.objectprovider.ResultListIterator.next(ResultLi
    stIterator.java:49)
    at com.mallesons.servicenet.ta.shared.BOIterator.next(BOIterator.java:48)
    at
    com.mallesons.servicenet.ta.event.SchedulerThread.process(Scheduler.java:171
    at com.mallesons.servicenet.ta.event.SchedulerThread.run(Scheduler.java:122)
    NestedThrowablesStackTrace:
    java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Object has
    been closed.
    at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown
    Source)(Inlined Compiled Code)
    at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown
    Source)(Inlined Compiled Code)
    at com.microsoft.jdbc.base.BaseConnection.validateClosedState(Unknown
    Source)(Inlined Compiled Code)
    at com.microsoft.jdbc.base.BaseStatement.validateClosedState(Unknown
    Source)(Inlined Compiled Code)
    at com.microsoft.jdbc.base.BaseResultSet.validateClosedState(Unknown
    Source)(Compiled Code)
    at com.microsoft.jdbc.base.BaseResultSet.getRow(Unknown Source)
    at
    com.solarmetric.datasource.ResultSetWrapper.getRow(ResultSetWrapper.java:465
    at
    com.solarmetric.kodo.impl.jdbc.runtime.LazyResultList.instantiateRow(LazyRes
    ultList.java:186)
    at
    com.solarmetric.kodo.impl.jdbc.runtime.LazyResultList.get(LazyResultList.jav
    a:142)
    at java.util.AbstractList$Itr.next(AbstractList.java:431)
    at
    com.solarmetric.kodo.runtime.objectprovider.ResultListIterator.next(ResultLi
    stIterator.java:49)
    at com.mallesons.servicenet.ta.shared.BOIterator.next(BOIterator.java:48)
    at
    com.mallesons.servicenet.ta.event.SchedulerThread.process(Scheduler.java:171
    at com.mallesons.servicenet.ta.event.SchedulerThread.run(Scheduler.java:122)

    Thanks for pointing out the optimisticLockException catch error. That would
    have been a bug but it hasn't been hit yet as I've only ever run one
    instance of this app!!
    The BOIterator is just wrapper layer and I have removed it to ensure it is
    not the culprit. Still getting the same error.
    I have done some more testing and have narrowed down the problem a little.
    It seems to only occur when I update one of the columns that is being used
    in the query. If I update a column that is not used in the query, it works
    fine.
    com.solarmetric.kodo.runtime.DataStoreException: java.sql.SQLException:
    [Microsoft][SQLServer 2000 Driver for JDBC]Object has been closed.
    [code=0;state=HY000]
    NestedThrowables:
    java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Object has
    been closed.
    at
    com.solarmetric.kodo.impl.jdbc.runtime.SQLExceptions.throwDataStore(SQLExcep
    tions.java:64)
    at
    com.solarmetric.kodo.impl.jdbc.runtime.LazyResultList.instantiateRow(LazyRes
    ultList.java:223)
    at
    com.solarmetric.kodo.impl.jdbc.runtime.LazyResultList.get(LazyResultList.jav
    a:142)
    at java.util.AbstractList$Itr.next(AbstractList.java:431)
    at
    com.solarmetric.kodo.runtime.objectprovider.ResultListIterator.next(ResultLi
    stIterator.java:49)
    at
    com.mallesons.servicenet.ta.event.SchedulerThread.process(Scheduler.java:197
    at com.mallesons.servicenet.ta.event.SchedulerThread.run(Scheduler.java:143)
    NestedThrowablesStackTrace:
    java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Object has
    been closed.
    at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
    at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
    at com.microsoft.jdbc.base.BaseConnection.validateClosedState(Unknown
    Source)
    at com.microsoft.jdbc.base.BaseStatement.validateClosedState(Unknown Source)
    at com.microsoft.jdbc.base.BaseResultSet.validateClosedState(Unknown Source)
    at com.microsoft.jdbc.base.BaseResultSet.getRow(Unknown Source)
    at
    com.solarmetric.datasource.ResultSetWrapper.getRow(ResultSetWrapper.java:478
    at
    com.solarmetric.kodo.impl.jdbc.runtime.LazyResultList.instantiateRow(LazyRes
    ultList.java:186)
    at
    com.solarmetric.kodo.impl.jdbc.runtime.LazyResultList.get(LazyResultList.jav
    a:142)
    at java.util.AbstractList$Itr.next(AbstractList.java:431)
    at
    com.solarmetric.kodo.runtime.objectprovider.ResultListIterator.next(ResultLi
    stIterator.java:49)
    at
    com.mallesons.servicenet.ta.event.SchedulerThread.process(Scheduler.java:197
    at com.mallesons.servicenet.ta.event.SchedulerThread.run(Scheduler.java:143)
    2003-10-27 15:26:40,142 DEBUG - SchedulerThread.run() - exit
    "Marc Prud'hommeaux" <[email protected]> wrote in message
    news:[email protected]...
    Nathan-
    I guess you are right that it doesn't look like the query result is
    being kept open between commits. I do notice that the block that catches
    the OptimisticLockException doesn't break out of the loop though: can
    you check to ensure that one isn't getting thrown?
    Also, what is the com.mallesons.servicenet.ta.shared.BOIterator stuff?
    If it is a wrapper layer that you have around the query execution,
    can you try removing it, just to ensure that it isn't misbehaving in
    some way?
    In article <[email protected]>, nathan boyes wrote:
    Hi Marc,
    Bug 718 certainly seems similar, however I still don't think it is
    necessarily the problem in this case. That particular bug relates to the
    resultset that was opened prior to commit, not remaining open after the
    commit. However, once I've committed, I call query.closeAll() then re
    execute the query. I would expect this to give me a new resultset that
    would not be affected by the previous commit.
    Also the CURSOR_CLOSE_ON_COMMIT is disabled by default and we haven't
    enabled it. A query against the database using one of the SQLServer
    functions confirms that this setting is false on the server.
    Predictably, instantiating the entire collection also fixes the problem.
    I
    guess this is similar to setting DefaultFetchThreshold = -1.
    Not really sure what else to try.
    "Marc Prud'hommeaux" <[email protected]> wrote in message
    news:[email protected]...
    Nathan-
    This sounds to me like
    http://bugzilla.solarmetric.com/show_bug.cgi?id=718 , even though it is
    not known to happen for SQLServer. If, before you commit, you
    instantiate the entire "col" list (with something like
    "new LinkedList (col)"), do you still see the problem?
    If this is indeed the problem, it seems that this is a server option
    that you can configure. If you disable CURSOR_CLOSE_ON_COMMIT on the
    server, do you still see the problem? See:
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_set-set_48kz.asp
    >>>
    >>>
    >>>
    >>>
    In article <[email protected]>, nathan boyes wrote:
    I have upgraded to 2.5.5 and am now calling query.closeAll() neither
    of
    which had any effect. When I set DefaultFetchThreshold to -1, thenthe
    problem disappeared.
    For efficiency, if I am iterating through 50 objects beforecommitting
    then
    it is probably worth setting
    DefaultFetchThreshold=50
    DefaultFetchBatchSize=50
    which will run without problem.
    However, that doesn't address the underlying problem that could stilloccur
    in other parts of our system.
    "Stephen Kim" <[email protected]> wrote in message
    news:[email protected]...
    First can you upgrade to Kodo 2.5.4 and see if the problem persists?
    If so, can you for the sake of debugging try setting
    DefaultFetchThreshold to -1?
    Also you should be calling either query.closeAll () or query.close(events).
    nathan boyes wrote:
    Hi guys
    I've discovered an unusual behaviour when iterating through a
    collection
    returned from a query.
    Scenario
    The code executes a query, iterates partially through the
    resultset
    and
    for
    each row calls a method which creates another object. Given that
    there
    could be thousands of rows, I commit the new objects every n timesand
    then
    go back to the start of the loop which re-executes the query. This
    code
    runs
    fine when
    MAX_SCHEDULES_PER_TRANS <=
    com.solarmetric.kodo.DefaultFetchBatchSize.
    Problem
    If the DefaultFetchBatchSize is 10, and I commit every 11
    iterations,
    then
    during the 3rd outer loop (ie commit has succeeded twice and the
    query
    has
    been executed 3 times) an exception is thrown when calling
    events.next()
    on
    the 10th element. The stack trace is included below, but it
    appears
    that
    the query resultset is somehow being closed early.
    If I increase the DefaultFetchBatchSize to 20, then I can also
    increase
    my
    MAX_SCHEDULES_PER_TRANS to 20 without getting the error.
    Any ideas?
    Regards
    Nathan
    Kodo 2.5.3
    SQLServer 2000
    Code Snippet
    private static final int MAX_SCHEDULES_PER_TRANS = 10;
    while (!terminated) {
    Collection col = (Collection) getQuery().execute(currentDate);
    getQuery() method Creates query object once and reused insubsequent
    calls
    Iterator events = col.iterator();
    int counter = 0;
    boolean committed = false;
    while (events.hasNext() && !committed && !terminated) {
    Event event = (Event) events.next();
    event.schedule()
    counter++;
    if ((counter == MAX_SCHEDULES_PER_TRANS ) ||
    !events.hasNext()) {
    >>>>>>
    try {
    context.getPersist().commitTransaction();
    committed = true;
    catch (OptimisticLockException e) {
    context.getPersist().rollbackTransaction();
    break;
    getQuery().close(col);
    Kodo.properties
    # Kodo JDO Properties configuration
    # DEVELOPMENT
    com.solarmetric.kodo.LicenseKey: xxxxxxx
    com.solarmetric.kodo.ee.ManagedRuntimeProperties=TransactionManagerName=Tran
    sactionFactory
    javax.jdo.PersistenceManagerFactoryClass=com.solarmetric.kodo.impl.jdbc.JDBC
    PersistenceManagerFactory
    javax.jdo.option.ConnectionDriverName=com.microsoft.jdbc.sqlserver.SQLServer
    Driver
    javax.jdo.option.ConnectionUserName=xxxxx
    javax.jdo.option.ConnectionPassword=xxxx
    javax.jdo.option.ConnectionURL=jdbc:microsoft:sqlserver://devsnetsql01:1433;
    SelectMethod=cursor;DatabaseName=devsnet09
    javax.jdo.option.RetainValues=true
    javax.jdo.option.RestoreValues=true
    javax.jdo.option.Optimistic=true
    javax.jdo.option.NontransactionalWrite=false
    javax.jdo.option.NontransactionalRead=true
    javax.jdo.option.Multithreaded=true
    javax.jdo.option.MsWait=5000
    javax.jdo.option.MinPool=0
    javax.jdo.option.MaxPool=0
    javax.jdo.option.IgnoreCache=false
    com.solarmetric.kodo.FlushBeforeQueries=with-connection
    com.solarmetric.kodo.impl.jdbc.schema.DBSequenceFactory=20
    com.solarmetric.kodo.impl.jdbc.StatementCacheMaxSize=0
    com.solarmetric.kodo.impl.jdbc.WarnOnPersistentTypeFailure=true
    com.solarmetric.kodo.impl.jdbc.SequenceFactoryClass=com.solarmetric.kodo.imp
    l.jdbc.schema.DBSequenceFactory
    com.solarmetric.kodo.impl.jdbc.FlatInheritanceMapping=true
    com.solarmetric.kodo.impl.jdbc.AutoReturnTimeout=10
    com.solarmetric.kodo.Logger=stdout
    com.solarmetric.kodo.EnableQueryExtensions=true
    com.solarmetric.kodo.DefaultFetchThreshold=30
    com.solarmetric.kodo.DefaultFetchBatchSize=10
    com.solarmetric.kodo.impl.jdbc.TransactionIsolation=READ_COMMITTED
    com.solarmetric.kodo.ee.ManagedRuntimeProperties=TransactionManagerMethod=co
    m.ibm.ejs.jts.jta.TransactionManagerFactory.getTransactionManager
    com.solarmetric.kodo.ee.ManagedRuntimeClass=com.solarmetric.kodo.ee.Invocati
    onManagedRuntime
    Stack trace
    com.solarmetric.kodo.runtime.DataStoreException:java.sql.SQLException:
    [Microsoft][SQLServer 2000 Driver for JDBC]Object has been closed.
    [code=0;state=HY000]
    NestedThrowables:
    java.sql.SQLException: [Microsoft][SQLServer 2000 Driver forJDBCObject
    has
    been closed.
    at
    com.solarmetric.kodo.impl.jdbc.runtime.SQLExceptions.throwDataStore(SQLExcep
    tions.java:64)
    at
    com.solarmetric.kodo.impl.jdbc.runtime.LazyResultList.instantiateRow(LazyRes
    ultList.java:223)
    at
    com.solarmetric.kodo.impl.jdbc.runtime.LazyResultList.get(LazyResultList.jav
    a:142)
    at java.util.AbstractList$Itr.next(AbstractList.java:431)
    at
    com.solarmetric.kodo.runtime.objectprovider.ResultListIterator.next(ResultLi
    stIterator.java:49)
    atcom.mallesons.servicenet.ta.shared.BOIterator.next(BOIterator.java:48)
    >>>>>>
    at
    com.mallesons.servicenet.ta.event.SchedulerThread.process(Scheduler.java:171
    atcom.mallesons.servicenet.ta.event.SchedulerThread.run(Scheduler.java:122)
    >>>>>>
    NestedThrowablesStackTrace:
    java.sql.SQLException: [Microsoft][SQLServer 2000 Driver forJDBCObject
    has
    been closed.
    at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown
    Source)(Inlined Compiled Code)
    at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown
    Source)(Inlined Compiled Code)
    at
    com.microsoft.jdbc.base.BaseConnection.validateClosedState(Unknown
    Source)(Inlined Compiled Code)
    atcom.microsoft.jdbc.base.BaseStatement.validateClosedState(Unknown
    Source)(Inlined Compiled Code)
    atcom.microsoft.jdbc.base.BaseResultSet.validateClosedState(Unknown
    Source)(Compiled Code)
    at com.microsoft.jdbc.base.BaseResultSet.getRow(Unknown Source)
    at
    com.solarmetric.datasource.ResultSetWrapper.getRow(ResultSetWrapper.java:465
    at
    com.solarmetric.kodo.impl.jdbc.runtime.LazyResultList.instantiateRow(LazyRes
    ultList.java:186)
    at
    com.solarmetric.kodo.impl.jdbc.runtime.LazyResultList.get(LazyResultList.jav
    a:142)
    at java.util.AbstractList$Itr.next(AbstractList.java:431)
    at
    com.solarmetric.kodo.runtime.objectprovider.ResultListIterator.next(ResultLi
    stIterator.java:49)
    atcom.mallesons.servicenet.ta.shared.BOIterator.next(BOIterator.java:48)
    >>>>>>
    at
    com.mallesons.servicenet.ta.event.SchedulerThread.process(Scheduler.java:171
    atcom.mallesons.servicenet.ta.event.SchedulerThread.run(Scheduler.java:122)
    >>>>>>
    >>>>>>
    >>>>>
    Stephen Kim
    [email protected]
    SolarMetric, Inc.
    http://www.solarmetric.com
    Marc Prud'hommeaux [email protected]
    SolarMetric Inc. http://www.solarmetric.com
    Marc Prud'hommeaux [email protected]
    SolarMetric Inc. http://www.solarmetric.com

  • Get query result in E-mail

    Hi Everyone,
    I am trying to get SQL Query Result in e-mail with proper format.
    I tired DB mail but result is not in proper format . It's hard to read from attachment. 
    From Below Query HTML format showing first 3 columns good after that all getting mixed up. 
    Select Ticktsno,customer_Id,Phone,Open date-time,OpenedBy,Assign_to,Category,Support_level,Incident_type,Description from dbo.query_result. 
    HTML Code: 
     if @@ROWCOUNT > 0
    begin
    declare @emailSubject varchar(100),
      @columnHeaders varchar(1000),
      @tableHTML nvarchar(max)
    select @emailSubject = 'My Results Email',
          -- Subject of Email
      @columnHeaders = 'tickets</th><th>Customer</th><th>Phone</th><th>Open Date/Time</th><th>OpenedBy</th><th>Assign_To</th><th>Category</th><th>Support_Level</th><th>Incident_Type</th><th>Status</th><th>DEscription'
       -- Column headers (must put </th><th> between each header)
    set @tableHTML =
      '<div><b>My Email Header</b></div><br>' + -- This is the bold text at the top of your email
      '<table border="1" cellpadding="5"><font face="Calibri" size=2>' +
      '<tr><th>' + @columnHeaders + '</th></tr>' +
      convert(nvarchar(max),
       SELECT td =  Tickets,       '',
                        td =  Customer, '',
                        td =  Phone, '',
                        td = [Open Date/Time], '',
                        td = OpenedBy, '',
                        td = Assign_To,
                        td = Category,
                        td =  Support_Level,
                        td = Incident_Type ,
    td = [Description]         
                         from master.dbo.QueryResult_2000
       for xml path('tr'), type))
      +'</font></table>'
    EXEC msdb.dbo.sp_send_dbmail @recipients='[email protected]',
        @subject = 'Query Result',
        @body = @tableHTML,
        @body_format = 'HTML' ;
    end
    What changes should make in HTML code to get report in proper HTML  format
    Please Mark As Answer if it is helpful. \\Aim To Inspire Rather to Teach A.Shah

    Thanks Uri for kind reply..I was able to edit that script. Script is running fine from SSMS and sending e-mail notification. But When I am running from SQK agent job getting successful but not getting e-mail notification.
    I enabled the profile from SQL job properties also. 
    Any thoughts on this?
    Please Mark As Answer if it is helpful. \\Aim To Inspire Rather to Teach A.Shah
    Hi Logicinisde,
    According to your description, if you run the scripts in the SSMS, it can send an email with HTML format to your mailbox. When you run this scripts by using SQL Server Agent job, it can show running successfully but you could not get any email. We need to
    verify if you select the correct Mail profile. After configuring the alert system, restart the SQL Server Agent service. If you experience any problems sending e-mail notifications through the SQL Server Agent, check the service account that the agent is running.
    If the SQL Server Agent is running with one of the built-in accounts like the Local System account, resources outside the SQL Server machine will be unavailable. This includes SMTP mail servers that are on other machines. If this is the case, change the service
    account for the SQL Server Agent to a domain account to resolve this issue.
    For more information about using Database Mail in SQL Server and using Database Mail with SQL Server Agent, you can review the following articles.
    http://www.idevelopment.info/data/SQLServer/DBA_tips/Database_Administration/DBA_22.shtml
    http://technet.microsoft.com/en-us/library/ms190606(v=sql.105).aspx
    Regards,
    Sofiya Li
    Sofiya Li
    TechNet Community Support

  • How to send query results from BW to R/3 abap program

    Hi,
    I have to bring in query results from BW into a abap program written in R/3...can anyone help me on how to accomplish this(BW to R/3) please...i was thinking if reporting agent or broadcasting should help but i dont know how to get started.
    Please help.
    Thank you so much.

    Hi Vijay,
      As i know, you can send data from BW to Flat file or into any table in BW or to BW application server only.
      You need 3rd party to send data to different server.
    You can use
    1. Tcode : RSCRM_BAPI to download query values/results into a table or into a flat file. OR
    2. You can use Infospokes to generate files from ODS/CUBE/master data objects to flat files(local/application server) or to a table.
    3. Using information broadcasting we can send mail(dont know much options), but i dont think generation of file possible.
      You need to trnasfer generated file from BW to R/3 and load into R/3 using BDC or LSMW(if data is low).
      I think, you can also use RFC function modules to read data from BW to R/3, plz check with ABAPer.
    Hope it Helps
    Srini

  • Http 404 error exporting query result into Excel.

    Hello. I'm getting an Http 404 The webpage cannot be found" error when trying to export any APEX application's query results into Excel (Application Express 3.2.1.00.10). This was working fine before. Nothing changed with our APEX application. I've been always using I.E. Version 7.0.5730.11 with no problems. I've reset the I.E. defaults and still the problem exists. I've downloaded Mozilla Firefox and the problem does not happen. However, I would like to know why my I.E. still gets this error? Any feedback or suggestions would greatly be appreciated. Thanks for your time.

    My EI settings are as follows:
    Tools -> Internet Options -> Security
    All Three: Internet, Local Intrarnet, and Trusted Sites ... at Custom Level have the following settings:
    Downloads:
    Automatic prompting for file downloads = Enable
    File download = Enable
    Font download = Enable
    Problem still exists.
    Thanks for the help.... any additional feedback or suggestions would greatly be appreciated. Thanks for your time.

  • cache-query-results question

    I have another post for general descriptor tag information but I do have a specific question. In a project I am looking at I see:
    <cache-usage> check cache by primary key </cache-usage>
    <cache-query-results>false</cache-query-results>
    <maintain-cache>true</maintain-cache>
    I'm not sure how to interpret this. Does this mean that a cache is in place or not? cache-query-rests is set to false which implies no caching, yet the other parameters imply a cache is in place. What overrides here?
    Thanks

    The XML maps directly to the API so the JavaDocs and related documentation are the best tools:
    cache-usage: query.setCacheUsage(int)
    This option indicates how the object cache should be used when processing the query. This is how in-memory query is configured as well as support for cache-hits on ReadObjectQuery.
    cache-query-result: query.setShouldCacheQueryResults(boolean)
    This option allows you to indicate that the results returned from the query execution should be held. When the query is executed again these results will be returned without going to the database or searching the object cache. This is just caching the results locally within the query.
    maintain-cache: query.maintainCache() or query.dontMaintainCache()
    This setting determines if the results returned from the query should be cached in the shared object cache. It is on by default and turning this off is very rare. Occasionally done to compare the cache version with the database verision when handling an optimistic locking failure.
    Doug

  • Caching query results?

    Hi guys,
    I have this page which calls the same query (across a database link!) four times! First when an initial LOV is generated (and the page is loaded), again for another LOV based off the initial one and finally for the report generated based off the 2 selections. This is crazily slow (30-40 seconds each load~) and also: When you try to sort with an Interactive Report by clicking the column names it then queries the database again (I assumed this part was cached but apparently not). I therefore need to cache the results from an initial query and then just limit the results locally. How can I do this? Guides? Examples?
    Thanks for help.
    Mike

    I tried this example based on a view:
    CREATE MATERIALIZED VIEW MV_TEST2
         REFRESH COMPLETE
         START WITH SYSDATE
         NEXT  SYSDATE + 1/48
         WITH ROWID
         AS SELECT * FROM test1;REFRESH COMPLETE -- The complete refresh re-creates the entire materialized view.
    START WITH SYSDATE -- run now
    NEXT SYSDATE + 1/48 -- run again in half an hour
    WITH ROWID -- I think this option is important if you use partial refresh of the view.
    AS SELECT * FROM test1; -- test1 is a view:
    CREATE OR REPLACE VIEW TEST1 AS
    SELECT st_id, st_name
        FROM aaw_solution_tree;Are column indexes still possible? I'm not sure:
    Indexing: !with respect to MV's on 10gR2 Jonathan Lewis wrote! ... you are allowed to create indexes on the tables that sit under materialized views - just don't make them unique indexes
    How much freedom is there in setting the refresh rate?
    What type of refreshing do you need?
    Another useful link: [http://asktom.oracle.com/pls/ask/search?p_string=materialized+view|http://asktom.oracle.com/pls/ask/search?p_string=materialized+view]
    Hope it helps.
    Tobias

  • Desktop apps: Report Builder 3.0 (x86) that does not let me allow query result which I created Customers Report. Here is the error message returns.:

    Desktop apps: Report Builder 3.0 (x86) that does not let me allow query result which I created Customers Report. Here is the error message returns as following.
    Database query from: AdventureWorks2014
    System.Web.Services.Protocols.SoapException: The permissions granted to user 'SQLServer2014\Mubs' are insufficient for performing this operation. ---> Microsoft.ReportingServices.Diagnostics.Utilities.AccessDeniedException: The permissions granted to
    user 'mujb-HP\mujb' are insufficient for performing this operation.
       at Microsoft.ReportingServices.Library.ReportingService2010Impl.CreateReportEditSession(String Report, String Parent, Byte[] Definition, String& EditSessionID, Warning[]& Warnings)
       at Microsoft.ReportingServices.WebServer.ReportingService2010.CreateReportEditSession(String Report, String Parent, Byte[] Definition, String& EditSessionID, Warning[]& Warnings)
    The permissions granted to user 'mujb-HP\mujb' are insufficient for performing this operation.
    Is there anybody help me out, pl
    My MSSQL Server express 2014 edition x64  and My desktop "Report Builder (RB) 3.0' is 32bit (x86).
    Does Report Builder x64 exist? I didn't see anywhere so I downloaded x86 RB

    Hi mujb,
    Per my understanding you are using the report builder 3.0 to design the report and when you click the query designer button to execute the query you got the error message above, right?
    I have tested on my local envornment and your issue can be caused by the user "SQLServer2014\Mubs"  and "mujb-HP\mujb"  haven't grant permission to the report server or the shared dataeource/dataset if you have used this.
    I would like to confirm if you have assigned both the Item-Level and System-Level role of the user above to sucessfully access the report server, If you haven't grant any access to the above user and when you connect to the report server in the report builder,
    you may got the error message:
    More details information below for your reference:
    Please execute the query in the microsoft SQL Server Management Studio to see if you have permission to execute the query.
    If the query works fine in step1, please run the report builder as Administrator and if you are using the shared datasource/dataset the issue can be cause by the you haven't grant access the share datasource, Double click to open the Datasource
    and click the "Test Connection" as below to test if it can connect successfully:
    If the "Test Connection" failed, please click the shared datasource/dataset on Report Server to check if you have grant correct permission.
    Related information about the grant permission to report server for your reference:
    https://msdn.microsoft.com/en-us/library/ms156034.aspx
    http://www.allenkinsel.com/archive/2013/01/adventures-in-ssrs/
    If your issue still exists, please try to provide more details information.
    Regards,
    Vicky Liu
    Vicky Liu
    TechNet Community Support

  • Getting query results from a PL/SQL procedure

    Hi! So, I’m a little stumped and I can’t seem to find the answer to what I believe is probably a simple question…
    So, here goes… I have a big ol’ union query that I use to create a report on a page, it’s about 25k – not over the 32k limit, but fails to be able to compile every time (I always get a 400 – Bad Request error). I’m not sure why this is happening, but I can remove a union statement and it compiles just fine – so it has something to do with the size of the query. ANYWAY – I’ve resolved that I should put this bad boy into the database as a stored procedure and just call it from Apex, my problem is I can’t figure out quite how to do this with variables, etc.…
    Instead of giving you my whole big query, I’ll use the emp table as the concept is the same:
    Say we have a query that creates a report on a page:
    select empno, ename, job, mgr, hiredate, sal, comm, deptno
    from emp
    where job = :P_JOB
    and hiredate >= :P_HIREDATE;
    How would I take this query, create it as a stored procedure on the db, pass the variables from Apex and return the query result set from the stored proc as a report?
    I really appreciate any help on this!
    Best,
    Gilcrest

    Hi Gilcrest,
    You should create the query as a View and use the view name and the WHERE clause in the report's sql source.
    Andy

  • Sending email using PL/SQL based on a query result

    Hello all,
    I want to create a procedure using PL/SQL, based on a query result.Here is the scenario:
    I have multiple tables in Target and Source databases that I want to compare(not the whole table but queries on these tables) and if they differ, I want to shoot an email. I have some ideas how to implement this but not sure whether it is the best approach.
    select Acct_id, total from SourceTableA
    minus
    select Acct_id, total from TargetTableA
    select Acct_id, sum from SourceTableB
    minus
    select Acct_id, sum from TargetTableB
    If the result of any of above queries > 0 then I want to shoot an email and want to repeat this procedure in the morning every day.
    I know how to implement send_mail procedure using UTL_SMTP package and how to schedule tha job by dbms_job package. But I am not sure how to implement the result of minus query. In case if minus > 0 then I also want to send the name of tables in the email message where source and target tables are not same. Should i use cursor, variable or insert the result in a new table? any help would be highly appreciated. Thanks in advance.
    Khan

    Actually these queries are the part of our daily testing that we run everyday manually(after the scheduled ETL load) to see if there are any discrepencies between our datawarehouse tables and source tables. So instead of running these queries manually everyday we want to schedula a procedure that will shoot an email in case of any discrepency and indicate which tables have problems.

  • How can I get Numbers to return the first row in a group of VLOOKUP query results instead of last one?

    I'm trying to query from one table (call it Table1) a batch of rows in another table (Table2) using VLOOKUP on a date specified in the first table (Table1). My problem is it's returning the last incident in Table2 of the requested date instead of the first incident. This really breaks the OFFSET scheme I'd like to use to collect the rest of the items for that date. Is there some way to compel VLOOKUP to return the first row of query results, not the last?
    NOTE: I see I've asked this before, but forgot to go back and look at responses given. It's been a while and I've limped along until now with the way things were. I'm actually trying to delete this questions, so if you see it, ignore it. I suppose if someone can tell me real quick how to delete a stupid question, that might be helpful.

    you cannot delete a post yourself.  You can flag the post an request a moderator remove.

  • Warning Message in query result as 'Notification Number DBMAN 345'

    Hi ,
    I have a warning message while executing the query
    'Diagnosis
    Currently, it cannot be guaranteed that SIDs and master data exists for all characteristic attributes for the DataStore object to be read.
    There is a restriction on a navigation attribute of the listed characteristic in the query. This filters all characteristic values of the master-data bearing characteristic for which there is not yet master data out of the result.
    For performance reasons, this filtering is unavoidable.
    System Response
    Procedure
    In case of doubt, find other restirctions directly on the characteristic values of the characteristics contained in the DataStore object.
    Procedure for System Administration
      Notification Number DBMAN 345  '
    'i am getting this error because of cutomer exit variables  on navigatioanl attributes of  Omaterial'
    I tried supressing it in  RSRT.. but unable to find the message.
    I tried  debugging and assigning enhancement points in  FM  BAL_LOG_MSG_READ.. As it is standard function module its not suggestable to do..
    can we creat custom FM ?? will it be called if we  write code to supress warning message??
    Please let me know how to use  BADI'S  in order to supress the error message that appearing in query result?
    Thanks All.

    Hi,
    The warning is raised due to the following reasons:
      - you have a selection in the filter of a navigation attribute
      - in your DSO you do not use the option "SIDs Generation upon Activation"
    If the option "SIDs Generation upon Activation" is not flagged,
    you may get char.values for an Infoobject in the system not
    having any SIDs. As a result you may see in the report less data as
    expected.
    For example we have Infoobject A with its Nav.attribute B
      Infoobject A   Nav.attribute B
      12             13   ->> has a SID in the X-table
      11             10
      9              13   ->> has no SID in the X-table
    If you define a selection on B =13 in the query, you only get infoobject
    A with key 12 displayed in the result, since only B =13 has a SID
    in the relevant X-table.
    The warning refers to this behaviour and cannot be avoided unless you:
       - flag the option in the ODS-settings
       - or remove the filter defined on 0MATERIAL__xxxx
    Thanks,
    Venkat

Maybe you are looking for