Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

alv

Former Member
0 Likes
349

hi to all,

can any body help me this regard?

how to make colors in individual rows and colums .

i created one program which has total .i want that total to be different color .

if any body has sample program about color , it would be a great help for me .

if possible , pls.send me .

regards ,

Kiran.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
324

Hello Kiran,

?

http://www.sapfans.com/forums/viewtopic.php?t=52107

http://www.geocities.com/mpioud/Z_ALV_LINE_COLOR.html

<b>

ROW COLOUR:</b>

http://www.sap-img.com/abap/line-color-in-alv-example.htm

Check this link.It has most of the information about ALV Controls and coloring of rows,columns and cells.

http://www.abap4.it/download/ALV.pdf

<b>A SAMPLE PROGRAM FOR COLUMN COLOUR:</b>

REPORT ZSAMPLE.

<b>TYPE-POOLS COL.</b>

DATA: ALV type ref to cl_gui_alv_grid,

cont type ref to cl_gui_custom_container,

ok_code type sy-ucomm.

DATA: BEgin of s_spfli,

carrid type spfli-carrid,

connid type spfli-connid,

airpfrom type spfli-airpfrom,

airpto type spfli-airpto,

<b>COLOR(4),</b>

end of s_spfli.

DATA: I_fld type lvc_t_fcat,

wa_fld type lvc_s_fcat,

I_spfli like table of s_spfli,

x_layout type LVC_S_LAYO.

START-OF-SELECTION.

select carrid connid airpfrom airpto from spfli into table i_spfli.

<b>concatenate 'C' COL_NEGATIVE '10' INTO S_SPFLI-COLOR.</b> MODIFY I_SPFLI FROM S_SPFLI TRANSPORTING COLOR WHERE CARRID = 'LH' AND

CONNID = '0400'.

<b>x_layout-info_fname = 'COLOR'.</b>

call screen 100.

&----


*& Module STATUS_0100 OUTPUT

&----


  • text

----


MODULE STATUS_0100 OUTPUT.

SET PF-STATUS 'GUI'.

  • SET TITLEBAR 'xxx'.

if cont is initial.

CREATE OBJECT CONT

EXPORTING

CONTAINER_NAME = 'CONTAINER'.

CREATE OBJECT ALV

EXPORTING

I_PARENT = cont.

wa_fld-fieldname = 'CARRID'.

wa_fld-ref_table = 'SPFLI'.

wa_fld-ref_field = 'CARRID'.

append WA_FLD to I_FLD.

wa_fld-fieldname = 'CONNID'.

wa_fld-ref_table = 'SPFLI'.

wa_fld-ref_field = 'CONNID'.

append WA_FLD to I_FLD.

wa_fld-fieldname = 'AIRPFROM'.

wa_fld-ref_table = 'SPFLI'.

wa_fld-ref_field = 'AIRPFROM'.

append WA_FLD to I_FLD.

wa_fld-fieldname = 'AIRPTO'.

wa_fld-ref_table = 'SPFLI'.

wa_fld-ref_field = 'AIRPTO'.

append WA_FLD to I_FLD.

CALL METHOD ALV->SET_TABLE_FOR_FIRST_DISPLAY

EXPORTING

  • I_BUFFER_ACTIVE =

  • I_BYPASSING_BUFFER =

  • I_CONSISTENCY_CHECK =

I_STRUCTURE_NAME = 'S_SPFLI'

IS_LAYOUT = x_layout

  • IS_PRINT =

  • IT_SPECIAL_GROUPS =

  • IT_TOOLBAR_EXCLUDING =

  • IT_HYPERLINK =

  • IT_ALV_GRAPHICS =

  • IT_EXCEPT_QINFO =

  • IR_SALV_ADAPTER =

CHANGING

IT_OUTTAB = I_spfli

IT_FIELDCATALOG = I_FLD

  • IT_SORT =

  • IT_FILTER =

  • EXCEPTIONS

  • INVALID_PARAMETER_COMBINATION = 1

  • PROGRAM_ERROR = 2

  • TOO_MANY_LINES = 3

  • others = 4

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

endif.

ENDMODULE. " STATUS_0100 OUTPUT

&----


*& Module USER_COMMAND_0100 INPUT

&----


  • text

----


MODULE USER_COMMAND_0100 INPUT.

case ok_code.

when 'BACK'.

CALL METHOD alv->FREE.

LEAVE to screen 0.

when 'EXIT'.

CALL METHOD alv->FREE.

LEAVE PROGRAM.

endcase.

ENDMODULE. " USER_COMMAND_0100 INPUT

Regards,

Beejal

**Reward if this helps

2 REPLIES 2
Read only

Former Member
0 Likes
325

Hello Kiran,

?

http://www.sapfans.com/forums/viewtopic.php?t=52107

http://www.geocities.com/mpioud/Z_ALV_LINE_COLOR.html

<b>

ROW COLOUR:</b>

http://www.sap-img.com/abap/line-color-in-alv-example.htm

Check this link.It has most of the information about ALV Controls and coloring of rows,columns and cells.

http://www.abap4.it/download/ALV.pdf

<b>A SAMPLE PROGRAM FOR COLUMN COLOUR:</b>

REPORT ZSAMPLE.

<b>TYPE-POOLS COL.</b>

DATA: ALV type ref to cl_gui_alv_grid,

cont type ref to cl_gui_custom_container,

ok_code type sy-ucomm.

DATA: BEgin of s_spfli,

carrid type spfli-carrid,

connid type spfli-connid,

airpfrom type spfli-airpfrom,

airpto type spfli-airpto,

<b>COLOR(4),</b>

end of s_spfli.

DATA: I_fld type lvc_t_fcat,

wa_fld type lvc_s_fcat,

I_spfli like table of s_spfli,

x_layout type LVC_S_LAYO.

START-OF-SELECTION.

select carrid connid airpfrom airpto from spfli into table i_spfli.

<b>concatenate 'C' COL_NEGATIVE '10' INTO S_SPFLI-COLOR.</b> MODIFY I_SPFLI FROM S_SPFLI TRANSPORTING COLOR WHERE CARRID = 'LH' AND

CONNID = '0400'.

<b>x_layout-info_fname = 'COLOR'.</b>

call screen 100.

&----


*& Module STATUS_0100 OUTPUT

&----


  • text

----


MODULE STATUS_0100 OUTPUT.

SET PF-STATUS 'GUI'.

  • SET TITLEBAR 'xxx'.

if cont is initial.

CREATE OBJECT CONT

EXPORTING

CONTAINER_NAME = 'CONTAINER'.

CREATE OBJECT ALV

EXPORTING

I_PARENT = cont.

wa_fld-fieldname = 'CARRID'.

wa_fld-ref_table = 'SPFLI'.

wa_fld-ref_field = 'CARRID'.

append WA_FLD to I_FLD.

wa_fld-fieldname = 'CONNID'.

wa_fld-ref_table = 'SPFLI'.

wa_fld-ref_field = 'CONNID'.

append WA_FLD to I_FLD.

wa_fld-fieldname = 'AIRPFROM'.

wa_fld-ref_table = 'SPFLI'.

wa_fld-ref_field = 'AIRPFROM'.

append WA_FLD to I_FLD.

wa_fld-fieldname = 'AIRPTO'.

wa_fld-ref_table = 'SPFLI'.

wa_fld-ref_field = 'AIRPTO'.

append WA_FLD to I_FLD.

CALL METHOD ALV->SET_TABLE_FOR_FIRST_DISPLAY

EXPORTING

  • I_BUFFER_ACTIVE =

  • I_BYPASSING_BUFFER =

  • I_CONSISTENCY_CHECK =

I_STRUCTURE_NAME = 'S_SPFLI'

IS_LAYOUT = x_layout

  • IS_PRINT =

  • IT_SPECIAL_GROUPS =

  • IT_TOOLBAR_EXCLUDING =

  • IT_HYPERLINK =

  • IT_ALV_GRAPHICS =

  • IT_EXCEPT_QINFO =

  • IR_SALV_ADAPTER =

CHANGING

IT_OUTTAB = I_spfli

IT_FIELDCATALOG = I_FLD

  • IT_SORT =

  • IT_FILTER =

  • EXCEPTIONS

  • INVALID_PARAMETER_COMBINATION = 1

  • PROGRAM_ERROR = 2

  • TOO_MANY_LINES = 3

  • others = 4

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

endif.

ENDMODULE. " STATUS_0100 OUTPUT

&----


*& Module USER_COMMAND_0100 INPUT

&----


  • text

----


MODULE USER_COMMAND_0100 INPUT.

case ok_code.

when 'BACK'.

CALL METHOD alv->FREE.

LEAVE to screen 0.

when 'EXIT'.

CALL METHOD alv->FREE.

LEAVE PROGRAM.

endcase.

ENDMODULE. " USER_COMMAND_0100 INPUT

Regards,

Beejal

**Reward if this helps

Read only

Former Member