on 2005 Aug 11 1:23 PM
Hi,
How do U create a Traffic Light? and how to you change the Light? That's all I need.
Thanks,
Kishan
Hi,
Here is some hint to display the traffic lines in a report.
Write ICON_GREEN_LIGHT AS ICON.
Write ICON_YELLOW_LIGHT AS ICON.
Write ICON_RED_LIGHT AS ICON.
Best Regards,
Vijay
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
C_GREEN(4) TYPE C VALUE '@08@',
C_RED(4) TYPE C VALUE '@0A@',
C_YELLOW(4) TYPE C VALUE '@09@',
write : c_green, c_red, c_yellow.
Hope this will solve your problem
Cheers,
Sasi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I tried your suggestions
REPORT Z_TEST_ICON .
Write ICON_GREEN_LIGHT AS ICON.
Write ICON_YELLOW_LIGHT AS ICON.
Write ICON_RED_LIGHT AS ICON.
But this is what I get:
Field "ICON_GREEN_LIGHT" is unknown. It is neither in one of the specified tables nor defined by a "DATA" statement.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi dude,
This is the way u add lights to ur alv report.
I'm following this method and i'm getting lights. This will work for sure.
In data declaration along with your alv display structure as a field named lights(any name).
DATA : BEGIN OF wa_srr,
vbeln LIKE vbak-vbeln, "Sales Order number
posnr LIKE vbap-posnr, "Item nunmber
matnr LIKE makt-matnr, "Material number Desc
maktx LIKE makt-maktx, "Material Description
gbstk LIKE vbuk-gbstk, "Completion status
bukrs LIKE knb1-bukrs, "Company Code
butxt LIKE t001-butxt, "Company Code description
vkorg LIKE vbak-vkorg, "Sales organization
vtext LIKE tvkot-vtext, "Sales Org description
vtweg LIKE vbak-vtweg, "Distribution Channel
dtext LIKE tvtwt-vtext, "Dist Channel description
spart LIKE vbak-spart, "Division
dvtxt LIKE tspat-vtext, "Division Description
kunnr LIKE vbak-kunnr, "Customer Number
name1 LIKE kna1-name1, "Customer Name
land1 LIKE kna1-land1, "Country
regio LIKE kna1-regio, "State
ort01 LIKE kna1-ort01, "City
erdat LIKE vbak-erdat, "Creation Date
vdatu LIKE vbak-vdatu, "Due date
kwmeng LIKE vbap-kwmeng, "Material Quantity
netpr LIKE vbap-netpr, "unit net price
netwr LIKE vbap-netwr, "Price
wavwr LIKE vbap-wavwr, "Cost price
bzirk LIKE vbkd-bzirk, "Sales District
bztxt LIKE t171t-bztxt, "Sales District Discription
lights, "Diplaying Status
END OF wa_srr.
While you are building the field cat do as follows
FORM build_layout CHANGING l_wa_layout TYPE slis_layout_alv.
l_wa_layout-zebra = cb_zebr. "Set alterante colored line
l_wa_layout-colwidth_optimize = cb_colop. "Optimize column width
l_wa_layout-no_vline = cb_novli. "No vertical line
l_wa_layout-no_colhead = cb_nocol. "no column Header
l_wa_layout-lights_fieldname = 'LIGHTS'. "Set light field
(assigning the field u have added in ur structure here as light field in alv report)
ENDFORM. " BUILD_LAYOUT
Then as per the logic, u make green, yellow or red light
Example,
FORM build_light .
LOOP AT it_srr INTO wa_srr. "for all entries in the table
IF wa_srr-gbstk = 'C'. "If status is 'completed',
wa_srr-lights = '3'. "Show green signal light
ELSEIF wa_srr-gbstk = 'B'. "If status is 'Partial'
wa_srr-lights = '2'. "Show yellow signal light
ELSE. "If status is 'incomplete'
wa_srr-lights = '1'. "Show red signal light
ENDIF.
MODIFY it_srr FROM wa_srr. "Update to table
ENDLOOP.
ENDFORM. " build_light
after building ur layout, Pass it to ur alv function module like this.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_callback_top_of_page = 'TOP_OF_PAGE'
i_background_id = 'ALV_BACKGROUND'
i_grid_title = text-011
pass ur layout structure here********
is_layout = wa_layout
****************************************
it_fieldcat = it_fcat
it_sort = it_sort
i_save = v_save
is_variant = wa_variant
is_print = wa_print
TABLES
t_outtab = it_srr
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE i001. "List cannot be displayed
ENDIF.
wat all i did to add light is,
1) adding an extra field in the main structure.
2)create internal table with this structure as data table for alv report
3) add 'field name' field in layout
4) I have passed values(3, 2, 1) for green, yellow and red light resp, to the field(LIGHTS) in the internal table that is passed to alv function module.(Based on some condition)
5) pass the layout structure layout to alv function module
Thats it. If u do all this teps, u r done with it.
Lemme know u solved it by giving points.
with regards,
praveen.
Hi Kishan,
Before trying Vijaya's code, do not forget to add the following includes.
<b>INCLUDE <ICON>.</b>
or <b>INCLUDE <LIST>.</b>
<b><LIST></b> is a superset of <b><ICON></b>. It contains the Type-Pool defination for <b><SYMBOL>, <ICON>, <LINE>, <COLOR></b>.
Hope this helps.
Best Regards,
Sanyam
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Kishan,
1)
Write ICON_GREEN_LIGHT AS ICON. "status 1
2)
READ LINE SY-INDEX FIELD VALUE
itab-MARK INTO H_MARK.
3)
modify itab-status . "status2
4)
refresh your output:
Write ICON_red_LIGHT AS ICON. "status 2
regards Andreas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Check the program BCALV_GRID_04.
regards
Aveek
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
57 | |
11 | |
7 | |
6 | |
6 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.