Skip to Content
author's profile photo Former Member
Former Member

Dynamic ALV + deep structure

Hi Experts,

I have a requirement to use dynamic ALV with the color table.

The number of ALV columns depend on the Time Horizon selected

i.e 10Days will display 10 columns or 14Days will display 14 columns

How do you dynamically create an internal table with a deep structure?

The deep structure is required because I need the color table in the field catalog to color individual cells of the ALV!

Any ideas how to do this?

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Nov 29, 2007 at 11:52 AM

    Well we might need some more explanation as to what you are trying to do... however the "color" table occurs once per row but can contain settings for several (all) columns in that row... and as for varying the number of columns, can we assume there is a maximum number you might need for your "horizon"..? If so, just define this max number in your ALV structure then just hide the ones you don't need before you display the ALV report.

    Jonathan

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Jonathan,

      I am aware of the suggestion but I wonder if it is possible to create dynamic deep structures in abap.

      When I define a dynamic work area of TYPE ANY and assign an internal table to one of it's columns the program short dumps with error type h cannot be assigned to type c.

      Is there any other way?

  • author's profile photo Former Member
    Former Member
    Posted on Nov 29, 2007 at 11:59 AM

    Add a component COLOR_TYPE type LVC_T_SCOL to your structure.

    data: it_color type type table of lvc_s_scol.

    data: wa_color type lvc_s_scol.

    if condition.

    • set color to green

    move '5' to wa_color-color-col.

    move '0' to wa_color-color-int.

    move '0' to wa_color-color-inv.

    • or set to yellow

    move '3' to wa_color-color-col.

    move '1' to wa_color-color-int.

    move '0' to wa_color-color-inv.

    • or set to red

    move '6' to wa_color-color-col.

    move '0' to wa_color-color-int.

    move '0' to wa_color-color-inv.

    append wa_color to it_color.

    wa_alv_data-color_cell[] = it_color[].

    clear wa_color.

    endif

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.