on 01-30-2013 10:46 AM
Hello Gents and Women,
I have found/developed the following code to export a table from webdyn pro abap to excel.
DATA lo_nd_zhr_ecm_appr_full TYPE REF TO if_wd_context_node.
DATA: lt_export_table TYPE wd_this->elements_zhr_ecm_appr_full,
lw_export_table LIKE LINE OF lt_export_table.
DATA: text TYPE string,
xtext TYPE xstring.
DATA: lv_amount TYPE char40,
lv_percent TYPE char40,
lv_amount_bonus TYPE char40,
lv_amount_percent TYPE char40,
lv_amount_comm TYPE char40.
DATA: lv_count TYPE i.
DATA: lv_filename TYPE string.
DATA: lt_poss_review_tab TYPE hrecm00review_tab,
lw_poss_review TYPE hrecm00review.
lo_nd_zhr_ecm_appr_full = wd_context->get_child_node( name = wd_this->wdctx_zhr_ecm_appr_full ).
lo_nd_zhr_ecm_appr_full->get_static_attributes_table( IMPORTING table = lt_export_table ).
"-- get the number of rows in table
DESCRIBE TABLE lt_export_table LINES lv_count.
"-- Check if there are rows
IF lv_count GT 0.
CONCATENATE text
'Pernr'
'Employee Name'
'Personal'
'Current Salary'
'Salary Increase'
'Salary Increase %'
'New Salary'
'Current Bonus'
'Bonus Increase'
'Bonus Increase %'
'New Bonus'
'Commission Increase'
'New Sal/Bon %'
'New OTE'
'Currency'
'Proven Core Competences'
'Proven Career Competences'
'Objectives'
'Actual Functional Coverage'
'Progress to last year'
'Status'
'Bonus Notes'
'Salary Notes'
'Commission Notes'
'Performance'
'Potential'
'Retention'
cl_abap_char_utilities=>newline INTO text SEPARATED BY
cl_abap_char_utilities=>horizontal_tab.
LOOP AT lt_export_table INTO lw_export_table.
WRITE lw_export_table-ec_amount TO lv_amount.
CONDENSE lv_amount.
WRITE lw_export_table-ec_percent TO lv_percent.
CONDENSE lv_percent.
WRITE lw_export_table-ec_amount_bonus TO lv_amount_bonus.
CONDENSE lv_amount_bonus.
WRITE lw_export_table-ec_percent_bonus TO lv_amount_percent.
CONDENSE lv_amount_percent.
WRITE lw_export_table-ec_amount_commission TO lv_amount_comm.
CONDENSE lv_amount_comm.
CONCATENATE text
lw_export_table-pernr
lw_export_table-ecm_eename
lw_export_table-zecm_pers_bu
lw_export_table-ec_bssal
lv_amount
lv_percent
lw_export_table-zecm_newsal
lw_export_table-ec_bssal_bonus
lv_amount_bonus
lv_amount_percent
lw_export_table-zecm_newbonu
lv_amount_comm
lw_export_table-zecm_newcalc
lw_export_table-zecm_ote
lw_export_table-ec_currency
lw_export_table-zecm_pcc
lw_export_table-zecm_pcac
lw_export_table-zecm_obj
lw_export_table-zecm_afc
lw_export_table-zecm_ply
lw_export_table-ec_state
lw_export_table-ec_notes_bon
lw_export_table-ec_notes_sal
lw_export_table-ec_notes_comm
lw_export_table-zecm_perform
lw_export_table-zecm_potent
lw_export_table-zecm_retent
cl_abap_char_utilities=>newline INTO text SEPARATED BY
cl_abap_char_utilities=>horizontal_tab.
ENDLOOP.
CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
EXPORTING
text = text
IMPORTING
buffer = xtext.
CALL FUNCTION 'HR_ECM_UI_GET_POSS_COMP_REVS'
IMPORTING
poss_review_tab = lt_poss_review_tab.
"-- Find a cool file name
READ TABLE lt_poss_review_tab INTO lw_poss_review INDEX 1.
IF sy-subrc EQ 0.
MOVE lw_poss_review-crevi_text TO lv_filename.
CONCATENATE lv_filename '.xls' INTO lv_filename.
ELSE.
MOVE 'Review.xls' TO lv_filename.
ENDIF.
wdr_task=>client_window->client->attach_file_to_response(
**path to the word file
i_filename = lv_filename
* String Variable
i_content = xtext
* File Type
i_mime_type = 'EXCEL' ).
ENDIF.
But if I have a person who is named like this:
It shows up like this in my exported excel:
I hope someone can help me with this problem, because I only found a topic about this with Arabic signs and I'm not using Arabic.
Kind regaards,
Vincent
I hate to do this but I will have to Bump this Topic:
I tried other Mime Types like: RAW / APPLICATIONMSEXCEL / MSEXCEL
Kind regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.