<?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 Control level statement query in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/control-level-statement-query/m-p/12290700#M1989374</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
  &lt;P&gt;Hope you and your family are doing good. &lt;/P&gt;
  &lt;P&gt;I need one control level statement for a requirement I got. But I am not sure of which one i can use. &lt;/P&gt;
  &lt;P&gt;Requirement: will get the header+item data for a documents into internal table through excel / xls file. For suppose if a document has 5 line items, all the five line item header details must be same. Need to add a validation for that. For example, If we pass three documents, if document one has 2 line items, document two has 3 line items and document three has 3 line items. the sequence of records in the internal table will be as follows. We have one field in the internal table which stores line number, &lt;/P&gt;
  &lt;P&gt;1&lt;/P&gt;
  &lt;P&gt;2&lt;/P&gt;
  &lt;P&gt;1&lt;/P&gt;
  &lt;P&gt;2&lt;/P&gt;
  &lt;P&gt;3&lt;/P&gt;
  &lt;P&gt;1&lt;/P&gt;
  &lt;P&gt;2&lt;/P&gt;
  &lt;P&gt;3.&lt;/P&gt;
  &lt;P&gt;So, here I need to check all the header records document wise, which control statement I can use for this ? Can I use AT END OF line number ? Please suggest me the control level statement that fits for my requirement. &lt;/P&gt;</description>
    <pubDate>Thu, 05 Nov 2020 06:02:51 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2020-11-05T06:02:51Z</dc:date>
    <item>
      <title>Control level statement query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/control-level-statement-query/m-p/12290700#M1989374</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
  &lt;P&gt;Hope you and your family are doing good. &lt;/P&gt;
  &lt;P&gt;I need one control level statement for a requirement I got. But I am not sure of which one i can use. &lt;/P&gt;
  &lt;P&gt;Requirement: will get the header+item data for a documents into internal table through excel / xls file. For suppose if a document has 5 line items, all the five line item header details must be same. Need to add a validation for that. For example, If we pass three documents, if document one has 2 line items, document two has 3 line items and document three has 3 line items. the sequence of records in the internal table will be as follows. We have one field in the internal table which stores line number, &lt;/P&gt;
  &lt;P&gt;1&lt;/P&gt;
  &lt;P&gt;2&lt;/P&gt;
  &lt;P&gt;1&lt;/P&gt;
  &lt;P&gt;2&lt;/P&gt;
  &lt;P&gt;3&lt;/P&gt;
  &lt;P&gt;1&lt;/P&gt;
  &lt;P&gt;2&lt;/P&gt;
  &lt;P&gt;3.&lt;/P&gt;
  &lt;P&gt;So, here I need to check all the header records document wise, which control statement I can use for this ? Can I use AT END OF line number ? Please suggest me the control level statement that fits for my requirement. &lt;/P&gt;</description>
      <pubDate>Thu, 05 Nov 2020 06:02:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/control-level-statement-query/m-p/12290700#M1989374</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2020-11-05T06:02:51Z</dc:date>
    </item>
    <item>
      <title>Re: Control level statement query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/control-level-statement-query/m-p/12290701#M1989375</link>
      <description>&lt;P&gt;I don't understand neither the starting point nor what you exactly ask.&lt;/P&gt;&lt;P&gt;For the starting point, do you have one internal table like that?&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DOC_NUM   ITEM_NUM
-------   --------
1         1
1         2
2         1
2         2
2         3
3         1
3         2
3         3
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;What do you want to obtain? What did you try?&lt;/P&gt;&lt;P&gt;NB: Please use the CODE button to format tables.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Nov 2020 10:14:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/control-level-statement-query/m-p/12290701#M1989375</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2020-11-05T10:14:29Z</dc:date>
    </item>
    <item>
      <title>Re: Control level statement query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/control-level-statement-query/m-p/12290702#M1989376</link>
      <description>&lt;P&gt;As per my understanding of your question, you just have one column-"Line Number" in your table which identifies when a new document is started by having value 1.&lt;/P&gt;&lt;P&gt;So, you can put a check on this column and use condition-&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;IF itab-line_No EQ '1'.
...
ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;AT END OF won't work here as it will trigger at each record when line_no value will change which is each record of your loop.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Nov 2020 19:00:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/control-level-statement-query/m-p/12290702#M1989376</guid>
      <dc:creator>Pankaj_Gupta</dc:creator>
      <dc:date>2020-11-05T19:00:24Z</dc:date>
    </item>
    <item>
      <title>Re: Control level statement query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/control-level-statement-query/m-p/12290703#M1989377</link>
      <description>&lt;P&gt;I suppose your records look like
&amp;lt;header_number&amp;gt; &amp;lt;header_field1&amp;gt; ... &amp;lt;header_fieldn&amp;gt; &amp;lt;item_number&amp;gt; &amp;lt;irem_field1&amp;gt; &amp;lt;item_field2&amp;gt; ... and your internal table is already sorted by &amp;lt;header_number&amp;gt; &amp;lt;item_number&amp;gt;&lt;/P&gt;&lt;P&gt;I suggest something like&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP AT itab.
  " New header
  AT NEW &amp;lt;header_number&amp;gt;.
    new_header = 'X'.
  ENDAT
  " Process records (every field available)
  IF new_header = 'X'.
     move-corresponding record to header_structure.
  ELSE.  
    IF some header field &amp;lt;&amp;gt; saver header field
      " raise an error
    ENDIF. 
  ENDIF.
ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;If you don't have a header number, then check &amp;lt;item_number&amp;gt; = 1 instead of setting new_header flag. (And check that &amp;lt;item_number&amp;gt; is always 1 or previous value + 1)&lt;/P&gt;</description>
      <pubDate>Fri, 06 Nov 2020 14:25:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/control-level-statement-query/m-p/12290703#M1989377</guid>
      <dc:creator>RaymondGiuseppi</dc:creator>
      <dc:date>2020-11-06T14:25:04Z</dc:date>
    </item>
  </channel>
</rss>

