<?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 Looping internal table and adding values in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/looping-internal-table-and-adding-values/m-p/11886249#M1961076</link>
    <description>&lt;P&gt;All, I need your help. I am pulling a hand full of fields from tables PA0001 (werks, pernr, btrtl, orgeh, bukrs, kostl, plans) table PA0002 (vorna, nachn) and table PA0105 (usrid, usrid_long) and placing them into an internal table by PERNR being the key.&lt;/P&gt;
  &lt;P&gt;Next, I need to loop my internal table (i_employee) and for each PERNR, fill the field 'usrid_long' with the value PA0105-usrid_long where PA0105-subty = '0010'. "This is not working. The table isnt getting updated.&lt;/P&gt;
  &lt;P&gt;Also, I need to call a function module 'Z_HR_GET_MGR_BY_ORG' to fetch the manager PERNR for each pernr in my internal table. I pass the employee position (i_employee-plans) and recieve the manager pernr (chief). I need to store the returned value in my internal table for each pernr. This is also not working. I can confirm the FM is working correctly.&lt;/P&gt;
  &lt;P&gt;Then I need to compare the manager pernr I grabbed against the pernr in my IT. If they are equal, pass 'Y' to approver and if not, pass 'N' to approver.&lt;/P&gt;
  &lt;P&gt;Below is my code. Can anyone fix my code for an abap beginner? Much appreciated.&lt;/P&gt;
  &lt;P&gt; TABLES:&lt;BR /&gt; pa0001,&lt;BR /&gt; pa0105,&lt;BR /&gt; pa0002.&lt;BR /&gt; &lt;BR /&gt; DATA: w_werks LIKE pa0001-werks. "PersonnelArea&lt;BR /&gt; DATA: w_pernr LIKE pa0001-pernr. "VendorID&lt;BR /&gt; DATA: w_btrtl LIKE pa0001-btrtl. "SubArea&lt;BR /&gt; DATA: w_orgeh LIKE pa0001-orgeh. "OrgUnit&lt;BR /&gt; DATA: w_usrid LIKE pa0105-usrid. "USerID&lt;BR /&gt; DATA: w_usridl LIKE pa0105-usrid_long. "EmailAddress / LogonID&lt;BR /&gt; DATA: w_vorna LIKE pa0002-vorna. "EmployeeFirstName&lt;BR /&gt; DATA: w_nachn LIKE pa0002-nachn. "EmployeeLastName&lt;BR /&gt; DATA: w_bukrs LIKE pa0001-bukrs. "CompanyCode&lt;BR /&gt; DATA: w_kostl LIKE pa0001-kostl. "CostCenter&lt;BR /&gt; DATA: w_mgrpos LIKE pa0001-plans. "Position&lt;BR /&gt; DATA: chief TYPE persno. "Chief / Manager ID&lt;BR /&gt; DATA: approver TYPE string. "Approver, Y or N&lt;BR /&gt; DATA: employee_file TYPE rlgrap-filename.&lt;BR /&gt; DATA: w_pos LIKE sy-fdpos.&lt;BR /&gt; DATA: w_pos2 LIKE sy-fdpos.&lt;BR /&gt; DATA: date LIKE sy-datum.&lt;BR /&gt; FIELD-SYMBOLS: &amp;lt;fs_approver&amp;gt; TYPE ANY.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt; TYPES:&lt;BR /&gt; BEGIN OF t_pernr,&lt;BR /&gt; pernr TYPE pa0001-pernr,&lt;BR /&gt; werks TYPE pa0001-werks,&lt;BR /&gt; btrtl TYPE pa0001-btrtl,&lt;BR /&gt; orgeh TYPE pa0001-orgeh,&lt;BR /&gt; bukrs TYPE pa0001-bukrs,&lt;BR /&gt; kostl TYPE pa0001-kostl,&lt;BR /&gt; vorna TYPE pa0002-vorna,&lt;BR /&gt; nachn TYPE pa0002-nachn,&lt;BR /&gt; usrid TYPE pa0105-usrid,&lt;BR /&gt; usrid_long TYPE pa0105-usrid_long,&lt;BR /&gt; plans TYPE pa0001-plans,&lt;BR /&gt; chief TYPE persno,&lt;BR /&gt; subty TYPE pa0105-subty,&lt;BR /&gt; approver,&lt;BR /&gt; END OF t_pernr.&lt;BR /&gt; &lt;BR /&gt; DATA: i_employee TYPE TABLE OF t_pernr WITH HEADER LINE.&lt;BR /&gt; &lt;BR /&gt; DATA: w_employee TYPE t_pernr.&lt;BR /&gt; &lt;BR /&gt; * Join all tables together by PERNR and use as key to pull necessary fields&lt;BR /&gt; SELECT pa0001~pernr pa0001~werks pa0002~vorna pa0002~nachn pa0001~btrtl pa0001~orgeh pa0001~bukrs pa0001~kostl&lt;BR /&gt; pa0105~usrid pa0001~plans&lt;BR /&gt; INTO CORRESPONDING FIELDS OF TABLE i_employee&lt;BR /&gt; FROM pa0001 INNER JOIN pa0002 ON pa0001~pernr = pa0002~pernr INNER JOIN pa0105 ON pa0001~pernr = pa0105~pernr&lt;BR /&gt; WHERE pa0105~SUBTY = '0001' AND pa0001~endda = '99991231'.&lt;BR /&gt; &lt;BR /&gt; * Grab email address for each employee - subtype 0010&lt;BR /&gt; LOOP at i_employee.&lt;BR /&gt; i_employee-usrid_long = pa0105-usrid_long.&lt;BR /&gt; MODIFY i_employee TRANSPORTING usrid_long WHERE pernr = pa0105-pernr AND subty = '0010'.&lt;BR /&gt; ENDLOOP.&lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt; * Pass employee position to FM to grab chief / expense approver ID&lt;BR /&gt; SORT i_employee BY pernr.&lt;BR /&gt; LOOP AT i_employee ASSIGNING &amp;lt;fs_approver&amp;gt;.&lt;BR /&gt; CALL FUNCTION 'Z_HR_GET_MGR_BY_ORG'&lt;BR /&gt; EXPORTING&lt;BR /&gt; plans = i_employee-plans&lt;BR /&gt; IMPORTING&lt;BR /&gt; mgr_pernr = chief.&lt;BR /&gt; IF i_employee-chief EQ i_employee-pernr.&lt;BR /&gt; i_employee-approver = 'Y'.&lt;BR /&gt; ELSE.&lt;BR /&gt; i_employee-approver = 'N'.&lt;BR /&gt; ENDIF.&lt;BR /&gt; ENDLOOP.&lt;/P&gt;</description>
    <pubDate>Mon, 15 Apr 2019 13:19:42 GMT</pubDate>
    <dc:creator>former_member518858</dc:creator>
    <dc:date>2019-04-15T13:19:42Z</dc:date>
    <item>
      <title>Looping internal table and adding values</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/looping-internal-table-and-adding-values/m-p/11886249#M1961076</link>
      <description>&lt;P&gt;All, I need your help. I am pulling a hand full of fields from tables PA0001 (werks, pernr, btrtl, orgeh, bukrs, kostl, plans) table PA0002 (vorna, nachn) and table PA0105 (usrid, usrid_long) and placing them into an internal table by PERNR being the key.&lt;/P&gt;
  &lt;P&gt;Next, I need to loop my internal table (i_employee) and for each PERNR, fill the field 'usrid_long' with the value PA0105-usrid_long where PA0105-subty = '0010'. "This is not working. The table isnt getting updated.&lt;/P&gt;
  &lt;P&gt;Also, I need to call a function module 'Z_HR_GET_MGR_BY_ORG' to fetch the manager PERNR for each pernr in my internal table. I pass the employee position (i_employee-plans) and recieve the manager pernr (chief). I need to store the returned value in my internal table for each pernr. This is also not working. I can confirm the FM is working correctly.&lt;/P&gt;
  &lt;P&gt;Then I need to compare the manager pernr I grabbed against the pernr in my IT. If they are equal, pass 'Y' to approver and if not, pass 'N' to approver.&lt;/P&gt;
  &lt;P&gt;Below is my code. Can anyone fix my code for an abap beginner? Much appreciated.&lt;/P&gt;
  &lt;P&gt; TABLES:&lt;BR /&gt; pa0001,&lt;BR /&gt; pa0105,&lt;BR /&gt; pa0002.&lt;BR /&gt; &lt;BR /&gt; DATA: w_werks LIKE pa0001-werks. "PersonnelArea&lt;BR /&gt; DATA: w_pernr LIKE pa0001-pernr. "VendorID&lt;BR /&gt; DATA: w_btrtl LIKE pa0001-btrtl. "SubArea&lt;BR /&gt; DATA: w_orgeh LIKE pa0001-orgeh. "OrgUnit&lt;BR /&gt; DATA: w_usrid LIKE pa0105-usrid. "USerID&lt;BR /&gt; DATA: w_usridl LIKE pa0105-usrid_long. "EmailAddress / LogonID&lt;BR /&gt; DATA: w_vorna LIKE pa0002-vorna. "EmployeeFirstName&lt;BR /&gt; DATA: w_nachn LIKE pa0002-nachn. "EmployeeLastName&lt;BR /&gt; DATA: w_bukrs LIKE pa0001-bukrs. "CompanyCode&lt;BR /&gt; DATA: w_kostl LIKE pa0001-kostl. "CostCenter&lt;BR /&gt; DATA: w_mgrpos LIKE pa0001-plans. "Position&lt;BR /&gt; DATA: chief TYPE persno. "Chief / Manager ID&lt;BR /&gt; DATA: approver TYPE string. "Approver, Y or N&lt;BR /&gt; DATA: employee_file TYPE rlgrap-filename.&lt;BR /&gt; DATA: w_pos LIKE sy-fdpos.&lt;BR /&gt; DATA: w_pos2 LIKE sy-fdpos.&lt;BR /&gt; DATA: date LIKE sy-datum.&lt;BR /&gt; FIELD-SYMBOLS: &amp;lt;fs_approver&amp;gt; TYPE ANY.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt; TYPES:&lt;BR /&gt; BEGIN OF t_pernr,&lt;BR /&gt; pernr TYPE pa0001-pernr,&lt;BR /&gt; werks TYPE pa0001-werks,&lt;BR /&gt; btrtl TYPE pa0001-btrtl,&lt;BR /&gt; orgeh TYPE pa0001-orgeh,&lt;BR /&gt; bukrs TYPE pa0001-bukrs,&lt;BR /&gt; kostl TYPE pa0001-kostl,&lt;BR /&gt; vorna TYPE pa0002-vorna,&lt;BR /&gt; nachn TYPE pa0002-nachn,&lt;BR /&gt; usrid TYPE pa0105-usrid,&lt;BR /&gt; usrid_long TYPE pa0105-usrid_long,&lt;BR /&gt; plans TYPE pa0001-plans,&lt;BR /&gt; chief TYPE persno,&lt;BR /&gt; subty TYPE pa0105-subty,&lt;BR /&gt; approver,&lt;BR /&gt; END OF t_pernr.&lt;BR /&gt; &lt;BR /&gt; DATA: i_employee TYPE TABLE OF t_pernr WITH HEADER LINE.&lt;BR /&gt; &lt;BR /&gt; DATA: w_employee TYPE t_pernr.&lt;BR /&gt; &lt;BR /&gt; * Join all tables together by PERNR and use as key to pull necessary fields&lt;BR /&gt; SELECT pa0001~pernr pa0001~werks pa0002~vorna pa0002~nachn pa0001~btrtl pa0001~orgeh pa0001~bukrs pa0001~kostl&lt;BR /&gt; pa0105~usrid pa0001~plans&lt;BR /&gt; INTO CORRESPONDING FIELDS OF TABLE i_employee&lt;BR /&gt; FROM pa0001 INNER JOIN pa0002 ON pa0001~pernr = pa0002~pernr INNER JOIN pa0105 ON pa0001~pernr = pa0105~pernr&lt;BR /&gt; WHERE pa0105~SUBTY = '0001' AND pa0001~endda = '99991231'.&lt;BR /&gt; &lt;BR /&gt; * Grab email address for each employee - subtype 0010&lt;BR /&gt; LOOP at i_employee.&lt;BR /&gt; i_employee-usrid_long = pa0105-usrid_long.&lt;BR /&gt; MODIFY i_employee TRANSPORTING usrid_long WHERE pernr = pa0105-pernr AND subty = '0010'.&lt;BR /&gt; ENDLOOP.&lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt; * Pass employee position to FM to grab chief / expense approver ID&lt;BR /&gt; SORT i_employee BY pernr.&lt;BR /&gt; LOOP AT i_employee ASSIGNING &amp;lt;fs_approver&amp;gt;.&lt;BR /&gt; CALL FUNCTION 'Z_HR_GET_MGR_BY_ORG'&lt;BR /&gt; EXPORTING&lt;BR /&gt; plans = i_employee-plans&lt;BR /&gt; IMPORTING&lt;BR /&gt; mgr_pernr = chief.&lt;BR /&gt; IF i_employee-chief EQ i_employee-pernr.&lt;BR /&gt; i_employee-approver = 'Y'.&lt;BR /&gt; ELSE.&lt;BR /&gt; i_employee-approver = 'N'.&lt;BR /&gt; ENDIF.&lt;BR /&gt; ENDLOOP.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Apr 2019 13:19:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/looping-internal-table-and-adding-values/m-p/11886249#M1961076</guid>
      <dc:creator>former_member518858</dc:creator>
      <dc:date>2019-04-15T13:19:42Z</dc:date>
    </item>
    <item>
      <title>Re: Looping internal table and adding values</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/looping-internal-table-and-adding-values/m-p/11886250#M1961077</link>
      <description>&lt;P&gt;If only you'd used the "code" button in the editor to post your code in a nicely formatted way, I might take the time to look at it. &lt;/P&gt;</description>
      <pubDate>Mon, 15 Apr 2019 13:37:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/looping-internal-table-and-adding-values/m-p/11886250#M1961077</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2019-04-15T13:37:18Z</dc:date>
    </item>
    <item>
      <title>Re: Looping internal table and adding values</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/looping-internal-table-and-adding-values/m-p/11886251#M1961078</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;My apologies, hopefully this helps.

TABLES:&lt;BR /&gt;pa0001,&lt;BR /&gt;pa0105,&lt;BR /&gt;pa0002.&lt;BR /&gt;DATA: w_werks LIKE pa0001-werks. "PersonnelArea&lt;BR /&gt;DATA: w_pernr LIKE pa0001-pernr. "VendorID&lt;BR /&gt;DATA: w_btrtl LIKE pa0001-btrtl. "SubArea&lt;BR /&gt;DATA: w_orgeh LIKE pa0001-orgeh. "OrgUnit&lt;BR /&gt;DATA: w_usrid LIKE pa0105-usrid. "USerID&lt;BR /&gt;DATA: w_usridl LIKE pa0105-usrid_long. "EmailAddress / LogonID&lt;BR /&gt;DATA: w_vorna LIKE pa0002-vorna. "EmployeeFirstName&lt;BR /&gt;DATA: w_nachn LIKE pa0002-nachn. "EmployeeLastName&lt;BR /&gt;DATA: w_bukrs LIKE pa0001-bukrs. "CompanyCode&lt;BR /&gt;DATA: w_kostl LIKE pa0001-kostl. "CostCenter&lt;BR /&gt;DATA: w_mgrpos LIKE pa0001-plans. "Position&lt;BR /&gt;DATA: chief TYPE persno. "Chief / Manager ID&lt;BR /&gt;DATA: approver TYPE string. "Approver, Y or N&lt;BR /&gt;DATA: employee_file TYPE rlgrap-filename.&lt;BR /&gt;DATA: w_pos LIKE sy-fdpos.&lt;BR /&gt;DATA: w_pos2 LIKE sy-fdpos.&lt;BR /&gt;DATA: date LIKE sy-datum.&lt;BR /&gt;FIELD-SYMBOLS: &amp;lt;fs_approver&amp;gt; TYPE ANY.&lt;BR /&gt;&lt;BR /&gt;TYPES:&lt;BR /&gt;BEGIN OF t_pernr,&lt;BR /&gt;pernr TYPE pa0001-pernr,&lt;BR /&gt;werks TYPE pa0001-werks,&lt;BR /&gt;btrtl TYPE pa0001-btrtl,&lt;BR /&gt;orgeh TYPE pa0001-orgeh,&lt;BR /&gt;bukrs TYPE pa0001-bukrs,&lt;BR /&gt;kostl TYPE pa0001-kostl,&lt;BR /&gt;vorna TYPE pa0002-vorna,&lt;BR /&gt;nachn TYPE pa0002-nachn,&lt;BR /&gt;usrid TYPE pa0105-usrid,&lt;BR /&gt;usrid_long TYPE pa0105-usrid_long,&lt;BR /&gt;plans TYPE pa0001-plans,&lt;BR /&gt;chief TYPE persno,&lt;BR /&gt;subty TYPE pa0105-subty,&lt;BR /&gt;approver,&lt;BR /&gt;END OF t_pernr.&lt;BR /&gt;DATA: i_employee TYPE TABLE OF t_pernr WITH HEADER LINE.&lt;BR /&gt;DATA: w_employee TYPE t_pernr.&lt;BR /&gt;* Join all tables together by PERNR and use as key to pull necessary fields&lt;BR /&gt;SELECT pa0001~pernr pa0001~werks pa0002~vorna pa0002~nachn pa0001~btrtl pa0001~orgeh pa0001~bukrs pa0001~kostl&lt;BR /&gt;pa0105~usrid pa0001~plans&lt;BR /&gt;INTO CORRESPONDING FIELDS OF TABLE i_employee&lt;BR /&gt;FROM pa0001 INNER JOIN pa0002 ON pa0001~pernr = pa0002~pernr INNER JOIN pa0105 ON pa0001~pernr = pa0105~pernr&lt;BR /&gt;WHERE pa0105~SUBTY = '0001' AND pa0001~endda = '99991231'.&lt;BR /&gt;* Grab email address for each employee - subtype 0010&lt;BR /&gt;LOOP at i_employee.&lt;BR /&gt;i_employee-usrid_long = pa0105-usrid_long.&lt;BR /&gt;MODIFY i_employee TRANSPORTING usrid_long WHERE pernr = pa0105-pernr AND subty = '0010'.&lt;BR /&gt;ENDLOOP.&lt;BR /&gt;&lt;BR /&gt;* Pass employee position to FM to grab chief / expense approver ID&lt;BR /&gt;SORT i_employee BY pernr.&lt;BR /&gt;LOOP AT i_employee ASSIGNING &amp;lt;fs_approver&amp;gt;.&lt;BR /&gt;CALL FUNCTION 'Z_HR_GET_MGR_BY_ORG'&lt;BR /&gt;EXPORTING&lt;BR /&gt;plans = i_employee-plans&lt;BR /&gt;IMPORTING&lt;BR /&gt;mgr_pernr = chief.&lt;BR /&gt;IF i_employee-chief EQ i_employee-pernr.&lt;BR /&gt;i_employee-approver = 'Y'.&lt;BR /&gt;ELSE.&lt;BR /&gt;i_employee-approver = 'N'.&lt;BR /&gt;ENDIF.&lt;BR /&gt;ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 15 Apr 2019 13:42:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/looping-internal-table-and-adding-values/m-p/11886251#M1961078</guid>
      <dc:creator>former_member518858</dc:creator>
      <dc:date>2019-04-15T13:42:07Z</dc:date>
    </item>
    <item>
      <title>Re: Looping internal table and adding values</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/looping-internal-table-and-adding-values/m-p/11886252#M1961079</link>
      <description>&lt;P&gt;If you tried debugging, you'd find that the reason your internal table isn't updating is because there are no records that match your criteria.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Apr 2019 13:45:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/looping-internal-table-and-adding-values/m-p/11886252#M1961079</guid>
      <dc:creator>ArthurParisius</dc:creator>
      <dc:date>2019-04-15T13:45:37Z</dc:date>
    </item>
    <item>
      <title>Re: Looping internal table and adding values</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/looping-internal-table-and-adding-values/m-p/11886253#M1961080</link>
      <description>&lt;P&gt;&lt;A href="https://answers.sap.com/users/209949/ryanchris.html"&gt;Ryan Higgins&lt;/A&gt; you should better &lt;STRONG&gt;EDIT&lt;/STRONG&gt; your question rather posting a new comment with the formatted code &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Apr 2019 13:48:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/looping-internal-table-and-adding-values/m-p/11886253#M1961080</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2019-04-15T13:48:50Z</dc:date>
    </item>
    <item>
      <title>Re: Looping internal table and adding values</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/looping-internal-table-and-adding-values/m-p/11886254#M1961081</link>
      <description>&lt;P&gt;Hello, to better clarify my question. I am using a select to pull multiple fields from multiple HR tables into one itab by key PERNR shown below.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt; SELECT pa0001~pernr pa0001~werks pa0002~vorna pa0002~nachn pa0001~btrtl pa0001~orgeh pa0001~bukrs pa0001~kostl
 pa0105~usrid pa0001~plans
 INTO CORRESPONDING FIELDS OF TABLE i_employee
 FROM pa0001 INNER JOIN pa0002 ON pa0001~pernr = pa0002~pernr INNER JOIN pa0105 ON pa0001~pernr = pa0105~pernr
 WHERE pa0105~SUBTY = '0001' AND pa0001~endda = '99991231'.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Next, I want to loop through this itab (i_employee) and update the usrid_long field with the value from PA0105-usrid_long for each PERNR. This part is where I need help.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;   LOOP at i_employee.
 i_employee-usrid_long = pa0105-usrid_long.
 MODIFY i_employee TRANSPORTING usrid_long WHERE pernr = pa0105-pernr AND subty = '0010'.
 ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 15 Apr 2019 14:07:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/looping-internal-table-and-adding-values/m-p/11886254#M1961081</guid>
      <dc:creator>former_member518858</dc:creator>
      <dc:date>2019-04-15T14:07:30Z</dc:date>
    </item>
    <item>
      <title>Re: Looping internal table and adding values</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/looping-internal-table-and-adding-values/m-p/11886255#M1961082</link>
      <description>Hi Ryan,Your code is working.But, where is the PA0105 table query? First you need to fill the table and, after this, do the comparison respecting the WHERE conditions.</description>
      <pubDate>Mon, 15 Apr 2019 14:52:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/looping-internal-table-and-adding-values/m-p/11886255#M1961082</guid>
      <dc:creator>Private_Member_447388</dc:creator>
      <dc:date>2019-04-15T14:52:11Z</dc:date>
    </item>
    <item>
      <title>Re: Looping internal table and adding values</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/looping-internal-table-and-adding-values/m-p/11886256#M1961083</link>
      <description>&lt;P&gt;Thanks for the help Thiago.&lt;/P&gt;&lt;P&gt;Would something like this work&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt; LOOP at i_employee.
 SELECT pa0105~usrid_long FROM pa0105 INTO i_employee-usrid_long WHERE pernr = pa0105~pernr AND subty = '0010'.
 ENDSELECT.
 ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 15 Apr 2019 15:11:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/looping-internal-table-and-adding-values/m-p/11886256#M1961083</guid>
      <dc:creator>former_member518858</dc:creator>
      <dc:date>2019-04-15T15:11:46Z</dc:date>
    </item>
    <item>
      <title>Re: Looping internal table and adding values</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/looping-internal-table-and-adding-values/m-p/11886257#M1961084</link>
      <description>&lt;P&gt;HI &lt;A href="https://answers.sap.com/users/209949/ryanchris.html"&gt;Ryan Higgins&lt;/A&gt;, this may help pls check this.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;** First fill the pa0105 and follow below it may work.
LOOP at i_employee.
read table pa0105 intl lwa_pa0105 with key perner = i_employee-perner.
i_employee-usrid_long = lwa_pa0105-usrid_long.
MODIFY i_employee TRANSPORTING usrid_long WHERE pernr = lwa_pa0105-pernr AND subty = '0010'.
ENDLOOP.
&amp;lt;br&amp;gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 15 Apr 2019 16:34:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/looping-internal-table-and-adding-values/m-p/11886257#M1961084</guid>
      <dc:creator>former_member596005</dc:creator>
      <dc:date>2019-04-15T16:34:44Z</dc:date>
    </item>
    <item>
      <title>Re: Looping internal table and adding values</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/looping-internal-table-and-adding-values/m-p/11886258#M1961085</link>
      <description>&lt;P&gt;Hi Jagadeesh,&lt;/P&gt;&lt;P&gt;I am getting error "." epected after "PA0105". when I try that code.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Apr 2019 19:34:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/looping-internal-table-and-adding-values/m-p/11886258#M1961085</guid>
      <dc:creator>former_member518858</dc:creator>
      <dc:date>2019-04-15T19:34:26Z</dc:date>
    </item>
    <item>
      <title>Re: Looping internal table and adding values</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/looping-internal-table-and-adding-values/m-p/11886259#M1961086</link>
      <description>&lt;P&gt;first, dont use the table with header line.&lt;/P&gt;&lt;P&gt;second, there is no query to select pa0105 with subty = 0010.&lt;/P&gt;&lt;P&gt;third, loop the employee table without condition to compare with pa0105 is wrong way, table also cant dirrectly access like you did. are you trying to copy the usrid_long form subty 0010 to 0001? if not you should consider to do it in query instead of loop.&lt;/P&gt;&lt;P&gt;last thing, you could finger it out by yourself, its quite basic abap you cant jump into some language without learning it.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Apr 2019 00:42:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/looping-internal-table-and-adding-values/m-p/11886259#M1961086</guid>
      <dc:creator>DoanManhQuynh</dc:creator>
      <dc:date>2019-04-16T00:42:33Z</dc:date>
    </item>
    <item>
      <title>Re: Looping internal table and adding values</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/looping-internal-table-and-adding-values/m-p/11886260#M1961087</link>
      <description>&lt;P&gt;I agree. This is a very basic piece of code, and there's so much wrong with it it - it looks like programming by guessing how the language works. I suggest you spend some time working through some books on learning ABAP, or go on a course. before attempting real programs.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Apr 2019 07:25:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/looping-internal-table-and-adding-values/m-p/11886260#M1961087</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2019-04-16T07:25:54Z</dc:date>
    </item>
    <item>
      <title>Re: Looping internal table and adding values</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/looping-internal-table-and-adding-values/m-p/11886261#M1961088</link>
      <description>&lt;P&gt;Hi Ryan,&lt;/P&gt;&lt;P&gt;As some people already said here, you don't need to use the addition "with header line" in your internal table. And depending on your NW version you may not even declare this table statically, you can use inline declaration on your select command, like: ... into table @data(lt_employee) ...&lt;/P&gt;&lt;P&gt;Then, to update your internal table use the field symbol from your loop, like below:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;"Statically declaring the field-symbol:
field-symbols &amp;lt;ls_employee&amp;gt; like line of lt_employee.
loop at lt_employee assigning &amp;lt;ls_employee&amp;gt;.
    &amp;lt;ls_employee&amp;gt;-field1 = 'content'.
    &amp;lt;ls_employee&amp;gt;-field2 = 'content'.
  endif.
endloop.

"Or using inline declaration:
loop at lt_employee assigning field-symbol(&amp;lt;ls_employee&amp;gt;).  
    &amp;lt;ls_employee&amp;gt;-field1 = 'content'.
    &amp;lt;ls_employee&amp;gt;-field2 = 'content'.
  endif.
endloop.&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 16 Apr 2019 10:38:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/looping-internal-table-and-adding-values/m-p/11886261#M1961088</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2019-04-16T10:38:48Z</dc:date>
    </item>
  </channel>
</rss>

