cancel
Showing results for 
Search instead for 
Did you mean: 

smartform table control main area alternate color combination.(zebra style)

Former Member
0 Kudos

i want to color odd or even number of rows with two color (alternate color combination- zebra) to a smartform table item list.

i have tried various solution and applied different logic for that but it did not work.

can anyone help me out ?

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

You can create different row types(with coulred) for the table.

use the row types in your table main area.

and print it alternately by checking the sy-tabix(as a flag).

Jshree

Former Member
0 Kudos

how can you put any condition inside main area ??

using tabix ???

Former Member
0 Kudos

Hi,

You cannot get the sy-tabix inside the program lines.do programatically.

1.Set a flag lv_flg = 0.

2.Inside the main area you will be having two row types.

3.For the first rowtype cells provide the condition lv_flg = 0.

4.For the second rowtype cells provide the condition lv_flg = 1.

5.While processing the first rowtype (i.e for odd line item) ,create a program lines inside that and change the flag to lv_flg = 1.

In the initial stage the flag lv_flg will be 0.

6.So,when the second item loops it will check for the flag and prints the second rowtype.

Jshree

Former Member
0 Kudos

for Zebra stripe (toggle as needed)...

IF LV_FLAG = 0.

LV_FLAG = 1.

else.

LV_FLAG = 0.

endif.

in your output conditions....output based upon shaded for LV_FLAG = 1, not shaded for LV_FLAG = 0, etc.

Former Member
0 Kudos

shadding is not possible in table control !

thank you for the help.

Former Member
0 Kudos

Finally i can get the door where i can enter for the solution.

i have done some research and sample development but finally i found very simple logic.

as follows.....

1) take 1 integer variable in your internal table (i have used "color type i").

2 ) in initialization i wrote

data : val type i.

loop at it_bseg into wa_bseg.

val = wa_bseg-buzei mod 2.

wa_bseg-color = val.

modify it_bseg from wa_bseg.

endloop.

so that i can get true and false(which 1 and 0) value in each row of internal table number of rows.

3 ) in main area of the table control

i have created 2 row type lines.. each line contains different number of cells like no,name,amount....& so on....

4 ) in 1st row type double click and select conditions tab

apply condition : WA_BSEG-COLOR = 1

5 ) in 2nd row type doble click and select conditions tab

apply condition : WA_BSEG-COLOR = 0

6 ) after completing you can switch your row type at run time

now i have to apply color for each row type

but table control cant support box and shadding feature..

i would welcome any suggestion from you gyus...........i am thinking and trying to do it verious styles....

if any let me know...

thank you...

Former Member
0 Kudos

Dear friends,

finally i got the solution for coloring table control and zebra printing.

steps.

1 ) after showing above logic for doubilng row type.

follow

2 ) double click on table control and press table tab.

3 ) press details button which you nevigate table control in numerical mode (where you have to specify table length and cells by number)

4 ) copy line 1 and paste it to below that line . now you have two lines (you can press table painter button where you can see double line upside/downside)

5 ) press button draw lines and columns now you can select any of row and color it with different color and shade.

6 ) in table control's main area double click any of rowtype and select line type to another (which you have colored)

7 ) activate smartform and execute it.

you can find zebra style table row,

thank you ...

Edited by: Corrtech on Nov 11, 2011 11:36 AM

Former Member
0 Kudos

i am not able to create program lines inside row type.

only loop and command feature is available inside row type.

thank you.

Tatenda_Chaibva
Explorer
0 Kudos

Hi Avirat

I figured it out, what i did was in the table that i was looping at i put in an extra field which was of type C and in it you then fill the field using

DATA: lv_mod TYPE i.

LOOP AT lt_xyz INTO ls_xyz.

     lv_mod = sy-tabix MOD 2.

     IF lv_mod = 0.

          ls_xyz-colour = 'X'.

     ELSE.

          CLEAR ls_xyz-colour.

     ENDIF.

ENDLOOP.

Then I created 2 line types and based on the results you get from your table you and chose which line to show.

This is all prior to using the table in the Form. Assuming it is an import Table.

Regards

Tatenda