2005 Aug 25 6:21 AM
Hello All,
Could you tell me how can I export the internal table into exel pattern?
Thanks a lot.
2005 Aug 25 6:29 AM
concatenate field1 field2 field3... fieldn into <field string> separated by CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB
regds
gv
2005 Aug 25 6:29 AM
Hi,
Use this FM . This looks good with yellow color for the headings and green for key fields. I've given it in a FORM ENDFORM. Just copy and paste it in ur code and make changes in the itab names and field names as needed.
DATA: IT_COLS LIKE GXXLT_V OCCURS 0 WITH HEADER LINE.
DATA: IT_ONLINE LIKE GXXLT_O OCCURS 0 WITH HEADER LINE.
DATA: IT_PRINT LIKE GXXLT_P OCCURS 0 WITH HEADER LINE.
1)Load the actual data into the itab it_qual_com.
2)PERFORM EXCEL_GENERATION.
Bingo this will work. Please award points for the same if this was useful.
Cheers,
Sam.
FORM EXCEL_GENERATION.
IND = 0.
IT_COLS-COL_NAME = 'Emp No'.
IND = IND + 1.
IT_COLS-COL_NO = IND.
Append it_cols.
IT_COLS-COL_NAME = 'Name'.
IND = IND + 1.
IT_COLS-COL_NO = IND.
Append it_cols.
IT_COLS-COL_NAME = 'Date of Joining'.
IND = IND + 1.
IT_COLS-COL_NO = IND.
Append it_cols.
IT_COLS-COL_NAME = 'Confirmed'.
IND = IND + 1.
IT_COLS-COL_NO = IND.
Append it_cols.
IT_COLS-COL_NAME = 'Role Code'.
IND = IND + 1.
IT_COLS-COL_NO = IND.
Append it_cols.
IT_COLS-COL_NAME = 'Role Description'.
IND = IND + 1.
IT_COLS-COL_NO = IND.
Append it_cols.
IT_COLS-COL_NAME = 'Job Band'.
IND = IND + 1.
IT_COLS-COL_NO = IND.
Append it_cols.
IT_COLS-COL_NAME = 'Skill'.
IND = IND + 1.
IT_COLS-COL_NO = IND.
Append it_cols.
IT_COLS-COL_NAME = 'Additional Weightage'.
IND = IND + 1.
IT_COLS-COL_NO = IND.
Append it_cols.
IT_COLS-COL_NAME = 'Progeon Experience(months)'.
IND = IND + 1.
IT_COLS-COL_NO = IND.
Append it_cols.
IT_COLS-COL_NAME = 'Prev. Relevant Experience(months)'.
IND = IND + 1.
IT_COLS-COL_NO = IND.
Append it_cols.
IT_COLS-COL_NAME = 'Total Experience(months)'.
IND = IND + 1.
IT_COLS-COL_NO = IND.
Append it_cols.
IT_COLS-COL_NAME = 'PU/Dept'.
IND = IND + 1.
IT_COLS-COL_NO = IND.
Append it_cols.
IT_COLS-COL_NAME = 'DU'.
IND = IND + 1.
IT_COLS-COL_NO = IND.
Append it_cols.
IT_COLS-COL_NAME = 'Location'.
IND = IND + 1.
IT_COLS-COL_NO = IND.
Append it_cols.
IT_COLS-COL_NAME = 'Age'.
IND = IND + 1.
IT_COLS-COL_NO = IND.
Append it_cols.
IT_COLS-COL_NAME = 'Date of Birth'.
IND = IND + 1.
IT_COLS-COL_NO = IND.
Append it_cols.
IT_COLS-COL_NAME = 'Gender'.
IND = IND + 1.
IT_COLS-COL_NO = IND.
Append it_cols.
IT_COLS-COL_NAME = 'Birth Place'.
IND = IND + 1.
IT_COLS-COL_NO = IND.
Append it_cols.
IT_COLS-COL_NAME = 'State'.
IND = IND + 1.
IT_COLS-COL_NO = IND.
Append it_cols.
IT_COLS-COL_NAME = 'Nationality'.
IND = IND + 1.
IT_COLS-COL_NO = IND.
Append it_cols.
IT_COLS-COL_NAME = 'PB'.
IND = IND + 1.
IT_COLS-COL_NO = IND.
Append it_cols.
IT_COLS-COL_NAME = 'PSB'.
IND = IND + 1.
IT_COLS-COL_NO = IND.
Append it_cols.
IT_COLS-COL_NAME = 'Stream Code'.
IND = IND + 1.
IT_COLS-COL_NO = IND.
Append it_cols.
CALL FUNCTION 'XXL_SIMPLE_API'
EXPORTING
N_KEY_COLS = 1
TABLES
COL_TEXT = IT_COLS
DATA = IT_QUAL_COM "data itab
ONLINE_TEXT = IT_ONLINE
PRINT_TEXT = IT_PRINT
EXCEPTIONS
DIM_MISMATCH_DATA = 1
FILE_OPEN_ERROR = 2
FILE_WRITE_ERROR = 3
INV_WINSYS = 4
INV_XXL = 5
OTHERS = 6
.
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. "EXCEL_GENERATION
Cheers,
Sam
2005 Aug 25 6:32 AM
Hi,
Also, if your requirement is mere exporting into Excel Sheet, then you can also use this FM
'MS_EXCEL_OLE_STANDARD_DAT'
Cheers,
Sam
2005 Aug 25 6:41 AM
HELLO JUST USE THIS,
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
FILENAME = 'C:/FILE.XLS'
FILETYPE = 'DAT'
TABLES
data_tab = ITAB.
2005 Aug 25 6:48 AM
I have the model of the excel document (header of document and header of the table). I need export my internal date from my program into this excel document.
2005 Aug 25 7:11 AM
Hi,
You can use FM 'SAP_CONVERT_TO_XLS_FORMAT' or even you can do it using interface I_OI_SPREADSHEET ( SAPRDEMO_TABLES_IN_EXCEL ).
call function 'SAP_CONVERT_TO_XLS_FORMAT'
exporting
I_FIELD_SEPERATOR = seper
I_LINE_HEADER = 'X'
I_FILENAME = P_FILE
tables
I_TAB_SAP_DATA = itab
exceptions
CONVERSION_FAILED = 1.
Svetlin
P.S. If you find an answer useful, please assign reward points.
2005 Aug 25 7:24 AM
Ashish Jain:
with GUI_DOWNLOAD allowed file types are BIN and ASC
Hi Igor,
What you are saying is that, you have a template (EXCEL) and you want to open this and fill data from your ABAP right?
you need OLE programming. Check the following link for a very good tutorial by Serdar Simsekler
on that
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/technologies/an easy reference for ole automation.article
Regards
Raja
2005 Aug 25 6:58 AM
Hi Igor
'GUI_DOWNLOAD' is the function module for your purpose.
To me its the best available option. just use the Import parameter
FILETYPE = 'XLS' (defualt is 'ASC')
Regards
Ashish