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

Sample code to output internal table data to a specified server drive?

Former Member
0 Likes
446

Sample code to output internal table data to a specified server drive/folder (not local drive)?

Thanks and We will give you reward points!

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
423

Hello,

Here you can find useful information about download data [https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e0901cba-f49e-2910-748c-d7ce4c0c4c1c]

And in this blog from Thomas Jung there's a good example using ABAP OO and with Unicode support [https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/1932] [original link is broken] [original link is broken] [original link is broken];

Regards,

2 REPLIES 2
Read only

Former Member
0 Likes
423

Hi Kevin

Here is a very basic example. Remember to change the server directory to your own server name and path.

REPORT ZBRADTEST.

DATA: DATAHEAD(1000).

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME.

PARAMETERS: P_OFILE LIKE RLGRAP-FILENAME

DEFAULT '
SERVERNAME\SAPdwnld\Testfile.txt'.

SELECTION-SCREEN END OF BLOCK B1.

*Open Download File for Writing

OPEN DATASET P_OFILE FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.

IF SY-SUBRC = 0.

*Write to download file

DATAHEAD+0 = 'Material No.'.

DATAHEAD+18 = 'Description'.

DATAHEAD+58 = 'Old Material No.'.

DATAHEAD+76 = 'Bin Loc.'.

DATAHEAD+86 = 'WH'.

DATAHEAD+96 = 'Price'.

DATAHEAD+102 = 'P.Unt'.

DATAHEAD+107 = 'Ext Matl Group'.

DATAHEAD+125 = 'Available Stk'.

DATAHEAD+138 = '.'.

TRANSFER DATAHEAD TO P_OFILE.

CLEAR DATAHEAD.

LOOP AT ITAB.

DATAHEAD+0 = ITAB-FIELD1.

DATAHEAD+18 = ITAB-FIELD2.

TRANSFER DATAHEAD TO P_OFILE.

ENDLOOP.

*Close Download File

CLOSE DATASET P_OFILE.

ENDIF.

Edited by: Brad Gorlicki on Apr 3, 2008 2:55 AM

Read only

Former Member
0 Likes
424

Hello,

Here you can find useful information about download data [https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e0901cba-f49e-2910-748c-d7ce4c0c4c1c]

And in this blog from Thomas Jung there's a good example using ABAP OO and with Unicode support [https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/1932] [original link is broken] [original link is broken] [original link is broken];

Regards,