Application Development 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: 

how to convert flat file type from DAT to ASC

Former Member
0 Kudos

hello all

i am trying to download a flat file and trying to upload it in another program.

for this i am using gui_upload and gui_download function modules.

if i download the file as ASC and upload with ASC there is no problem.

if i download the file as DAT and upload with DAT its giving an exception invalid file type

if i download the file as DAT and upload with ASC its giving an exception bad data format.

but in real senario my customer is sending a flat file with DAT type and i am unable to upload it.

how to solve this problem?

1 ACCEPTED SOLUTION

Former Member
0 Kudos

In addition to providing

file_type = 'X';

you may also try passing

DAT_MODE = 'X'.

Regards,

Mohaiyuddin

3 REPLIES 3

Former Member
0 Kudos

Hi,

when uploading DAT pass file type as 'ASC' and give HAS_FIELD_SEPARATOR = 'X'.

For other types see the code below.

CASE P_RECTYP.

WHEN 'DAT'.

MOVE 'X' TO L_FLDSEP.

MOVE 'ASC' TO L_TYPE.

WHEN 'ASC'.

MOVE ' ' TO L_FLDSEP.

MOVE P_RECTYP TO L_TYPE.

WHEN 'BIN'.

CLEAR L_TYPE.

MOVE P_RECTYP TO L_TYPE.

MOVE ' ' TO L_FLDSEP.

WHEN OTHERS.

MOVE 'X' TO L_FLDSEP.

MOVE 'ASC' TO L_TYPE.

ENDCASE.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = LV_FILENAME

FILETYPE = l_type

HAS_FIELD_SEPARATOR = l_fldsep

Regards,

Vasanth

Former Member
0 Kudos

In addition to providing

file_type = 'X';

you may also try passing

DAT_MODE = 'X'.

Regards,

Mohaiyuddin

0 Kudos

Thanks Mohaiyuddin

its working with DAT_MODE = 'X'.

i have given you 10 points