Monday, May 23, 2011

Downloading file on to the application server

Description

This is a demo application to download the data from the internal table of the application to a file in the application server.

Step by Step Guidance.

Go to transaction SE38 to open ABAP editor and Type in the program name click the create button. Here we have used “ZDOWNLOAD_APPL_DEMO” as the program name.

Enter the Short Description for the program

Select the Program type to be “Executable program”

Click on SAVE CHECK and ACTIVATE.

Give the path of the file which has to be uploaded

Here we have the file in location “\USR\SAP\SRI\SYS\SRC\DOWN.TXT”

The drive name is taken as the default SAP installation drive.

OUTPUT LIST SCREEN

The data from the internal table is moved in to DOWN.TXT file in the Presentation server and out put displayed on the list screen shows the data in the internal table.

Output File in the Application server.

Go to Transaction AL11 to see the SAP installation directories

Find our directory double click

Find our downloaded file in the directory and double click it

The Downloaded data is displayed

SOURCE CODE
REPORT  ZDOWNLOAD_APPL_DEMO.
TYPES : BEGIN OF ST_DEMO,         REG_NO(10) TYPE C,         NAME(20) TYPE C,         ADDR(20) TYPE C,         END OF ST_DEMO.
DATA : WA_DEMO TYPE ST_DEMO,        IT_DEMO TYPE TABLE OF ST_DEMO,        L_FNAME TYPE STRING .
PARAMETERS: P_FNAME(128) TYPE C DEFAULT '\usr\sap\SRI\SYS\src\DOWN.TXT' OBLIGATORY. L_FNAME = P_FNAME. WA_DEMO-REG_NO = '100001'. WA_DEMO-NAME = 'ANAND'. WA_DEMO-ADDR = 'NAGARKOVIL'.  APPEND WA_DEMO TO IT_DEMO.
WA_DEMO-REG_NO = '100002'. WA_DEMO-NAME = 'VIKRAM'. WA_DEMO-ADDR = 'CHENNAI'. APPEND WA_DEMO TO IT_DEMO.
  OPEN DATASET L_FNAME FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.   WRITE :5 'REG NUM',16 'NAME',37 'ADDRESS' .   LOOP AT IT_DEMO INTO WA_DEMO.     IF SY-SUBRC = 0.       TRANSFER WA_DEMO TO L_FNAME.       WRITE :/5 WA_DEMO-REG_NO,16 WA_DEMO-NAME,37 WA_DEMO-ADDR.     ENDIF.   ENDLOOP.

No comments:

Tutorials on SAP-ABAP

Adobe Interactive Forms Tutorials

Business Server Pages (BSP)

Userexits/BADIs

Web Dynpro for ABAP (Step by step procedure for web dynpro,Tutorials on Web Dynpro,)

ALV Tutorials

goodsites