Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

upload time data text file in ztable for HR module

dear all SAP guru's

text file is like that

260807300001

270815480001

270812210002.

1st 4 char is date&month .

2nd 4 char is time.

3rd 4 char is employee no.

i want to upload this file in z table.

when i m uploading the time is not uploading correctly.my condition is like that

already 1 condition is in Z table after that when i upload 2nd entry that time what 1st time is time in and 2nd is time out.

coding as fallows . give any solution for that.

LOOP AT it_out.

CONCATENATE sy-datum0(4) it_out-text2(2) it_out-text+0(2) INTO itab1-val1.

CONCATENATE it_out-text+4(4) '00' INTO itab1-val2.

MOVE it_out-text+8(4) TO itab1-val3.

APPEND itab1.

CLEAR itab1.

ENDLOOP.

SELECT *

FROM ztimedata

INTO TABLE it_ztimedata.

DESCRIBE TABLE it_ztimedata LINES cnt.

LOOP AT it_out.

CLEAR cnt.

LOOP AT itab1.

itab1-date1 = itab1-val1.

itab1-timein = itab1-val2.

itab1-pernr = itab1-val3.

cnt = cnt + 1.

itab1-counter = cnt.

MODIFY itab1.

ENDLOOP.

ENDLOOP.

SORT itab1 BY pernr date1 timein.

DATA cnt1 TYPE i.

DATA p_date LIKE sy-datum.

SELECT SINGLE * FROM ztimedata

INTO CORRESPONDING FIELDS OF it_ztimedata.

LOOP AT itab1.

ztimedata-counter = itab1-counter.

ztimedata-date1 = itab1-val1.

ztimedata-pernr = itab1-val3.

ztimedata-shift = itab1-shift.

ztimedata-attendance = itab1-attendance.

CLEAR IT_ZTIMEDATA-TIMEIN.

IF ztimedata-timein IS INITIAL.

it_ztimedata-timein = itab1-val2.

ztimedata-timein = itab1-val2.

CLEAR it_ztimedata-timeout .

ELSEIF ztimedata-timein IS NOT INITIAL.

it_ztimedata-timeout = itab1-val2.

ztimedata-timeout = itab1-val2.

ENDIF.

append it_ztimedata.

MODIFY ztimedata from it_ztimedata.

  • COMMIT WORK.

ENDLOOP.

in that coding if any correction pls correct me.

Nikhil Narkhede

Tags:
Not what you were looking for? View more on this topic or Ask a question