on 11-01-2007 3:36 PM
Hi Experts,
I am working on inbound program. My flat file is in text format.
I am reading the file in a string. This file contains date, time and employee number. When I read this file in a string preceding zeros are not read.
I mean if the date is 05/08/2007 it reads only 5/8/2007.
Can anyone please help me. its urgent. Thanks
May be your file doesn't contains the leading zeros.
Please check out the file.
Regards,
Naimesh Patel
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Guys,
Thanks alot for your suggestions. The problem is solved.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please post your data declarations, your read logic and your output logic pertaining to these fields. If you have all the declarations as char type and you are reading the file in text mode, you should not see this behaviour.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
REPORT zamag_inbound.
TABLES: cc1tev, pa0000.
DATA: read_line(500).
DATA: BEGIN OF amag_in OCCURS 0,
indic(3),
empty_1(45),
ldate type dats,
empty_2(1),
ltime type tims,
empty_3(8),
pernr LIKE pa0000-pernr,
empty_4(52),
clcki(2),
empty_5(6),
END OF amag_in.
*Data: p_file type string value'09'.
Data: k1 TYPE dats,
k2 type tims,
k3 type string,
k4 type string,
k5 type string.
SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
PARAMETERS:
p_file TYPE salfile-longname.
SELECTION-SCREEN END OF BLOCK blk1.
&----
START-OF-SELECTION.
&----
PERFORM upload_file.
&----
END-OF-SELECTION.
&----
LOOP AT amag_in.
WRITE: / amag_in-indic,
amag_in-ldate,
amag_in-ltime,
amag_in-pernr,
amag_in-clcki.
ENDLOOP.
&----
*& Form UPLOAD_FILE
&----
text
----
--> p1 text
<-- p2 text
----
FORM upload_file .
OPEN DATASET p_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
DO.
READ DATASET p_file INTO read_line.
IF sy-subrc = 0.
write read_line9+(10) to k1 as
k1 = read_line+9(10).
k2 = read_line+19(5).
k3 = read_line+26(6).
K4 = read_line+39(2).
SPLIT read_line AT tab_1 INTO amag_in-indic
amag_in-empty_1
amag_in-ldate
amag_in-empty_2
amag_in-ltime
amag_in-empty_3
amag_in-pernr
amag_in-empty_4
amag_in-clcki
amag_in-empty_5.
APPEND amag_in.
IF sy-subrc = 0.
APPEND amag_in.
ELSE.
EXIT.
else.
exit.
ENDIF.
ENDDO.
ENDIF.
ENDFORM. " UPLOAD_FILE
You should not define date and time as type dats and tims respectively when you are uploading the file because you are getting the date in 10 character and probably time in 8 character format and the dats is 8 character and tims is 6 character data types.
Declare your internal table(with fields of char type and lenghts matching that of the file fields) to fit to your file format and upload the contents and then format them to the format you need for furhter processing.
Where do you actually see that the zeroes are missing - a report, debugging, a download??
Rob
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Please check in your file, whether the data with the preciding ZERO or what,,,, and if that is ok then just define the date as CHAR so that what ever you specify will be displaye.
Thanks
Yogesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
5 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.