<?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: problem with structure... in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-structure/m-p/3601474#M867408</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Rafe,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A structure is basically a single set of different fields grouped using a single name - it can therefore only hold a single set of values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For your requirement you need to define an internal table with a layout that matches your structure:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: zpt_s_mass LIKE STANDARD TABLE OF zps_s_mass.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then, in each pass of the loop, after you have set the sructure values, you need to append them to the internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;IF success EQ 'X'.
zps_s_mass-status = 'Mutation Erfolgreich'.
ELSE.
zps_s_mass-status = 'Mutation Fehlgeschlagen'.
ENDIF.

APPEND zps_s_mass TO zpt_s_mass.    "&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;

MODIFY it_XXX1 FROM wa_XXX1.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Later on, you can get the values back one at a time by looping through the internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP AT zpt_s_mass INTO zps_s_mass.

...code to process

ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Andrew&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 27 Mar 2008 00:54:14 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-03-27T00:54:14Z</dc:date>
    <item>
      <title>problem with structure...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-structure/m-p/3601472#M867406</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hey there,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;im new to abap and i have the following problem:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;zps_s_mass is the structure which i need it later to show in an ALV. the program searches the table it_nexceltab for an identical entry in the table it_XXX1. if it finds an itendic entry it mutates the entry in the table it_XXX1 (it_nexceltab-instrneu).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but then, i want to write the data in a structure with a bonus field "status" in this field i write if the mutation was a success, if it found a identical entry. i need the structure later to show in an ALV.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the problem is, that it always overwrites my data in the structure, with every loop. but i need all entries...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thx for any help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT it_XXX1 INTO wa_XXX1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    success = ''.&lt;/P&gt;&lt;P&gt;    zusatz = ''.&lt;/P&gt;&lt;P&gt;    name = wa_XXX1-verna.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    FIND '@' IN wa_XXX1-verna.&lt;/P&gt;&lt;P&gt;    IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;      REPLACE '@ ' IN wa_XXX1-verna WITH ''.&lt;/P&gt;&lt;P&gt;      zusatz = '@ '.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    LOOP AT it_nexceltab INTO wa_nexceltab.&lt;/P&gt;&lt;P&gt;      IF wa_XXX1-verna EQ wa_nexceltab-instralt.&lt;/P&gt;&lt;P&gt;        name = wa_nexceltab-instrneu.&lt;/P&gt;&lt;P&gt;        success = 'X'.&lt;/P&gt;&lt;P&gt;      ENDIF.&lt;/P&gt;&lt;P&gt;    ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    IF zusatz EQ '@ '.&lt;/P&gt;&lt;P&gt;      CONCATENATE zusatz name INTO name.&lt;/P&gt;&lt;P&gt;      zusatz = ''.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    wa_XXX1-verna = name.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    zps_s_mass-persnr = wa_XXX1-vernr.&lt;/P&gt;&lt;P&gt;    zps_s_mass-nameinstr = wa_XXX1-verna.&lt;/P&gt;&lt;P&gt;    zps_s_mass-tabelle = 'XXX1'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    IF success EQ 'X'.&lt;/P&gt;&lt;P&gt;      zps_s_mass-status = 'Mutation Erfolgreich'.&lt;/P&gt;&lt;P&gt;    ELSE.&lt;/P&gt;&lt;P&gt;      zps_s_mass-status = 'Mutation Fehlgeschlagen'.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    MODIFY it_XXX1 FROM wa_XXX1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: rafe b. on Mar 26, 2008 1:34 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Mar 2008 12:28:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-structure/m-p/3601472#M867406</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-26T12:28:25Z</dc:date>
    </item>
    <item>
      <title>Re: problem with structure...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-structure/m-p/3601473#M867407</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rafe, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I guess I know were your conflict is caused by. It's not a structural discrepancy, but a LOOP in the LOOP problem. The inner LOOP is running always till the end, i.e. there is always information captured from the last occurence when &lt;STRONG&gt;wa_XXX1-verna&lt;/STRONG&gt; equals &lt;STRONG&gt;wa_nexceltab-instralt&lt;/STRONG&gt;. When the if-statement is true, there has to be an EXIT-statement, i.e. the LOOP will be exited.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Another recommendation: It's faster an securer to use the clear-statement for to initialize a field (not &amp;lt;field&amp;gt; = '').&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I marked the critical loop in &lt;STRONG&gt;bold&lt;/STRONG&gt; and added the EXIT-statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT it_XXX1 INTO wa_XXX1. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;success = ''. &lt;/P&gt;&lt;P&gt;zusatz = ''. &lt;/P&gt;&lt;P&gt;name = wa_XXX1-verna. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FIND '@' IN wa_XXX1-verna. &lt;/P&gt;&lt;P&gt;IF sy-subrc = 0. &lt;/P&gt;&lt;P&gt;REPLACE '@ ' IN wa_XXX1-verna WITH ''. &lt;/P&gt;&lt;P&gt;zusatz = '@ '. &lt;/P&gt;&lt;P&gt;ENDIF. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOOP AT it_nexceltab INTO wa_nexceltab.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;IF wa_XXX1-verna EQ wa_nexceltab-instralt.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;name = wa_nexceltab-instrneu.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;success = 'X'.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;                             &lt;STRONG&gt;EXIT.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ENDIF.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ENDLOOP.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;IF zusatz EQ '@ '. &lt;/P&gt;&lt;P&gt;CONCATENATE zusatz name INTO name. &lt;/P&gt;&lt;P&gt;zusatz = ''. &lt;/P&gt;&lt;P&gt;ENDIF. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wa_XXX1-verna = name. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;zps_s_mass-persnr = wa_XXX1-vernr. &lt;/P&gt;&lt;P&gt;zps_s_mass-nameinstr = wa_XXX1-verna. &lt;/P&gt;&lt;P&gt;zps_s_mass-tabelle = 'XXX1'. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF success EQ 'X'. &lt;/P&gt;&lt;P&gt;zps_s_mass-status = 'Mutation Erfolgreich'. &lt;/P&gt;&lt;P&gt;ELSE. &lt;/P&gt;&lt;P&gt;zps_s_mass-status = 'Mutation Fehlgeschlagen'. &lt;/P&gt;&lt;P&gt;ENDIF. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MODIFY it_XXX1 FROM wa_XXX1. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDLOOP. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have success and fun,&lt;/P&gt;&lt;P&gt;Heinz&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PS: Ich spreche auch Deutsch; bin aus Muenchen.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Mar 2008 22:10:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-structure/m-p/3601473#M867407</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-26T22:10:03Z</dc:date>
    </item>
    <item>
      <title>Re: problem with structure...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-structure/m-p/3601474#M867408</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Rafe,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A structure is basically a single set of different fields grouped using a single name - it can therefore only hold a single set of values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For your requirement you need to define an internal table with a layout that matches your structure:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: zpt_s_mass LIKE STANDARD TABLE OF zps_s_mass.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then, in each pass of the loop, after you have set the sructure values, you need to append them to the internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;IF success EQ 'X'.
zps_s_mass-status = 'Mutation Erfolgreich'.
ELSE.
zps_s_mass-status = 'Mutation Fehlgeschlagen'.
ENDIF.

APPEND zps_s_mass TO zpt_s_mass.    "&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;

MODIFY it_XXX1 FROM wa_XXX1.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Later on, you can get the values back one at a time by looping through the internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP AT zpt_s_mass INTO zps_s_mass.

...code to process

ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Andrew&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Mar 2008 00:54:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-structure/m-p/3601474#M867408</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-27T00:54:14Z</dc:date>
    </item>
    <item>
      <title>Re: problem with structure...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-structure/m-p/3601475#M867409</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi rafe,&lt;/P&gt;&lt;P&gt;see this code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data:it2_xx1 like wa_xx1 occurs 0 with header line.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT it_XXX1 INTO wa_XXX1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;success = ''.&lt;/P&gt;&lt;P&gt;zusatz = ''.&lt;/P&gt;&lt;P&gt;name = wa_XXX1-verna.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FIND '@' IN wa_XXX1-verna.&lt;/P&gt;&lt;P&gt;IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;REPLACE '@ ' IN wa_XXX1-verna WITH ''.&lt;/P&gt;&lt;P&gt;zusatz = '@ '.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT it_nexceltab INTO wa_nexceltab.&lt;/P&gt;&lt;P&gt;IF wa_XXX1-verna EQ wa_nexceltab-instralt.&lt;/P&gt;&lt;P&gt;name = wa_nexceltab-instrneu.&lt;/P&gt;&lt;P&gt;success = 'X'.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF zusatz EQ '@ '.&lt;/P&gt;&lt;P&gt;CONCATENATE zusatz name INTO name.&lt;/P&gt;&lt;P&gt;zusatz = ''.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wa_XXX1-verna = name.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;zps_s_mass-persnr = wa_XXX1-vernr.&lt;/P&gt;&lt;P&gt;zps_s_mass-nameinstr = wa_XXX1-verna.&lt;/P&gt;&lt;P&gt;zps_s_mass-tabelle = 'XXX1'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF success EQ 'X'.&lt;/P&gt;&lt;P&gt;zps_s_mass-status = 'Mutation Erfolgreich'.&lt;/P&gt;&lt;P&gt;ELSE.&lt;/P&gt;&lt;P&gt;zps_s_mass-status = 'Mutation Fehlgeschlagen'.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;move-corresponding wa_XXX1 to it2_xx1.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;append it2_xx1.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;clear it2_xx1.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Mar 2008 03:44:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-structure/m-p/3601475#M867409</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-27T03:44:02Z</dc:date>
    </item>
    <item>
      <title>Re: problem with structure...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-structure/m-p/3601476#M867410</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;defining an internal table with a layout that matches my structure solved the problem!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thx for all your help &lt;span class="lia-unicode-emoji" title=":grinning_face_with_big_eyes:"&gt;😃&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Mar 2008 07:47:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-structure/m-p/3601476#M867410</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-27T07:47:47Z</dc:date>
    </item>
  </channel>
</rss>

