Traffic light system
When selecting a number from a drop down menu is it possible to make a colour appear depending on what number is chosen. Like a traffic light system, you choose 1 and it comes up red, you choose 3 and it comes up green?
Thank you for taking a look
S
Well, you can use a slightly modified version of the script above. Something like this should do:
var risk = Number(this.getField("Risk").value);
if (risk>=1 && risk<=7) {
event.value = "Low Risk";
event.target.fillColor = color.green;
} else if (risk>=8 && risk<=15) {
event.value = "Medium Risk";
event.target.fillColor = color.yellow;
} else if (risk>=16) {
event.value = "High Risk";
event.target.fillColor = color.red;
} else {
event.value = "";
event.target.fillColor = color.white;
This code should be used as the custom calculation script of the field where you want to display the "traffic light", and it assumes there's a field called "Risk" that contains the risk value (this field could be hidden).
Edit: fixed code
Similar Messages
-
hi, i'm developing a simulation for a traffic light system. i'm finding problem in traffic lighting system. i gave each traffic light 2 minitus. 120 seconds for re light 50 seconds fro green light and 10 seconds for yellow. i did until the the car movement. i dont know how to control the to stop at the juction when the is a red light and also the timer. help me to modify the simulator.
import java.awt.Graphics;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
public class RectNew extends Applet implements Runnable
Image car1;
Image car2;
Image car3;
Image car4;
Image beh;
Image offScreenImage;
Dimension offDimension;
Graphics offGraphics;
MediaTracker mt;
Thread thisThread;
boolean enableCar1;
boolean enableCar2;
boolean enableCar3;
boolean enableCar4;
int car1X;
int car1Y;
int car2X;
int car2Y;
int car3X;
int car3Y;
int car4X;
int car4Y;
int i;
public void init()
enableCar1 =true;
enableCar2 =true;
enableCar3 =true;
enableCar4 = true;
beh = getImage(getCodeBase(),"road_corner.jpg");
car1=getImage(getCodeBase(),"Orange.jpg");
car2=getImage(getCodeBase(),"Blue.jpg");
car3=getImage(getCodeBase(),"Red.jpg");
car4=getImage(getCodeBase(),"Green.jpg");
car1X=0;
car1Y=(int)(((640-car1.getHeight(this))-0+1));
car2X=(int)(((590-car2.getWidth(this))-0+1));
car2Y=0;
car3X=0;
car3Y=(int) (((540-car3.getHeight(this))-0+1));
car4X=(int)(((490-car4.getWidth(this))-0+1));
car4Y=0;
mt=new MediaTracker(this);
mt.addImage(car1,1);
mt.addImage(car2,2);
mt.addImage(car3,3);
mt.addImage(car4,4);
try
mt.waitForAll();
catch(InterruptedException e)
resize(640,640);
thisThread=new Thread(this);
thisThread.start();
public synchronized void paint(Graphics g)
Dimension d=getSize();
if(offGraphics==null || d.width!=offDimension.width || d.height!=offDimension.height)
offDimension=d;
offScreenImage=createImage(d.width,d.height);
offGraphics=offScreenImage.getGraphics();
offGraphics.drawImage(beh,0, 0, d.width,d.height,this);
offGraphics.drawImage(car1,car1X,car1Y,this);
offGraphics.drawImage(car2,car2X,car2Y,this);
offGraphics.drawImage(car3,car3X,car3Y,this);
offGraphics.drawImage(car4,car4X,car4Y,this);
//Traffic Light 1
offGraphics.setColor(Color.blue);
offGraphics.fillRect(200,200,25,50);
offGraphics.setColor(Color.red);
offGraphics.fillOval(205,205,15,15);
offGraphics.setColor(Color.yellow);
offGraphics.fillOval(205,220,15,15);
offGraphics.setColor(Color.green);
offGraphics.fillOval(205,235,15,15);
//Traffic Light 2
offGraphics.setColor(Color.blue);
offGraphics.fillRect(400,200,25,50);
offGraphics.setColor(Color.red);
offGraphics.fillOval(405,205,15,15);
offGraphics.setColor(Color.yellow);
offGraphics.fillOval(405,220,15,15);
offGraphics.setColor(Color.green);
offGraphics.fillOval(405,235,15,15);
//Traffic Light 3
offGraphics.setColor(Color.blue);
offGraphics.fillRect(200,400,25,50);
offGraphics.setColor(Color.red);
offGraphics.fillOval(205,405,15,15);
offGraphics.setColor(Color.yellow);
offGraphics.fillOval(205,420,15,15);
offGraphics.setColor(Color.green);
offGraphics.fillOval(205,435,15,15);
//Traffic Light 4
offGraphics.setColor(Color.blue);
offGraphics.fillRect(400,400,25,50);
offGraphics.setColor(Color.red);
offGraphics.fillOval(405,405,15,15);
offGraphics.setColor(Color.yellow);
offGraphics.fillOval(405,420,15,15);
offGraphics.setColor(Color.green);
offGraphics.fillOval(405,435,15,15);
g.drawImage(offScreenImage,0,0,this);
public void update(Graphics g)
paint(g);
public void start()
if(thisThread==null)
thisThread=new Thread(this);
thisThread.start();
public void stop()
if(thisThread!=null)
thisThread=null;
public void run()
while(true)
if((enableCar2==true) && (car1X+car1.getWidth(this)+20>car2X) && (car1X+car1.getWidth(this)<car2X))
if((car1Y<car2Y+car2.getHeight(this)) && (car1Y+car1.getHeight(this)>car2Y))
enableCar1=false;
//enableCar3=false;
//enableCar4=false;
if((enableCar1==true) && (car2Y+car2.getHeight(this)+20>car1Y) && (car2Y+car2.getHeight(this)<car1Y+20))
if((car2X<car1X+car1.getWidth(this)) && ((car2X>car1X)||(car2X+car2.getWidth(this)>car1X)))
enableCar2=false;
//enableCar3=false;
//enableCar4=false;
if((enableCar4==true) && (car3X+car3.getWidth(this)+20>car4X) && (car3X+car3.getWidth(this)<car4X))
if((car3Y<car4Y+car4.getHeight(this)) && (car3Y+car3.getHeight(this)>car4Y))
enableCar3=false;
//enableCar2=false;
//enableCar3=false;
if((enableCar3==true) && (car4Y+car4.getHeight(this)+20>car4Y) && (car4Y+car4.getHeight(this)<car3Y+20))
if((car4X<car3X+car3.getWidth(this)) && ((car4X>car3X)||(car4X+car4.getWidth(this)>car3X)))
enableCar4=false;
//enableCar2=false;
//enableCar1=false;
if(enableCar1==false)
if(car2Y>car1Y+car1.getHeight(this))
enableCar1=true;
if(enableCar2==false)
if(car1X>car2X+car2.getWidth(this))
enableCar2=true;
if(enableCar3==false)
if(car4Y>car3Y+car3.getHeight(this))
enableCar3=true;
if(enableCar4==false)
if(car3X>car4X+car4.getWidth(this))
enableCar4=true;
if(enableCar1)
car1X+=5;
if(enableCar2)
car2Y+=5;
if(enableCar3)
car3X+=5;
if(enableCar4)
car4Y+=5;
if(car1X>=640)
car1X=-100;
car1Y=(int) (((280-car1.getHeight(this))-0+1));
enableCar1=true;
enableCar2=true;
enableCar3=true;
enableCar4=true;
if(car2Y>=640)
car2Y=-100;
car2X=(int)(((370-car2.getWidth(this))-0+1));
enableCar1=true;
enableCar2=true;
enableCar3=true;
enableCar4=true;
if(car3X>=640)
car3X=-100;
car3Y=(int) (((380-car3.getHeight(this))-0+1));
enableCar1=true;
enableCar2=true;
enableCar3=true;
enableCar4=true;
if(car4Y>=640)
car4Y=-100;
car4X=(int)(((300-car4.getWidth(this))-0+1));
enableCar1=true;
enableCar2=true;
enableCar3=true;
enableCar4=true;
repaint();
try
Thread.sleep(5);
showStatus("Traffic Light System Sensor");
catch(InterruptedException e)
}thanxHi,
This forum is exclusively for the Sun Java Studio Creator related discussions. Could you please post your question in the appropriate forum.
Thanks,
Creator Team. -
I wish to create a traffic light system.
I want to create a 'traffic light system' in a spread sheet. I want to enter a date (in the future) in cell that will show green, six months before that date is reached the cell turns amber and then when the date is reached the cell turns red. Any ideas on a function or formula please?
Hi Rj,
This can be handled by conditional formatting of the cell containing the date.
You have three conditions:
The date is more than six months from today.
The date is less than six months from today.
The date is today or before today.
1 can be set as the default condition. It does not need to be tested. Set the default fill colour to green.
3 will be the last condition to become true, so use it as the first condition to be evaluated.
2 will become true before 3 does, so test it after testing 3.
Regards,
Barry -
I want to create a traffic light sequence in labview
Hi,
I'm very new to Labview(first post here) and am learning by trying some simple things.
I'm trying to create a continuous running traffic light system, RED, THEN RED AND AMBER, THEN JUST GREEN, THEN JUST AMBER, THEN JUST RED, and repeat the sequence.
I've got 3 LED's of the 3 colours and at the moment they run, RED, THEN RED AND AMBER, THEN RED AND AMBER AND GREEN, THEN ALL OFF, and the sequence then repeats.
I've used a case structure within a while loop. Set a state for each colour and the reset(all off). Straight forward I think.
Does anyone have any tips on how i might add to what I've got to create the aforementioned traffic light sequence?
Many thanks for your time.
PJ.
Solved!
Go to Solution.You have passed the test, so I will attach the VI this time (LV9, let me know if you need an earlier version). You'd be surprised how many people will complain about not being provided code, glad to see you are a good sport.
The cluster array constant was created by right-clicking the control and choosing Create Constant. It simply let me show in a screenshot the contents of the Sequence Array.
I added the delay as a little hint to always be thinking one move ahead. Eventually you will be thinking many more moves ahead, but start out by considering the next thing you'll want to do and try to keep your code flexible enough to handle it.
Attachments:
SimpleTrafficLight.vi 11 KB -
Displaying traffic lights in alv grid report?
Hi everyone,
I have an alv grid report.I m using the FM reuse_alv_grod_display to display my alv report.I am passing the fieldcatalogue automatically.I m getting the output perfectly.Now i have to add traffic lights to that alv report.
Since i m passing the fieldcatalogue automatically i m confused to display the traffic lights?
any suggestions please?
Thank you.hi dp,
look at the program i made... se the bold part you will be able to impelment lights easily,
DECLARING TYPES POOL *
All the definitions of internal tables, structures and constants
are declared in a type-pool called SLIS.
type-pools: slis.
TABLES *
tables: vbak,vbap,kna1.
TYPES *
*&--defining types for TABLE VBAK
types: begin of t_vbak,
vbeln type vbeln_va, "sales document
kunnr type kunag,
erdat type erdat,
auart type auart,
netwr type netwr_ak,
waerk type waerk,
vkorg type vkorg,
vtweg type vtweg,
spart type spart,
name1 type name1_gp,
stras type stras_gp,
ort01 type ort01_gp,
pstlz type pstlz,
regio type regio,
land1 type land1_gp,
telf1 type telf1,
end of t_vbak.
*&--Defining types for TABLE VBAP
types: begin of t_vbap,
vbeln type vbeln_va,
posnr type posnr_va,
matnr type matnr,
maktx type maktx,
end of t_vbap.
*&--MERGED FINAL SALES TABLE
types: begin of t_sales_final,
vbeln type vbeln_va,
kunnr type kunag,
posnr type posnr_va,
erdat type erdat, "date of creation
auart type auart,
netwr type netwr_ak,
waerk type waerk,
vkorg type vkorg,
vtweg type vtweg,
spart type spart,
name1 type name1_gp,
v_lights type c,
stras type stras_gp,
ort01 type ort01_gp,
pstlz type pstlz,
regio type regio,
land1 type land1_gp,
telf1 type telf1,
matnr type matnr,
maktx type maktx,
end of t_sales_final.
defining wrokarea and IT.
WORK AREA DECLARATION *
*&---work area for Internal Tables
data: wa_vbak type t_vbak.
data: wa_vbap type t_vbap.
data: wa_sales_final type t_sales_final.
*&--work area for layout
data: wa_layout type slis_layout_alv.
INTERNAL TABLES DECLARATION *
*&---Internal tables without Header Line.
data : i_vbak type standard table of t_vbak,
i_vbap type standard table of t_vbap,
i_sales_final type standard table of t_sales_final.
*&---Internal table for field catalog
data : i_fieldcat type slis_t_fieldcat_alv,
*&---Internal table for the sorting sequence.
i_sortinfo type slis_t_sortinfo_alv,
*&---Internal table for the event catalog.
i_eventcat type slis_t_event,
*&---Internal table for the top of page event
i_listheader type slis_t_listheader.
VARIABLE DECLARATION *
data : v_progname like sy-repid, "Program name(system defined)
v_gridtitle type lvc_title. "Grid Title
INITIALIZATION EVENT *
initialization.
v_progname = sy-repid.
refresh:i_vbak,
i_vbap,
i_sales_final,
i_fieldcat,
i_sortinfo,
i_eventcat,
i_listheader.
clear: wa_vbak,
wa_vbap,
wa_sales_final,
wa_layout.
SELECTION SCREEN *
SCREEN FOR ENTERING INFORMATION
selection-screen begin of block b1 with frame title text-001.
select-options: r_vbeln for wa_vbak-vbeln obligatory.
select-options: r_erdat for wa_vbak-erdat obligatory.
selection-screen end of block b1 .
AT SELECTION SCREEN *
at selection-screen.
perform zf_validate_sales_doc_no.
perform zf_validate_date.
START OF SELECTION EVENT
start-of-selection.
perform zf_populate_header.
perform zf_populate_detail.
perform zf_append_sales_final.
END OF SELECTION EVENT
end-of-selection.
*If Internal Table Is Populated Then Only Display Alv Report.
if i_sales_final is not initial.
Prepare fieldcatalog .
perform zf_build_fieldcat using i_fieldcat.
MODIFY the records IN the internal TABLE for the traffic lights.
perform zf_modify_final.
build event catalogue
perform zf_eventcat using i_eventcat.
build sorting
perform zf_sorting using i_sortinfo.
&---Build Listheader for TOP OF PAGE EVENT.
perform zf_build_listheader using i_listheader.
&---Build layout.
perform zf_layout.
&---Initializating Grid Title
perform zf_build_grid_title.
&---Display alv grid.
perform zf_display_alv_grid.
else.
*If Table is not Populated ie Records Does not exist
message 'Record Does Not Exist' type 'S'.
endif.
*& Form zf_validate_sales_doc_no
text
--> p1 text
<-- p2 text
form zf_validate_sales_doc_no .
select single vbeln into wa_vbak-vbeln from vbak where vbeln in r_vbeln .
if sy-subrc <> 0.
message i101.
endif.
endform. " zf_validate_sales_doc_no
*& Form zf_validate_date
text
--> p1 text
<-- p2 text
form zf_validate_date .
if date is future
if r_erdat-low >= sy-datum.
message e102.
elseif r_erdat-high >= sy-datum.
message e103.
endif.
endform. " zf_validate_date
*& Form zf_populate_header
text
--> p1 text
<-- p2 text
form zf_populate_header .
select vbeln
kunnr
erdat
auart
netwr
waerk
vkorg
vtweg
spart
into table i_vbak from vbak where vbeln in r_vbeln.
if sy-subrc <> 0.
message 'RECORD DOES NOT EXIST' type 'E'.
endif.
sort i_vbak by vbeln.
*&--LOGIC TO GET FIELDS FROM TABLE KNA1 INTO INTERNAL TABLE I_VBAK
loop at i_vbak into wa_vbak.
select single name1 stras ort01 pstlz regio land1 telf1 into (wa_vbak-name1,
wa_vbak-stras,
wa_vbak-ort01,
wa_vbak-pstlz,
wa_vbak-regio,
wa_vbak-land1,
wa_vbak-telf1)
from kna1
where kunnr = wa_vbak-kunnr.
modifying it_header.
modify i_vbak from wa_vbak.
clear wa_vbak.
endloop.
endform. " zf_populate_header
*& Form zf_populate_detail
text
--> p1 text
<-- p2 text
form zf_populate_detail .
if i_vbak[] is not initial.
select vbeln
posnr
matnr
into table i_vbap from vbap
for all entries in i_vbak where vbeln = i_vbak-vbeln.
endif.
sort i_vbap by vbeln.
sort i_vbap by posnr.
*&--LOGIC TO GET FIELDS FROM TABLE MAKT INTO INTERNAL TABLE I_VBAP
loop at i_vbap into wa_vbap.
select single maktx into (wa_vbap-maktx)
from makt where matnr = wa_vbap-matnr and spras = sy-langu.
modifying it_header.
modify i_vbap from wa_vbap.
clear wa_vbap.
endloop.
endform. " zf_populate_detail
*& Form zf_append_sales_final
text
--> p1 text
<-- p2 text
form zf_append_sales_final .
sort i_vbak by vbeln.
sort i_vbap by vbeln posnr.
loop at i_vbak into wa_vbak.
move-corresponding wa_vbak to wa_sales_final.
read table i_vbap with key vbeln = wa_vbak-vbeln
binary search transporting no fields.
loop at i_vbap into wa_vbap from sy-tabix.
if wa_vbap-vbeln <> wa_vbak-vbeln.
exit.
endif.
move-corresponding wa_vbap to wa_sales_final.
append wa_sales_final to i_sales_final.
endloop.
endloop.
endform. " zf_append_sales_final
*& Form zf_build_fieldcat
text
-->P_I_FIELDCAT text
form zf_build_fieldcat using p_i_fieldcat type slis_t_fieldcat_alv.
data: l_fieldcat type slis_fieldcat_alv. "local Workarea used
clear l_fieldcat.
FOR LIGHT IN COLUMN
clear l_fieldcat.
l_fieldcat-col_pos = '1'. " POSITION OF THE COLUMN.
l_fieldcat-fieldname = 'V_LIGHTS'.
" FIELD FOR WHICH CATALOG ID FILLED.
*We are passing final internal table 'I_FINAL' to l_fieldcat(local
*variable
l_fieldcat-tabname = 'I_SALES_FINAL'.
" INTERNAL TABLE TO WHICH THE FIELD BELONGS TO.
l_fieldcat-just = 'C'. " FOR JUSTIFICATION.
l_fieldcat-outputlen = 20.
" TO DEFINE OUTPUT LENGTH OF THE COLUMN.
append l_fieldcat to p_i_fieldcat.
FIRST COLUMN ********************************
l_fieldcat-col_pos = '2'. " POSITION OF THE COLUMN
l_fieldcat-fieldname = 'VBELN'. " FIELD FOR WHICH CATALOG ID FILLED
l_fieldcat-tabname = 'I_SALES_FINAL'. " INTERNAL TABLE BELONGS TO
l_fieldcat-key = 'X'. " SO THAT this field is not scrollable hiddable.
l_fieldcat-just = 'L'. " FOR JUSTIFICATION
*l_fieldcat-hotspot = 'X'. " MARK THIS field as hotsopt
l_fieldcat-lzero = 'X'. " OUTPUT WITH leading zeros.
l_fieldcat-seltext_l = 'Sales Document'. " long text for header.
l_fieldcat-seltext_m = 'Sales Doc'. " medium text for header.
l_fieldcat-seltext_s = 'Sales Doc'. " sort text for header.
l_fieldcat-outputlen = 20. " SET THE output length.
l_fieldcat-ref_tabname = 'VBAK'. " FOR F1 & F4 help as
append l_fieldcat to p_i_fieldcat.
clear l_fieldcat.
**************************SECOND COLUMN ********************************
*l_fieldcat-col_pos = '3'. " POSITION OF THE COLUMN
l_fieldcat-row_pos = '2'. " POSITION OF THE COLUMN
l_fieldcat-fieldname = 'POSNR'. " FIELD FOR WHICH CATALOG ID FILLED
l_fieldcat-tabname = 'I_SALES_FINAL'. " INTERNAL TABLE BELONGS TO
l_fieldcat-key = 'X'. " SO THAT this field is not scrollable hiddable.
l_fieldcat-just = 'L'. " FOR JUSTIFICATION
l_fieldcat-hotspot = 'X'. " MARK THIS field as hotsopt
l_fieldcat-lzero = 'x'. " OUTPUT WITH leading zeros.
l_fieldcat-seltext_l = 'Sales Document Item'. " long text for header.
l_fieldcat-seltext_m = 'Sales Document Item'. " medium text for header.
l_fieldcat-seltext_s = 'Sales Document Item'. " sort text for header.
l_fieldcat-outputlen = 20. " SET THE output length.
l_fieldcat-ref_tabname = 'VBAP'. " FOR F1 & F4 help as
append l_fieldcat to p_i_fieldcat.
clear l_fieldcat.
endform. " zf_build_fieldcat
*& Form zf_eventcat
text
-->P_I_EVENTCAT text
form zf_eventcat using p_i_eventcat type slis_t_event.
data: l_eventcat type slis_alv_event.
clear l_eventcat.
call function 'REUSE_ALV_EVENTS_GET'
exporting
i_list_type = 0
importing
et_events = p_i_eventcat
exceptions
list_type_wrong = 1
others = 2
if sy-subrc 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
TOP OF PAGE FORM
clear l_eventcat.
read table p_i_eventcat into l_eventcat with key
name = slis_ev_top_of_page.
"(COMPONENT "NAME"of structure)
if sy-subrc = 0. "if success
move 'ZF_TOP_OF_PAGE' to l_eventcat-form.
"matches name and moves form to workarea and modifies table
modify p_i_eventcat from l_eventcat index sy-tabix
transporting form.
endif.
PF_STATUS_SET FORM
clear l_eventcat.
read table p_i_eventcat into l_eventcat with key
name = slis_ev_pf_status_set.
if sy-subrc = 0.
move 'ZF_PF_STATUS_SET' to l_eventcat-form.
modify p_i_eventcat from l_eventcat index sy-tabix
transporting form.
endif.
USER_COMMAND FORM
clear l_eventcat.
read table p_i_eventcat into l_eventcat with key
name = slis_ev_user_command.
if sy-subrc = 0.
move 'ZF_USER_COMMAND' to l_eventcat-form.
modify p_i_eventcat from l_eventcat index sy-tabix
transporting form.
endif.
endform. " zf_eventcat
*& Form zf_sorting
text
-->P_I_SORTINFO text
form zf_sorting using p_i_sortinfo.
endform. " zf_sorting
*& Form zf_build_listheader
text
-->P_I_LISTHEADER text
form zf_build_listheader using p_i_listheader type slis_t_listheader.
data: l_listheader type slis_listheader.
refresh p_i_listheader.
clear l_listheader.
HEADER
l_listheader-typ = 'H'.
l_listheader-info = 'FUJITSU CONSULTING INDIA LTD.'.
append l_listheader to p_i_listheader.
SELECTION
l_listheader-typ = 'S'.
l_listheader-key = 'Date:'.
l_listheader-info = sy-datum.
append l_listheader to p_i_listheader.
ACTION
l_listheader-typ = 'A'.
*l_listheader-key =
l_listheader-info = 'SALES ORDER ALV REPORT By Rohan Malik'.
append l_listheader to p_i_listheader.
endform. " zf_build_listheader
*& Form zf_build_grid_title
text
--> p1 text
<-- p2 text
form zf_build_grid_title .
v_gridtitle = 'List of Purchase Order'.
endform. " zf_build_grid_title
*& Form zf_display_alv_grid
text
--> p1 text
<-- p2 text
form zf_display_alv_grid .
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = v_progname
i_grid_title = v_gridtitle
is_layout = wa_layout
it_fieldcat = i_fieldcat
it_sort = i_sortinfo
it_events = i_eventcat
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
tables
t_outtab = i_sales_final
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
endform. " zf_display_alv_grid
*& Form zf_top_of_page
text
--> p1 text
<-- p2 text
form zf_top_of_page .
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = i_listheader
i_logo = 'ENJOYSAP_LOGO'
I_END_OF_LIST_GRID =
endform. " zf_top_of_page
*& Form zf_user_command
text
--> p1 text
<-- p2 text
form zf_user_command using r_ucomm like sy-ucomm
rs_selfield type slis_selfield .
case r_ucomm. "FCODE
when 'VA03'.
read table i_sales_final into wa_sales_final index rs_selfield-tabindex.
set parameter id 'AUN' field rs_selfield-value.
call transaction 'VA03' and skip first screen .
message i102 with rs_selfield-value .
when '&IC1'. "for hotspot with VBELN, POSNR, MATNR, KUNNR.
if rs_selfield-fieldname = 'MATNR'.
set parameter id 'MAT' field rs_selfield-value.
call transaction 'MM03' and skip first screen.
return.
message i103 with rs_selfield-value .
endif.
if rs_selfield-fieldname = 'VBELN'.
set parameter id 'AUN' field rs_selfield-value.
call transaction 'VA03' and skip first screen.
return.
message i104 with rs_selfield-value .
endif.
endcase.
endform. " zf_user_command
*& Form ZF_PF_STATUS_SET
text
--> p1 text
<-- p2 text
form zf_pf_status_set using rt_extab type slis_t_extab.
set pf-status 'Z11_RM_ALV_SO'.
endform. " ZF_PF_STATUS_SET
*& Form zf_layout
text
--> p1 text
<-- p2 text
form zf_layout .
wa_layout-zebra = 'X'.
wa_layout-lights_fieldname = 'V_LIGHTS'.
wa_layout-lights_tabname = 'I_SALES_FINAL'.
" 1, 2 or 3 for red, yellow and green respectively.
endform. " zf_layout
*& Form zf_modify_final
text
--> p1 text
<-- p2 text
form zf_modify_final .
CODE TO EXECUTE LIGHTS
*start of loop
loop at i_sales_final into wa_sales_final.
*giving conditions and modifying as we want to change many rows
if wa_sales_final-netwr <= 10000.
wa_sales_final-v_lights = '1'.
modify i_sales_final from wa_sales_final transporting v_lights.
elseif wa_sales_final-netwr > 10000 and wa_sales_final-netwr <= 100000.
wa_sales_final-v_lights = '2'. " Exception.
modify i_sales_final from wa_sales_final transporting v_lights.
else.
wa_sales_final-v_lights = '3'. " Exception.
modify i_sales_final from wa_sales_final transporting v_lights.
endif.
endloop.
reward point s if helpful
rohan malik -
Traffic light in RF monitor screen (LRF1) - how it is derive from?
Hi,
This is a question about WM-RF. My question is how does the system determine the traffic light color in the RF monitor screen (LRF1). I read the SAP help portal and compare it to the screen and it still doesn't make any sense out of it..
On the SPRO, there is DEFINE QUEUE table, with thefollowing setup:
WS--QUEUEQName-CapacUsed-CapacUsed----AccessLim
110--B01_GEN-GenName610--
2StrictLimitation
Thus the relation is: 6/10 = 0.6
Next, I went to LRF1 and saw this record with warehouse 110, and Queue B01GEN, and having the following value_:
QUEUE -
TOs--LOADProc.By--
Propotion
B01_GEN----150.0002--
Green
Thus the relation is: 15/2 = 7.5
Why is it green? SAP help portal give the following explaination, and I don't know to derive it?
A- The queue tranffic light is green if the relation is less than the value given in the left relation field.
B - The queue traffic light is yellow if the relation is greater than or the same as the value specified in the right field.
C - The queue traffic light is red if the relation is greater than or the same as the value specified in the left relation field.
Please share if you know.
Thanks..TuffHello,
Does anyone know my question?
Appreciate some help here.
Thanks,
tuff -
Control and monitoring of traffic lights
i am a student and new to graphical programming.i am using labview 6.1 to monitor and control a system of traffic lights from a central location.my problem is geting the lights to go on and off.
You asked the same question here and the answer is still the same. Provide some details on what exactly you're attempting to do and what specifically is the problem. That means details on what kind of hardware you're using to interface to the lights, any error codes being generated, etc. Posting your program would help as well.
-
Can I change default traffic lights setting?
How?Traffic Lights can be defined.
You can use the exception groups to define under which conditions materials are indicated by red, yellow, or green traffic lights. Example: You want all materials, whose dates lie in the past, to be indicated by a red traffic light.
The definition of traffic lights applies to both types of list.
Prerequisites-
You have accessed the material list in collective access, or the MRP list or stock/requirements list for a material.
In case of individual lists: you have displayed the material tree.
Procedure
1. Choose Green Dot
The system displays the Define traffic light dialog box.
2. Enter the number of workdays for the parameters Days' supply, 1st receipt days' supply and 2nd receipt days' supply, and under which circumstances the materials are to be displayed with red, yellow, and green traffic lights.
You want the traffic light to be red when the days' supply for a material is <= 0, yellow when the days' supply is > 0 and <= 10 days, and green when the days' supply is > 10 days.
Enter:
Color Days supply
Red 0
Yellow 10
Green 999,9
4. Use the exception groups to define under which conditions materials are indicated by red, yellow, or green traffic lights.
You want materials with exception messages in exception group 4 to be indicated by a yellow traffic light and materials with exception messages in exception group 5 to be indicated by a red traffic light.
Choose:
Exception group 5 Exception group 5
Red X
Yellow X
Green
6. Save
Reward if cleared and close the thread. -
Traffic Lights - SAP CRM 7 - User's Inbox
Hi All,
How can we configure trafic lights for transactions displayed in the users inbox ( SAP CRM 7).
Are the traffic lights controlled by the due date in the date profile ?
What is logic used by the system to assign colors to each of the transactions ? CAn this logic be controlled or changed ?
Any help/guidance on how to configure traffic lights will be much appreciated.
Thanks in advance!
Cheers
SSHi Subu,
You can refer out of the box traffic lights functionality in component view CRMCMP_GS_WC/TodaysTasks . Look at method GET_P_DUE under context node RESULTNEW.
First system calculates the variable gv_due_value using the following code.
rv_value = get_due_value( lr_entity ).
gv_due_value = rv_value.
Within method GET_DUE_VALUE system compares task date with current date to determine if it overdue.
IF sy-datlo GT lv_date_to.
rv_value = gc_due-overdue.
ELSEIF sy-datlo EQ lv_date_to.
rv_value = gc_due-due_today.
ELSE.
rv_value = gc_due-due_later.
ENDIF.
After this, the following code in GET_P_DUE method sets traffic light.
wa_due-value = rv_value.
CASE rv_value.
WHEN '1'.
wa_due-url = cl_thtmlb_util=>get_icon_url( 'overDue_1.gif' ).
wa_due-otr = cl_wd_utilities=>get_otr_text_by_alias( 'CRM_UIU_BT_ACTIVITY/OVERDUE' ).
WHEN '2'.
wa_due-url = cl_thtmlb_util=>get_icon_url( 'due_1.gif' ).
wa_due-otr = cl_wd_utilities=>get_otr_text_by_alias( 'CRM_UIU_BT_ACTIVITY/DUE_TODAY' ).
WHEN '3'.
wa_due-url = cl_thtmlb_util=>get_icon_url( 'notDue_1.gif' ).
wa_due-otr = cl_wd_utilities=>get_otr_text_by_alias( 'CRM_UIU_BT_ACTIVITY/DUE_LATER' ).
WHEN OTHERS.
wa_due-url = cl_thtmlb_util=>get_icon_url( '1x1.gif' ).
wa_due-otr = cl_wd_utilities=>get_otr_text_by_alias( 'CRM_UIU_BT_ACTIVITY/COMPLETED' ).
ENDCASE.
Regards
Krishna Kanduri -
Traffic lights Vs day's supply
Hi,
In MRP collective lists, system is showing red signal lights to all the materials and showing the message "3.0- days is less than limiting value of 0.1-"
In the day's supply,1stRDS and 2nd columns system is showing the value 3.0-.
In this case, how to change the signal light from red to green?
Can any body please explain the concept behind this?
Thanks in advance.
Sekhar.hi
traffic light depends upon the day's supply and exception messages.
in md04 collective access , display all materials with MRP controller wise. Press the Tab " define traffic lights" there u can put ur own criterion of days supply and R days supply.
Example how system calculates days supply.
Calculation of the range of coverage: Starting from the current plant stock, the requirements are deducted one after the other along the time axis. This is done until there is a shortage (requirement > stock). The range of coverage is then the number of workdays between todays date and the date of the requirement that causes the shortage minus one day. The value after the decimal point is the ratio between the opening stock on the day of the shortage and the requirement on the day of the shortage.
Stock = 240 pcs
1st day: Requirement for 90 pcs => Stock = 150 pcs
2nd day: Requirement for 70 pcs => Stock = 80 pcs
3rd day: Requirement for 100 pcs => Shortage
Range of coverage = 3 workdays minus 1 + 80/100
= 2 + 0,8
= 2,8
Reward if useful
Amit -
Yellow Traffic Lights in Authorizations
Hi all
I will like to know if there is a report were I can obtain all specific roles with the yellow light on.
Please let me know
Thanks
CeciliaI do not know of a report but you could try:
In SE16, select table AGR_1251
Enter your role selection in AGR_NAME
In the 'low' field value (don't know exactly what it's called and no system right now) go to the special selection screen and enter * in the "exclude single value" tab.
Roles with yellow traffic lights are those with empty fields in the auths.
To find red traffic lights (empty org values) do the same with table AGR_1252
Jurjen -
Traffic lights in SP15 : Flex 2.0
Hey all,
We've upgraded lately our Portal and BW system to SP15. In SP13 we were able to set up according to wiki about traffic lights, traffic lights. Now this is not possible any more. is this due to the deployment in Flex 2.0? Our is there an other reason?
Is there any body who knows how to solve this issue?
Kind Regards
KurtHi,
Yes i Know, but in the former SP we could give a background color to an exception value. like red, green or yellow. Now this is not possible any more. Can we solve this?
Regards
Kurt -
Why is there a red traffic light in ME55?
Different purchasing group and have deleted items?
There is one PR in my system that only has only one purchasing group and do not have deleted items, and it can't be released via ME55. Understand that it can be released via ME54.
However, anyone can share why is this happening?Hello:
I have the same problem. SAP version 6.0
I have just implemented the overall release for purchase requisitions.
If the purchase requisition has a deleted line item, when I try to release it via ME55, a red light that say Release via individual release.
Do you know how I can fix it?
For PO, I have implemented the overall release and I never had any problems.
Thanks in advanced -
Traffic light in collective delivering processing
Hi Folks,
I was wondering while doing collective delivery processing against STO..i am able to process delivery inspite of red traffic light when it should be only under yellow light ...How is that possible ? also would like to know how and when red and yellow light appears..
Look forward to hear from you soon..
Thanks and Regards
RahulHi Rahul,
Red light indicates error from where you cannot proceed further.
Yellow light indicates warning, but you can still proceed further at that level.......which may affect at further level.
Green light indicates ok
In your case, check if you can run the whole cycle successfully. if the system lets you pass through the red indicator........it could be system bug.
Regards
Sai -
Hi!
I am searching for an traffic light overview for workorders. For example if some of them are overdue, Partially confirmed,.. I am interested in the system status and I want to assign the traffic lights accordingly to the system status. I use transactions "iw38 or iw39"
In our SAP System it isn't possible to activate the "monitor". Is this depended on the customizing?
THX for your help.
br patrickDo anybody know something about such Traffic lights? br patrick
Maybe you are looking for
-
My Original 3g iPhone isn't recognized by iTunes
When I plug in my original 3G iPhone, iTunes doesn't recognize it; therefore, I can't sync or update the music/apps. Thoughts?
-
Display not working Properly please help???
Hey all I have read thru about 25 pages of different posts relating to the video screen problem, and none see to be exactly like mine. I have 1st genereation IMAC G5, that had the orginally logic board problem where screen wouldnt come on at all, i g
-
Hi Experts, XXXX payment run from February 11 did not carry out. I made the mistake of trying to carry it out instead of deleting the proposal. Now, the vendor for AMEX payments in XXXX are blocked for payments because the payment run would not carr
-
Kernal Panic...Help.
Hey everyone... In the last 3 days i got kernal panic twice. When i was Using iChat and Caming. I'm not sure what started the problem and i recently Installed a Fresh copy of Tiger OS X on my Computer... Please let me. I'd post the log error bout i d
-
How to view all of Skype call and conversation his...
Hi I need to view all of my Skype call history but the furthest I can go back is around 2 months. How do I change this? I am using a Samsung Galaxy 2 tab. Thank you!