09-12-2008 6:10 AM
Hi All,
I'm creating an excel file in the application server using OPEN DATASET etc,..
I want to give some name to the excel sheet.
Please let me know how to do that??
Thanks & Regards
Santhosh
09-12-2008 6:26 AM
How are you creating the excel sheet in the application server? Can you not create the file in the presentation server and then move it to the application server. Most of the Excel Funtion modules can be run only with the presentation server.
09-12-2008 7:07 AM
Hi Aparna,
I know how to create a excel file in application server,
but i want to know how i can name the sheet in the excel file.
Thanks & Regards
Santhosh
10-07-2008 4:59 AM
hi santosh,
can you provide me the steps how to create excel file on the application server.
thanks in advance,
sastry,
10-14-2008 1:45 PM
Hi Sastry,
U can proceed like this..
DATA : FILE_NAME TYPE STRING.
FIELD-SYMBOLS: <F>.
DATA: BUFFER(8000) TYPE C,
FIELDNAME_OFFSET TYPE I.
CLASS CL_ABAP_CHAR_UTILITIES DEFINITION LOAD.
DATA: HTAB(1) TYPE C.
DATA: WA_FIELDCAT LIKE LINE OF GT_FIELDCAT.
HTAB = CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.
file_name = '\\ORDSAP-SBX\EXPORT\ADMAPPING.XLS'
** Give the file path name where do u want to store the file in application server
IF FILE_NAME IS NOT INITIAL.
OPEN DATASET FILE_NAME FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
IF SY-SUBRC = 0.
CLEAR BUFFER.
CLEAR FIELDNAME_OFFSET.
LOOP AT GT_FIELDCAT INTO WA_FIELDCAT.
ASSIGN WA_FIELDCAT-SELTEXT_L TO <F>.
IF SY-SUBRC NE 0.
EXIT.
ENDIF.
WRITE <F> TO BUFFER+FIELDNAME_OFFSET.
CONDENSE BUFFER.
FIELDNAME_OFFSET = STRLEN( BUFFER ).
WRITE HTAB TO BUFFER+FIELDNAME_OFFSET(1).
ADD 1 TO FIELDNAME_OFFSET.
ENDLOOP.
TRANSFER BUFFER TO FILE_NAME LENGTH FIELDNAME_OFFSET.
LOOP AT SYHR_LG_BL00 INTO SYHR_LG_BL00_WA.
CLEAR: BUFFER,FIELDNAME_OFFSET.
DO.
ASSIGN COMPONENT SY-INDEX OF STRUCTURE SYHR_LG_BL00_WA TO <F>.
IF SY-SUBRC NE 0.
EXIT.
ENDIF.
WRITE <F> TO BUFFER+FIELDNAME_OFFSET.
CONDENSE BUFFER.
FIELDNAME_OFFSET = STRLEN( BUFFER ).
WRITE HTAB TO BUFFER+FIELDNAME_OFFSET(1).
ADD 1 TO FIELDNAME_OFFSET.
ENDDO.
TRANSFER BUFFER TO FILE_NAME LENGTH FIELDNAME_OFFSET.
ENDLOOP.
CLOSE DATASET FILE_NAME.
ENDIF.
ENDIF.
Thanks & Regards
Santhosh
09-12-2008 6:27 AM
HI,
i have been in a similar kind of situation a while before and at my place there is function module called zca_file_get_name which when given the name through the program will create the file in the application server and there after we can write the data into it...
let me know if it helps
09-12-2008 7:04 AM
Hi Babu,
I'm able to create the file in the application server,
but i want to name the sheet in the excel file. I want to know that..
Thanks & Regards
Santhosh