04-17-2006 10:17 AM
Hi,
I need to convert my report output to word document with a customised logo in the word document. Can anyone please help me out by providing the necessary procedure (step by step process or code in abap).
Thanks and Regards
AK
04-17-2006 10:29 AM
Hi Ashok ,
You just copy this Abap code and run it. The output is an excel file .
REPORT ZKUN_FILE6 .
TABLES: USR03,DD02L.
DATA: ZX030L LIKE X030L.
DATA BEGIN OF ZDFIES OCCURS 0.
INCLUDE STRUCTURE DFIES.
DATA END OF ZDFIES.
DATA: BEGIN OF FLDITAB OCCURS 0,
FLDNAME(11) TYPE C,
END OF FLDITAB.
DATA ITABUSR03 LIKE USR03 OCCURS 0 WITH HEADER LINE.
DATA TNAME LIKE DD02L-TABNAME.
SELECT * FROM USR03 INTO TABLE ITABUSR03.
TNAME = 'USR03'.
PERFORM GETFIELEDS.
PERFORM SHOW123.
********************************************
FORM GETFIELEDS.
CALL FUNCTION 'GET_FIELDTAB'
EXPORTING
LANGU = SY-LANGU
ONLY = SPACE
TABNAME = TNAME
WITHTEXT = 'X'
IMPORTING
HEADER = ZX030L
TABLES
FIELDTAB = ZDFIES
EXCEPTIONS
INTERNAL_ERROR = 01
NO_TEXTS_FOUND = 02
TABLE_HAS_NO_FIELDS = 03
TABLE_NOT_ACTIV = 04.
CASE SY-SUBRC.
WHEN 0.
LOOP AT ZDFIES.
FLDITAB-FLDNAME = ZDFIES-FIELDNAME.
APPEND FLDITAB.
ENDLOOP.
WHEN OTHERS.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
with SY-SUBRC.
ENDCASE.
ENDFORM.
***********************************
FORM SHOW123.
CALL FUNCTION 'EXCEL_OLE_STANDARD_DAT'
EXPORTING
FILE_NAME = 'C:\USR03.XLS'
DATA_SHEET_NAME = 'USER LIST'
TABLES
DATA_TAB = ITABUSR03
FIELDNAMES = FLDITAB
EXCEPTIONS
FILE_NOT_EXIST = 1
FILENAME_EXPECTED = 2
COMMUNICATION_ERROR = 3
OLE_OBJECT_METHOD_ERROR = 4
OLE_OBJECT_PROPERTY_ERROR = 5
INVALID_FILENAME = 6
INVALID_PIVOT_FIELDS = 7
DOWNLOAD_PROBLEM = 8
OTHERS = 9.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM.
Thanks and Regards,
Kunal.
( hope this solves your problem.)
04-17-2006 10:20 AM
Hi,
Check this sample code..
http://www.sap-img.com/abap/download-to-excel-with-format-border-color-cell-etc.htm
Regards
vijay
04-17-2006 10:26 AM
hi vijay,
Your link was very helpful .
can i do the same in a word document.
I need a sample ole program for that also.
I also need to embed my company logo in the word document.
Thanks and Regards
AK
04-17-2006 10:42 AM
Hi ashok,
if you check the SAP standard ALV reports <b>BALVST02_GRID</b> there there is a Option Word Processing (CTRLSHFTF8)
Check it, it will display the list in Word, and you can show the report with colours also.
Regards
vijay
04-17-2006 10:25 AM
hi
good
to through this
http://abap4.tripod.com/How_to_call_HR_DISPLAY_BASIC_LIST.html
http://www.sapgenie.com/abap/functions.htm
thanks
mrutyun
04-17-2006 10:27 AM
Hi Ashok,
There is a wonderful pdf document which will help you in connecting Office Automation tools like MS Word and Excel with ABAP.
Just check this link.
Regards,
SP.
04-17-2006 10:57 AM
Hi prasad ,
your link was very helpful .
I could download all my report data into a word format.
Can i embed my company's logo as part of the report in word doc.
My requirement is to download my report content , with my company's logo embedded in the word doc as part of the report.
SO is this possible using ole .
Can anyone suggest me suitable procedures
AK
04-18-2006 5:06 AM
Hi Ashok,
Check this link. It will give you useful information about Desktop Office Integration.
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCCIOFFI/BCCIOFFI.pdf
I think this document will guide you in satisfying your requirement.
Regards,
SP.
03-29-2007 5:42 AM
Hi Kumar,
Even i have a requirement now to download report output to a microsoft word and then to add customized logo to it. The link which prasad mentioned was not accessible now. So, I request you to kindly send me the documents and a sample Program (if possible) for transferring report output to microsoft word. Kindly do the needful.
Regards,
Rajesh
04-17-2006 10:29 AM
Hi Ashok ,
You just copy this Abap code and run it. The output is an excel file .
REPORT ZKUN_FILE6 .
TABLES: USR03,DD02L.
DATA: ZX030L LIKE X030L.
DATA BEGIN OF ZDFIES OCCURS 0.
INCLUDE STRUCTURE DFIES.
DATA END OF ZDFIES.
DATA: BEGIN OF FLDITAB OCCURS 0,
FLDNAME(11) TYPE C,
END OF FLDITAB.
DATA ITABUSR03 LIKE USR03 OCCURS 0 WITH HEADER LINE.
DATA TNAME LIKE DD02L-TABNAME.
SELECT * FROM USR03 INTO TABLE ITABUSR03.
TNAME = 'USR03'.
PERFORM GETFIELEDS.
PERFORM SHOW123.
********************************************
FORM GETFIELEDS.
CALL FUNCTION 'GET_FIELDTAB'
EXPORTING
LANGU = SY-LANGU
ONLY = SPACE
TABNAME = TNAME
WITHTEXT = 'X'
IMPORTING
HEADER = ZX030L
TABLES
FIELDTAB = ZDFIES
EXCEPTIONS
INTERNAL_ERROR = 01
NO_TEXTS_FOUND = 02
TABLE_HAS_NO_FIELDS = 03
TABLE_NOT_ACTIV = 04.
CASE SY-SUBRC.
WHEN 0.
LOOP AT ZDFIES.
FLDITAB-FLDNAME = ZDFIES-FIELDNAME.
APPEND FLDITAB.
ENDLOOP.
WHEN OTHERS.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
with SY-SUBRC.
ENDCASE.
ENDFORM.
***********************************
FORM SHOW123.
CALL FUNCTION 'EXCEL_OLE_STANDARD_DAT'
EXPORTING
FILE_NAME = 'C:\USR03.XLS'
DATA_SHEET_NAME = 'USER LIST'
TABLES
DATA_TAB = ITABUSR03
FIELDNAMES = FLDITAB
EXCEPTIONS
FILE_NOT_EXIST = 1
FILENAME_EXPECTED = 2
COMMUNICATION_ERROR = 3
OLE_OBJECT_METHOD_ERROR = 4
OLE_OBJECT_PROPERTY_ERROR = 5
INVALID_FILENAME = 6
INVALID_PIVOT_FIELDS = 7
DOWNLOAD_PROBLEM = 8
OTHERS = 9.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM.
Thanks and Regards,
Kunal.
( hope this solves your problem.)