05-07-2007 7:27 AM
Hi,
I have the requirement to download the ALV output to excel file into desktop later the user creates the pivot table based on excel file.
Currently i am using FM MS_EXCEL_OLE_STANDARD_DAT. The output is passing to excel but it is automatically opening excel file which is not required.
I want the feature that ALV output should be stored in excel without opening it.
Regards,
Ratna
05-07-2007 7:29 AM
Hi,
Instead of the FM which you are using, use GUI_DOWNLOAD FM.
Pass the file type as 'ASC' and file path as 'C:\File.xls" or the file path & name as per your requirement.
The file will be stored on the path but it wont open automatically.
Best regards,
Prashant
05-07-2007 7:29 AM
Hi,
Instead of the FM which you are using, use GUI_DOWNLOAD FM.
Pass the file type as 'ASC' and file path as 'C:\File.xls" or the file path & name as per your requirement.
The file will be stored on the path but it wont open automatically.
Best regards,
Prashant
05-07-2007 7:36 AM
Hi Prashant,
Thanks for your response...
In GUI Download, can i put coulum headings for excel file.
If so can you please tell me how to set it.
Regards,
Ratna.
05-07-2007 7:32 AM
05-07-2007 7:42 AM
hi this is full program
&----
*& Report ZCR_BOMPLANT_DOWNLOAD
*&
&----
*&
*&
&----
REPORT ZCR_BOMPLANT_DOWNLOAD.
----
MODULE *
*----
*
Objective : Asset Movement with Factory *
Program : Updates Tables ( ) *
: Outputs List ( ) *
: Downloads data ( X ) *
*
Technical Spec No : JOB # 146 *
Date Created : 2007-03-22 *
Author : Nelson Rodrigo *
Location : Regent's Court *
LDB : *
*
*----
External Dependencies *
*----
*
*----
Amendment History *
*----
Who Change ID Reason *
*----
************************************************************************
*----
Tables : *
*----
*
TABLES : MAST , "Material to BOM Link
STKO , "BOM Header
MARA . "General Material Data
*
*----
Types Begin with TY_ *
*----
*
TYPES : BEGIN OF TY_MASTER ,
MATNR TYPE MAST-MATNR , "Material Number
WERKS TYPE MAST-WERKS , "Plant
STLAN TYPE MAST-STLAN , "BOM Usage
STLNR TYPE MAST-STLNR , "Bill of material
STLAL TYPE MAST-STLAL , "Alternative BOM
ANDAT TYPE MAST-ANDAT , "Date record created on
AEDAT TYPE MAST-AEDAT , "Date of Last Change
AENAM TYPE MAST-AENAM , "Name of Person Who Changed Object
STLST TYPE STKO-STLST , "BOM status
ZPLP1 TYPE MBEW-ZPLP1 , "Future Planned Price 1
DWERK TYPE MVKE-DWERK , "Delivering Plant (Own or External)
END OF TY_MASTER .
*
TYPES : MY_TYPE(20) TYPE C.
*
*----
Constants Begin with C_ *
*----
*
*----
Internal tables Begin with IT_ *
*----
*
DATA : IT_MASTER TYPE STANDARD TABLE OF TY_MASTER,
WA_MASTER TYPE TY_MASTER .
*
DATA : IT_HEADER TYPE TABLE OF MY_TYPE.
*
*
*----
Data Begin with W_ *
*----
*
DATA : W_PTH TYPE RLGRAP-FILENAME.
DATA : W_FILE TYPE RLGRAP-FILENAME.
*
*----
Field Symbols Begin with FS_ *
*----
*
*
*----
Select Options Begin with SO_ *
*----
*
*
*----
Parameter Begin with PR_ *
*----
*
*----
I N I T I A L I Z A T I O N *
*----
*
*--- Add Header Fields to Header Table ---
*
APPEND 'Material Number' TO IT_HEADER .
APPEND 'Plant' TO IT_HEADER .
APPEND 'BOM Usage' TO IT_HEADER .
APPEND 'Bill Code' TO IT_HEADER .
APPEND 'Alternative BOM' TO IT_HEADER .
APPEND 'Created On' TO IT_HEADER .
APPEND 'Changed On' TO IT_HEADER .
APPEND 'Changed By' TO IT_HEADER .
APPEND 'BOM Status' TO IT_HEADER .
APPEND 'Planned Price' TO IT_HEADER .
APPEND 'Delivery Plant' TO IT_HEADER .
*
IF SY-MANDT = '700'.
W_PTH = '
lkdb01\ISD\IS\Software Developments\Developments\Data Files\SAP Dumps\BOM_Available\'.
ELSE.
W_PTH = 'C:\'.
ENDIF.
*
*----
A T S E L E C T I O N S C R E E N *
*----
*
*
************************************************************************
s t a r t o f s e l e c t i o n
************************************************************************
*
START-OF-SELECTION.
*
*--- Load Data to Internal Table ---
*
SELECT MASTMATNR MASTWERKS MASTSTLAN MASTSTLNR MASTSTLAL MASTANDAT MASTAEDAT MASTAENAM STKO~STLST
INTO TABLE IT_MASTER
FROM MAST
INNER JOIN STKO ON STKOSTLNR EQ MASTSTLNR
AND STKOSTLAL EQ MASTSTLAL
INNER JOIN MARA ON MARAMATNR EQ MASTMATNR
WHERE MARA~MTART LIKE 'ZFG%'
AND STKO~LKENZ NE 'X'
AND STKO~LOEKZ NE 'X'
AND STKO~STLST EQ '1'.
*
**************************************************************************************************************
*
SELECT MAST~MATNR MAST~WERKS MAST~STLAN MAST~STLNR MAST~STLAL MAST~ANDAT MAST~AEDAT MAST~AENAM STKO~STLST MBEW~ZPLP1 MVKE~DWERK
INTO TABLE IT_MASTER
FROM MAST
INNER JOIN STKO ON STKO~STLNR EQ MAST~STLNR
AND STKO~STLAL EQ MAST~STLAL
INNER JOIN MARA ON MARA~MATNR EQ MAST~MATNR
INNER JOIN MBEW ON MBEW~MATNR EQ MAST~MATNR
AND MBEW~BWKEY EQ MAST~WERKS
INNER JOIN MVKE ON MVKE~MATNR EQ MAST~MATNR
WHERE MARA~MTART LIKE 'ZFG%'
AND STKO~LKENZ NE 'X'
AND STKO~LOEKZ NE 'X'
AND STKO~STLST EQ '1'.
*
**************************************************************************************************************
IF SY-SUBRC <> 0.
MESSAGE I014(ZLOAD).
ENDIF.
*
*--- Set Path to Function Module ---
*
CONCATENATE W_PTH SY-DATUM ' - ' 'BOM_AVAILABLE_PLANT.XLS' INTO W_FILE.
*
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
FILENAME = W_FILE
FILETYPE = 'DAT'
TABLES
DATA_TAB = IT_MASTER
FIELDNAMES = IT_HEADER
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_WRITE_ERROR = 2
INVALID_FILESIZE = 3
INVALID_TYPE = 4
NO_BATCH = 5
UNKNOWN_ERROR = 6
INVALID_TABLE_EIDTH = 7
GUI_REFUSE_FILETRANSFER = 8
CUSTOMER_ERROR = 9
OTHERS = 10.
*
IF SY-SUBRC = 0.
SUBMIT ZI005_MARA_DUMP_SOLIDEAL_N.
MESSAGE I023(ZLOAD) WITH text-001.
ELSE.
MESSAGE I022(ZLOAD) WITH W_FILE. "Errors while downloading.
ENDIF.
*
END-OF-SELECTION.
*
SUBMIT ZI005_MARA_DUMP_SOLIDEAL_N.
*
***********************************************************************
E N D O F S E L E C T I O N
************************************************************************
----
end of page
*----
**********************----
E N D O F A B A P
**********************----
Rewards if helpful