‎2009 Jul 23 4:53 AM
Hi Experts,
my file is in form of
UNBUNOC:2INTTRA:ZZZMGH:ZZZ090721:2334100053501'UNH1IFTSTA:D:99B:UN'BGM23++++++++++++++++++++++++
on application server.
now i want to read this file in following form.....DESIRED FORM
UNBUNOC:2INTTRA:ZZZMGH:ZZZ090721:2334+100053501
UNH1IFTSTA:D:99B:UN
BGM23
means where i get seperator ' rest of the data append in next line....this will go on till last separator ' find.
i have use a file
P_FILE(255) TYPE C.
it only read 255 charactor in a row and have file on application server like above i mention IT CAN HAVE MORE THAN 255 CHARACTOR.......SO i want to seperate this is in seperate rows......
please suggest me the way i read my file in desired form....
thanks
babbal
‎2009 Jul 23 6:08 AM
Hello Babal ,
i am gving u the logic ...
1) Read your file from application to your internal table .
loop the internal table into wa_itab . .
do .
if wa_itab is not initial .
split wa_itab at <seprator> into var1 var2 .
wa_itab = var2 .
endif .
enddo .
endloop.
if feel any problem , please ....ask
Thanks and Regards..
Priyank
‎2009 Jul 23 6:39 AM
Hello,
You can read file into string using DATASET.
After that split it into internal of single column at delimiter "'".
SPLIT string AT sep INTO TABLE ITAB.
Thanks,
Augustin.
‎2009 Jul 23 6:52 AM
Hi Babbal singh,
try this way. It works.
Thanks
Venkat.OREPORT ztest_notepad.
DATA:it_data TYPE TABLE OF string,
wa_data LIKE LINE OF it_data.
DATA:p_app_file(100) TYPE c VALUE '/user/sap/tmp',
p_separator TYPE c VALUE ''''. "quote separator
"START-OF-SELECTION
START-OF-SELECTION.
OPEN DATASET p_app_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc = 0.
DO.
READ DATASET p_app_file INTO wa_data.
IF wa_data IS INITIAL.
EXIT.
ELSE.
SPLIT wa_data AT p_separator INTO TABLE it_data.
ENDIF.
ENDDO.
ENDIF.
CLOSE DATASET p_app_file.