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 we create the file on the application server

Former Member
0 Kudos

Hi all,

How we create a file on the application server. the file have the the header data and corresponding line item data also.

i.e. how we use the statement AT NEW and ENDAT. while creating the file.

Pls send me some related code for this.

Thanks,

vipin

1 REPLY 1

rodrigo_paisante3
Active Contributor
0 Kudos

Hi,

You can create afile in server with the fm GUI_UPLOAD. You transfer the data from the file to an internal table. You need to create the internal table with the layout of the file.

After you use the GUI_DOWNLOAD to create the file from the internal table.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR v_file.

CALL FUNCTION 'WS_FILENAME_GET'

EXPORTING

def_filename = ''

def_path = 'C:\'

mask = ',all files, ..'

mode = ''

IMPORTING

filename = p_file

EXCEPTIONS

inv_winsys = 1

no_batch = 2

selection_cancel = 3

selection_error = 4

OTHERS = 5.

v_file = p_file.

form file.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = p_file

TABLES

data_tab = ti_entrada[].

endform.

AT NEW ... ENDAT example (from help)

Example

TYPES: BEGIN OF COMPANIES_TYPE,

NAME(30),

PRODUCT(20),

SALES TYPE I,

END OF COMPANIES_TYPE.

DATA: COMPANIES TYPE STANDARD TABLE OF COMPANIES_TYPE WITH

NON-UNIQUE DEFAULT KEY INITIAL SIZE 20,

WA_COMPANIES TYPE COMPANIES_TYPE.

...

LOOP AT COMPANIES INTO WA_COMPANIES.

AT NEW NAME.

NEW-PAGE.

WRITE / WA_COMPANIES-NAME.

ENDAT.

WRITE: / WA_COMPANIES-PRODUCT, WA_COMPANIES-SALES.

AT END OF NAME.

SUM.

WRITE: / WA_COMPANIES-NAME, WA_COMPANIES-SALES.

ENDAT.

ENDLOOP.

Regards!

Message was edited by:

RP