<?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 Dynamic Bapi call - Problem with field symbols (challenging) in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-bapi-call-problem-with-field-symbols-challenging/m-p/2266965#M492001</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi guys, I'm trying to implement a method that calls a bapi dynamically.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I try to create a type structure using RTTS and them fill each field dinamically... unfortunaly when I assign a data reference to a field symbol, casting it, it keeps giving me an error that the field symbol has no structure.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please see the code above and give me ideias.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;method CALLBAPI.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  type-pools ABAP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  DATA: l_exceptionsTable TYPE ABAP_FUNC_EXCPBIND_TAB,&lt;/P&gt;&lt;P&gt;         L_ParameterType TYPE REF TO cl_abap_structdescr,&lt;/P&gt;&lt;P&gt;       L_ParameterTab TYPE STANDARD TABLE OF REF TO cl_abap_structdescr,&lt;/P&gt;&lt;P&gt;        L_CompTab TYPE cl_abap_structdescr=&amp;gt;component_table,&lt;/P&gt;&lt;P&gt;       L_Component TYPE CHAR30.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  DATA: dref TYPE REF TO DATA.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  FIELD-SYMBOLS: &amp;lt;l_parametersTable&amp;gt; TYPE ABAP_FUNC_PARMBIND,&lt;/P&gt;&lt;P&gt;                 &amp;lt;L_Struct_Components&amp;gt; TYPE abap_componentdescr,&lt;/P&gt;&lt;P&gt;                 &amp;lt;fs&amp;gt; TYPE ANY.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Get exporting Structures&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  LOOP AT L_PARAMETERSTABLE ASSIGNING &amp;lt;l_parametersTable&amp;gt; WHERE kind =&lt;/P&gt;&lt;P&gt;  abap_func_exporting.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    L_ParameterType ?= cl_abap_typedescr=&amp;gt;describe_by_name(&lt;/P&gt;&lt;P&gt;    &amp;lt;l_parametersTable&amp;gt;-name ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    L_CompTab = L_ParameterType-&amp;gt;get_components( ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    CREATE DATA dref TYPE HANDLE L_ParameterType.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    ASSIGN dref-&amp;gt;* TO &amp;lt;fs&amp;gt; CASTING TYPE HANDLE L_ParameterType.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    LOOP AT L_CompTab ASSIGNING &amp;lt;L_Struct_Components&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      L_Component = &amp;lt;L_Struct_Components&amp;gt;-name.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    number '1' is for tests purpose.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;****&lt;STRONG&gt;!!!!!!!!!&lt;/STRONG&gt;*****&lt;STRONG&gt;!!!!!&lt;/STRONG&gt;****THIS LINE GIVES AN ERROR:&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*The data object "&amp;lt;FS&amp;gt;" has no structure and therefore no component	&lt;/P&gt;&lt;P&gt;*called "" .		&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;     &amp;lt;fs&amp;gt;-(L_Component)  = '1'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    ENDLOOP.&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*... need some code here...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  call function l_bapi_name&lt;/P&gt;&lt;P&gt;    PARAMETER-TABLE&lt;/P&gt;&lt;P&gt;      l_parametersTable&lt;/P&gt;&lt;P&gt;    EXCEPTION-TABLE&lt;/P&gt;&lt;P&gt;      l_exceptionsTable.&lt;/P&gt;&lt;P&gt;endmethod.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Luis Pereira&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Luis Pereira&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Luis Pereira&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 25 May 2007 16:34:35 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-05-25T16:34:35Z</dc:date>
    <item>
      <title>Dynamic Bapi call - Problem with field symbols (challenging)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-bapi-call-problem-with-field-symbols-challenging/m-p/2266965#M492001</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi guys, I'm trying to implement a method that calls a bapi dynamically.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I try to create a type structure using RTTS and them fill each field dinamically... unfortunaly when I assign a data reference to a field symbol, casting it, it keeps giving me an error that the field symbol has no structure.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please see the code above and give me ideias.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;method CALLBAPI.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  type-pools ABAP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  DATA: l_exceptionsTable TYPE ABAP_FUNC_EXCPBIND_TAB,&lt;/P&gt;&lt;P&gt;         L_ParameterType TYPE REF TO cl_abap_structdescr,&lt;/P&gt;&lt;P&gt;       L_ParameterTab TYPE STANDARD TABLE OF REF TO cl_abap_structdescr,&lt;/P&gt;&lt;P&gt;        L_CompTab TYPE cl_abap_structdescr=&amp;gt;component_table,&lt;/P&gt;&lt;P&gt;       L_Component TYPE CHAR30.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  DATA: dref TYPE REF TO DATA.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  FIELD-SYMBOLS: &amp;lt;l_parametersTable&amp;gt; TYPE ABAP_FUNC_PARMBIND,&lt;/P&gt;&lt;P&gt;                 &amp;lt;L_Struct_Components&amp;gt; TYPE abap_componentdescr,&lt;/P&gt;&lt;P&gt;                 &amp;lt;fs&amp;gt; TYPE ANY.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Get exporting Structures&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  LOOP AT L_PARAMETERSTABLE ASSIGNING &amp;lt;l_parametersTable&amp;gt; WHERE kind =&lt;/P&gt;&lt;P&gt;  abap_func_exporting.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    L_ParameterType ?= cl_abap_typedescr=&amp;gt;describe_by_name(&lt;/P&gt;&lt;P&gt;    &amp;lt;l_parametersTable&amp;gt;-name ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    L_CompTab = L_ParameterType-&amp;gt;get_components( ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    CREATE DATA dref TYPE HANDLE L_ParameterType.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    ASSIGN dref-&amp;gt;* TO &amp;lt;fs&amp;gt; CASTING TYPE HANDLE L_ParameterType.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    LOOP AT L_CompTab ASSIGNING &amp;lt;L_Struct_Components&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      L_Component = &amp;lt;L_Struct_Components&amp;gt;-name.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    number '1' is for tests purpose.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;****&lt;STRONG&gt;!!!!!!!!!&lt;/STRONG&gt;*****&lt;STRONG&gt;!!!!!&lt;/STRONG&gt;****THIS LINE GIVES AN ERROR:&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*The data object "&amp;lt;FS&amp;gt;" has no structure and therefore no component	&lt;/P&gt;&lt;P&gt;*called "" .		&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;     &amp;lt;fs&amp;gt;-(L_Component)  = '1'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    ENDLOOP.&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*... need some code here...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  call function l_bapi_name&lt;/P&gt;&lt;P&gt;    PARAMETER-TABLE&lt;/P&gt;&lt;P&gt;      l_parametersTable&lt;/P&gt;&lt;P&gt;    EXCEPTION-TABLE&lt;/P&gt;&lt;P&gt;      l_exceptionsTable.&lt;/P&gt;&lt;P&gt;endmethod.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Luis Pereira&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Luis Pereira&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Luis Pereira&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 May 2007 16:34:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-bapi-call-problem-with-field-symbols-challenging/m-p/2266965#M492001</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-25T16:34:35Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Bapi call - Problem with field symbols (challenging)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-bapi-call-problem-with-field-symbols-challenging/m-p/2266966#M492002</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;try something like this..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;field-symbols : &amp;lt;FS&amp;gt; type standard stable.   " change the declaration.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : l_value(20).&lt;/P&gt;&lt;P&gt;Field-symbols : &amp;lt;FS1&amp;gt; type any.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;l_value = (L_Component).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Assign component l_value of structure &amp;lt;FS&amp;gt; to &amp;lt;FS1&amp;gt;.&lt;/P&gt;&lt;P&gt;&amp;lt;FS1&amp;gt; = '1'.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 May 2007 17:08:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-bapi-call-problem-with-field-symbols-challenging/m-p/2266966#M492002</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-25T17:08:05Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Bapi call - Problem with field symbols (challenging)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-bapi-call-problem-with-field-symbols-challenging/m-p/2266967#M492003</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;The &amp;lt;FS&amp;gt; is defined TYPE ANY so you can't indicate the name of a possible field of &amp;lt;FS&amp;gt;, because the system see &amp;lt;FS&amp;gt; like a structure only at run time:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;&amp;lt;fs&amp;gt;-(L_Component) = '1'. &amp;lt;----&lt;/P&gt;&lt;HR originaltext="------------------" /&gt;&lt;P&gt;&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try to use another field-symbols:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;ASSIGN COMPONENT L_COMPONENT OF STRUCTURE &amp;lt;FS&amp;gt; TO &amp;lt;COMP&amp;gt;.
IF SY-SUBRC = 0.
  &amp;lt;COMP&amp;gt; = '1'.
ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Max&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 May 2007 17:11:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-bapi-call-problem-with-field-symbols-challenging/m-p/2266967#M492003</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-25T17:11:47Z</dc:date>
    </item>
  </channel>
</rss>

