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

Transfer binary file from PC to app server

Former Member
0 Likes
2,248

I'm trying to move a file from the PC to the app server. It is a binary file.

This code and file look ok, but the file is not correct.

Is there any function or other technique to move the file? I'm afraid gui_upload may be doing some kind of conversion.

DATA: BEGIN OF itab OCCURS 0,

raw(255) TYPE x,

END OF itab.

DATA: lin TYPE i.

DATA: l_filename TYPE string.

DATA: l_filelen TYPE i.

l_filename = 'c:\temp\file.bin'.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = l_filename

filetype = 'BIN'

IMPORTING

filelength = l_filelen

TABLES

data_tab = itab.

l_target = '/dir/outputfile.bin'.

OPEN DATASET l_target FOR OUTPUT IN BINARY MODE.

DATA: l_pos TYPE i.

LOOP AT itab.

CLEAR lin.

lin = XSTRLEN( itab-raw ).

l_pos = l_pos + lin.

IF l_pos > l_filelen.

lin = lin - ( l_pos - l_filelen ).

ENDIF.

TRANSFER itab-raw TO l_target LENGTH lin.

ENDLOOP.

CLOSE DATASET l_target.

1 ACCEPTED SOLUTION
Read only

former_member194669
Active Contributor
0 Likes
1,108

Try to use transaction CG3Z

Want to use same in your program then use fm C13Z_FRONT_END_TO_APPL

a®

4 REPLIES 4
Read only

former_member194669
Active Contributor
0 Likes
1,109

Try to use transaction CG3Z

Want to use same in your program then use fm C13Z_FRONT_END_TO_APPL

a®

Read only

Former Member
0 Likes
1,108

HI,

You can use this Tcode CG3Z.

Read only

anuj_srivastava
Active Participant
0 Likes
1,108

Hi ,

Did u tried giving the filetype as 'ASC'.

Give a try with this.

If that doesn't work then u have the option of CG3Z tcode.

Read only

0 Likes
1,108

It's a binary file. ASC won't work.

Thanks for the feedback the transaction and function module.

Actually I used function C13Z_FILE_UPLOAD_BINARY.

I think my code was good. This function has the same result.

For some reason the follow on processing was acting differently on this "copied" file. It looks the same and has the exact same byte count as the original.

I was able to work around my other issues.

Thanks again.