<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How can a stored process know which application invoked it? in Developers</title>
    <link>https://communities.sas.com/t5/Developers/How-can-a-stored-process-know-which-application-invoked-it/m-p/120478#M3884</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Seems a benefit of stored processes is that a single stored process could be invoked by lots of different applications (web report studio, stored process web app, EG, office-add on, information delivery portal, blah blah).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sometimes the code executed should vary, depending on which application invoked the process.&amp;nbsp; For example, a stored process might give user option of using a prompt to set _odsdest= html | rtf | pdf.&amp;nbsp; If that stored process is invoked from SPWA, all should be fine.&amp;nbsp; But if it is invoked from office-add on and user selects PDF, the stored process should force the destination to be rtf or html, because Excel knows not of pdf.&amp;nbsp; Or maybe I am coding a javascript alert, which I guess would only work when the process is called from SPWA or IDP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a macro variable (or other environment variable) that can reliably indicate what sort of app invoked the stored process?&amp;nbsp; So I would use it the same way as in vanilla SAS, I use &amp;amp;SYSENV to determine if code is being run in interactive mode or batch?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;--Q.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 18 May 2012 15:44:55 GMT</pubDate>
    <dc:creator>Quentin</dc:creator>
    <dc:date>2012-05-18T15:44:55Z</dc:date>
    <item>
      <title>How can a stored process know which application invoked it?</title>
      <link>https://communities.sas.com/t5/Developers/How-can-a-stored-process-know-which-application-invoked-it/m-p/120478#M3884</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Seems a benefit of stored processes is that a single stored process could be invoked by lots of different applications (web report studio, stored process web app, EG, office-add on, information delivery portal, blah blah).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sometimes the code executed should vary, depending on which application invoked the process.&amp;nbsp; For example, a stored process might give user option of using a prompt to set _odsdest= html | rtf | pdf.&amp;nbsp; If that stored process is invoked from SPWA, all should be fine.&amp;nbsp; But if it is invoked from office-add on and user selects PDF, the stored process should force the destination to be rtf or html, because Excel knows not of pdf.&amp;nbsp; Or maybe I am coding a javascript alert, which I guess would only work when the process is called from SPWA or IDP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a macro variable (or other environment variable) that can reliably indicate what sort of app invoked the stored process?&amp;nbsp; So I would use it the same way as in vanilla SAS, I use &amp;amp;SYSENV to determine if code is being run in interactive mode or batch?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;--Q.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 May 2012 15:44:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/How-can-a-stored-process-know-which-application-invoked-it/m-p/120478#M3884</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2012-05-18T15:44:55Z</dc:date>
    </item>
    <item>
      <title>Re: How can a stored process know which application invoked it?</title>
      <link>https://communities.sas.com/t5/Developers/How-can-a-stored-process-know-which-application-invoked-it/m-p/120479#M3885</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi:&lt;/P&gt;&lt;P&gt;&amp;nbsp; One thing that I do is test the value or existence of the automatic variable &amp;amp;_URL -- if it has a value, then the stored process was requested by either the IDP or the SPWA. If &amp;amp;_URL is not in the global symbol table, then the stored process was requested by a different client app. If you are allowing the users to select a value for destination, then of course, you can test the value of &amp;amp;_ODSDEST -- if they were using RTF or PDF, for example, you might not use your code that inserts JavaScript.. but for JavaScript, testing &amp;amp;_URL is probably more reliable than &amp;amp;_ODSDEST.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; In some instances, &amp;amp;_CLIENT might give you something usable. But, if the CLIENT cannot be determined, then you get just server info. New with 9.3 is &amp;amp;_MSOFFICECLIENT, whose value will tell you the name of the Office client (&lt;CODE&gt;Excel&lt;/CODE&gt;, &lt;CODE&gt;Word&lt;/CODE&gt;, &lt;CODE&gt;PowerPoint&lt;/CODE&gt;, or &lt;CODE&gt;Outlook&lt;/CODE&gt;) that made a request for a stored process.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; The bottom line is that you'd have to code some tests, probably in a macro program inside your stored process. The full list of reserved macro variables differed in earlier versions of SAS. This is the list for 9.3 in the doc:&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/stpug/62758/HTML/default/viewer.htm#p184mqqbi9w6qjn1q0619x19eg02.htm" title="http://support.sas.com/documentation/cdl/en/stpug/62758/HTML/default/viewer.htm#p184mqqbi9w6qjn1q0619x19eg02.htm"&gt;http://support.sas.com/documentation/cdl/en/stpug/62758/HTML/default/viewer.htm#p184mqqbi9w6qjn1q0619x19eg02.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cynthia&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 May 2012 18:38:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/How-can-a-stored-process-know-which-application-invoked-it/m-p/120479#M3885</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2012-05-18T18:38:56Z</dc:date>
    </item>
    <item>
      <title>Re: How can a stored process know which application invoked it?</title>
      <link>https://communities.sas.com/t5/Developers/How-can-a-stored-process-know-which-application-invoked-it/m-p/120480#M3886</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Cynthia,&lt;/P&gt;&lt;P&gt;Looks like I can get most of the way by testing &amp;amp;_URL and &amp;amp;_MSOFFICECLIENT.&lt;/P&gt;&lt;P&gt;--Q.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 May 2012 13:18:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/How-can-a-stored-process-know-which-application-invoked-it/m-p/120480#M3886</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2012-05-21T13:18:21Z</dc:date>
    </item>
  </channel>
</rss>

