<?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: 'Associated Type' in a BAPI TABLE Column for dynamic internal table in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/associated-type-in-a-bapi-table-column-for-dynamic-internal-table/m-p/6828765#M1471127</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ram,&lt;/P&gt;&lt;P&gt;You want to create a dynamic internal table right? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this one: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
  DATA: e_dyntab_tb            TYPE lvc_t_fcat,
             i_reftab               TYPE REF   TO data.
 
  CALL METHOD cl_alv_table_create=&amp;gt;create_dynamic_table
    EXPORTING
      it_fieldcatalog = e_dyntab_tb          "Pass alv_fcat here
    IMPORTING
      ep_table        = i_reftab.
 
* Create Dynamic Work Area and assign to FS
  ASSIGN i_reftab-&amp;gt;* TO &amp;lt;fs_final_itab&amp;gt;.      "Assigning the Final Table,
  CREATE DATA t_line_reftab LIKE LINE OF &amp;lt;fs_final_itab&amp;gt;.
 
  ASSIGN t_line_reftab-&amp;gt;* TO &amp;lt;fs_line_reftab&amp;gt;.  "Create a Work Area



"e_dyntab_tb contains the structure of lvc_t_fcat and is being populated by:

  MOVE: c_matnr      TO e_dyntab_wa-fieldname.
  APPEND e_dyntab_wa TO e_dyntab_tb.
 
  MOVE: c_maktx         TO e_dyntab_wa-fieldname.
  APPEND e_dyntab_wa TO e_dyntab_tb.
 
  MOVE: c_meins      TO e_dyntab_wa-fieldname.
  APPEND e_dyntab_wa TO e_dyntab_tb.
 
 " So onu2026

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please let me know if you need more information.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Jun&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 29 Mar 2010 01:32:50 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-03-29T01:32:50Z</dc:date>
    <item>
      <title>'Associated Type' in a BAPI TABLE Column for dynamic internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/associated-type-in-a-bapi-table-column-for-dynamic-internal-table/m-p/6828764#M1471126</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello SAP gurus&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have written a BAPI that recieves 'TABLE NAME', 'COLUMNS TO SELECT' and 'WHERE TO CONDITION'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So at the time of Runtime, table, columns etc., are determined dynamically and then using a dynamic internal table it returns the data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For this I have defined the TABLES TAB of BAPI as follows.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Parameter Name         Typing        Associated Type&lt;/P&gt;&lt;P&gt;RESULT                         LIKE                     MPP_DYNAMIC&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I did the testing, it worked perfectly fine for simple custom tables that I have created.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, when I tried to test this BAPI with table  'MARA', it crashes with the following error&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------------------" /&gt;&lt;P&gt;Runtime Errors         UC_OBJECTS_NOT_CONVERTIBLE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Error analysis&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    The statement&lt;/P&gt;&lt;P&gt;       "MOVE src TO dst"&lt;/P&gt;&lt;P&gt;    requires that the operands "dst" and "src" are convertible.&lt;/P&gt;&lt;P&gt;    Since this statement is in a Unicode program, the special conversion&lt;/P&gt;&lt;P&gt;    rules for Unicode programs apply.&lt;/P&gt;&lt;P&gt;    In this case, these rules were violated.&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am not sure what I should be entering the TABLE tab.  I tried  EXPORT tab of BAPI and it didnt help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any suggestions or feedback will be highly appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tks&lt;/P&gt;&lt;P&gt;Ram&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Prasad Ram on Mar 29, 2010 3:03 AM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Prasad Ram on Mar 29, 2010 3:06 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Mar 2010 01:02:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/associated-type-in-a-bapi-table-column-for-dynamic-internal-table/m-p/6828764#M1471126</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-29T01:02:44Z</dc:date>
    </item>
    <item>
      <title>Re: 'Associated Type' in a BAPI TABLE Column for dynamic internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/associated-type-in-a-bapi-table-column-for-dynamic-internal-table/m-p/6828765#M1471127</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ram,&lt;/P&gt;&lt;P&gt;You want to create a dynamic internal table right? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this one: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
  DATA: e_dyntab_tb            TYPE lvc_t_fcat,
             i_reftab               TYPE REF   TO data.
 
  CALL METHOD cl_alv_table_create=&amp;gt;create_dynamic_table
    EXPORTING
      it_fieldcatalog = e_dyntab_tb          "Pass alv_fcat here
    IMPORTING
      ep_table        = i_reftab.
 
* Create Dynamic Work Area and assign to FS
  ASSIGN i_reftab-&amp;gt;* TO &amp;lt;fs_final_itab&amp;gt;.      "Assigning the Final Table,
  CREATE DATA t_line_reftab LIKE LINE OF &amp;lt;fs_final_itab&amp;gt;.
 
  ASSIGN t_line_reftab-&amp;gt;* TO &amp;lt;fs_line_reftab&amp;gt;.  "Create a Work Area



"e_dyntab_tb contains the structure of lvc_t_fcat and is being populated by:

  MOVE: c_matnr      TO e_dyntab_wa-fieldname.
  APPEND e_dyntab_wa TO e_dyntab_tb.
 
  MOVE: c_maktx         TO e_dyntab_wa-fieldname.
  APPEND e_dyntab_wa TO e_dyntab_tb.
 
  MOVE: c_meins      TO e_dyntab_wa-fieldname.
  APPEND e_dyntab_wa TO e_dyntab_tb.
 
 " So onu2026

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please let me know if you need more information.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Jun&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Mar 2010 01:32:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/associated-type-in-a-bapi-table-column-for-dynamic-internal-table/m-p/6828765#M1471127</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-29T01:32:50Z</dc:date>
    </item>
    <item>
      <title>Re: 'Associated Type' in a BAPI TABLE Column for dynamic internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/associated-type-in-a-bapi-table-column-for-dynamic-internal-table/m-p/6828766#M1471128</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the response. I appreciate it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have created a dynamic internal table which is getting populated. Infact, It works for simple custom tables that has about 5 to 6 fields. However, when I try this BAPI to get data from standard tables (ex., MARA) I get that error I mentioned in the original post. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So my question now is 'HOW TO GET THIS DYNAMIC INTERNAL TABLE OUT OF BAPI'. What should be the definition in the 'TABLE' tab of Bapi.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the code that I am using &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="--------------------------------------------------------------------" /&gt;&lt;P&gt;function zbapi_search_from_sap_tables.&lt;/P&gt;&lt;P&gt;*"----&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;STRONG&gt;"&lt;/STRONG&gt;"Local Interface:&lt;/P&gt;&lt;P&gt;*"  IMPORTING&lt;/P&gt;&lt;P&gt;*"     VALUE(TABNAME) TYPE  TEXT20&lt;/P&gt;&lt;P&gt;*"     VALUE(SELECTCOL) TYPE  TEXT50&lt;/P&gt;&lt;P&gt;*"     VALUE(WHERECOND) TYPE  TEXT50&lt;/P&gt;&lt;P&gt;*"  TABLES&lt;/P&gt;&lt;P&gt;*"      RESULT STRUCTURE  MPP_DYNAMIC&lt;/P&gt;&lt;P&gt;*"----&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  data: itab_ref type ref to data,&lt;/P&gt;&lt;P&gt;        dy_line type ref to data,&lt;/P&gt;&lt;P&gt;        tempstring type string.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  create data itab_ref type standard table of (tabname).&lt;/P&gt;&lt;P&gt;  field-symbols: &amp;lt;itab&amp;gt; type standard table,&lt;/P&gt;&lt;P&gt;                 &amp;lt;dyn_wa&amp;gt;.&lt;/P&gt;&lt;P&gt;  assign itab_ref-&amp;gt;* to &amp;lt;itab&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  create data dy_line like line of &amp;lt;itab&amp;gt;.&lt;/P&gt;&lt;P&gt;  assign dy_line-&amp;gt;* to &amp;lt;dyn_wa&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  define dselect.&lt;/P&gt;&lt;P&gt;    select (&amp;amp;1) from (&amp;amp;2) into corresponding fields of table &amp;amp;3 where (&amp;amp;4).&lt;/P&gt;&lt;P&gt;  end-of-definition.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  dselect selectcol tabname &amp;lt;itab&amp;gt; wherecond.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  loop at &amp;lt;itab&amp;gt; into &amp;lt;dyn_wa&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;     result = &amp;lt;dyn_wa&amp;gt;.&lt;/P&gt;&lt;P&gt;     condense result.&lt;/P&gt;&lt;P&gt;     append result.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  endloop.&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="--------------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you have any suggestions, I would appreciate it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tks&lt;/P&gt;&lt;P&gt;Ram&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Prasad Ram on Mar 29, 2010 4:19 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Mar 2010 02:18:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/associated-type-in-a-bapi-table-column-for-dynamic-internal-table/m-p/6828766#M1471128</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-29T02:18:59Z</dc:date>
    </item>
  </channel>
</rss>

