‎2009 Apr 20 11:42 AM
Hi All,
My requirement is iam having TAB -Delimited text file in some directory .I need to write a conversion program which will pick the file and uploadin the zeetable.Inbetween we need to some validations in the conversion program.Can any one send some IDEA on this requiremnet .
-> If any one send some sample program which do the same function it would be great.THANKS IN ADVANCE.
Regards,
Sriram
‎2009 Apr 20 12:51 PM
Hi
For ur zee table simply create table maintenance generator. After activiting again go to utilities->Table Maintenance generator-> Environment->Modifications->events and create new entries inside this include write ur own validations which u required for ur ztable during uploading data.
‎2009 Apr 20 1:12 PM
Hello,
Hope the following will help you.
<< Unformatable code rmoved >>
Regards
Edited by: Rob Burbank on Apr 20, 2009 9:48 AM
‎2009 Apr 20 1:19 PM
HI,
1. Get the TAB -Delimited file from the directory into internal table itab using GUI_DOWNLOAD.
2. Perfrom the validation on the itab and append the sucessuful records in I_FINAL.
3 Using MODIFY statement update the Z table.
‎2009 Apr 20 2:42 PM
Hi Sriram,
According to your requirement,the solution goes in the following way
1) have a path in your program to upload the file(tab delimited) eg: C:/Document sand Settings/test.txt
2) SAP has given many interface FM's like GUI_DOWNLOAD which suits your requirement,this FM downloads the non sap data in the tab delimited file into an internal table
3)Immediately calling the FM use sy-subrc if its 1 then make the validations in your internal table
4) Finally MODIFY enables us to modify the Z customized DB table.
If anything else revert back
Thanks and Regards
Srikanth.P
‎2009 Apr 20 7:22 PM
hey..check this code..
DATA: BEGIN OF itab OCCURS 0,
text(1520) TYPE c,
END OF itab.
DATA: wa_itab like line of itab.
CONSTANTS: co_var(9) VALUE 'FNAME',
ABAP_TRUE(5) VALUE 'TRUE'.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002 .
PARAMETER: p_lfile TYPE rlgrap-filename.
SELECTION-SCREEN END OF BLOCK b2.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_lfile.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
program_name = syst-repid
dynpro_number = syst-dynnr
field_name = co_var
CHANGING
file_name = p_lfile
EXCEPTIONS
mask_too_long = 1
OTHERS = 2.
START-OF-SELECTION.
DATA fsize type i.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = p_lfile
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = 'X'
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
VIRUS_SCAN_PROFILE =
IMPORTING
FILELENGTH = fsize
HEADER =
TABLES
DATA_TAB = itab
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17
.
if sy-subrc = 0.
Loop at itab into wa_itab.
INSERT DB_TAB from wa_itab.
ENDLOOP.
endif.
Edited by: Krishna Chaitanya G on Apr 20, 2009 8:23 PM
‎2009 Apr 20 7:40 PM
apart from the all above replies, would like to give u 1 more tip: its self explanatory, if u find any such prog.s in ur system itself ( preferably in QA system).
example specify GUI_DOWNLOAD in se37 and then use WHERE USED LIST and select Z prog. in ur system.
thanq