<?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: count in internal table in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/count-in-internal-table/m-p/4438571#M1053333</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;this means for example&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT itab INTO s_itab WHERE code_employee EQ g_code_employee.&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;the internal table has a field named code_employee, there .. you should filtrer with a field named g_code_employee&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PD: Sry for my bad english&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;David Carballido ^^&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 04 Sep 2008 20:55:37 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-09-04T20:55:37Z</dc:date>
    <item>
      <title>count in internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/count-in-internal-table/m-p/4438566#M1053328</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need code to perform this logic:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;fields: employee no., calendar day, hours.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to loop through an internal table to sort it with respect to employee no.and calendar day in ascending order.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to find out if 7 records exist for a particular employee.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If any employee has 7 records in that internal table, I need to store the hours of the latest day in a variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example, an emplyee has seven records for seven days in a week from Sunday though saturday, I need to store the saturday hours in a variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to do this for all employees with seven records and store.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please help me.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Sep 2008 19:56:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/count-in-internal-table/m-p/4438566#M1053328</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-04T19:56:12Z</dc:date>
    </item>
    <item>
      <title>Re: count in internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/count-in-internal-table/m-p/4438567#M1053329</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, try &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP AT ti_itab INTO ws_itab WHERE (condition employee).
  ADD 1 TO l_int.
  IF l_int EQ 7.
    EXIT.
  ENDIF.
ENDLOOP

IF l_int EQ 7.
  ... logic
ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Sep 2008 20:07:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/count-in-internal-table/m-p/4438567#M1053329</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-04T20:07:45Z</dc:date>
    </item>
    <item>
      <title>Re: count in internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/count-in-internal-table/m-p/4438568#M1053330</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If we have limited number of records probably we may use the following logic.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Step1 : if we have all the records in table I_MAIN.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Step2 : append lines of i_main to i_temp1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Step3 : delete adjacent entries in i_temp1 comparing employees.&lt;/P&gt;&lt;P&gt; By doing this we will get all the employee numbers.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Step 4: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;loop at i_temp1 into wa_temp1.

    At new employee.
" For every employee move all records to temp2.
      append lines of i_mail to i_temp2.
    End at.

Delete table i_temp2 where employee ne wa_temp1-employee.
" Remove other employee details from temp table.

Describe table i_temp2.
  if sy-tfill eq 7.
       sort i_temp2 descending order by date.
        read table i_temp2 index 1 into wa_temp2.
          move wa_temp2-value to ws_variable.         
  endif.

endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me know if there is any performance issue. This must work fast.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But don't use hash tables. Because SORT and DELETE will work slow on hash tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here you can use describe table or else you can use LINES( itab ) command which work faster.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All the very best to you.&lt;/P&gt;&lt;P&gt; - Mohan.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Sep 2008 20:21:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/count-in-internal-table/m-p/4438568#M1053330</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-04T20:21:03Z</dc:date>
    </item>
    <item>
      <title>Re: count in internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/count-in-internal-table/m-p/4438569#M1053331</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Raj,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please go through the below code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
SORT t_itab with key emp_no cal.
LOOP AT t_itab INTO w_itab WHERE (condition employee).
  if w_itab-emp_no EQ empno_temp.
     count = count + 1.
  endif.
  empno_temp = w_itab-empno.
  if count EQ 7.
    hour_temp = w_itab-hour . 
  endif.
You can use the hour_temp which will get the latest hours if employee has 7 records.
ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this program will help you. Please let me know if you are still facing the problem. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Ravi Kanth.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Sep 2008 20:39:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/count-in-internal-table/m-p/4438569#M1053331</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-04T20:39:41Z</dc:date>
    </item>
    <item>
      <title>Re: count in internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/count-in-internal-table/m-p/4438570#M1053332</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;what does this mean?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;WHERE (condition employee).&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Sep 2008 20:42:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/count-in-internal-table/m-p/4438570#M1053332</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-04T20:42:04Z</dc:date>
    </item>
    <item>
      <title>Re: count in internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/count-in-internal-table/m-p/4438571#M1053333</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;this means for example&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT itab INTO s_itab WHERE code_employee EQ g_code_employee.&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;the internal table has a field named code_employee, there .. you should filtrer with a field named g_code_employee&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PD: Sry for my bad english&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;David Carballido ^^&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Sep 2008 20:55:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/count-in-internal-table/m-p/4438571#M1053333</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-04T20:55:37Z</dc:date>
    </item>
    <item>
      <title>Re: count in internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/count-in-internal-table/m-p/4438572#M1053334</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;There is no need of the where condition for which I have given for you.&lt;/P&gt;&lt;P&gt;You can remove that if you are fallowing my logic.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Sep 2008 21:35:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/count-in-internal-table/m-p/4438572#M1053334</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-04T21:35:16Z</dc:date>
    </item>
  </channel>
</rss>

