Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

help required on append statement

Former Member
0 Likes
811

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?

7 REPLIES 7
Read only

Former Member
0 Likes
784

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

Read only

0 Likes
784

hai...

just hav a look on the code.

i posted entire code.

empm is like BAPI7013_4

t q.

Read only

FredericGirod
Active Contributor
0 Likes
784

select pernr into table empm from pa0001 ....

what is the problem ?

regards

Frédéric

Read only

0 Likes
784

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

Read only

0 Likes
784

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

Read only

Former Member
0 Likes
784

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

Read only

0 Likes
784

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.