<?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 Re: write code in ad hoc query in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/write-code-in-ad-hoc-query/m-p/2507007#M566766</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Its quite straight forward, so just have a play around, but the steps are something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1.	SQ01/environment/info sets/query areas/standard&lt;/P&gt;&lt;P&gt;2.	Choose the info set you wish to change&lt;/P&gt;&lt;P&gt;3.	Choose the filed group you wish to add a field to&lt;/P&gt;&lt;P&gt;4.	Right click the infoset you want to add a field to&lt;/P&gt;&lt;P&gt;5.	Add the new field to the field group for that infoset&lt;/P&gt;&lt;P&gt;6.	Then use the extras button to add code to that field&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tend to use the initialization, and record processing event blocks for adding my code.  USe the eblow link for the SAP documentation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://saphelp.user.ad.glasgow.gov.uk:8000/saphelp/helpdata/EN/d2/cb3efb455611d189710000e8322d00/frameset.htm" target="test_blank"&gt;http://saphelp.user.ad.glasgow.gov.uk:8000/saphelp/helpdata/EN/d2/cb3efb455611d189710000e8322d00/frameset.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And here is some sample code i've used for one particaulr field, just to give you an idea of how easy it is.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;rp_provide_from_last p0000 space pn-begda pn-endda.

* Get last Ity2001 record
IF p0000-massn = '16'.
  SELECT SINGLE pernr max( endda )
         FROM pa2001
         INTO (p2001-pernr, p2001-endda)
              WHERE pernr = pernr-pernr
              GROUP BY pernr.
ELSE.
  rp_provide_from_last p2001 space pn-begda pn-endda.
ENDIF.

SELECT SINGLE UMSKD
       INTO WA_UMSKD
       FROM Y0PT_AMMSUBS
            WHERE PERNR = p2001-pernr
            AND   ENDDA = p2001-endda.


wa_OCCHC  = wa_UMSKD(2).
occhealth = wa_OCCHC.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;a href="http://saphelp.user.ad.glasgow.gov.uk:8000/saphelp/helpdata/EN/d2/cb3efb455611d189710000e8322d00/frameset.htm"&amp;gt;http://saphelp.user.ad.glasgow.gov.uk:8000/saphelp/helpdata/EN/d2/cb3efb455611d189710000e8322d00/frameset.htm&amp;lt;/a&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 09 Jul 2007 14:58:08 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-07-09T14:58:08Z</dc:date>
    <item>
      <title>write code in ad hoc query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/write-code-in-ad-hoc-query/m-p/2507005#M566764</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hello All,&lt;/P&gt;&lt;P&gt;I have a reqmnt, My client has an existing ad hoc query and I need to add two fields to it, both of the fields are not direct and needs some coding, cud anyone please explain how can i go bout it?&lt;/P&gt;&lt;P&gt;thanks,&lt;/P&gt;&lt;P&gt;RS&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Jul 2007 14:30:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/write-code-in-ad-hoc-query/m-p/2507005#M566764</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-09T14:30:24Z</dc:date>
    </item>
    <item>
      <title>Re: write code in ad hoc query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/write-code-in-ad-hoc-query/m-p/2507006#M566765</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok....This is not the way to go....But it's the way they work on my current project....You can go to SE38 with the name of the generated program and add the needed fields....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Don't blame me....Blame my employeers -;)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Greetings,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Blag.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Jul 2007 14:42:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/write-code-in-ad-hoc-query/m-p/2507006#M566765</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-09T14:42:05Z</dc:date>
    </item>
    <item>
      <title>Re: write code in ad hoc query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/write-code-in-ad-hoc-query/m-p/2507007#M566766</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Its quite straight forward, so just have a play around, but the steps are something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1.	SQ01/environment/info sets/query areas/standard&lt;/P&gt;&lt;P&gt;2.	Choose the info set you wish to change&lt;/P&gt;&lt;P&gt;3.	Choose the filed group you wish to add a field to&lt;/P&gt;&lt;P&gt;4.	Right click the infoset you want to add a field to&lt;/P&gt;&lt;P&gt;5.	Add the new field to the field group for that infoset&lt;/P&gt;&lt;P&gt;6.	Then use the extras button to add code to that field&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tend to use the initialization, and record processing event blocks for adding my code.  USe the eblow link for the SAP documentation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://saphelp.user.ad.glasgow.gov.uk:8000/saphelp/helpdata/EN/d2/cb3efb455611d189710000e8322d00/frameset.htm" target="test_blank"&gt;http://saphelp.user.ad.glasgow.gov.uk:8000/saphelp/helpdata/EN/d2/cb3efb455611d189710000e8322d00/frameset.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And here is some sample code i've used for one particaulr field, just to give you an idea of how easy it is.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;rp_provide_from_last p0000 space pn-begda pn-endda.

* Get last Ity2001 record
IF p0000-massn = '16'.
  SELECT SINGLE pernr max( endda )
         FROM pa2001
         INTO (p2001-pernr, p2001-endda)
              WHERE pernr = pernr-pernr
              GROUP BY pernr.
ELSE.
  rp_provide_from_last p2001 space pn-begda pn-endda.
ENDIF.

SELECT SINGLE UMSKD
       INTO WA_UMSKD
       FROM Y0PT_AMMSUBS
            WHERE PERNR = p2001-pernr
            AND   ENDDA = p2001-endda.


wa_OCCHC  = wa_UMSKD(2).
occhealth = wa_OCCHC.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;a href="http://saphelp.user.ad.glasgow.gov.uk:8000/saphelp/helpdata/EN/d2/cb3efb455611d189710000e8322d00/frameset.htm"&amp;gt;http://saphelp.user.ad.glasgow.gov.uk:8000/saphelp/helpdata/EN/d2/cb3efb455611d189710000e8322d00/frameset.htm&amp;lt;/a&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Jul 2007 14:58:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/write-code-in-ad-hoc-query/m-p/2507007#M566766</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-09T14:58:08Z</dc:date>
    </item>
  </channel>
</rss>

