2008 May 27 6:42 AM
Hi All,
i have one requirement
I will upload one tab separated file into the application server
then tht file uploaded in the below format
6#17300094#1#05142008####4.0#0200#200#1#USBANK####
8#17300094##05142008#01###4.0#0200#200#1#USBANK####
4#5569630000126876#05132008#08128#0#0#1500000###0#0#00840################0#12319999######
4#5569630000127205#05132008#08128#0#0#1500000###0#0#00840################0#12319999######
4#5569630000127312#05132008#08128#0#0#1500000###0#0#00840################0#12319999######
4#5569630000127445#05132008#08128#0#0#1500000###0#0#00840################0#12319999######
4#5569630000127767#05132008#08128#0#0#1500000###0#0#00840################0#12319999######
4#5569630000127817#05132008#08128#0#0#1500000###0#0#00840################0#12319999######
4#5569630000127841#05132008#08128#0#0#1500000###0#0#00840################0#12319999######
4#5569630000128120#05132008#08128#0#0#1500000###0#0#00840################0#12319999######
4#5569630000128286#05132008#08128#0#0#1500000###0#0#00840################0#12319999######
4#5569630000128328#05132008#08128#0#0#1500000###0#0#00840################0#12319999######
4#5569630000128492#05132008#08128#0#0#1500000###0#0#00840################0#12319999######
4#5569630000128690#05132008#08128#0#0#1500000###0#0#00840################0#12319999######
4#5569630000128724#05132008#08128#0#0#1500000###0#0#00840################0#12319999######
4#5569630000128765#05132008#08128#0#0#1500000###0#0#00840################0#12319999######
4#5569630000129094#05132008#08128#0#0#1500000###0#0#00840################0#12319999######
4#5569630000129110#05132008#08128#0#0#1500000###0#0#00840################0#12319999######
4#5569630000129136#05132008#08128#0#0#1500000###0#0#00840################0#12319999######
9#17300094##05142008#01#17##4.0#0200#200#1#USBANK####
now i opened that file by using the statement
OPEN DATASET p_file FOR INPUT IN BINARY MODE.
but now wht happening is
when i use read statement as like this
READ DATASET p_file INTO t_itab.
then line by line data is not getting into t_itab.
now my requirement is still i want to open that file in binary mode only and i want to get the line by line into t_itab.
i know that if open the file in text mode then when i use the read statement then i will get line by line data into t_itab.
points will be rewarded for all gud posts....
Hi All,
i have one requirement
I will upload one tab separated file into the application server
then tht file uploaded in the below format
6#17300094#1#05142008####4.0#0200#200#1#USBANK####
8#17300094##05142008#01###4.0#0200#200#1#USBANK####
4#5569630000126876#05132008#08128#0#0#1500000###0#0#00840################0#12319999######
4#5569630000127205#05132008#08128#0#0#1500000###0#0#00840################0#12319999######
4#5569630000127312#05132008#08128#0#0#1500000###0#0#00840################0#12319999######
4#5569630000127445#05132008#08128#0#0#1500000###0#0#00840################0#12319999######
4#5569630000127767#05132008#08128#0#0#1500000###0#0#00840################0#12319999######
4#5569630000127817#05132008#08128#0#0#1500000###0#0#00840################0#12319999######
4#5569630000127841#05132008#08128#0#0#1500000###0#0#00840################0#12319999######
4#5569630000128120#05132008#08128#0#0#1500000###0#0#00840################0#12319999######
4#5569630000128286#05132008#08128#0#0#1500000###0#0#00840################0#12319999######
4#5569630000128328#05132008#08128#0#0#1500000###0#0#00840################0#12319999######
4#5569630000128492#05132008#08128#0#0#1500000###0#0#00840################0#12319999######
4#5569630000128690#05132008#08128#0#0#1500000###0#0#00840################0#12319999######
4#5569630000128724#05132008#08128#0#0#1500000###0#0#00840################0#12319999######
4#5569630000128765#05132008#08128#0#0#1500000###0#0#00840################0#12319999######
4#5569630000129094#05132008#08128#0#0#1500000###0#0#00840################0#12319999######
4#5569630000129110#05132008#08128#0#0#1500000###0#0#00840################0#12319999######
4#5569630000129136#05132008#08128#0#0#1500000###0#0#00840################0#12319999######
9#17300094##05142008#01#17##4.0#0200#200#1#USBANK####
now i opened that file by using the statement
OPEN DATASET p_file FOR INPUT IN BINARY MODE.
but now wht happening is
when i use read statement as like this
READ DATASET p_file INTO t_itab.
then line by line data is not getting into t_itab.
now my requirement is still i want to open that file in binary mode only and i want to get the line by line into t_itab.
i know that if open the file in text mode then when i use the read statement then i will get line by line data into t_itab.
points will be rewarded for all gud posts....
2008 May 27 6:50 AM
Hi
use this
open dataset p_file for input in text mode encoding default.
if sy-subrc ne 0.
message s001(zv_errr).
exit.
endif.
clear wa_sourcefile.
while c_one = c_one.
read dataset p_file into ws_c_temp_itab.
if sy-subrc eq 0.
call function 'Z_RECORD_CONVERT'
importing
input = ws_c_temp_itab
data_tab = wa_sourcefile.
"Getting the data into i_sourcefile
append wa_sourcefile to i_sourcefile.
clear wa_sourcefile.
else.
close dataset p_file.
exit.
endif.
endwhile.
endif.
for this
1. you need to use a tab separated file
2. and you need to upload a text file
2008 May 27 7:16 AM
Hi Chari,,
i too know that if i open the file in text mode i can read it line by line but i want to open it in binary mode and i need to retrive the data how can i do that....
2008 May 27 8:05 AM
Hi Sunil,
Try the following.
TYPES: BEGIN OF lty_data,
fld TYPE string,
END OF lty_data.
DATA: l_length TYPE i,
l_length2 TYPE i,
ls_data TYPE lty_data.
OPEN DATASET v_infile FOR INPUT IN BINARY MODE. " open extract file
IF sy-subrc <> 0.
WRITE: / 'Error - Failed to open ', v_infile.
ENDIF.
DO.
READ DATASET v_infile INTO ls_data-fld.
IF sy-subrc NE 0.
EXIT.
ELSE.
l_length = STRLEN( ls_data-fld ).
APPEND ls_data TO lt_data.
ENDIF.
ENDDO.
LOOP AT lt_data INTO ls_data.
CALL FUNCTION 'SCMS_STRING_TO_FTEXT'
EXPORTING
text = ls_data-fld
IMPORTING
length = l_length2
TABLES
ftext_tab = mailbin.
ENDLOOP.Hope it helps.
2008 May 27 8:20 AM
Hi,
While uploading the tab delimited file into application server first u keep all the data in internal . then u upload all the data to application server right..
while uploading the data into application sever u use transfer statement directly..
before doing so u just concatenate field values suppose f1,f2,f3.. seperated by (constants:c_hextab(1) type x value '09') '09' hexadecimal value.Then the file will be uploaded as tablimited in application server.
Please do award points if find usefull.
2008 May 27 8:27 AM
hi,
try with splitting statemet ...
contab = '#'.
OPEN DATASET dsn FOR INPUT IN binary MODE .
IF sy-subrc NE 0.
ELSE.
DO.
CLEAR: wa_string.
READ DATASET dsn INTO wa_string.
IF sy-subrc NE 0.
EXIT.
ELSE.
SPLIT wa_string AT con_tab INTO izrev_value-monat
izrev_value-gjahr
izrev_value-circle
izrev_value-feed_type
izrev_value-cos
v_core.
ENDIF.
ENDDO.
CLOSE DATASET dsn.
endif.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |