Welcome To My BLOG

This site is to give a brief idea for the abap learners who are looking for some real time programs .It consists of collection of programs from my side . I hope these programs are very much used for all of the learners. Please check the links for any information in ABAP.
Please vote for my Blog. And please input me on this mail addrssess.Email me

Share this link with your friends

http://www.rebtel.com/u/15163104576

For every friend who signs up using this link and makes a payment, we'll give you 8 €!


Wednesday, September 22, 2010

How to upload .dbf file

SPAN
Unknown macro: { font-family}
.L1S31
Unknown macro: { font-style}
.L1S32
Unknown macro: { color}
.L1S33
Unknown macro: { color}
.L1S52
Unknown macro: { color}
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = p_filenm
i_begin_col = '1'
i_begin_row = '2' "Do not require headings
i_end_col = '14'
i_end_row = lineno
TABLES
intern = itab
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE e010(zz) WITH text-001. "Problem uploading Excel Spreadsheet
ENDIF.
* Sort table by rows and colums
*SORT itab BY row col.
* Get first row retrieved
READ TABLE itab INDEX 1.
* Set first row retrieved to current row
gd_currentrow = itab-row.
LOOP AT itab.
* Reset values for next row
IF itab-row NE gd_currentrow.
APPEND wa_record TO it_record.
CLEAR wa_record.
gd_currentrow = itab-row.
ENDIF.
CASE itab-col.
WHEN '0001'. "First name
wa_record-ecode = itab-value.
WHEN '0002'. "Surname
wa_record-edate = itab-value.
WHEN '0005'. "Age
wa_record-eshift = itab-value.
WHEN '0006'.
wa_record-earrtim = itab-value.
WHEN '0011'.
wa_record-edeptim = itab-value.
WHEN '0013'.
wa_record-ewrkhrs = itab-value.
ENDCASE.
* append wa_record to wa_it.
ENDLOOP.
APPEND wa_record TO it_record.
CLEAR wa_record.
LOOP AT it_record INTO wa_record.
wa_it-ecode = wa_record-ecode.
wa_it-edate = wa_record-edate.
wa_it-eshift = wa_record-eshift.
wa_it-earrtim = wa_record-earrtim.
wa_it-edeptim = wa_record-edeptim.
wa_it-ewrkhrs = wa_record-ewrkhrs.
APPEND wa_it TO it.
CLEAR wa_it.
ENDLOOP.
j = 0.
i = 1.
LOOP AT it INTO wa_it FROM i.
wa_it1-empcode = wa_it-ecode.
SPLIT wa_it-edate AT '/' INTO emth edt eyr.
clear wa_it-edate.
concatenate edt '.' emth '.' eyr INTO wa_it-edate.
* REPLACE ALL OCCURRENCES OF '/' IN wa_it-edate WITH '.'.
CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
EXPORTING
date_external = wa_it-edate
IMPORTING
date_internal = edate1
EXCEPTIONS
date_external_is_invalid = 1
OTHERS = 2.
wa_it1-mdate = edate1.
wa_it1-shift = wa_it-eshift.
SPLIT wa_it-earrtim AT '.' INTO hr mm.
IF hr NOT BETWEEN 10 AND 24.
hr1 = hr.
CONCATENATE j hr1 mm '00' INTO w_artim.
ELSE.
CONCATENATE hr mm '00' INTO w_artim.
ENDIF.
IF w_artim = '000'.
w_artim = '0000'.
ENDIF.
wa_it1-arrtim = w_artim.
CLEAR: hr,mm,w_artim.
SPLIT wa_it-edeptim AT '.' INTO hr mm.
IF hr NOT BETWEEN 10 AND 24.
CONCATENATE j hr mm '00' INTO w_artim.
ELSE.
CONCATENATE hr mm '00' INTO w_artim.
ENDIF.
IF w_artim = '000'.
w_artim = '0000'.
ENDIF.
wa_it1-deptim = w_artim.
CLEAR: hr,mm,w_artim.
SPLIT wa_it-ewrkhrs AT '.' INTO hr mm.
IF hr NOT BETWEEN 10 AND 24.
CONCATENATE j hr mm '00' INTO w_artim.
ELSE.
CONCATENATE hr mm '00' INTO w_artim.
ENDIF.
wa_it1-wrkhrs = w_artim.
APPEND wa_it1 TO it1.
CLEAR : wa_it,wa_it1,edt,edt1,emth,emth1,eyr,edate1,hr,mm,w_artim.
* i = i + 1.
ENDLOOP.

No comments: