...
DATA:
...
lo_style_std_bold_red TYPE REF TO zcl_excel_style,
lv_style_std_bold_red_guid TYPE zexcel_cell_style,
lo_style_cond TYPE REF TO zcl_excel_style_conditional,
ls_style_expr TYPE zexcel_conditional_expression
.
...
"-Create bold red font style based on standard for conditional formatting
lo_style_std_bold_red = lo_excel->add_new_style( ).
lo_style_std_bold_red->font->name = zcl_excel_style_font=>c_name_arial.
lo_style_std_bold_red->font->scheme = zcl_excel_style_font=>c_scheme_none.
lo_style_std_bold_red->font->size = 10.
lo_style_std_bold_red->font->bold = abap_true.
lo_style_std_bold_red->font->color-rgb = '00FF0000'.
lv_style_std_bold_red_guid = lo_style_std_bold_red->get_guid( ).
...
"-Get highest row-------------------------------------------------------
lv_row = lo_worksheet->get_highest_row( ).
"-Conditional formatting------------------------------------------------
lo_style_cond = lo_worksheet->add_new_conditional_style( ).
lo_style_cond->rule = zcl_excel_style_conditional=>c_rule_expression.
ls_style_expr-formula = 'INDIRECT(ADDRESS(ROW(),COLUMN()))<>0'.
ls_style_expr-cell_style = lv_style_std_bold_red_guid.
lo_style_cond->mode_expression = ls_style_expr.
lo_style_cond->set_range(
EXPORTING
ip_start_row = lv_row
ip_start_column = 'B'
ip_stop_row = lv_row
ip_stop_column = 'S'
).
...
FIELD-SYMBOLS:
<lt_data> TYPE ANY TABLE,
<ls_data> TYPE any,
<lv_comp> TYPE any
.
...
LOOP AT <lt_data> ASSIGNING <ls_data>.
DO.
ASSIGN COMPONENT sy-index OF STRUCTURE <ls_data> TO <lv_comp>.
IF sy-subrc = 0.
...
CONTINUE.
ELSE.
EXIT.
ENDIF.
ENDDO.
ENDLOOP.
...
DATA:
lt_data TPYE t_mytable,
ls_data TYPE s_mystructure
.
...
LOOP AT lt_data INTO ls_data.
lo_worksheet->set_cell( ip_column = 'A' ip_row = 1 ip_value = ls_data-my_field ).
...
ENDLOOP.
...
In the German version of Excel looks an IF function like this
=WENN(A1 = 1; "Yes"; "No")
To use this formula with abap2xlsx in an ABAP source it must looks like this:
IF(A1 = 1, "Yes", "No")
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
4 | |
2 | |
2 | |
2 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 |