06-27-2008 9:34 AM
Hi experts,
Can anybody explain me how to calculate number of training programmes attended for the given employee. Also let me to know is there any function modules to execute the earlier.
useful replies will be rewarded.
Regards,
Sankar.
06-27-2008 11:46 AM
Hi,
I am not sure how you are maintaining these entries in a table. But there are 2 possibilities.
Scenario 1.
If the table consists of
EMPID COURSE_NAME No.Of. Trainings(NOTrg)
001 ABAP 5
002 OOPs 3
001 OOPs 3.
In this case you can use COLLECT.
Here is a simple example
====
DATA: BEGIN OF training,
empid TYPE emp-empid,
NOTrg TYPE emp-NOTrg,
END OF training.
DATA training_attended LIKE HASHED TABLE OF training
WITH UNIQUE KEY empid.
SELECT empid NOTrg
FROM emp
INTO training WHERE empid = 001.
COLLECT training INTO training_attended.
ENDSELECT.
====
Scenario 2.
If table consists of each training as a apecific line
EMPID COURSE_NAME
001 ABAP
002 OOPs
001 OOPs
In this case you can do the following
Select count(*) from emp into wa where empid = 001.
I hope this answers your query.
Regards,
Saurabh
06-27-2008 11:50 AM