Google Search - Blog...........

ABAP - Uploading .DBF File to SAP System.

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.


ALSO READ:

- Download Data From Application Server Files To Presentation Server Using FM C13Z_APPL_TO_FRONT_END.

- Creating A Directory On Presentation Server Using FM GUI_CREATE_DIRECTORY.

- Removing A Directory From Presentation Server Using FM GUI_REMOVE_DIRECTORY.

- Removing A File From Presentation Server Using FM GUI_DELETE_FILE.

- ZIP Files In Application Server Using FM SCMS_XSTRING_TO_BINARY.



RETURN TO MAIN INDEX:

- Sample Programs On Uploading & Downloading Files.

- Sample Programs On HR ABAP.

- Sample Report Programs On ALV List/ Grid Display.

- Sample Programs On Selection Screen.

- Sample Programs On BDC.

.....Back To MAIN INDEX.


2 comments:

  1. My friend told me about an interesting tool,which he found in the Internet - fix dbf file. I used it and I was astonished,reason of the tool solved all my old troubles with dbf files and more than. It performed it for free if I didn't make a mistake.

    ReplyDelete
  2. hi!
    help me :
    how to write and append .DBF file ?
    giotdang3@gmail.com

    ReplyDelete