‎2008 Jan 14 12:57 PM
Hi Everyone,
I am able to transfer my internal table data to Excel. By default for all the columns it is doing sum. For one of the column, I don't need that.
Deleting the row entries is not possible.
I can do that in Excel (manually) through selecting the column -> Field Settings -> Subtotals -> none.
My requirement is to do that in Abap Program itself.
I tried using Macro, but may be I am not using it properly.
Please help me!
Thanks & Regards,
Abdul
‎2008 Jan 16 4:14 AM
Hi Abdul,
Check this code yaar. It will help you.
TABLES: T001.
data: it_t001 type t001 occurs 0,
it_fields type dfies occurs 0 with header line,
*DFIES
*DD Interface: Table Fields for DDIF_FIELDINFO_GET
begin of it_fnames occurs 0,
reptext like dfies-reptext,
end of it_fnames.
dfies-reptext REPRESENTS HEADDINGS OF FIELDS.
The structure definition required for this internal table.
The following definition is not working:
it_fnames like dfies-reptext occurs 0 with header line.
because Function Module will use the following:
ASSIGN COMPONENT 1 OF STRUCTURE FIELDNAMES TO <F>.
select * from t001 into table it_t001.
CALL FUNCTION 'GET_FIELDTAB'
EXPORTING
LANGU = SY-LANGU
ONLY = ' '
TABNAME = 'T001'
WITHTEXT = 'X'
IMPORTING
HEADER =
RC =
TABLES
FIELDTAB = it_fields
EXCEPTIONS
INTERNAL_ERROR = 1
NO_TEXTS_FOUND = 2
TABLE_HAS_NO_FIELDS = 3
TABLE_NOT_ACTIV = 4
OTHERS = 5
.
IF SY-SUBRC 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
loop at it_fields.
it_fnames-reptext = it_fields-reptext.
append it_fnames.
endloop.
CALL FUNCTION 'MS_EXCEL_OLE_STANDARD_DAT'
EXPORTING
FILE_NAME = 'C:\test.xls'
CREATE_PIVOT = 0
DATA_SHEET_NAME = 'sheet1'
PIVOT_SHEET_NAME = ' '
PASSWORD = ' '
PASSWORD_OPTION = 0
TABLES
PIVOT_FIELD_TAB =
DATA_TAB = it_t001
FIELDNAMES = it_fnames
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.
kindly reward if found helpful.
cheers,
Hema.
‎2008 Jan 16 2:23 PM
Hi Hema,
Thanks for your concern, yaar. This code is helpful, but what you are doing using Function modules here, I have already done that using interface and methods. My problem still persists.
Ofcourse I will give you points, but let me keep this thread open for some more time, I may get some usefule answer.
Thanks & Regards,
Abdul
‎2008 Jan 17 11:24 AM
‎2012 Oct 18 3:15 PM
Hello Abdul,
I have the same problem, did you find the solution for editing the table pivot? (
column -> Field Settings -> Subtotals -> none)
Thanks & regards
Javier