‎2008 Jul 28 7:37 AM
Hi,
I am facing a problem that when downloading the data from application server using
OPEN DATASET p_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
It is successfully reading the data but it contains so many '#' symbols between spaces.
For example: 125 abc xyz
This is my record with tab space.
but it is reading 125#####abc#####xyz#### like that. Even this record format is same in application server also.
could you please suggess me what is the problem here? is problem with uploading the data to the application server? or any other format is exist to read the data?
Using GUI_UPLOAD function with FILETYPE = 'DAT' it is reading successfully. But I want to run my program in back ground. In back ground these function modules are not working.
Regards,
Sarayu.
‎2008 Jul 28 7:44 AM
Hi Sarayu,
Split the file at the character '#'.
Check this following code sample:
OPEN DATASET f_name FOR INPUT IN TEXT MODE ENCODING DEFAULT.
DO.
READ DATASET f_name INTO w_data1.
IF sy-subrc NE 0.
EXIT.
ENDIF.
SPLIT w_data1 AT w_char INTO fs_bkpf-bukrs
fs_bkpf-gjahr
fs_bkpf-blart
fs_bkpf-bldat
fs_bkpf-budat
fs_bkpf-monat
fs_bkpf-cpudt.
APPEND fs_bkpf TO t_bkpf.
ENDDO.
CLOSE DATASET f_name.Here the w_char will be '#'.
Hope this helps you.
Regards,
Chandra Sekhar
‎2008 Jul 28 7:40 AM
their might be tabspace between the fields while writing the data into application sever.
Check for this CL_ABAP_CHAR_UTILITIES--> HORIZONTAL_TAB in your program. if it is there, then there is a tab space.
Regards
Kannaiah
‎2008 Jul 28 7:47 AM
Hi Kannaih,
Thank you!
My requirement is:
Upload the master data records almost 50 fields of data to application server. And Download the same data with tabspace (for 50 fields) and create master data in back ground.
I am first time working in datasets. Could you please let me know the process how to do it.
Regards,
Sarayu.
‎2008 Jul 28 7:44 AM
Hi Sarayu,
Split the file at the character '#'.
Check this following code sample:
OPEN DATASET f_name FOR INPUT IN TEXT MODE ENCODING DEFAULT.
DO.
READ DATASET f_name INTO w_data1.
IF sy-subrc NE 0.
EXIT.
ENDIF.
SPLIT w_data1 AT w_char INTO fs_bkpf-bukrs
fs_bkpf-gjahr
fs_bkpf-blart
fs_bkpf-bldat
fs_bkpf-budat
fs_bkpf-monat
fs_bkpf-cpudt.
APPEND fs_bkpf TO t_bkpf.
ENDDO.
CLOSE DATASET f_name.Here the w_char will be '#'.
Hope this helps you.
Regards,
Chandra Sekhar
‎2008 Jul 28 7:47 AM
While uploading the data to application server, first populate the internal field usinf FM GUI_UPLOAD. In the FM, make sure that
File Seperator = 'X' is checked.
In your flat file also, make sure that fields are tab seperated, otherwise it will read garbage characters.
Once you upload the file to application server using
OPEN DATASET PFILE FOR OUTPUT IN LEGACY TEXT MODE.
Later you can download that file at any time using,
OPEN DATASET PFILE FOR INPUT IN LEGACY TEXT MODE.
Hope it will help you,
Matt
‎2009 Jan 08 12:33 PM