2007 Feb 04 3:51 PM
Hallow I have a problem to sum recorded in table .
I have a 2 tables first table <b>emp_tab</b> is table with pernr (employee number) org unit and jobs and hour for employee
And second table (my main table) t_itab that have org unit and jobs of employee
Emp_tab is like that
Job org.unit person_num hour
50 00007676 00000163 00100003
22 00009001 00000163 00100004
15 00295349 00000273 00096050
5 02523298 00000273 00250052
6 02906773 00000273 00250052
7 07859563 00000163 00000040
8 09863256 00000163 00000040
9 31049912 00000273 00250052
I wont to sum the hour that employee do in org.unit (like163) and job (like 40) and move it to my main table t_itab.
Ex. In org_unit 163 and job 40 the sum is 15 hours
And this sum I wont to move to a new field In t_itab
the Keys job and org.unit
Maybe some one have idea how to do that
Tanks for your time
2007 Feb 04 4:47 PM
Hi Antonio,
You can create new internal table (emp_tab2) with fields like this.
...
DATA: BEGIN OF EMP_TAB2 OCCURS 0,
JOB_ORG LIKE ...
JOB LIKE ...
ORG_UNIT ...
PERSON_NUM LIKE ...
HOUR LIKE ...
DATA: END OF EMP_TAB2.
SORT EMP_TAB.
LOOP AT EMP_TAB.
MOVE EMP_TAB-JOB TO EMP_TAB2-JOB_ORG(2).
MOVE EMP_TAB-ORG_UNIT TO EMP_TAB2-JOB_ORF+2(8).
MOVE EMP_TAB-PERSON TO EMP_TAB2-PERSON.
MOVE EMP_TAB-HOUR TO EMP_TAB2-HOUR.
COLLECT EMP_TAB2.
ENDLOOP.
...
Now .. the EMP_TAB2 has the sum of hour by combinnatino of job and org.unit.
Next, you can move EMP_TAB2 data to internal table T_TAB.
Please check the syntax and hope this will help.
Regards,
Ferry Lianto
Hallow I have a problem to sum recorded in table .
I have a 2 tables first table <b>emp_tab</b> is table with pernr (employee number) org unit and jobs and hour for employee
And second table (my main table) t_itab that have org unit and jobs of employee
Emp_tab is like that
Job org.unit person_num hour
50 00007676 00000163 00100003
22 00009001 00000163 00100004
15 00295349 00000273 00096050
5 02523298 00000273 00250052
6 02906773 00000273 00250052
7 07859563 00000163 00000040
8 09863256 00000163 00000040
9 31049912 00000273 00250052
I wont to sum the hour that employee do in org.unit (like163) and job (like 40) and move it to my main table t_itab.
Ex. In org_unit 163 and job 40 the sum is 15 hours
And this sum I wont to move to a new field In t_itab
the Keys job and org.unit
Maybe some one have idea how to do that
Tanks for your time
2007 Feb 04 4:47 PM
Hi Antonio,
You can create new internal table (emp_tab2) with fields like this.
...
DATA: BEGIN OF EMP_TAB2 OCCURS 0,
JOB_ORG LIKE ...
JOB LIKE ...
ORG_UNIT ...
PERSON_NUM LIKE ...
HOUR LIKE ...
DATA: END OF EMP_TAB2.
SORT EMP_TAB.
LOOP AT EMP_TAB.
MOVE EMP_TAB-JOB TO EMP_TAB2-JOB_ORG(2).
MOVE EMP_TAB-ORG_UNIT TO EMP_TAB2-JOB_ORF+2(8).
MOVE EMP_TAB-PERSON TO EMP_TAB2-PERSON.
MOVE EMP_TAB-HOUR TO EMP_TAB2-HOUR.
COLLECT EMP_TAB2.
ENDLOOP.
...
Now .. the EMP_TAB2 has the sum of hour by combinnatino of job and org.unit.
Next, you can move EMP_TAB2 data to internal table T_TAB.
Please check the syntax and hope this will help.
Regards,
Ferry Lianto
2007 Feb 04 5:19 PM