Professional Documents
Culture Documents
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" REFERENCE(I_MAIL_ID) TYPE ADR6-SMTP_ADDR
*" EXPORTING
*" REFERENCE(E_RETURN) TYPE BAPIRET2
*"----------------------------------------------------------------------
*"----------------------------------------------------------------------
*"----------------------------------------------------------------------
ENDDO.
DO 15 TIMES.
wa_tab2-/bic/gpu_fduom1 = '2234'.
wa_tab2-fy_comm_spnd = '686'.
wa_tab2-figcy_prevmnth = '997979'.
APPEND wa_tab2 TO t_tab2.
ENDDO.
lv_date = sy-datum - 1.
* Styles
r_styles = l_document->create_simple_element( name = 'Styles' parent =
l_element_root ).
***
* Style for tablename
r_style2 = l_document->create_simple_element( name = 'Style' parent =
r_styles ).
r_style2->set_attribute_ns( name = 'ID' prefix = 'ss' value = 'Header1' ).
******************
* Style for Data
r_style1 = l_document->create_simple_element( name = 'Style' parent =
r_styles ).
r_style1->set_attribute_ns( name = 'ID' prefix = 'ss' value = 'Data' ).
* Worksheet(First tab)
r_worksheet = l_document->create_simple_element( name = 'Worksheet' parent =
l_element_root ).
r_worksheet->set_attribute_ns( name = 'Name' prefix = 'ss' value = 'Commodity
Impact' ).
* Table
r_table = l_document->create_simple_element( name = 'Table' parent =
r_worksheet ).
r_table->set_attribute_ns( name = 'FullColumns' prefix = 'x' value = '1' ).
r_table->set_attribute_ns( name = 'FullRows' prefix = 'x' value = '1' ).
* Column Formatting
r_column = l_document->create_simple_element( name = 'Column' parent = r_table ).
r_column->set_attribute_ns( name = 'Width' prefix = 'ss' value = '150' ).
* Blank Row
r_row = l_document->create_simple_element( name = 'Row' parent = r_table ).
r_row->set_attribute_ns( name = 'AutoFitHeight' prefix = 'ss' value = '0' ).
*Title of table
* fy commodity
r_cell = l_document->create_simple_element( name = 'Cell' parent = r_row ).
r_cell->set_attribute_ns( name = 'StyleID' prefix = 'ss' value = 'Header' ).
r_data = l_document->create_simple_element( name = 'Data' value = 'FY Commodity
Spend ($MM)' parent = r_cell ).
r_data->set_attribute_ns( name = 'Type' prefix = 'ss' value = 'String' ).
* change vs jan
r_cell = l_document->create_simple_element( name = 'Cell' parent = r_row ).
r_cell->set_attribute_ns( name = 'StyleID' prefix = 'ss' value = 'Header' ).
l_value = 'Change vs'.
* Data Table
LOOP AT t_tab2 INTO wa_tab2.
* commodity
r_cell = l_document->create_simple_element( name = 'Cell' parent = r_row ).
r_cell->set_attribute_ns( name = 'StyleID' prefix = 'ss' value = 'Data' ).
l_value = wa_tab2-/bic/gpu_fduom1.
r_data = l_document->create_simple_element( name = 'Data' value = l_value
parent = r_cell ). " Data
r_data->set_attribute_ns( name = 'Type' prefix = 'ss' value = 'String' ).
" Cell format
wa_input = wa_tab2-fy_comm_spnd.
* fy
r_cell = l_document->create_simple_element( name = 'Cell' parent = r_row ).
r_cell->set_attribute_ns( name = 'StyleID' prefix = 'ss' value = 'Data' ).
l_value = wa_output.
r_data = l_document->create_simple_element( name = 'Data' value = l_value
parent = r_cell ). " Data
r_data->set_attribute_ns( name = 'Type' prefix = 'ss' value = 'String' ).
" Cell format
wa_input = wa_tab2-figcy_prevmnth.
* changes vs jan
r_cell = l_document->create_simple_element( name = 'Cell' parent = r_row ).
r_cell->set_attribute_ns( name = 'StyleID' prefix = 'ss' value = 'Data' ).
l_value = wa_output.
r_data = l_document->create_simple_element( name = 'Data' value = l_value
parent = r_cell ). " Data
r_data->set_attribute_ns( name = 'Type' prefix = 'ss' value = 'String' ).
" Cell format
CLEAR wa_tab2.
ENDLOOP.
**************
* * Worksheet2( second tab)
r_worksheet = l_document->create_simple_element( name = 'Worksheet' parent =
l_element_root ).
r_worksheet->set_attribute_ns( name = 'Name' prefix = 'ss' value = 'Tab2' ).
* Table
r_table = l_document->create_simple_element( name = 'Table' parent =
r_worksheet ).
r_table->set_attribute_ns( name = 'FullColumns' prefix = 'x' value = '1' ).
r_table->set_attribute_ns( name = 'FullRows' prefix = 'x' value = '1' ).
* Column Formatting
r_column = l_document->create_simple_element( name = 'Column' parent = r_table ).
r_column->set_attribute_ns( name = 'Width' prefix = 'ss' value = '150' ).
* Blank Row
r_row = l_document->create_simple_element( name = 'Row' parent = r_table ).
r_row->set_attribute_ns( name = 'AutoFitHeight' prefix = 'ss' value = '0' ).
***********
* 2 Blank rows
r_row = l_document->create_simple_element( name = 'Row' parent = r_table ).
r_row->set_attribute_ns( name = 'AutoFitHeight' prefix = 'ss' value = '0' ).
r_row = l_document->create_simple_element( name = 'Row' parent = r_table ).
r_row->set_attribute_ns( name = 'AutoFitHeight' prefix = 'ss' value = '0' ).
*Supplier.
r_cell = l_document->create_simple_element( name = 'Cell' parent = r_row ).
r_cell->set_attribute_ns( name = 'StyleID' prefix = 'ss' value = 'Header2' ).
r_data = l_document->create_simple_element( name = 'Data' value = 'SUPPLIER'
parent = r_cell ).
r_data->set_attribute_ns( name = 'Type' prefix = 'ss' value = 'String' ).
* SUBREGION
r_cell = l_document->create_simple_element( name = 'Cell' parent = r_row ).
r_cell->set_attribute_ns( name = 'StyleID' prefix = 'ss' value = 'Header2' ).
r_data = l_document->create_simple_element( name = 'Data' value = 'SUBREGION'
parent = r_cell ).
r_data->set_attribute_ns( name = 'Type' prefix = 'ss' value = 'String' ).
* MATERIAL VOLUME
r_cell = l_document->create_simple_element( name = 'Cell' parent = r_row ).
r_cell->set_attribute_ns( name = 'StyleID' prefix = 'ss' value = 'Header2' ).
r_data = l_document->create_simple_element( name = 'Data' value = 'MATERIAL
VOLUME' parent = r_cell ).
r_data->set_attribute_ns( name = 'Type' prefix = 'ss' value = 'String' ).
* COMMODITY
r_cell = l_document->create_simple_element( name = 'Cell' parent = r_row ).
r_cell->set_attribute_ns( name = 'StyleID' prefix = 'ss' value = 'Header2' ).
r_data = l_document->create_simple_element( name = 'Data' value = 'COMMODITY'
parent = r_cell ).
r_data->set_attribute_ns( name = 'Type' prefix = 'ss' value = 'String' ).
* FY_EXPOSURE
r_cell = l_document->create_simple_element( name = 'Cell' parent = r_row ).
r_cell->set_attribute_ns( name = 'StyleID' prefix = 'ss' value = 'Header2' ).
r_data = l_document->create_simple_element( name = 'Data' value = 'FY_EXPOSURE'
parent = r_cell ).
r_data->set_attribute_ns( name = 'Type' prefix = 'ss' value = 'String' ).
* UOM
r_cell = l_document->create_simple_element( name = 'Cell' parent = r_row ).
r_cell->set_attribute_ns( name = 'StyleID' prefix = 'ss' value = 'Header2' ).
r_data = l_document->create_simple_element( name = 'Data' value = 'UOM' parent =
r_cell ).
r_data->set_attribute_ns( name = 'Type' prefix = 'ss' value = 'String' ).
* * CURRENCY
r_cell = l_document->create_simple_element( name = 'Cell' parent = r_row ).
r_cell->set_attribute_ns( name = 'StyleID' prefix = 'ss' value = 'Header2' ).
r_data = l_document->create_simple_element( name = 'Data' value = 'CURRENCY'
parent = r_cell ).
r_data->set_attribute_ns( name = 'Type' prefix = 'ss' value = 'String' ).
* COMMODITY SPEND
r_cell = l_document->create_simple_element( name = 'Cell' parent = r_row ).
r_cell->set_attribute_ns( name = 'StyleID' prefix = 'ss' value = 'Header2' ).
r_data = l_document->create_simple_element( name = 'Data' value = 'COMMODITY
SPEND' parent = r_cell ).
r_data->set_attribute_ns( name = 'Type' prefix = 'ss' value = 'String' ).
* CHANGE VS PREVIOUS
r_cell = l_document->create_simple_element( name = 'Cell' parent = r_row ).
r_cell->set_attribute_ns( name = 'StyleID' prefix = 'ss' value = 'Header2' ).
r_data = l_document->create_simple_element( name = 'Data' value = 'CHANGE VS
PREVIOUS' parent = r_cell ).
r_data->set_attribute_ns( name = 'Type' prefix = 'ss' value = 'String' ).
* CREATION DATE(MONTH/YEAR)
r_cell = l_document->create_simple_element( name = 'Cell' parent = r_row ).
r_cell->set_attribute_ns( name = 'StyleID' prefix = 'ss' value = 'Header2' ).
r_data = l_document->create_simple_element( name = 'Data' value = 'CREATION
DATE(MONTH/YEAR)' parent = r_cell ).
r_data->set_attribute_ns( name = 'Type' prefix = 'ss' value = 'String' ).
* FIG CYCLE
r_cell = l_document->create_simple_element( name = 'Cell' parent = r_row ).
r_cell->set_attribute_ns( name = 'StyleID' prefix = 'ss' value = 'Header2' ).
r_data = l_document->create_simple_element( name = 'Data' value = 'FIG CYCLE'
parent = r_cell ).
r_data->set_attribute_ns( name = 'Type' prefix = 'ss' value = 'String' ).
* Data Table
LOOP AT t_tab1 INTO wa_tab1.
* supplier
r_cell = l_document->create_simple_element( name = 'Cell' parent = r_row ).
r_cell->set_attribute_ns( name = 'StyleID' prefix = 'ss' value = 'Data' ).
l_value = wa_tab1-/bic/gpucntct.
r_data = l_document->create_simple_element( name = 'Data' value = l_value
parent = r_cell ). " Data
r_data->set_attribute_ns( name = 'Type' prefix = 'ss' value = 'String' ).
" Cell format
* sub region
r_cell = l_document->create_simple_element( name = 'Cell' parent = r_row ).
r_cell->set_attribute_ns( name = 'StyleID' prefix = 'ss' value = 'Data' ).
l_value = wa_tab1-subregtxtlg.
r_data = l_document->create_simple_element( name = 'Data' value = l_value
parent = r_cell ). " Data
r_data->set_attribute_ns( name = 'Type' prefix = 'ss' value = 'String' ).
" Cell format
* material volume
r_cell = l_document->create_simple_element( name = 'Cell' parent = r_row ).
r_cell->set_attribute_ns( name = 'StyleID' prefix = 'ss' value = 'Data' ).
l_value = wa_tab1-/bic/gpufsejul.
r_data = l_document->create_simple_element( name = 'Data' value = l_value
parent = r_cell ). " Data
r_data->set_attribute_ns( name = 'Type' prefix = 'ss' value = 'String' ).
" Cell format
* commodity
r_cell = l_document->create_simple_element( name = 'Cell' parent = r_row ).
r_cell->set_attribute_ns( name = 'StyleID' prefix = 'ss' value = 'Data' ).
l_value = wa_tab1-/bic/gpu_fduom.
r_data = l_document->create_simple_element( name = 'Data' value = l_value
parent = r_cell ). " Data
r_data->set_attribute_ns( name = 'Type' prefix = 'ss' value = 'String' ).
" Cell format
* Fy_exposure
r_cell = l_document->create_simple_element( name = 'Cell' parent = r_row ).
r_cell->set_attribute_ns( name = 'StyleID' prefix = 'ss' value = 'Data' ).
l_value = wa_tab1-fy_exposure.
r_data = l_document->create_simple_element( name = 'Data' value = l_value
parent = r_cell ). " Data
r_data->set_attribute_ns( name = 'Type' prefix = 'ss' value = 'String' ).
" Cell format
*UOM
r_cell = l_document->create_simple_element( name = 'Cell' parent = r_row ).
r_cell->set_attribute_ns( name = 'StyleID' prefix = 'ss' value = 'Data' ).
l_value = wa_tab1-/bic/gpuuom.
r_data = l_document->create_simple_element( name = 'Data' value = l_value
parent = r_cell ). " Data
r_data->set_attribute_ns( name = 'Type' prefix = 'ss' value = 'String' ).
* currency
r_cell = l_document->create_simple_element( name = 'Cell' parent = r_row ).
r_cell->set_attribute_ns( name = 'StyleID' prefix = 'ss' value = 'Data' ).
l_value = wa_tab1-currency.
r_data = l_document->create_simple_element( name = 'Data' value = l_value
parent = r_cell ). " Data
r_data->set_attribute_ns( name = 'Type' prefix = 'ss' value = 'String' ).
wa_input = wa_tab1-/bic/gpucsdjul.
* commodity spend
r_cell = l_document->create_simple_element( name = 'Cell' parent = r_row ).
r_cell->set_attribute_ns( name = 'StyleID' prefix = 'ss' value = 'Data' ).
l_value = wa_output.
r_data = l_document->create_simple_element( name = 'Data' value = l_value
parent = r_cell ). " Data
r_data->set_attribute_ns( name = 'Type' prefix = 'ss' value = 'String' ).
wa_input = wa_tab1-chng_vs_prev.
* change vs prev
r_cell = l_document->create_simple_element( name = 'Cell' parent = r_row ).
r_cell->set_attribute_ns( name = 'StyleID' prefix = 'ss' value = 'Data' ).
l_value = wa_output.
r_data = l_document->create_simple_element( name = 'Data' value = l_value
parent = r_cell ). " Data
r_data->set_attribute_ns( name = 'Type' prefix = 'ss' value = 'String' ).
* creation date
r_cell = l_document->create_simple_element( name = 'Cell' parent = r_row ).
r_cell->set_attribute_ns( name = 'StyleID' prefix = 'ss' value = 'Data' ).
l_value = wa_tab1-/bic/gpucocdat_1.
r_data = l_document->create_simple_element( name = 'Data' value = l_value
parent = r_cell ). " Data
r_data->set_attribute_ns( name = 'Type' prefix = 'ss' value = 'String' ).
* Fig cycle
r_cell = l_document->create_simple_element( name = 'Cell' parent = r_row ).
r_cell->set_attribute_ns( name = 'StyleID' prefix = 'ss' value = 'Data' ).
l_value = wa_tab1-/bic/gpu_fcycl.
r_data = l_document->create_simple_element( name = 'Data' value = l_value
parent = r_cell ). " Data
r_data->set_attribute_ns( name = 'Type' prefix = 'ss' value = 'String' ).
CLEAR wa_tab1.
ENDLOOP.
* Target Recipent
CLEAR reclist.
reclist-receiver = 'nchintha@applelg.net'.
reclist-rec_type = 'U'.
reclist-express = 'X'.
APPEND reclist.
IF sy-subrc EQ 0.
COMMIT WORK .
WRITE : 'Mail Sent'.
ENDIF.