‎2007 Jul 21 1:13 PM
hi i am uploading time from my flat file to my internal table which further i have to
map to a second internal table which is of type database table.
time in my flat file is like 07:56:55
now i am taking the time feild in my internal table as type tims or c
the time comes in my internal table as 07:56
can anybody help me ths its very urgent
bhanu
‎2007 Jul 21 1:41 PM
Hi,
Please check these FM.
CONVERT_TIME_INPUT
TIME_CHECK_PLAUSIBILITY
Regards,
Ferry Lianto
‎2007 Jul 21 2:24 PM
Hello Bhanu,
These are few points u need to be clear about.
1) flat file consists of time data in 09:08:07 format which means that the length is 8 character long.
2) so for this 8 characters data to get uploaded the internal table field u specify should also be 8 characer long.
NOTE : TIMS is 6 character long so the remaining part gets truncated.
opt for char(008) type.
3) Now once the data gets uploaded into first internal table say itab1.
we need to map this time data (09:08:06) into the field of itab2 which u say is of type DATABASE table.
4) For this pls check if there is any function module that converts into internal format.(this is of type TIMS (6 character)
or u can use SPLIT and CONCATENATE commands.
Below given code helps u get solution.
NOTE : Do please observe that gt_time2 contains the data according to TIMS format.
*********************************************
data : begin of gt_time occurs 0,
time(08) type c,
end of gt_time.
data : gw_time like gt_time.
data : begin of gt_time2 occurs 0,
time2 type tims,
end of gt_time2.
DATA : filename1 TYPE string.
PARAMETERS: filename(150) TYPE c OBLIGATORY.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR filename.
*get file name.
PERFORM get_file.
start-of-selection.
filename1 = filename.
perform upload.
PERFORM TRANSFER.
perform display.
FORM get_file .
*get file name.
CALL FUNCTION 'WS_FILENAME_GET' "#EC *
EXPORTING
def_filename = ' '
def_path = '.'
mask = ''
mode = 'O'
title = 'FOR SELECTING FILE FOR CHARECTRISTICS'
IMPORTING
filename = filename.
ENDFORM. " GET_FILE
FORM upload .
*get data from flat file into internal table.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = filename1
has_field_separator = '#'
TABLES
data_tab = GT_TIME.
ENDFORM. " UPLOAD
&----
*& Form TRANSFER
&----
text
----
--> p1 text
<-- p2 text
----
form TRANSFER .
*transfer contents from table1 into table2.
data : l_hor(002),
l_min(002),
l_sec(002).
loop at gt_time into gw_time.
split gw_time-time at ':' into l_hor l_min l_sec.
concatenate l_hor l_min l_sec into gt_time2-time2.
append gt_time2.
endloop.
endform. " TRANSFER
&----
*& Form display
&----
text
----
--> p1 text
<-- p2 text
----
form display .
*display the result.
loop at gt_time2.
write 😕 gt_time2-time2.
endloop.
endform. " display
**********************************************
Pls dont forget to waard points if answer's found helpful.
Regards,
Sanghamitra.
‎2007 Jul 21 2:29 PM
Hi,
You are converting the data type of length 8 to length to length 6. So, the output is getting truncated.
Please check the code.
Regards,
Pavan