08-13-2009 11:58 AM
HI
My requirement is to read time events (Infotype 2011) for an employee for a given period.
For that purpose I want to fetch data from PCL2 database cluster.
Please tell me how to exctract data,which FM to use,table declarations required.
Regards,
Anubhav Gupta
08-13-2009 12:15 PM
Time events are in infotype 2011 (TEVEN and TEVEN_MORE) not in cluster PCL2, in cluster PCL2 you will find derived information like time pairs and time tickets which are saved separately for each employee and period to tables PT (pair table), WST (time tickets), and AT (link table) in cluster B2, database PCL2.
How to read the cluster B2 from database PCL2 has been [answered many times|https://forums.sdn.sap.com/search.jspa?objID=c42&q=readclusterPCL2+], (look for macro [RP-IMP-Cn-xx|http://help.sap.com/saphelp_45b/helpdata/EN/4f/d528ff575e11d189270000e8322f96/content.htm] or FM [HR_FORMS_TIM_GET_B2_RESULTS|https://forums.sdn.sap.com/search.jspa?objID=c42&q=HR_FORMS_TIM_GET_B2_RESULTS])
Regards,
Raymond
08-13-2009 12:07 PM
08-13-2009 12:15 PM
Time events are in infotype 2011 (TEVEN and TEVEN_MORE) not in cluster PCL2, in cluster PCL2 you will find derived information like time pairs and time tickets which are saved separately for each employee and period to tables PT (pair table), WST (time tickets), and AT (link table) in cluster B2, database PCL2.
How to read the cluster B2 from database PCL2 has been [answered many times|https://forums.sdn.sap.com/search.jspa?objID=c42&q=readclusterPCL2+], (look for macro [RP-IMP-Cn-xx|http://help.sap.com/saphelp_45b/helpdata/EN/4f/d528ff575e11d189270000e8322f96/content.htm] or FM [HR_FORMS_TIM_GET_B2_RESULTS|https://forums.sdn.sap.com/search.jspa?objID=c42&q=HR_FORMS_TIM_GET_B2_RESULTS])
Regards,
Raymond
08-13-2009 12:20 PM
Hi ,
Instead of FM, you can write code as follows -
Tables : PLC2.
SELECT-OPTIONS : s_date TYPE plc2-aedtm.
DATA : t_itab TYPE TABLE OF plc2.
SELECT * FROM PLC2 INTO TABLE t_itab
WHERE aedtm in s_date.
Regards
Pinaki
08-13-2009 12:22 PM
Hi,
you can use the function module HR_FORMS_TIM_GET_B2_RESULTS.
DATA: ls_tim_b2 TYPE hrf_tim_b2 ,
lt_b2 TYPE TABLE OF ptr_f_zl,
ls_b2 TYPE ptr_f_zl .
CLEAR: gt_p2002,g_hrs_wrkd,lt_b2.
REFRESH: gt_p2002,lt_b2.
g_bdate2 = g_bdate.
g_edate2 = g_bdate.
************FM For Fetching Data From B2 Cluster
CALL FUNCTION 'HR_FORMS_TIM_GET_B2_RESULTS'
EXPORTING
pernr = pernr-pernr
begda = g_edate2
endda = g_edate
IMPORTING
tim_b2 = ls_tim_b2
EXCEPTIONS
wrong_cluster_version = 1
no_read_authority = 2
cluster_archived = 3
technical_error = 4
OTHERS = 5.
*********Fetching Data From B2 Cluster
Regards
Milan
08-14-2009 7:23 AM
Thank you..
Now my requirement is to calculate time difference of ZL table.
Time is : 22:30:00 to 38:32:00
How to calculate it.
Thanks & Regards..
Anubhav
08-14-2009 8:52 AM
Hi Anubhav,
Try this 2 FM's
SD_CALC_DURATION_FROM_DATETIME - Find the difference between two date/time and report the difference in hours
SD_DATETIME_DIFFERENCE - Give the difference in Days and Time for 2 dates
Regards
Milan