<?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: Enhance SAP Query (susing ABAP code) - ECC6.0 in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/enhance-sap-query-susing-abap-code-ecc6-0/m-p/1759343#M328833</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Hari,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First thing is this is not the way to convert the SAP Query to Report.&lt;/P&gt;&lt;P&gt;First check that how many table in your query they have used.To check this if you go in SQ02 press display button left side you can see the tables.To check the fields selecting from tables check in field groups.&lt;/P&gt;&lt;P&gt;In record processing check are there any conditions are there.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now wrire a select statement by joing all tables which you found above and in this select statement extract all fields which you found in field group into one internal table .Here you give the selection screen fields as  condition fields in select statement.If you found any conditions in record processing event ,Loop that internal table  and check the conditions or modifications.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you need more help let me know.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pls. reward points for helpful answers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 04 Dec 2006 04:49:24 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-12-04T04:49:24Z</dc:date>
    <item>
      <title>Enhance SAP Query (susing ABAP code) - ECC6.0</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/enhance-sap-query-susing-abap-code-ecc6-0/m-p/1759342#M328832</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello folks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have an ABAP query. It gets the data I need, but because of the way the tables have to be joined, I get multiple records . If I write a SAP ABAP report, it would be straight forward to get exactly the records I am interested in, however I am stuck with having to use SAP query and enhance the results using ABAP code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have pasted the code (SAP generated based on the infoset defined in SQ02)below for your reference. The internal table &amp;lt;b&amp;gt;%dtab&amp;lt;/b&amp;gt; has the data I am interested in, however when I try to refer to this internal table I get an error. I do not remember what the error was but it failed a syntax check. I am sure that somebody who has done this before knows what I am talking about. Here is the code from the SAP query.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To retrace the steps I have done, in SQ02, I clicked "EXTRAS --&amp;gt; Code Tab". Here I tried adding the following line of code in the "End-of-selection (before list)" coding section. I was trying to put this declaration .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;w_dtab like line of %dtab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried this in the start-of-selection block as well, but ended with the same syntax check.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does this have to do with how this table is defined else can anybody advice how I can manipulate the data that is present in the internal table "%dtab" ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Hari&lt;/P&gt;&lt;P&gt;********&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;report AQ10AFI=========INV_SHIP_CA===.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;include /1BCDWB/IQ000000000073DAT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data %dtab type standard table of /1BCDWB/IQ000000000073 with header line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data %subrc type sy-subrc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;include /1BCDWB/IQ000000000073SSCR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;include /1BCDWB/IQ000000000073SSCRAT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;start-of-selection.&lt;/P&gt;&lt;P&gt;  if %runmode-extr_on &amp;lt;&amp;gt; space.&lt;/P&gt;&lt;P&gt;    call function '/1BCDWB/IQ000000000073EXTR'&lt;/P&gt;&lt;P&gt;         tables     %selopt = %seloptions&lt;/P&gt;&lt;P&gt;                    %dtab   = %dtab&lt;/P&gt;&lt;P&gt;         changing   %rtmode = %runmode&lt;/P&gt;&lt;P&gt;         exceptions no_data = 1&lt;/P&gt;&lt;P&gt;                    others  = 2.&lt;/P&gt;&lt;P&gt;    %subrc = sy-subrc.&lt;/P&gt;&lt;P&gt;    call function 'RSAQRT_CHECK_EXTR'&lt;/P&gt;&lt;P&gt;         exporting extr_subrc = %subrc&lt;/P&gt;&lt;P&gt;         tables    dtab   = %dtab&lt;/P&gt;&lt;P&gt;         changing  rtmode = %runmode.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;end-of-selection.&lt;/P&gt;&lt;P&gt;  if %runmode-show_on &amp;lt;&amp;gt; space.&lt;/P&gt;&lt;P&gt;    call function '/1BCDWB/IQ000000000073SHOW'&lt;/P&gt;&lt;P&gt;         tables   %dtab   = %dtab&lt;/P&gt;&lt;P&gt;         changing %rtmode = %runmode.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------" /&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   special code for old API and BW extractor calls&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form %set_data changing p_lines type i.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  import ldata to %dtab from memory id 'AQLISTDATA'.&lt;/P&gt;&lt;P&gt;  describe table %dtab lines p_lines.&lt;/P&gt;&lt;P&gt;  free memory id 'AQLISTDATA'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form %get_data tables p_dtab  structure %dtab&lt;/P&gt;&lt;P&gt;               using  p_first type i&lt;/P&gt;&lt;P&gt;                      p_last  type i.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  append lines of %dtab from p_first to p_last to p_dtab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form %get_ref_to_table using p_lid   type aql_lid&lt;/P&gt;&lt;P&gt;                             p_ref   type ref to data&lt;/P&gt;&lt;P&gt;                             p_subrc type i.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  if p_lid = %iqid-lid.&lt;/P&gt;&lt;P&gt;    create data p_ref like %dtab[].&lt;/P&gt;&lt;P&gt;    p_subrc = 0.&lt;/P&gt;&lt;P&gt;  else.&lt;/P&gt;&lt;P&gt;    p_subrc = 4.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 03 Dec 2006 23:23:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/enhance-sap-query-susing-abap-code-ecc6-0/m-p/1759342#M328832</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-12-03T23:23:22Z</dc:date>
    </item>
    <item>
      <title>Re: Enhance SAP Query (susing ABAP code) - ECC6.0</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/enhance-sap-query-susing-abap-code-ecc6-0/m-p/1759343#M328833</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Hari,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First thing is this is not the way to convert the SAP Query to Report.&lt;/P&gt;&lt;P&gt;First check that how many table in your query they have used.To check this if you go in SQ02 press display button left side you can see the tables.To check the fields selecting from tables check in field groups.&lt;/P&gt;&lt;P&gt;In record processing check are there any conditions are there.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now wrire a select statement by joing all tables which you found above and in this select statement extract all fields which you found in field group into one internal table .Here you give the selection screen fields as  condition fields in select statement.If you found any conditions in record processing event ,Loop that internal table  and check the conditions or modifications.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you need more help let me know.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pls. reward points for helpful answers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Dec 2006 04:49:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/enhance-sap-query-susing-abap-code-ecc6-0/m-p/1759343#M328833</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-12-04T04:49:24Z</dc:date>
    </item>
    <item>
      <title>Re: Enhance SAP Query (susing ABAP code) - ECC6.0</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/enhance-sap-query-susing-abap-code-ecc6-0/m-p/1759344#M328834</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am not sure I understand your comment "First thing is this is not the way to convert the SAP Query to Report."&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However the intention is to further filter the records that the query is currently retrieving. However your approach seems to be going down the line of having additional SELECT statements, and processing the internal table populated by the select statement. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How is that going to integrate with the internal %dtab which is what is eventually displayed ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Dec 2006 18:51:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/enhance-sap-query-susing-abap-code-ecc6-0/m-p/1759344#M328834</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-12-04T18:51:46Z</dc:date>
    </item>
  </channel>
</rss>

