GoodleAds

STEPS TO WORK WITH ROW COLOUR IN ALV REPORTS

Steps to work with row colour: -

1. Declare the one additional colour field in the data IT, which is char and length 4.
2. Fill the data IT based on given input.
3. Modify the colour field based on the requirement.
4. Pass the colour field name into layout WA (info_field name).
5. Fill the field catalog (not colour field)
6. Display output

PROGRAM:
*&---------------------------------------------------------------------*
*& Report  ZR_ROW_COLOUR
*&
*&---------------------------------------------------------------------*
REPORT ZR_ROW_COLOUR.
type-pools slis.
tables ekpo.
select-options s_ebeln for ekpo-ebeln.


typesbegin of ty_ekpo,
 ebeln 
type ekpo-ebeln,
 ebelp 
type ekpo-ebelp,
 menge 
type ekpo-menge,
 meins 
type ekpo-meins,
 netpr 
type ekpo-netpr,
 xyz
(4type c,
 
end of ty_ekpo.


datawa_ekpo type ty_ekpo,
      it_ekpo 
type table of ty_ekpo.
datait_fcat type slis_t_fieldcat_alv,
 wa_fcat 
like line of it_fcat.


Delcare the layout
data wa_layout type slis_layout_alv.



select ebeln
       ebelp
       menge
       meins
       netpr
  
from ekpo
  
into table it_ekpo
  
where ebeln in s_ebeln.


* Fill the layout wa.
wa_layout-info_fieldname 
'XYZ'.


* Fill the field catalog.
wa_fcat
-fieldname 'EBELN'.
wa_fcat-col_pos 
'1'.
wa_fcat-seltext_m 
'PUR DOC'.
append wa_fcat to it_fcat.
clear wa_fcat.
wa_fcat
-fieldname 'EBELP'.
wa_fcat-col_pos 
'2'.
wa_fcat-seltext_m 
'ITEM'.
append wa_fcat to it_fcat.
clear wa_fcat.
wa_fcat
-fieldname 'MENGE'.
wa_fcat-col_pos 
'3'.
wa_fcat-seltext_m 
'QTY'.
append wa_fcat to it_fcat.
clear wa_fcat.
wa_fcat
-fieldname 'MEINS'.
wa_fcat-col_pos 
'4'.
wa_fcat-seltext_m 
'UOM'.
append wa_fcat to it_fcat.
clear wa_fcat.
wa_fcat
-fieldname 'NETPR'.
wa_fcat-col_pos 
'5'.
wa_fcat-seltext_m 
'NET PRICE'.
append wa_fcat to it_fcat.
clear wa_fcat.
* Modify the color field
wa_ekpo
-xyz 'C310'.
modify it_ekpo from wa_ekpo transporting XYZ where NETPR > 1000.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
 
EXPORTING
 IS_LAYOUT 
WA_LAYOUT
 IT_FIELDCAT 
IT_FCAT
 
TABLES
 T_OUTTAB 
IT_EKPO.

OUTPUT:




No comments:

Post a Comment