<?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 Loop fields/components of structure in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-fields-components-of-structure/m-p/3981507#M951040</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to code something for "looping" through a structure, I mean that I get every field of a structure and its value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now I have it like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

  DO.

    ADD 1 TO lv_comp_count.
    ASSIGN COMPONENT lv_comp_count OF STRUCTURE is_data TO &amp;lt;fs_comp&amp;gt;.
    IF sy-subrc NE 0.
      EXIT.
    ENDIF.

* ....

  ENDDO.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But here I have the problem that I don't know the name of the field in this coding. How can I code this similar so that I get both: value and name of the field??&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;Regards, &lt;/P&gt;&lt;P&gt;Markus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 10 Jun 2008 09:51:36 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-06-10T09:51:36Z</dc:date>
    <item>
      <title>Loop fields/components of structure</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-fields-components-of-structure/m-p/3981507#M951040</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to code something for "looping" through a structure, I mean that I get every field of a structure and its value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now I have it like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

  DO.

    ADD 1 TO lv_comp_count.
    ASSIGN COMPONENT lv_comp_count OF STRUCTURE is_data TO &amp;lt;fs_comp&amp;gt;.
    IF sy-subrc NE 0.
      EXIT.
    ENDIF.

* ....

  ENDDO.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But here I have the problem that I don't know the name of the field in this coding. How can I code this similar so that I get both: value and name of the field??&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;Regards, &lt;/P&gt;&lt;P&gt;Markus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jun 2008 09:51:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-fields-components-of-structure/m-p/3981507#M951040</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-10T09:51:36Z</dc:date>
    </item>
    <item>
      <title>Re: Loop fields/components of structure</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-fields-components-of-structure/m-p/3981508#M951041</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;&lt;/P&gt;&lt;P&gt;perhaps the following funtion module will help you : &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CALL FUNCTION 'GET_COMPONENT_LIST'&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      program    = sy-repid&lt;/P&gt;&lt;P&gt;      fieldname  =   &amp;lt;name_of_you_struture&amp;gt;&lt;/P&gt;&lt;P&gt;    TABLES&lt;/P&gt;&lt;P&gt;      components = lt_components.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;P&gt;David&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jun 2008 10:18:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-fields-components-of-structure/m-p/3981508#M951041</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-10T10:18:26Z</dc:date>
    </item>
    <item>
      <title>Re: Loop fields/components of structure</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-fields-components-of-structure/m-p/3981509#M951042</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;And one hard-code for example &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;  DATA: COMP LIKE  RSTRUCINFO OCCURS 0 WITH HEADER LINE.
  CALL 'AB_STRUC_INFO'
    ID 'PROGRAM'   FIELD SY-REPID
    ID 'STRUCNAME' FIELD 'structure name'
    ID 'STRUCINFO' FIELD COMP-*SYS*.
  LOOP AT COMP.
    ...
  ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;Return table with fields of internal structure in program.&lt;/P&gt;&lt;P&gt;Good luck.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jun 2008 10:32:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-fields-components-of-structure/m-p/3981509#M951042</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-10T10:32:40Z</dc:date>
    </item>
    <item>
      <title>Re: Loop fields/components of structure</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-fields-components-of-structure/m-p/3981510#M951043</link>
      <description>&lt;P&gt;Hana dynamic implementation:&lt;/P&gt;&lt;P&gt;FIELD-SYMBOLS: &amp;lt;lv_field&amp;gt; type any.&lt;BR /&gt;data: lr_descr_struc TYPE REF TO data.&lt;BR /&gt;data: lo_structdescr TYPE REF TO cl_abap_structdescr.&lt;BR /&gt;&lt;BR /&gt; CLEAR: lr_descr_struc, lo_structdescr.&lt;BR /&gt; CREATE DATA lr_descr_struc like ch_service_datax. " &amp;lt;- any type&lt;BR /&gt; lo_structdescr ?= cl_abap_structdescr=&amp;gt;describe_by_data_ref( p_data_ref = lr_descr_struc ).&lt;BR /&gt; LOOP AT lo_structdescr-&amp;gt;components ASSIGNING FIELD-SYMBOL(&amp;lt;lv_component&amp;gt;).&lt;BR /&gt; if &amp;lt;lv_component&amp;gt;-name(1) eq 'Z'.&lt;BR /&gt; ASSIGN COMPONENT &amp;lt;lv_component&amp;gt;-name of STRUCTURE ch_service_datax to &amp;lt;lv_field&amp;gt;.&lt;BR /&gt; if &amp;lt;lv_field&amp;gt; is ASSIGNED.&lt;BR /&gt; &amp;lt;lv_field&amp;gt; = abap_true.&lt;BR /&gt; endif.&lt;BR /&gt; endif.&lt;BR /&gt; ENDLOOP.&lt;/P&gt;</description>
      <pubDate>Fri, 25 Sep 2020 20:26:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-fields-components-of-structure/m-p/3981510#M951043</guid>
      <dc:creator>former_member715866</dc:creator>
      <dc:date>2020-09-25T20:26:49Z</dc:date>
    </item>
  </channel>
</rss>

