Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing colours for ALV converter #1102

Open
KonstantinKhrushchev opened this issue Apr 20, 2023 · 4 comments · May be fixed by #1105
Open

Missing colours for ALV converter #1102

KonstantinKhrushchev opened this issue Apr 20, 2023 · 4 comments · May be fixed by #1105

Comments

@KonstantinKhrushchev
Copy link

Missing 700, 710 colours in ZCL_EXCEL_CONVERTER_ALV - CLASS_CONSTRUCTOR
My suggest:

ls_color-col       = 7.
ls_color-int       = 0.
ls_color-inv       = 0.
ls_color-fontcolor = 'FF000000'. " 000 000 000 Black
ls_color-fillcolor = 'FFF8E5C8'. " 246 229 204
INSERT ls_color INTO TABLE wt_colors.

ls_color-col       = 7.
ls_color-int       = 1.
ls_color-inv       = 0.
ls_color-fontcolor = 'FF000000'. " 000 000 000 Black
ls_color-fillcolor = 'FFFDBB71'. " 255 186 106
INSERT ls_color INTO TABLE wt_colors.

In an ideal get colours from Z customer table. Existing RGB codes(110,200...) doesn`t suit our client.

@sandraros
Copy link
Collaborator

sandraros commented Apr 20, 2023

Could you provide some code to reproduce the missing colors? Or explain how to see the problem from user's perspective? Thank you.

Code above to be placed after the "red" block (color 6), before ENDMETHOD:

* Red
ls_color-col = 6.
ls_color-int = 0.
ls_color-inv = 0.
ls_color-fontcolor = 'FF000000'. " 000 000 000 Black
ls_color-fillcolor = 'FFFDBBBC'. " 253 187 188 Red
INSERT ls_color INTO TABLE wt_colors.
ls_color-col = 6.
ls_color-int = 0.
ls_color-inv = 1.
ls_color-fontcolor = 'FFFDBBBC'. " 253 187 188 Red
ls_color-fillcolor = 'FFFFFFFF'. " 255 255 255 White
INSERT ls_color INTO TABLE wt_colors.
ls_color-col = 6.
ls_color-int = 1.
ls_color-inv = 0.
ls_color-fontcolor = 'FF000000'. " 000 000 000 Black
ls_color-fillcolor = 'FFFB6B6B'. " 251 107 107 int Red
INSERT ls_color INTO TABLE wt_colors.
ls_color-col = 6.
ls_color-int = 1.
ls_color-inv = 1.
ls_color-fontcolor = 'FFFB6B6B'. " 251 107 107 int Red
ls_color-fillcolor = 'FFFFFFFF'. " 255 255 255 White
INSERT ls_color INTO TABLE wt_colors.
ENDMETHOD.

@KonstantinKhrushchev
Copy link
Author

ALV rows with 700,710 background colours will have no background colour in excel cell.

@gregorwolf
Copy link
Collaborator

Hi @KonstantinKhrushchev,

would be great if you create a pull request with the needed corrections.

@sandraros
Copy link
Collaborator

Steps to reproduce (a test program would be nice to have in the demos repository):

  • Copy ZDEMO_EXCEL32 program
  • Insert these lines after REPORT zdemo_excel32:
    TYPES: BEGIN OF sbook.
        INCLUDE TYPE sbook.
    TYPES: color TYPE lvc_t_scol,
           END OF sbook.
  • replace the line INTO TABLE gt_sbook[] with:
          INTO CORRESPONDING FIELDS OF TABLE gt_sbook[]
  • Insert these lines before lo_salv->display( ):
      lo_salv->get_columns( )->set_color_column( 'COLOR' ).
      MODIFY gt_sbook FROM VALUE #( color = VALUE #( ( fname = 'FORCURAM' color-col = 7 color-int = '1' ) ) ) 
          TRANSPORTING color WHERE color IS INITIAL.
  • Activate the program > run it > click "Excel converter"

NB: this color method is not recognized by abap2xlsx:

CAST cl_salv_column_table( lo_salv->get_columns( )->get_column( 'FORCURAM' ) )->set_color( VALUE #( col = 7 int = 1 ) ).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants