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

Files Insert in fileserver

Former Member
0 Likes
666

Hi,

I have a requirement to insert the files(,pdf , .txt , .doc , .xls ) in fileserver from

abap program.

how to do .

Pls help.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
626

USE TRANSACTION

<b>CG3Z</b>

Hi,

I have a requirement to insert the files(,pdf , .txt , .doc , .xls ) in fileserver from

abap program.

how to do .

Pls help.

5 REPLIES 5
Read only

Former Member
0 Likes
627

USE TRANSACTION

<b>CG3Z</b>

Read only

Former Member
0 Likes
626

1) USe GUI_UPLOAD and GUI_DOWNLOAD for ulpoading and downloading file on presentation server.

2) use below demo code to download or upload file to or from Application server -

if it is one time use transaction CG3Y and CG3Z

REPORT ZGILL_AS message-id rp .

tables: pa0001,pa0002.

select-options s_pernr for pa0001-pernr no intervals MODIF ID XYZ.

parameters: p_dwnld AS CHECKBOX ,

p_upld AS CHECKBOX DEFAULT 'X'.

parameters: P_DSNI(75) TYPE C MODIF ID ABG DEFAULT

'/usr/local/sapdata/amit.dat' LOWER CASE.

data: begin of itab occurs 0,

pernr(8),

sp1(1) value ',',

werks(4),

sp2(1) value ',',

persg(1),

sp3(1) value ',',

persk(2),

end of itab.

data: s_eof(3).

start-of-selection.

if p_upld = 'X'.

OPEN DATASET P_DSNI FOR OUTPUT IN LEGACY TEXT MODE.

PERFORM FETCH_DATA.

STOP.

elseif p_dwnld = 'X'.

OPEN DATASET P_DSNI FOR INPUT IN LEGACY TEXT MODE.

IF SY-SUBRC NE 0.

MESSAGE E016 WITH

'Error opening seq. file, RC:' SY-SUBRC.

EXIT.

ENDIF.

CLEAR S_EOF.

DO.

PERFORM FETCH_file.

IF S_EOF EQ 'YES'. stop. ENDIF.

ENDDO.

endif.

END-OF-SELECTION.

if itab[] is not initial.

perform print_file1 tables itab.

else.

write:/ 'No records exists'.

endif.

&----


*& Form FETCH_DATA

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM FETCH_DATA .

SELECT * FROM PA0001 WHERE PERNR IN S_PERNR.

MOVE-CORRESPONDING PA0001 TO ITAB.

TRANSFER ITAB TO P_DSNI.

APPEND ITAB.

ENDSELECT.

CLOSE DATASET P_DSNI.

ENDFORM. " FETCH_DATA

&----


*& Form FETCH_file

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM FETCH_file .

READ DATASET P_DSNI INTO itab.

append itab.

clear itab.

IF SY-SUBRC NE 0.

S_EOF = 'YES'. EXIT.

ENDIF.

ENDFORM. " FETCH_file

&----


*& Form print_file1

&----


  • text

----


  • -->P_ITAB text

----


FORM print_file1 tables P_ITAB structure itab .

write:/2 'EmpNo',

14 'Personnel Area',

34 'Emp Group',

47 'Emp SubGroup'.

skip 1.

loop at p_itab.

write:2 p_itab-pernr,

14 p_itab-werks,

34 p_itab-persg,

47 p_itab-persk.

skip 1.

endloop.

ENDFORM. " print_file1

Read only

former_member188829
Active Contributor
0 Likes
626

use CG3Z tcode

Read only

Former Member
0 Likes
626

TCode CG3Z will serve your purpose.

Regards

Read only

Former Member
0 Likes
626

CG3Z is Ok.I am able to file transfer through this Tcode.

But I need this operation through a program. So I think I have to use Open Dataset commands for the same.Pls give me the code for File transfer using Dataset statments and not the internal table data transfer.