‎2005 Oct 21 12:33 PM
my code look like this:-
data: empm like BAPI7013_4 occurs 0 with header line,
time like BAPI7013_1 occurs 0 with header line.
data: reg_hours like time-REGULARHOURS,
abs_hours like time-ABSENCEHOURS,
overtime_hours like time-OVERTIMEHOURS,
hours_work like time.
append all the employees
empm-EMPLOYEENUMBER = '00071630'.
append empm.
clear empm.
This is for only employee number 71630.
Now, i want LOOP OVER EVERY EMPLOYEE AND APPEND TO THE TABLE EMPM
how should i do this?
‎2005 Oct 21 12:35 PM
Hari,
Where is the employee data? Is it in a internal table, then loop at that table and append it as you want. If it is there in the database table, use a SELECT get into a internal table and loop at the same.
Could you please give more details?
Regards,
Ravi
‎2005 Oct 21 1:28 PM
hai...
just hav a look on the code.
i posted entire code.
empm is like BAPI7013_4
t q.
‎2005 Oct 21 12:35 PM
select pernr into table empm from pa0001 ....
what is the problem ?
regards
Frédéric
‎2005 Oct 21 12:43 PM
hai..i am just posting the code . hav a look on this.
i want to calculate the no. of hours worked for all the employees that are in the table.
this code is for the selected employee
data: empm like BAPI7013_4 occurs 0 with header line,
time like BAPI7013_1 occurs 0 with header line.
data: reg_hours like time-REGULARHOURS,
abs_hours like time-ABSENCEHOURS,
overtime_hours like time-OVERTIMEHOURS,
hours_work like time.
append all the employees
<b>empm-EMPLOYEENUMBER = '00071630'.</b>
append empm.
clear empm.
*----
CALL FUNCTION 'BAPI_PTIMEOVERVIEW_GET'
EXPORTING
FROMDATE = '20051001'
TODATE = '20051031'
EXTAPPLICATION = ' '
TABLES
EMPLOYEES = empm
TIMETYPES =
TIMEOVERVIEW = time
TIMETYPEVALUES =
RETURN =
.
loop at time.
reg_hours = time-REGULARHOURS + reg_hours.
abs_hours = time-ABSENCEHOURS + abs_hours.
overtime_hours = time-OVERTIMEHOURS + overtime_hours.
hours_work = ( reg_hours - abs_hours ) + overtime_hours.
endloop.
write: / reg_hours.
write: / abs_hours.
write: / overtime_hours.
write: / hours_work.
i want to LOOP OVER EVERY EMPLOYEE AND APPEND TO THE TABLE EMPM
‎2005 Oct 21 12:48 PM
Hari,
I don't think you are getting what everyone is asking. We understand that you want to calculate the no. of hours for all the employees. However, where is the employees data? If you have not selected the same the DB, you need to do that.
DATA : t_pa001 type table of pa001.
DATA : workarea type pa001
SELECT (Fields) from PA001.
loop at pa001 into workarea.
empm-EMPLOYEENUMBER = workarea-pernr.
append empm.
clear empm.
endloop.
Can you try the above code?
Regards,
Ravi
‎2005 Oct 21 12:40 PM
u need to get all the employee numbers in an internal table first....say itab..
then u have various options...
1)
loop at itab.
emp-empnr = itab-empnr.
append emp.
endloop.
2) if fieldname is same in both itab and emp then
move-corresponding itab[] to emp[].
or
insert lines of itab [from idx1 to idx2] into table emp.
3) if tables have same structure
emp[] = itab[].
rgds,
PJ
‎2005 Oct 21 1:40 PM
hai...
can u please tell how to get all emp records in to internal table.
can u please help on the code..which i posted.