<?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: Ideas To Dynamic Programming. in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/ideas-to-dynamic-programming/m-p/7037961#M1500296</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hello martin ,&lt;/P&gt;&lt;P&gt;Thanks for your reply....And i will takecare of the security issues.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please help me solving the below problem...&lt;/P&gt;&lt;P&gt;I am experimenting with the below code but i am getting  &lt;/P&gt;&lt;P&gt;"the type component table is unknown."   i am on 4.7&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;please suggest me a alternative to this........&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;code:- &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;*&amp;amp;---------------------------------------------------------------------*
*&amp;amp; Report  ZDYNAMIC3                                                   *
*&amp;amp;                                                                     *
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;                                                                     *
*&amp;amp;                                                                     *
*&amp;amp;---------------------------------------------------------------------*

REPORT  ZDYNAMIC3                               .
 PARAMETER : p_tabnam TYPE tabname DEFAULT 'SFLIGHT',
             p_selfl1 TYPE edpline DEFAULT 'CARRID',            
             p_selfl2 TYPE edpline DEFAULT 'CONNID',
             p_selfl3 TYPE edpline DEFAULT 'FLDATE',            
             p_selfl4 TYPE edpline DEFAULT 'PRICE',
             p_selfl5 TYPE edpline DEFAULT 'CURRENCY',
             p_where1 TYPE edpline DEFAULT 'PRICE &amp;gt; 300',            
             p_where2 TYPE edpline DEFAULT 'AND CURRENCY = ''EUR'''.
             
FIELD-SYMBOLS : &amp;lt;lt_outtab&amp;gt; TYPE ANY TABLE, 
               &amp;lt;ls_outtab&amp;gt; TYPE ANY,
               &amp;lt;l_fld&amp;gt; TYPE ANY.

DATA: lt_where    TYPE TABLE OF edpline,
      lt_sel_list TYPE TABLE OF edpline,
      lt_group    TYPE TABLE OF edpline,
      l_having    TYPE string,
      l_wa_name   TYPE string,
      l_sel_list  TYPE edpline,
      dref        TYPE REF TO data,
      itab_type   TYPE REF TO cl_abap_tabledescr,
      struct_type TYPE REF TO cl_abap_structdescr,
      elem_type   TYPE REF TO cl_abap_elemdescr,
      comp_tab    TYPE cl_abap_structdescr=&amp;gt;component_table,
      comp_fld    TYPE cl_abap_structdescr=&amp;gt;component.
TYPES: f_count TYPE i.
* Creation of the output table including a non standard field, f_count* 
*see ABAP FAQ #14 for more information on this topic
struct_type ?= cl_abap_typedescr=&amp;gt;describe_by_name( p_tabnam ).
elem_type   ?= cl_abap_elemdescr=&amp;gt;describe_by_name( 'F_COUNT' ).
comp_tab = struct_type-&amp;gt;get_components( ).
* We remove the unnecessary fields
LOOP AT comp_tab INTO comp_fld.
   IF comp_fld-name &amp;lt;&amp;gt; p_selfl1
       AND   comp_fld-name &amp;lt;&amp;gt; p_selfl2
       AND      comp_fld-name &amp;lt;&amp;gt; p_selfl3 
       AND      comp_fld-name &amp;lt;&amp;gt; p_selfl4
       AND      comp_fld-name &amp;lt;&amp;gt; p_selfl5.
    DELETE TABLE comp_tab WITH TABLE KEY name = comp_fld-name.
    ENDIF.
    ENDLOOP.
    comp_fld-name = 'F_COUNT'.
    comp_fld-type = elem_type.
    APPEND comp_fld TO comp_tab.
    struct_type = cl_abap_structdescr=&amp;gt;create( comp_tab ).
    itab_type   = cl_abap_tabledescr=&amp;gt;create( struct_type ).
    l_wa_name = 'l_WA'.
    CREATE DATA dref TYPE HANDLE itab_type.
    ASSIGN dref-&amp;gt;* TO &amp;lt;lt_outtab&amp;gt;.
    CREATE DATA dref TYPE HANDLE struct_type.
    ASSIGN dref-&amp;gt;* TO &amp;lt;ls_outtab&amp;gt;.
* Creation of the selection fields and the "group by" clause
APPEND p_selfl1 TO lt_sel_list.
APPEND p_selfl1 TO lt_group.
APPEND p_selfl2 TO lt_sel_list.
APPEND p_selfl2 TO lt_group.
APPEND p_selfl3 TO lt_sel_list.
APPEND p_selfl3 TO lt_group.
APPEND p_selfl4 TO lt_sel_list.
APPEND p_selfl4 TO lt_group.
APPEND p_selfl5 TO lt_sel_list.
APPEND p_selfl5 TO lt_group.
APPEND 'COUNT(*) AS F_COUNT' TO lt_sel_list. 
* creation of the "where" clause
APPEND p_where1 TO lt_where.
APPEND p_where2 TO lt_where.
* Creation of the "having" clause
l_having = 'count(*) &amp;gt;= 1'.
* THE dynamic select
SELECT        (lt_sel_list)
     FROM     (p_tabnam)
     INTO CORRESPONDING FIELDS OF TABLE &amp;lt;lt_outtab&amp;gt;
     WHERE    (lt_where)       GROUP BY (lt_group)
     HAVING   (l_having)       ORDER BY (lt_group).
* display of the results
LOOP AT &amp;lt;lt_outtab&amp;gt; ASSIGNING &amp;lt;ls_outtab&amp;gt;.
LOOP AT comp_tab INTO comp_fld.
    ASSIGN COMPONENT comp_fld-name OF STRUCTURE &amp;lt;ls_outtab&amp;gt; TO &amp;lt;l_fld&amp;gt;.      WRITE: &amp;lt;l_fld&amp;gt;.   
     ENDLOOP.   
     SKIP.
     ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;jeevan.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 22 Jun 2010 07:27:01 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-06-22T07:27:01Z</dc:date>
    <item>
      <title>Ideas To Dynamic Programming.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/ideas-to-dynamic-programming/m-p/7037959#M1500294</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Friends,&lt;/P&gt;&lt;P&gt;In my requirement...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. I will be recieving a string of source code in a RFC input parameter. Then Using this Source code we have to execute the &lt;/P&gt;&lt;P&gt;query and return Data....either as a return parameter or otherwise i can download the report to a folder in application server.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please guide me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;jeevan.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 19 Jun 2010 09:07:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/ideas-to-dynamic-programming/m-p/7037959#M1500294</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-06-19T09:07:50Z</dc:date>
    </item>
    <item>
      <title>Re: Ideas To Dynamic Programming.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/ideas-to-dynamic-programming/m-p/7037960#M1500295</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I guess if you search on this forum or SAP documentation you will find examples how to achieve your goal. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have just one comment. This creates a security risk. You have to be very careful and validate your input ontherwise your FM can be ugly misused. Good luck.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Jun 2010 00:08:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/ideas-to-dynamic-programming/m-p/7037960#M1500295</guid>
      <dc:creator>mvoros</dc:creator>
      <dc:date>2010-06-21T00:08:19Z</dc:date>
    </item>
    <item>
      <title>Re: Ideas To Dynamic Programming.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/ideas-to-dynamic-programming/m-p/7037961#M1500296</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hello martin ,&lt;/P&gt;&lt;P&gt;Thanks for your reply....And i will takecare of the security issues.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please help me solving the below problem...&lt;/P&gt;&lt;P&gt;I am experimenting with the below code but i am getting  &lt;/P&gt;&lt;P&gt;"the type component table is unknown."   i am on 4.7&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;please suggest me a alternative to this........&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;code:- &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;*&amp;amp;---------------------------------------------------------------------*
*&amp;amp; Report  ZDYNAMIC3                                                   *
*&amp;amp;                                                                     *
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;                                                                     *
*&amp;amp;                                                                     *
*&amp;amp;---------------------------------------------------------------------*

REPORT  ZDYNAMIC3                               .
 PARAMETER : p_tabnam TYPE tabname DEFAULT 'SFLIGHT',
             p_selfl1 TYPE edpline DEFAULT 'CARRID',            
             p_selfl2 TYPE edpline DEFAULT 'CONNID',
             p_selfl3 TYPE edpline DEFAULT 'FLDATE',            
             p_selfl4 TYPE edpline DEFAULT 'PRICE',
             p_selfl5 TYPE edpline DEFAULT 'CURRENCY',
             p_where1 TYPE edpline DEFAULT 'PRICE &amp;gt; 300',            
             p_where2 TYPE edpline DEFAULT 'AND CURRENCY = ''EUR'''.
             
FIELD-SYMBOLS : &amp;lt;lt_outtab&amp;gt; TYPE ANY TABLE, 
               &amp;lt;ls_outtab&amp;gt; TYPE ANY,
               &amp;lt;l_fld&amp;gt; TYPE ANY.

DATA: lt_where    TYPE TABLE OF edpline,
      lt_sel_list TYPE TABLE OF edpline,
      lt_group    TYPE TABLE OF edpline,
      l_having    TYPE string,
      l_wa_name   TYPE string,
      l_sel_list  TYPE edpline,
      dref        TYPE REF TO data,
      itab_type   TYPE REF TO cl_abap_tabledescr,
      struct_type TYPE REF TO cl_abap_structdescr,
      elem_type   TYPE REF TO cl_abap_elemdescr,
      comp_tab    TYPE cl_abap_structdescr=&amp;gt;component_table,
      comp_fld    TYPE cl_abap_structdescr=&amp;gt;component.
TYPES: f_count TYPE i.
* Creation of the output table including a non standard field, f_count* 
*see ABAP FAQ #14 for more information on this topic
struct_type ?= cl_abap_typedescr=&amp;gt;describe_by_name( p_tabnam ).
elem_type   ?= cl_abap_elemdescr=&amp;gt;describe_by_name( 'F_COUNT' ).
comp_tab = struct_type-&amp;gt;get_components( ).
* We remove the unnecessary fields
LOOP AT comp_tab INTO comp_fld.
   IF comp_fld-name &amp;lt;&amp;gt; p_selfl1
       AND   comp_fld-name &amp;lt;&amp;gt; p_selfl2
       AND      comp_fld-name &amp;lt;&amp;gt; p_selfl3 
       AND      comp_fld-name &amp;lt;&amp;gt; p_selfl4
       AND      comp_fld-name &amp;lt;&amp;gt; p_selfl5.
    DELETE TABLE comp_tab WITH TABLE KEY name = comp_fld-name.
    ENDIF.
    ENDLOOP.
    comp_fld-name = 'F_COUNT'.
    comp_fld-type = elem_type.
    APPEND comp_fld TO comp_tab.
    struct_type = cl_abap_structdescr=&amp;gt;create( comp_tab ).
    itab_type   = cl_abap_tabledescr=&amp;gt;create( struct_type ).
    l_wa_name = 'l_WA'.
    CREATE DATA dref TYPE HANDLE itab_type.
    ASSIGN dref-&amp;gt;* TO &amp;lt;lt_outtab&amp;gt;.
    CREATE DATA dref TYPE HANDLE struct_type.
    ASSIGN dref-&amp;gt;* TO &amp;lt;ls_outtab&amp;gt;.
* Creation of the selection fields and the "group by" clause
APPEND p_selfl1 TO lt_sel_list.
APPEND p_selfl1 TO lt_group.
APPEND p_selfl2 TO lt_sel_list.
APPEND p_selfl2 TO lt_group.
APPEND p_selfl3 TO lt_sel_list.
APPEND p_selfl3 TO lt_group.
APPEND p_selfl4 TO lt_sel_list.
APPEND p_selfl4 TO lt_group.
APPEND p_selfl5 TO lt_sel_list.
APPEND p_selfl5 TO lt_group.
APPEND 'COUNT(*) AS F_COUNT' TO lt_sel_list. 
* creation of the "where" clause
APPEND p_where1 TO lt_where.
APPEND p_where2 TO lt_where.
* Creation of the "having" clause
l_having = 'count(*) &amp;gt;= 1'.
* THE dynamic select
SELECT        (lt_sel_list)
     FROM     (p_tabnam)
     INTO CORRESPONDING FIELDS OF TABLE &amp;lt;lt_outtab&amp;gt;
     WHERE    (lt_where)       GROUP BY (lt_group)
     HAVING   (l_having)       ORDER BY (lt_group).
* display of the results
LOOP AT &amp;lt;lt_outtab&amp;gt; ASSIGNING &amp;lt;ls_outtab&amp;gt;.
LOOP AT comp_tab INTO comp_fld.
    ASSIGN COMPONENT comp_fld-name OF STRUCTURE &amp;lt;ls_outtab&amp;gt; TO &amp;lt;l_fld&amp;gt;.      WRITE: &amp;lt;l_fld&amp;gt;.   
     ENDLOOP.   
     SKIP.
     ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;jeevan.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Jun 2010 07:27:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/ideas-to-dynamic-programming/m-p/7037961#M1500296</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-06-22T07:27:01Z</dc:date>
    </item>
    <item>
      <title>Re: Ideas To Dynamic Programming.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/ideas-to-dynamic-programming/m-p/7037962#M1500297</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;what line is giving you this error? I checked it on ECC6 system and it works.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jun 2010 23:29:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/ideas-to-dynamic-programming/m-p/7037962#M1500297</guid>
      <dc:creator>mvoros</dc:creator>
      <dc:date>2010-06-23T23:29:00Z</dc:date>
    </item>
    <item>
      <title>Re: Ideas To Dynamic Programming.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/ideas-to-dynamic-programming/m-p/7037963#M1500298</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;it looks like that class does not exist in 4.7. Use SE24 and try to view class cl_abap_structdescr....if it's not there then that's why you're getting the syntax error.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Jun 2010 00:58:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/ideas-to-dynamic-programming/m-p/7037963#M1500298</guid>
      <dc:creator>former_member186741</dc:creator>
      <dc:date>2010-06-24T00:58:40Z</dc:date>
    </item>
  </channel>
</rss>

