Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

download data from application server using DATASET.

Former Member
0 Likes
933

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.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
680

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

5 REPLIES 5
Read only

Former Member
0 Likes
680

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

Read only

0 Likes
680

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.

Read only

Former Member
0 Likes
681

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

Read only

Former Member
0 Likes
680

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

Read only

Former Member
0 Likes
680

Self Answered