Traffic light in work orders
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 patrick
Do anybody know something about such Traffic lights? br patrick
Similar Messages
-
Traffic light repaint not working via button
I created a traffic light, a button is pressed and the colors should cycle yellow>green>yellow>red etc.. as a normal traffic light would
when i press the start button, the repaint(); doesnt work, system.output shows me the number which corresponds to the light changes but somehow the graphics/paint is not updated.
what am i doing wrong?
package test2;<br />
<br />
import java.awt.event.ActionEvent;<br />
import java.awt.event.ActionListener;<br />
import javax.swing.JButton;<br />
import javax.swing.JOptionPane;<br />
import javax.swing.JPanel;<br />
<br />
public class Traffic_Lights extends JPanel implements ActionListener {<br />
<br />
private Light_Controller LightController;<br />
private JButton jStart, jStop;<br />
<br />
public Traffic_Lights() {<br />
jStart = new JButton("START");<br />
jStop = new JButton("EXIT");<br />
<br />
// Register Listeners with buttons<br />
jStart.addActionListener(this);<br />
jStop.addActionListener(this);<br />
LightController = new Light_Controller();<br />
this.add(jStart);<br />
this.add(jStop);<br />
}<br />
// Adding the traffic light<br />
<br />
<br />
/**<br />
* This method traps the button click events<br />
*/<br />
public void actionPerformed(ActionEvent e) {<br />
// Rotate button is clicked<br />
if (e.getSource() == jStart) {<br />
// Change the color displayed<br />
LightController.changeColor();<br />
package test2;<br />
import java.awt.*;<br />
import java.awt.geom.Rectangle2D;<br />
import javax.swing.JComponent;<br />
import javax.swing.JPanel;<br />
<br />
<br />
public class Light_Controller extends JPanel {<br />
<br />
private int lightState = 1;<br />
<br />
<br />
public void changeColor() {<br />
lightState++;<br />
System.out.println(lightState);<br />
if (lightState > 5) {<br />
lightState = 2;<br />
<br />
}<br />
<br />
this.repaint();<br />
<br />
}<br />
<br />
/**<br />
* This method draws the traffic light on the screen<br />
*/<br />
public void paintComponent(Graphics g) {<br />
super.paintComponent(g);<br />
<br />
Graphics2D g1 = (Graphics2D) g;<br />
// Draws the traffic light<br />
// Draw out white frame<br />
g.setColor(new Color(255,255,255));<br />
g.fillRoundRect(35,15,120,225,30,30);<br />
<br />
// Draw inner black frame<br />
g.setColor(new Color(0,0,0));<br />
g.fillRoundRect(50,30,90,195,30,30);<br />
g.drawRoundRect(35,15,120,225,30,30);<br />
<br />
// RED dim<br />
g.setColor(new Color(100,0,0));<br />
g.fillOval(70,40,50,50);<br />
<br />
// YELLOW dim<br />
g.setColor(new Color(100,100,0));<br />
g.fillOval(70,100,50,50);<br />
<br />
// GREEN dim<br />
g.setColor(new Color(0,100,0));<br />
g.fillOval(70,160,50,50);<br />
<br />
// Draw traffic light stand<br />
g.setColor(new Color(50,50,50));<br />
g.fillRect(80,240,30,30);<br />
<br />
switch(lightState) {<br />
case 1:<br />
// red glows<br />
g.setColor(new Color(255, 0, 0));<br />
g.fillOval(70, 40, 50, 50);<br />
g1.fill(new Rectangle2D.Double(440, 450, 60, 5));<br />
g1.fill(new Rectangle2D.Double(350, 240, 60, 5));<br />
g1.fill(new Rectangle2D.Double(345, 360, 5, 80));<br />
g1.fill(new Rectangle2D.Double(500, 250, 5, 90));<br />
break;<br />
<br />
case 2:<br />
// yellow glows<br />
g.setColor(new Color(255, 255, 0));<br />
g.fillOval(70, 100, 50, 50);<br />
g1.fill(new Rectangle2D.Double(440, 450, 60, 5));<br />
g1.fill(new Rectangle2D.Double(350, 240, 60, 5));<br />
g1.fill(new Rectangle2D.Double(345, 360, 5, 80));<br />
g1.fill(new Rectangle2D.Double(500, 250, 5, 90));<br />
break;<br />
<br />
case 3:<br />
// green glows<br />
g.setColor(new Color(0, 255, 0));<br />
g.fillOval(70, 160, 50, 50);<br />
g1.fill(new Rectangle2D.Double(440, 450, 60, 5));<br />
g1.fill(new Rectangle2D.Double(350, 240, 60, 5));<br />
g1.fill(new Rectangle2D.Double(345, 360, 5, 80));<br />
g1.fill(new Rectangle2D.Double(500, 250, 5, 90));<br />
break;<br />
<br />
case 4:<br />
// back to yellow glows<br />
g.setColor(new Color(255, 255, 0));<br />
g.fillOval(70, 100, 50, 50);<br />
g1.fill(new Rectangle2D.Double(440, 450, 60, 5));<br />
g1.fill(new Rectangle2D.Double(350, 240, 60, 5));<br />
g1.fill(new Rectangle2D.Double(345, 360, 5, 80));<br />
g1.fill(new Rectangle2D.Double(500, 250, 5, 90));<br />
break;<br />
<br />
case 5:<br />
// back to red glows<br />
g.setColor(new Color(255, 0, 0));<br />
g.fillOval(70, 40, 50, 50);<br />
g1.fill(new Rectangle2D.Double(440, 450, 60, 5));<br />
g1.fill(new Rectangle2D.Double(350, 240, 60, 5));<br />
g1.fill(new Rectangle2D.Double(345, 360, 5, 80));<br />
g1.fill(new Rectangle2D.Double(500, 250, 5, 90));<br />
break;<br />
}<br />
}<br />
} <br />Code continued...
class Light_Controller extends JPanel {
private int lightState = 1;
public void changeColor() {
lightState++;
System.out.println(lightState);
if (lightState > 5) {
lightState = 2;
this.repaint();
public void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g1 = (Graphics2D) g;
g.setColor(new Color(255, 255, 255));
g.fillRoundRect(35, 15, 120, 225, 30, 30);
g.setColor(new Color(0, 0, 0));
g.fillRoundRect(50, 30, 90, 195, 30, 30);
g.drawRoundRect(35, 15, 120, 225, 30, 30);
g.setColor(new Color(100, 0, 0));
g.fillOval(70, 40, 50, 50);
g.setColor(new Color(100, 100, 0));
g.fillOval(70, 100, 50, 50);
g.setColor(new Color(0, 100, 0));
g.fillOval(70, 160, 50, 50);
g.setColor(new Color(50, 50, 50));
g.fillRect(80, 240, 30, 30);
switch (lightState) {
case 1:
g.setColor(new Color(255, 0, 0));
g.fillOval(70, 40, 50, 50);
g1.fill(new Rectangle2D.Double(440, 450, 60, 5));
g1.fill(new Rectangle2D.Double(350, 240, 60, 5));
g1.fill(new Rectangle2D.Double(345, 360, 5, 80));
g1.fill(new Rectangle2D.Double(500, 250, 5, 90));
break;
case 2:
g.setColor(new Color(255, 255, 0));
g.fillOval(70, 100, 50, 50);
g1.fill(new Rectangle2D.Double(440, 450, 60, 5));
g1.fill(new Rectangle2D.Double(350, 240, 60, 5));
g1.fill(new Rectangle2D.Double(345, 360, 5, 80));
g1.fill(new Rectangle2D.Double(500, 250, 5, 90));
break;
case 3:
g.setColor(new Color(0, 255, 0));
g.fillOval(70, 160, 50, 50);
g1.fill(new Rectangle2D.Double(440, 450, 60, 5));
g1.fill(new Rectangle2D.Double(350, 240, 60, 5));
g1.fill(new Rectangle2D.Double(345, 360, 5, 80));
g1.fill(new Rectangle2D.Double(500, 250, 5, 90));
break;
case 4:
g.setColor(new Color(255, 255, 0));
g.fillOval(70, 100, 50, 50);
g1.fill(new Rectangle2D.Double(440, 450, 60, 5));
g1.fill(new Rectangle2D.Double(350, 240, 60, 5));
g1.fill(new Rectangle2D.Double(345, 360, 5, 80));
g1.fill(new Rectangle2D.Double(500, 250, 5, 90));
break;
case 5:
g.setColor(new Color(255, 0, 0));
g.fillOval(70, 40, 50, 50);
g1.fill(new Rectangle2D.Double(440, 450, 60, 5));
g1.fill(new Rectangle2D.Double(350, 240, 60, 5));
g1.fill(new Rectangle2D.Double(345, 360, 5, 80));
g1.fill(new Rectangle2D.Double(500, 250, 5, 90));
break;
} -
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 -
How to put up the traffic lights icon in the ALV Grid. OO output
Hi all,
I have a requriement that after all the report execution parts are done, i need to display the posted or unposted document using the Traffic light icon in the report output, i am displaying the report in ALV OO form and i already geta field with a conent X of the document is posted else that field is blank currently.
RegardsSample code here for this.
*& Report Z_50657_ALV_EX2 *
*& Program Name: Test Program for ALV *
* Developer Name: ADCDEV (Rahul Kavuri ) *
* Description: ALV Report to Display Vendor Details *
*& Date:7th April 2006 *
REPORT Z_50657_ALV_EX2
NO STANDARD PAGE HEADING
LINE-COUNT 65(3)
LINE-SIZE 220
MESSAGE-ID ZZ.
* Type Pools *
TYPE-POOLS: SLIS, ICON.
* Tables *
TABLES: VBAK. "Sales Document Data
* Internal Tables *
* TABLE TO HOLD DATA OF SALES DOCUMENT
DATA: BEGIN OF IT_VBAK OCCURS 0,
VBELN LIKE VBAK-VBELN, "Sales Document
VBTYP LIKE VBAK-VBTYP, "SD document category
AUDAT LIKE VBAK-AUDAT, "Document date (date received/sent)
AUGRU LIKE VBAK-AUGRU, "Order reason (reason for the business)
AUART LIKE VBAK-AUART, "Sales Document Type
NETWR LIKE VBAK-NETWR, "Net Sales Order in Doc. Currency
WAERK LIKE VBAK-WAERK, "SD document currency
ICON TYPE ICON-ID, "traffic lights
END OF IT_VBAK.
* Work Areas *
*WORK AREAS DEFINED FOR ALV'S
DATA: WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV, "field catalog
IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV, "field catalog ITAB
WA_SORT TYPE SLIS_SORTINFO_ALV, "SORT work area
IT_SORT TYPE SLIS_T_SORTINFO_ALV, "SORT ITAB
LAYOUT TYPE SLIS_LAYOUT_ALV, "LAYOUT
WA_FCODE TYPE SLIS_EXTAB, "FUN CODE
I_FCODE_EXTAB TYPE SLIS_T_EXTAB,
WA_EVENTS TYPE SLIS_ALV_EVENT,
IT_EVENTS TYPE SLIS_T_EVENT.
* Selection-Screen *
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME.
SELECT-OPTIONS: S_VBELN FOR VBAK-VBELN.
PARAMETERS: P_VBTYP LIKE VBAK-VBTYP DEFAULT 'C'.
SELECTION-SCREEN END OF BLOCK B1.
SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME.
PARAMETERS: LIST RADIOBUTTON GROUP G1,
GRID RADIOBUTTON GROUP G1.
SELECTION-SCREEN END OF BLOCK B2.
* At Selection-Screen *
*VALIDATION
* Start of Selection *
START-OF-SELECTION.
*POPULATION OF DATA INTO INTERNAL TABLE ITAB
PERFORM GET_DATA.
*DEFINE USER DEFINED FIELDCATALOG
PERFORM DEFINE_FIELDCATALOG.
*SUBTOTALS AND TOTALS DISPLAY USING SORT
PERFORM SORT_LIST.
*CHANGE FCODE OF STATUS
PERFORM CHANGE_FCODE.
*CHECK RADIOBUTTON OPTION AND ACCORDINGLY FINAL DISPLAY
PERFORM CHECK_OPTION.
*& Form GET_DATA
* text
FORM GET_DATA.
SELECT VBELN
VBTYP
AUDAT
AUGRU
AUART
NETWR
WAERK FROM VBAK INTO TABLE IT_VBAK
WHERE VBELN IN S_VBELN AND VBTYP = P_VBTYP
AND ERDAT > '01.01.2004' AND NETWR > 0.
LOOP AT IT_VBAK.
IF IT_VBAK-NETWR < 10000.
IT_VBAK-ICON = '@08@'.
ELSEIF IT_VBAK-NETWR > 100000.
IT_VBAK-ICON = '@0A@'.
ELSE.
IT_VBAK-ICON = '@09@'.
ENDIF.
MODIFY IT_VBAK INDEX SY-TABIX.
ENDLOOP.
ENDFORM. "GET_DATA
*& Form CHECK_OPTION
* text
FORM CHECK_OPTION.
WA_EVENTS-NAME = 'TOP_OF_PAGE'.
WA_EVENTS-FORM = 'TOP'.
APPEND WA_EVENTS TO IT_EVENTS.
CLEAR WA_EVENTS.
WA_EVENTS-NAME = 'END_OF_LIST'.
WA_EVENTS-FORM = 'END_LIST'.
APPEND WA_EVENTS TO IT_EVENTS.
CLEAR WA_EVENTS.
IF LIST = 'X'.
PERFORM LIST_DISP.
ENDIF.
IF GRID = 'X'.
PERFORM GRID_DISP.
ENDIF.
ENDFORM. "CHECK_OPTION
*& Form DEFINE_FIELDCATALOG
* text
FORM DEFINE_FIELDCATALOG.
WA_FIELDCAT-COL_POS = 1.
WA_FIELDCAT-FIELDNAME = 'ICON'.
WA_FIELDCAT-SELTEXT_L = 'ICON'.
WA_FIELDCAT-ICON = 'X'.
WA_FIELDCAT-OUTPUTLEN = 8.
WA_FIELDCAT-TABNAME = 'IT_VBAK'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = 2.
WA_FIELDCAT-FIELDNAME = 'VBELN'.
WA_FIELDCAT-SELTEXT_L = 'SALES DOC NO.'.
WA_FIELDCAT-OUTPUTLEN = 10.
WA_FIELDCAT-TABNAME = 'IT_VBAK'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = 3.
WA_FIELDCAT-FIELDNAME = 'AUDAT'.
WA_FIELDCAT-SELTEXT_L = 'CREATED ON'.
WA_FIELDCAT-OUTPUTLEN = 10.
WA_FIELDCAT-TABNAME = 'IT_VBAK'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = 4.
WA_FIELDCAT-FIELDNAME = 'VBTYP'.
WA_FIELDCAT-SELTEXT_L = 'CATEGORY'.
WA_FIELDCAT-OUTPUTLEN = 1.
WA_FIELDCAT-TABNAME = 'IT_VBAK'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = 6.
WA_FIELDCAT-FIELDNAME = 'AUGRU'.
WA_FIELDCAT-SELTEXT_L = 'REASON'.
WA_FIELDCAT-OUTPUTLEN = 3.
WA_FIELDCAT-TABNAME = 'IT_VBAK'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = 5.
WA_FIELDCAT-FIELDNAME = 'AUART'.
WA_FIELDCAT-SELTEXT_L = 'DOC TYPE'.
WA_FIELDCAT-OUTPUTLEN = 4.
WA_FIELDCAT-TABNAME = 'IT_VBAK'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = 7.
WA_FIELDCAT-FIELDNAME = 'NETWR'.
WA_FIELDCAT-SELTEXT_L = 'NET VALUE'.
WA_FIELDCAT-OUTPUTLEN = 17.
WA_FIELDCAT-DECIMALS_OUT = 2.
* WA_FIELDCAT-DO_SUM = 'X'.
WA_FIELDCAT-TABNAME = 'IT_VBAK'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = 8.
WA_FIELDCAT-FIELDNAME = 'WAERK'.
WA_FIELDCAT-SELTEXT_L = 'UNIT'.
WA_FIELDCAT-OUTPUTLEN = 50.
WA_FIELDCAT-TABNAME = 'IT_VBAK'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
ENDFORM. "DEFINE_FIELDCATALOG
*& Form DEFINE_LAYOUT
* text
FORM DEFINE_LAYOUT.
LAYOUT-ZEBRA = 'X'.
LAYOUT-SUBTOTALS_TEXT = 'SUBTOTAL SUM'.
LAYOUT-WINDOW_TITLEBAR = 'EXERCISE 2'.
LAYOUT-TOTALS_TEXT = 'TOTAL'.
ENDFORM. "DEFINE_LAYOUT
*& Form SORT_LIST
* text
FORM SORT_LIST.
WA_SORT-FIELDNAME = 'VBELN'.
WA_SORT-TABNAME = 'IT_VBAK'.
WA_SORT-SPOS = 1.
WA_SORT-UP = 'X'.
WA_SORT-SUBTOT = 'X'.
APPEND WA_SORT TO IT_SORT.
CLEAR WA_SORT.
WA_SORT-FIELDNAME = 'NETWR'.
WA_SORT-TABNAME = 'IT_VBAK'.
WA_SORT-UP = 'X'.
WA_SORT-SPOS = 2.
WA_SORT-SUBTOT = 'X'.
APPEND WA_SORT TO IT_SORT.
CLEAR WA_SORT.
ENDFORM. "SORT_LIST
*& Form LIST_DISP
* text
FORM LIST_DISP.
PERFORM DEFINE_LAYOUT.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IT_FIELDCAT = IT_FIELDCAT
IS_LAYOUT = LAYOUT
IT_SORT = IT_SORT
I_CALLBACK_PF_STATUS_SET = 'STATUS'
IT_EXCLUDING = I_FCODE_EXTAB
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
IT_EVENTS = IT_EVENTS[]
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = IT_VBAK
* 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. "LIST_DISP
*& Form GRID_DISP
* text
FORM GRID_DISP.
PERFORM DEFINE_LAYOUT.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IS_LAYOUT = LAYOUT
IT_FIELDCAT = IT_FIELDCAT
IT_SORT = IT_SORT
I_CALLBACK_PF_STATUS_SET = 'STATUS'
IT_EXCLUDING = I_FCODE_EXTAB
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
IT_EVENTS = IT_EVENTS[]
TABLES
T_OUTTAB = IT_VBAK.
* 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. "GRID_DISP
*& Form STATUS
* text
* -->P_EXTAB text
FORM STATUS USING P_EXTAB TYPE SLIS_T_EXTAB.
SET PF-STATUS 'STATUS' EXCLUDING P_EXTAB.
ENDFORM. "STATUS
*& Form USER_COMMAND
* text
* -->R_UCOMM text
* -->RS_SELFIELD text
FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
CASE R_UCOMM.
WHEN 'BACK' OR 'CANC' OR 'EXIT'.
LEAVE TO SCREEN 0.
WHEN '&IC1'.
SET PARAMETER ID 'AUN' FIELD RS_SELFIELD-VALUE.
CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
ENDCASE.
ENDFORM. "USER_COMMAND
*& Form CHANGE_FCODE
* text
FORM CHANGE_FCODE.
WA_FCODE = 'PRNT'.
APPEND WA_FCODE TO I_FCODE_EXTAB.
WA_FCODE = '&OAD'.
APPEND WA_FCODE TO I_FCODE_EXTAB.
WA_FCODE = '&AVE'.
APPEND WA_FCODE TO I_FCODE_EXTAB.
WA_FCODE = '&EB9'.
APPEND WA_FCODE TO I_FCODE_EXTAB.
WA_FCODE = '&SUM'.
APPEND WA_FCODE TO I_FCODE_EXTAB.
WA_FCODE = '&UMC'.
APPEND WA_FCODE TO I_FCODE_EXTAB.
WA_FCODE = '&XPA'.
APPEND WA_FCODE TO I_FCODE_EXTAB.
WA_FCODE = '&OMP'.
APPEND WA_FCODE TO I_FCODE_EXTAB.
ENDFORM. "CHANGE_FCODE
*& Form TOP
* text
FORM TOP.
IF LIST = 'X'.
WRITE:/ SY-ULINE.
WRITE:/ 'DATE:', SY-DATUM,55 'INTELLIGROUP ASIA PVT LTD'.
WRITE:/ 'TIME:', SY-UZEIT.
WRITE:/ 'USER NAME:', SY-UNAME,60 SY-TITLE.
WRITE:/ 'PAGE', SY-PAGNO.
WRITE:/ SY-ULINE.
ENDIF.
IF GRID = 'X'.
DATA: LS_LINE TYPE SLIS_LISTHEADER,
E04_LT_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER.
* Listenüberschrift: Typ H
CLEAR LS_LINE.
LS_LINE-TYP = 'H'.
* LS_LINE-KEY: not used for this type
LS_LINE-INFO = 'Summary'.
APPEND LS_LINE TO E04_LT_TOP_OF_PAGE.
* Kopfinfo: Typ S
CLEAR LS_LINE.
LS_LINE-TYP = 'S'.
LS_LINE-KEY = 'Intelligroup'.
LS_LINE-INFO = ''.
APPEND LS_LINE TO E04_LT_TOP_OF_PAGE.
LS_LINE-KEY = 'ASIA'.
LS_LINE-INFO = 'PVT LTD'.
APPEND LS_LINE TO E04_LT_TOP_OF_PAGE.
* Aktionsinfo: Typ A
CLEAR LS_LINE.
LS_LINE-TYP = 'A'.
* LS_LINE-KEY: not used for this type
LS_LINE-INFO = 'truman'.
APPEND LS_LINE TO E04_LT_TOP_OF_PAGE.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = E04_LT_TOP_OF_PAGE
I_LOGO = 'ENJOY_SAP_LOGO'.
ENDIF.
ENDFORM. "TOP
*& Form END_LIST
* text
FORM END_LIST.
IF LIST = 'X'.
SKIP 2.
WRITE:/60 'END OF PAGE'.
ENDIF.
IF GRID = 'X'.
DATA: LS_LINE TYPE SLIS_LISTHEADER,
E04_LT_END_OF_LIST TYPE SLIS_T_LISTHEADER.
* Listenüberschrift: Typ H
CLEAR LS_LINE.
LS_LINE-TYP = 'H'.
* LS_LINE-KEY: not used for this type
LS_LINE-INFO = 'Summary'.
APPEND LS_LINE TO E04_LT_END_OF_LIST.
* Kopfinfo: Typ S
CLEAR LS_LINE.
LS_LINE-TYP = 'S'.
LS_LINE-KEY = 'Intelligroup'.
LS_LINE-INFO = ''.
APPEND LS_LINE TO E04_LT_END_OF_LIST.
LS_LINE-KEY = 'ASIA'.
LS_LINE-INFO = 'PVT LTD'.
APPEND LS_LINE TO E04_LT_END_OF_LIST.
* Aktionsinfo: Typ A
CLEAR LS_LINE.
LS_LINE-TYP = 'A'.
* LS_LINE-KEY: not used for this type
LS_LINE-INFO = TEXT-105.
APPEND LS_LINE TO E04_LT_END_OF_LIST.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = E04_LT_END_OF_LIST.
ENDIF.
ENDFORM. "END_LIST -
How to add Traffic Lights to a Report?
Hi,
How do U create a Traffic Light? and how to you change the Light? That's all I need.
Thanks,
Kishanhi 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. -
ALV editable with traffic lights
Hello all,
I need some help about ALV editable; my reports display an ALV grid editable, and update all the new values on the DB table, but I have traffic lights as values on the DB table.
More informations:
So this is my internal table
<i>DATA: BEGIN OF it_table OCCURS 0,
document TYPE admi-document,
status TYPE admi-status, (traffic</i> lights from the table able to modify)
archiv_key TYPE admi_files-archiv_key,
status_opt TYPE admi_files-status_opt, (traffic lights from the table able to modify )
status_fil TYPE admi_files-status_fil, (traffic lights from the table able to modify )
END OF it_report.
</i>
I got all the match code form the table (DB) , so on my report I could modify all the traffic lights but when I save the modifications, I got a message error.
And the second problem was, I couldnt come back to the value initial and I getting the same message.
Can anybody help me please?
Thanks you.see the program and i am using traffic lights in my program --
REPORT ZWM_BIN_STOCK_REQ no standard page heading
message-id zwave.
D A T A D E C L A R A T I O N ****************************
Tables
tables : zpwvbap,
mara,
marc,
makt,
vbap,
zshift,
marm,
lqua.
TYPE-POOLS: SLIS.
Internal Table for Sales order
data : begin of i_vbap occurs 0,
matnr like zpwvbap-matnr," Material #
ZZCUTOFF like zpwvbak-ZZCUTOFF," Cutoff Time
vlpla like zpwvbap-vlpla,
kwmeng like zpwvbap-kwmeng," Quantity
vrkme like zpwvbap-vrkme, " Sales Unit
meins like zpwvbap-meins, " Unit of measure
end of i_vbap.
Internal Table for final Processing
data : begin of i_final occurs 0,
date(8) type c,
matnr like zpwvbap-matnr," Material #
zzshift like zshift-zzshift, " Wave Drop
maktx like makt-maktx," Desc
lgpla like lagp-lgpla, " Pick Bin
pverme like lqua-verme," Stock at Pick Bin
prverme like lqua-verme," Stock at Prod Bin
kwmeng like zpwvbap-kwmeng," Requiremnet from Wave Drop
vrkme like zpwvbap-vrkme, " Sales Unit
meins like zpwvbap-meins," Unit of measure
end of i_final.
Internal Table for Output
data : begin of i_output occurs 0,
field type c, " Traffic Lights
zzshift like zshift-zzshift, " Wave Drop
matnr like zpwvbap-matnr," Material #
maktx like makt-maktx," Desc
lgpla like lagp-lgpla, " Pick Bin
pverme like lqua-verme," Stock at Pick Bin
prverme like lqua-verme," Stock at Prod Bin
kwmeng like zpwvbap-kwmeng," Requiremnet from Wave Drop
vrkme like zpwvbap-vrkme," Sales Unit
meins like zpwvbap-meins," Unit of measure
diff like zpwvbap-kwmeng, " Diffrence
end of i_output.
Work Area for Final Internal Table
data wa_final like i_final.
data : w_zzcutoff(12) TYPE c,
v_date type sy-datum,
v_time(4) type c,
v_fldate(12) type c,
v_fhdate(12) type c,
v_pverme like lqua-verme,
v_prverme like lqua-verme,
v_diff like zpwvbap-kwmeng.
Variables for new check box
data : v_nverme like lqua-verme.
Internal Table for Pick Bin
data : begin of i_verme occurs 0,
verme like lqua-verme,
end of i_verme.
Internal table for Prod Bin
data : begin of i_pverme occurs 0,
verme like lqua-verme,
end of i_pverme.
Variables for ALV
DATA: FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
FIELDCAT_LN LIKE LINE OF FIELDCAT,
SORTCAT TYPE SLIS_T_SORTINFO_ALV,
SORTCAT_LN LIKE LINE OF SORTCAT,
EVENTCAT TYPE SLIS_T_EVENT,
EVENTCAT_LN LIKE LINE OF EVENTCAT,
LAYOUT TYPE SLIS_LAYOUT_ALV,
C_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE',
g_user_command TYPE slis_formname VALUE 'USER_COMMAND',
GT_LIST_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER.
DATA: COL_POS TYPE I,
P_LIGNAM TYPE SLIS_FIELDNAME VALUE 'FIELD'.
DATA : V_REPID LIKE SY-REPID,
flag type c.
S E L E C T I O N - S C R E E N *************************
selection-screen : begin of block blk with frame title text-001.
parameter : p_plant like marc-werks obligatory default '1000'.
select-options : s_date for sy-datum obligatory ,
s_shift for zshift-zzshift,
s_matnr for mara-matnr,
s_dept for zpwvbap-zzdept,
s_pdept for marc-ZZPRODDEPT.
selection-screen: end of block blk.
parameters : p_check as checkbox ."default 'X'.
ranges r_cutoff for w_zzcutoff.
I N I T I A L I Z A T I O N ****************************
initialization.
V_REPID = SY-REPID.
s_date-low = sy-datum + 1.
append s_date.
S T A R T - O F - S E L E C T I O N ***********************
start-of-selection.
Get the Shift Data.
PERFORM GET_SHIFT_DETAILS.
Get the data from ZPWVBAP Table
PERFORM GET_DATA_VBAP.
E N D - O F - S E L E C T I O N **********************
end-of-selection.
if not i_output[] is initial.
sort i_output by field zzshift matnr.
Reset the all Fiedcatlog.
PERFORM RESETVALUES.
Traffic Lights
PERFORM BUILD_LAYOUT.
Fill the fieldcatlog values
PERFORM FILL_FIELDCATLOG.
Call the List Function module
PERFORM CALL_lIST.
endif.
*& Form GET_SHIFT_DETAILS
Get the Cutoff Time.
FORM GET_SHIFT_DETAILS.
clear : v_fldate,
v_fhdate.
if not s_shift-low is initial.
clear: v_time,
v_date.
if s_shift-low = '1'.
v_time = '2000'.
elseif s_shift-low = '2'.
v_time = '2300'.
endif.
v_date = s_date-low - 1.
concatenate v_date v_time into v_fldate.
endif.
if not s_shift-high is initial.
clear : v_date,
v_time.
if s_shift-high = '1'.
v_time = '2000'.
elseif s_shift-high = '2'.
v_time = '2300'.
endif.
if not s_date-high is initial.
v_date = s_date-high - 1.
else.
v_date = s_date-low - 1.
endif.
concatenate v_date v_time into v_fhdate.
endif.
if not v_fhdate is initial.
r_cutoff-low = v_fldate.
r_cutoff-high = v_fhdate.
r_cutoff-sign = 'I'.
r_cutoff-option = 'BT'.
append r_cutoff.
endif.
ENDFORM. " GET_SHIFT_DETAILS
*& Form GET_DATA_VBAP
Get the data from ZPWVBAP Table
FORM GET_DATA_VBAP.
Get the data from ZPWVBAP and ZPWVBAK Table
if not v_fhdate is initial.
select matnr ZZCUTOFF vlpla sum( kwmeng ) vrkme meins
into table i_vbap
from zpwvbap as a inner join zpwvbak as b on
a~vbeln = b~vbeln
where a~werks = p_plant
and a~matnr in s_matnr
and b~vdatu in s_date
and a~zzdept in s_dept
and b~zzcutoff in r_cutoff
group by matnr zzcutoff vlpla vrkme meins.
elseif not v_fldate is initial.
select matnr ZZCUTOFF vlpla sum( kwmeng ) vrkme meins
into table i_vbap
from zpwvbap as a inner join zpwvbak as b on
a~vbeln = b~vbeln
where a~werks = p_plant
and a~matnr in s_matnr
and b~vdatu in s_date
and a~zzdept in s_dept
and b~zzcutoff = v_fldate
group by matnr zzcutoff vlpla vrkme meins.
else.
select matnr ZZCUTOFF vlpla sum( kwmeng ) vrkme meins
into table i_vbap
from zpwvbap as a inner join zpwvbak as b on
a~vbeln = b~vbeln
where a~werks = p_plant
and a~matnr in s_matnr
and b~vdatu in s_date
and a~zzdept in s_dept
and b~zzcutoff in r_cutoff
group by matnr zzcutoff vlpla vrkme meins .
endif.
if sy-subrc ne 0.
message i000(zwave) with 'No data found for given selection'.
stop.
endif.
sort i_vbap by zzcutoff matnr.
loop at i_vbap.
clear : v_pverme,
v_prverme.
Compare the data with pick method
select single zzpick from marc into marc-zzpick
where matnr = i_vbap-matnr
and werks = p_plant
and zzpick = '01'.
if sy-subrc ne 0.
continue.
endif.
Compare the data from MARC Table with Production Department
select single zzPRODdept from marc into marc-zzPRODdept
where matnr = i_vbap-matnr
and werks = p_plant
and zzPRODdept in s_pdept.
if sy-subrc ne 0.
continue.
endif.
Get the Material Description from MAKT Table
Select single maktx from makt into makt-maktx
where matnr = i_vbap-matnr
and spras = 'E'.
if sy-subrc eq 0.
i_final-maktx = makt-maktx.
endif.
Get the Pick Bin
i_final-lgpla = i_vbap-vlpla.
refresh i_verme.
clear i_verme.
Get the stock at Pick bin
select verme from lqua into table i_verme
where lgpla = i_vbap-vlpla
and matnr = i_vbap-matnr
and LGNUM = '100'.
if sy-subrc eq 0.
loop at i_verme.
v_pverme = v_pverme + i_verme-verme.
endloop.
if sy-subrc eq 0.
i_final-pverme = v_pverme.
endif.
endif.
refresh i_pverme.
clear i_pverme.
Get the stock at Production bin
select verme from lqua into table i_pverme
where matnr = i_vbap-matnr
and LGNUM = '100'
and ( lgpla = '9595959595' or
lgpla = '2222222222' or
lgpla = '5555555555' or
lgpla = '3232323232' or
lgpla = '8080808080' or
lgpla = '4040404040' or
lgpla = '9090909090' ).
if sy-subrc eq 0.
loop at i_pverme.
v_prverme = v_prverme + i_pverme-verme.
endloop.
if sy-subrc eq 0.
i_final-prverme = v_prverme.
endif.
endif.
Compare the unit of measure and sales unit
if i_vbap-vrkme ne i_vbap-meins.
Get the data from MARM Table ( Unit of measure )
select single * from marm into marm
where matnr = i_vbap-matnr
and meinh = i_vbap-vrkme.
if sy-subrc eq 0.
i_final-pverme = ( i_final-pverme * marm-umren ) / marm-umrez.
endif.
endif.
Material #
i_final-matnr = i_vbap-matnr.
Quantity from ZPWVBAP
i_final-kwmeng = i_vbap-kwmeng.
Unit of Measure
i_final-meins = i_vbap-meins.
Sales Unit
i_final-vrkme = i_vbap-vrkme.
Wave Drop
if i_vbap-ZZCUTOFF+8(4) = '2000' .
i_final-zzshift = '1'.
endif.
if i_vbap-zzcutoff+8(4) = '2300'.
i_final-zzshift = '2'.
endif.
i_final-date = i_vbap-zzcutoff+0(8).
append i_final.
clear : i_final,
i_vbap.
**Difference
i_output-diff = i_output-pverme - i_vbap-kwmeng.
Traffic Lights Depends on value
if i_output-pverme > i_output-kwmeng.
i_output-field = '3'.
elseif i_output-pverme < i_output-kwmeng.
i_output-field = '1'.
elseif i_output-pverme = i_output-kwmeng.
i_output-field = '2'.
endif.
append i_output.
clear : i_output,
i_vbap.
endloop.
refresh i_vbap.
sort i_final by date matnr zzshift.
Processing the internal table to get same material with pick quantity
deduction even it for 2nd shift
loop at i_final.
Move the data into work area in order remove #
move i_final to wa_final.
clear : flag.
at new matnr.
move : wa_final-matnr to i_output-matnr," Material #
wa_final-maktx to i_output-maktx," Desc
wa_final-lgpla to i_output-lgpla," Pick Bin
wa_final-kwmeng to i_output-kwmeng," Order qty
wa_final-zzshift to i_output-zzshift," Shift
wa_final-pverme to i_output-pverme, " Pick bin qty
wa_final-vrkme to i_output-vrkme," Sales Unit
wa_final-prverme to i_output-prverme. " Prod Bin Qty
break sreddy.
Difference
i_output-diff = i_output-pverme - i_output-kwmeng.
New logic for Only HMR Department
if p_check = 'X'.
if i_output-pverme < i_output-kwmeng.
v_nverme = i_output-pverme + i_output-prverme.
if v_nverme > i_output-kwmeng.
if i_output-pverme < i_output-kwmeng.
i_output-field = '2'.
else.
Traffic Lights Depends on value
i_output-field = '3'.
endif.
elseif v_nverme < i_output-kwmeng.
i_output-field = '1'.
elseif v_nverme = i_output-kwmeng.
i_output-field = '2'.
endif.
elseif i_output-pverme > i_output-kwmeng.
i_output-field = '3'.
elseif i_output-pverme = i_output-kwmeng.
i_output-field = '3'.
endif.
else.
Traffic Lights Depends on value
if i_output-pverme > i_output-kwmeng.
i_output-field = '3'.
elseif i_output-pverme < i_output-kwmeng.
i_output-field = '1'.
elseif i_output-pverme = i_output-kwmeng.
i_output-field = '2'.
endif.
endif.
move i_output-diff to v_diff.
flag = 'X'.
endat.
if flag ne 'X'.
move : wa_final-matnr to i_output-matnr," Material #
wa_final-maktx to i_output-maktx," Desc
wa_final-lgpla to i_output-lgpla," Pick Bin
wa_final-kwmeng to i_output-kwmeng," Order qty
wa_final-zzshift to i_output-zzshift," Shift
wa_final-vrkme to i_output-vrkme," Sales Unit
wa_final-prverme to i_output-prverme. " Prod Bin Qty
Move Diffrence value
move v_diff to i_output-pverme.
clear: v_diff.
New logic for Only HMR Department
New logic for Only HMR Department
if p_check = 'X'.
if i_output-pverme < i_output-kwmeng.
v_nverme = i_output-pverme + i_output-prverme.
if v_nverme > i_output-kwmeng.
if i_output-pverme < i_output-kwmeng.
i_output-field = '2'.
else.
Traffic Lights Depends on value
i_output-field = '3'.
endif.
Traffic Lights Depends on value
i_output-field = '3'.
elseif v_nverme < i_output-kwmeng.
i_output-field = '1'.
elseif v_nverme = i_output-kwmeng.
i_output-field = '2'.
endif.
elseif i_output-pverme > i_output-kwmeng.
i_output-field = '3'.
elseif i_output-pverme = i_output-kwmeng.
i_output-field = '3'.
endif.
i_output-diff = i_output-pverme - i_output-kwmeng.
else.
Difference
i_output-diff = i_output-pverme - i_output-kwmeng.
Traffic Lights Depends on value
if i_output-pverme > i_output-kwmeng.
i_output-field = '3'.
elseif i_output-pverme < i_output-kwmeng.
i_output-field = '1'.
elseif i_output-pverme = i_output-kwmeng.
i_output-field = '2'.
endif.
endif.
endif.
append i_output.
clear : i_output,
wa_final,
i_final,
v_nverme.
endloop.
sort i_output by field zzshift matnr.
ENDFORM. " GET_DATA_VBAP
*& Form RESETVALUES
Reset the all fieldcatlogs
FORM RESETVALUES.
FIELDCAT_LN-KEY = SPACE.
FIELDCAT_LN-DO_SUM = SPACE.
FIELDCAT_LN-NO_OUT = SPACE.
FIELDCAT_LN-QFIELDNAME = SPACE.
FIELDCAT_LN-HOTSPOT = SPACE.
FIELDCAT_LN-OUTPUTLEN = '0'.
CLEAR: fieldcat_ln-seltext_l, fieldcat_ln-seltext_m,
fieldcat_ln-seltext_s, fieldcat_ln-reptext_ddic.
ENDFORM. " RESETVALUES
*& Form FILL_FIELDCATLOG
Fill the Fieldcatlog values
FORM FILL_FIELDCATLOG.
DATA: ls_fieldcat TYPE slis_fieldcat_alv.
Trafiic Light
CLEAR LS_FIELDCAT.
LS_FIELDCAT-FIELDNAME = 'FIELD'.
LS_FIELDCAT-TABNAME = 'I_OUTPUT'.
LS_FIELDCAT-OUTPUTLEN = 7.
LS_FIELDCAT-col_pos = '1'.
ls_fieldcat-seltext_L = 'Lights'.
ls_fieldcat-seltext_s = 'Lights'.
ls_fieldcat-seltext_m = 'Lights'.
APPEND LS_FIELDCAT TO FIELDCAT.
Wave Drop
CLEAR LS_FIELDCAT.
LS_FIELDCAT-FIELDNAME = 'ZZSHIFT'.
LS_FIELDCAT-TABNAME = 'I_OUTPUT'.
LS_FIELDCAT-OUTPUTLEN = 9.
LS_FIELDCAT-col_pos = '2'.
ls_fieldcat-seltext_L = 'Wave Drop'.
APPEND LS_FIELDCAT TO FIELDCAT.
Material
CLEAR LS_FIELDCAT.
LS_FIELDCAT-FIELDNAME = 'MATNR'.
LS_FIELDCAT-TABNAME = 'I_OUTPUT'.
LS_FIELDCAT-OUTPUTLEN = 18.
LS_FIELDCAT-col_pos = '3'.
ls_fieldcat-seltext_L = 'Material'.
APPEND LS_FIELDCAT TO FIELDCAT.
Description
CLEAR LS_FIELDCAT.
LS_FIELDCAT-FIELDNAME = 'MAKTX'.
LS_FIELDCAT-TABNAME = 'I_OUTPUT'.
LS_FIELDCAT-OUTPUTLEN = 40.
LS_FIELDCAT-col_pos = '4'.
ls_fieldcat-seltext_L = 'Description'.
APPEND LS_FIELDCAT TO FIELDCAT.
Pick Bin
CLEAR LS_FIELDCAT.
LS_FIELDCAT-FIELDNAME = 'LGPLA'.
LS_FIELDCAT-TABNAME = 'I_OUTPUT'.
LS_FIELDCAT-OUTPUTLEN = 15.
LS_FIELDCAT-col_pos = '5'.
ls_fieldcat-seltext_L = 'Pick Bin'.
APPEND LS_FIELDCAT TO FIELDCAT.
Trafiic Light
CLEAR LS_FIELDCAT.
LS_FIELDCAT-FIELDNAME = 'PVERME'.
LS_FIELDCAT-TABNAME = 'I_OUTPUT'.
LS_FIELDCAT-OUTPUTLEN = 16.
LS_FIELDCAT-col_pos = '6'.
ls_fieldcat-seltext_L = 'Stock at Pick Bin'.
APPEND LS_FIELDCAT TO FIELDCAT.
Stock at Prod Bin
CLEAR LS_FIELDCAT.
LS_FIELDCAT-FIELDNAME = 'PRVERME'.
LS_FIELDCAT-TABNAME = 'I_OUTPUT'.
LS_FIELDCAT-OUTPUTLEN = 16.
LS_FIELDCAT-col_pos = '7'.
ls_fieldcat-seltext_L = 'Stock at Prod Bin'.
APPEND LS_FIELDCAT TO FIELDCAT.
Req from wave drop
CLEAR LS_FIELDCAT.
LS_FIELDCAT-FIELDNAME = 'KWMENG'.
LS_FIELDCAT-TABNAME = 'I_OUTPUT'.
LS_FIELDCAT-OUTPUTLEN = 23.
LS_FIELDCAT-col_pos = '8'.
ls_fieldcat-seltext_L = 'Requirement from Wave Drop'.
APPEND LS_FIELDCAT TO FIELDCAT.
Sales Unit
CLEAR LS_FIELDCAT.
LS_FIELDCAT-FIELDNAME = 'VRKME'.
LS_FIELDCAT-TABNAME = 'I_OUTPUT'.
LS_FIELDCAT-OUTPUTLEN = 12.
LS_FIELDCAT-col_pos = '9'.
ls_fieldcat-seltext_L = 'Sales Unit'.
APPEND LS_FIELDCAT TO FIELDCAT.
Unit of Measure
CLEAR LS_FIELDCAT.
LS_FIELDCAT-FIELDNAME = 'MEINS'.
LS_FIELDCAT-TABNAME = 'I_OUTPUT'.
LS_FIELDCAT-OUTPUTLEN = 9.
LS_FIELDCAT-col_pos = '10'.
ls_fieldcat-seltext_L = 'UNIT'.
ls_fieldcat-no_out = 'X'.
APPEND LS_FIELDCAT TO FIELDCAT.
Diffference
CLEAR LS_FIELDCAT.
LS_FIELDCAT-FIELDNAME = 'DIFF'.
LS_FIELDCAT-TABNAME = 'I_OUTPUT'.
LS_FIELDCAT-OUTPUTLEN = 12.
LS_FIELDCAT-col_pos = '11'.
ls_fieldcat-seltext_L = 'Difference'.
APPEND LS_FIELDCAT TO FIELDCAT.
ENDFORM. " FILL_FIELDCATLOG
*& Form CALL_lIST
Use ALV Function module to display output
FORM CALL_lIST.
Top - of - Page
PERFORM COMMENT_BUILD USING GT_LIST_TOP_OF_PAGE[].
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = V_REPID
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = g_user_command
I_CALLBACK_TOP_OF_PAGE = C_TOP_OF_PAGE
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT = LAYOUT
IT_FIELDCAT = FIELDCAT
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IT_ALV_GRAPHICS =
IT_ADD_FIELDCAT =
IT_HYPERLINK =
I_HTML_HEIGHT_TOP =
I_HTML_HEIGHT_END =
IT_EXCEPT_QINFO =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = I_OUTPUT
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. " CALL_lIST
*& Form BUILD_LAYOUT
text
FORM BUILD_LAYOUT.
LAYOUT-GET_SELINFOS = 'X'.
Now we want a traffic light to say if the Truck is deleted
the variable p_lignam contains the name in IREPO which stores the
value for the traffic light
LAYOUT-LIGHTS_FIELDNAME = P_LIGNAM.
layout-HEADER_TEXT = 'Lights'.
LAYOUT-LIGHTS_CONDENSE = 'X'.
ENDFORM. " BUILD_LAYOUT
*& Form COMMENT_BUILD
text
-->P_GT_LIST_TOP_OF_PAGE[] text
FORM COMMENT_BUILD USING LT_TOP_OF_PAGE TYPE
SLIS_T_LISTHEADER.
data : v_day(2) type c,
v_mon(2) type c,
v_year(4) type c,
v_ldate(10) type c,
v_hdate(10) type c.
DATA: LS_LINE TYPE SLIS_LISTHEADER.
data: d_date like sy-datum.
clear : v_ldate,
v_hdate.
Header Information.
LIST HEADING LINE: TYPE H
CLEAR LS_LINE.
LS_LINE-TYP = 'H'.
LS_LINE-KEY: NOT USED FOR THIS TYPE
LS_LINE-INFO = 'Bin Replenishment report for HMR'.
APPEND LS_LINE TO LT_TOP_OF_PAGE.
STATUS LINE: TYPE S
CLEAR LS_LINE.
LS_LINE-TYP = 'S'.
LS_LINE-KEY = TEXT-003.
LS_LINE-INFO = TEXT-003.
APPEND LS_LINE TO LT_TOP_OF_PAGE.
STATUS LINE: TYPE S
CLEAR LS_LINE.
LS_LINE-TYP = 'S'.
LS_LINE-KEY = TEXT-003.
LS_LINE-INFO = TEXT-003.
APPEND LS_LINE TO LT_TOP_OF_PAGE.
Get the data ( s_date_low) into proper format.
v_year = s_date-low+0(4).
v_mon = s_date-low+4(2).
v_day = s_date-low+6(2).
concatenate v_mon '/' v_day '/' v_year into v_ldate.
clear : v_mon,
v_year,
v_day.
Get the data ( s_date_high) into proper format.
v_year = s_date-high+0(4).
v_mon = s_date-high+4(2).
v_day = s_date-high+6(2).
concatenate v_mon '/' v_day '/' v_year into v_hdate.
clear : v_mon,
v_year,
v_day.
Delivery date
if not s_date-low is initial .
if not s_date-high is initial.
CLEAR LS_LINE.
LS_LINE-TYP = 'S'.
LS_LINE-KEY = 'Delivery date From:'.
LS_LINE-INFO = v_ldate.
APPEND LS_LINE TO LT_TOP_OF_PAGE.
CLEAR LS_LINE.
LS_LINE-TYP = 'S'.
LS_LINE-KEY = 'Delivery date To :'.
LS_LINE-INFO = v_hdate.
APPEND LS_LINE TO LT_TOP_OF_PAGE.
endif.
endif.
if not s_date-low is initial.
if s_date-high is initial.
CLEAR LS_LINE.
LS_LINE-TYP = 'S'.
LS_LINE-KEY = 'Delivery date :'.
LS_LINE-INFO = v_ldate.
APPEND LS_LINE TO LT_TOP_OF_PAGE.
endif.
endif.
Wave Drop
if not S_SHIFT-LOW is initial.
if not S_SHIFT-high is initial.
CLEAR LS_LINE.
LS_LINE-TYP = 'S'.
LS_LINE-KEY = 'Wave Drop From :'.
LS_LINE-INFO = s_shift-low.
APPEND LS_LINE TO LT_TOP_OF_PAGE.
CLEAR LS_LINE.
LS_LINE-TYP = 'S'.
LS_LINE-KEY = 'Wave Drop to :'.
LS_LINE-INFO = s_shift-high.
APPEND LS_LINE TO LT_TOP_OF_PAGE.
endif.
endif.
if not S_SHIFT-LOW is initial.
if S_SHIFT-high is initial.
CLEAR LS_LINE.
LS_LINE-TYP = 'S'.
LS_LINE-KEY = 'Wave Drop :'.
LS_LINE-INFO = s_shift-low.
APPEND LS_LINE TO LT_TOP_OF_PAGE.
CLEAR LS_LINE.
LS_LINE-TYP = 'S'.
LS_LINE-KEY = 'Wave Drop to :'.
LS_LINE-INFO = s_shift-high.
APPEND LS_LINE TO LT_TOP_OF_PAGE.
endif.
endif.
Department
if not s_dept-low is initial .
if not s_dept-high is initial.
CLEAR LS_LINE.
LS_LINE-TYP = 'S'.
LS_LINE-KEY = 'Department From :'.
LS_LINE-INFO = s_dept-low.
APPEND LS_LINE TO LT_TOP_OF_PAGE.
CLEAR LS_LINE.
LS_LINE-TYP = 'S'.
LS_LINE-KEY = 'Department to :'.
LS_LINE-INFO = s_dept-high.
APPEND LS_LINE TO LT_TOP_OF_PAGE.
endif.
endif.
if not s_dept-low is initial .
if s_dept-high is initial.
CLEAR LS_LINE.
LS_LINE-TYP = 'S'.
LS_LINE-KEY = 'Department :'.
LS_LINE-INFO = s_dept-low.
APPEND LS_LINE TO LT_TOP_OF_PAGE.
endif.
endif.
Production Department
if not S_PDEPT-LOW is initial.
if not S_PDEPT-high is initial.
CLEAR LS_LINE.
LS_LINE-TYP = 'S'.
LS_LINE-KEY = 'Production Department From :'.
LS_LINE-INFO = S_PDEPT-LOW.
APPEND LS_LINE TO LT_TOP_OF_PAGE.
CLEAR LS_LINE.
LS_LINE-TYP = 'S'.
LS_LINE-KEY = 'Production Department to :'.
LS_LINE-INFO = S_PDEPT-high.
APPEND LS_LINE TO LT_TOP_OF_PAGE.
endif.
endif.
if not S_PDEPT-LOW is initial.
if S_PDEPT-high is initial.
CLEAR LS_LINE.
LS_LINE-TYP = 'S'.
LS_LINE-KEY = 'Production Department :'.
LS_LINE-INFO = S_PDEPT-LOW.
APPEND LS_LINE TO LT_TOP_OF_PAGE.
endif.
endif.
ENDFORM. " COMMENT_BUILD
FORM TOP_OF_PAGE *
FORM TOP_OF_PAGE.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = GT_LIST_TOP_OF_PAGE
I_LOGO =
I_END_OF_LIST_GRID =
ENDFORM.
FORM USER_COMMAND *
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield. "#EC CALLED
CASE R_UCOMM.
WHEN '&IC1'.
read table i_output index rs_selfield-tabindex.
SET PARAMETER ID 'MAT' FIELD i_output-matnr.
SET PARAMETER ID 'WRK' FIELD p_plant.
if not i_output-matnr is initial.
call transaction 'MD04' and skip first screen.
endif.
ENDCASE.
ENDFORM. -
Tooltip for Traffic light when mouse over
Hallo experts,
I have a column in a ALV with trafic light(red, yelloy and green) . I woild like to have a tooltip text
when the user move the mose over the traffic light per row.
I use the class cl_salv_table to output my ALV.
When is rood: article is not more in warehouse
when is yellow: quantity article very low, must be ordered
when is green: article enough in warehouse.
Thanks in advance,
Edited by: Bassydiallo on Feb 25, 2011 3:59 PMThanks all of you , here the code I use. It works I get the right traffic light on the column class_light, I just need
the tooltip on it.
I tried to insert your code in my program but i don't get the tooltip. Can some body tell me where I have to inser the code above ?
Thanks in advance for your help.
REPORT z_prg_alv00_article.
TYPE-POOLS: icon.
TYPE-POOLS: col.
TYPES: BEGIN OF tt_article.
INCLUDE STRUCTURE st_article.
TYPES: class_light TYPE n, " column traffic light
END OF tt_article.
DATA: gr_container TYPE REF TO cl_gui_custom_container.
DATA: gt_outtab TYPE TABLE OF tt_article,
gr_alv TYPE REF TO cl_salv_table,
ok_code LIKE sy-ucomm.
DATA: wa_tt_article LIKE LINE OF gt_outtab.
CALL SCREEN 100.
Module before output of screen 100
MODULE LOAD_DATA_ALV100 OUTPUT
MODULE load_data_alv100 OUTPUT.
SELECT * FROM tab_article INTO CORRESPONDING FIELDS OF TABLE gt_outtab
LOOP at gt_outtab INTO wa_article.
settings the color
IF wa_article-qty < 100.
wa_article-class_light = '1'.
ELSEIF wa_article-qty > 100 AND wa_article-qty < 300.
wa_wa_article-class_light = '2'.
ELSE.
wa_sflight-class_light = '3'.
ENDIF.
MODIFY gt_outtab FROM wa_article TRANSPORTING class_light.
ENDLOOP.
IF gr_container IS INITIAL.
"Creating the container-instance with reference gr_cont
CREATE OBJECT gr_container
EXPORTING
container_name = 'CONT_AREA'
EXCEPTIONS
OTHERS = 1.
CALL METHOD cl_salv_table=>factory
EXPORTING
r_container = gr_container
container_name = 'CONT_AREA'
IMPORTING
r_salv_table = gr_alv
CHANGING
t_table = gt_outtab.
"display alv
gr_alv->display( ).
ELSE.
gr_alv->refresh( ).
ENDIF.
ENDMODULE. "LOAD_DATA_ALV100 OUTPUT -
Error Message while assigning resource to work orders
Hi All,
We have the MRS tool integration with service work orders for scheduling. When we assign the resources with 9 hours as duration there is no error. When we allocate more than 9 hours for some resources, not all, we receive the error message as
" Duration 29,160 S is not a multiple of 15 minutes " . These duration of secs varies when the duration is varied > 9 hours.
We have checked the planning board profile configurations but nothing seems to be visible. In customising we have the following settings,
Time Granularity : 15 mins
Min duraiton of assignments: 15 mins
Automatic Assignment Splits
Min duraiton : 2 hours
Max overtime hours : 2 hours
Max Ratio is % : 75
Can anyone throw some light on this?
Regards,
SelvaHi Anil Satya,
The MRS is integrated with Service Order types and the operations are selected for each order then the assignment of hours takes place in MRS.
If the assignment is done for 9 hours then there is no such error. These errors are very specific to some personnel numbers ( not for all ) where the duration is more than 9 hours.
Is there any availability of resources for this operation / job through configuration settings? Why such a question is some resources even when 15 or 20 hours is assigned , no errors exists.
Hope this explanation provides a better clarity.
Regards,
Selva -
Traffic light on the basis of last month
Hi guys,
I have a question about the traffic light in the model Visual Composer. I would like to have a traffic light besids a table or graphic that wil be shown the status ( Green, red, yellow!) on the basis of the last month. In the table or in a graphic wil be shown several data of several months. But the traffic light have to respond on the basis of last month. That means that, if the last month exception( in the query) is green, the traffic light also wil be green.
Can anybody help me please?
Another question.
How can i get only two types of order as example in a pie chart? I have seen that in a pie chart you can only add one formula, not two.So!!
Thanks,
Regards,
EsratIn the VC model create an Expression Box. Double click on this box to open up its Properties.
In the control properties window there is tab "Styles", here give Green color to the column 'Style' and in the next column 'Condition' select 'Enter Formula...'
Select the field and enter the condition.
Like
Style Condition
Style 1 @CITY == 'Frankfurt'
Style2 @BANK_CTRY == 'DE' -
Hi experts,
I am using below code to generate the traffic lights but in column header i am getting one button i want to replace that as Traffic lights. how to do this can any body tell me
"Includes
INCLUDE <icon>.
INCLUDE <symbol>.
*& Declaration part
"Types
TYPES:
BEGIN OF t_lights,
matnr TYPE mard-matnr,
werks TYPE mard-werks,
lgort TYPE mard-lgort,
lights TYPE char4, "Variable is needs to be declared with length 4 char
END OF t_lights.
"Work Areas
DATA:
w_lights TYPE t_lights.
"Internal tables
DATA:
i_lights TYPE STANDARD TABLE OF t_lights.
ALV Declarations
Types Pools
TYPE-POOLS:
slis.
Types
TYPES:
t_fieldcat TYPE slis_fieldcat_alv,
t_events TYPE slis_alv_event,
t_layout TYPE slis_layout_alv.
Workareas
DATA:
w_fieldcat TYPE t_fieldcat,
w_events TYPE t_events,
w_layout TYPE t_layout.
Internal Tables
DATA:
i_fieldcat TYPE STANDARD TABLE OF t_fieldcat,
i_events TYPE STANDARD TABLE OF t_events.
*& start of selection
START-OF-SELECTION.
PERFORM get_data.
*& end-of-selection.
END-OF-SELECTION.
PERFORM build_fieldcatlog.
PERFORM build_layout.
PERFORM list_display.
*& Form get_data
FORM get_data .
SELECT matnr
werks
lgort
FROM mard
INTO CORRESPONDING FIELDS OF TABLE i_lights
UP TO 10 ROWS.
IF i_lights[] IS INITIAL.
"Dummy data
DO 10 TIMES.
w_lights-matnr = sy-index.
w_lights-werks = sy-index + 1.
w_lights-lgort = sy-index + 2.
APPEND w_lights TO i_lights.
CLEAR w_lights.
ENDDO.
ENDIF.
"Just pass 1=red or 2=yellow or 3=green to lights fields
LOOP AT i_lights INTO w_lights .
IF sy-tabix BETWEEN 1 AND 3.
w_lights-lights = '1'.
ELSEIF sy-tabix BETWEEN 4 AND 7.
w_lights-lights = '2'.
ELSEIF sy-tabix BETWEEN 8 AND 10.
w_lights-lights = '3'.
ENDIF.
MODIFY i_lights FROM w_lights INDEX sy-tabix TRANSPORTING lights.
ENDLOOP.
ENDFORM. " get_data
*& Form build_fieldcatlog
FORM build_fieldcatlog .
CLEAR:w_fieldcat,i_fieldcat[].
w_fieldcat-fieldname = 'MATNR'.
w_fieldcat-seltext_m = 'MATNR'.
APPEND w_fieldcat TO i_fieldcat.
CLEAR w_fieldcat.
w_fieldcat-fieldname = 'WERKS'.
w_fieldcat-seltext_m = 'WERKS'.
APPEND w_fieldcat TO i_fieldcat.
CLEAR w_fieldcat.
w_fieldcat-fieldname = 'LGORT'.
w_fieldcat-seltext_m = 'LGORT'.
APPEND w_fieldcat TO i_fieldcat.
CLEAR w_fieldcat.
ENDFORM. " build_fieldcatlog
*& Form build_layout
FORM build_layout .
w_layout-colwidth_optimize = 'X'.
w_layout-zebra = 'X'.
w_layout-lights_fieldname = 'LIGHTS'.
w_layout-lights_tabname = 'I_LIGHTS'.
ENDFORM. " build_layout
*& Form list_display
FORM list_display .
DATA:
l_program TYPE sy-repid.
l_program = sy-repid.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = l_program
is_layout = w_layout
it_fieldcat = i_fieldcat
TABLES
t_outtab = i_lights
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. " list_display
Thanks,
TharanginiHi!
Try this code.I have removed the previous code where you specify Lights in layout.I specified the lights column in fieldcatalog as Icon and passed the icon value instead of the no.s which you specified earlier.
"Includes
INCLUDE <icon>.
INCLUDE <symbol>.
*& Declaration part
"Types
TYPES:
BEGIN OF t_lights,
matnr TYPE mard-matnr,
werks TYPE mard-werks,
lgort TYPE mard-lgort,
lights(4),
END OF t_lights.
"Work Areas
DATA:
w_lights TYPE t_lights.
"Internal tables
DATA:
i_lights TYPE STANDARD TABLE OF t_lights.
TYPE-POOLS:
slis.
TYPES:
t_fieldcat TYPE slis_fieldcat_alv,
t_events TYPE slis_alv_event,
t_layout TYPE slis_layout_alv.
DATA:
w_fieldcat TYPE t_fieldcat,
w_events TYPE t_events,
w_layout TYPE t_layout.
DATA:
i_fieldcat TYPE STANDARD TABLE OF t_fieldcat,
i_events TYPE STANDARD TABLE OF t_events.
*& start of selection
START-OF-SELECTION.
PERFORM get_data.
*& end-of-selection.
END-OF-SELECTION.
PERFORM build_fieldcatlog.
PERFORM build_layout.
PERFORM list_display.
*& Form get_data
FORM get_data .
SELECT matnr
werks
lgort
FROM mard
INTO CORRESPONDING FIELDS OF TABLE i_lights
UP TO 10 ROWS.
IF i_lights[] IS INITIAL.
"Dummy data
DO 10 TIMES.
w_lights-matnr = sy-index.
w_lights-werks = sy-index + 1.
w_lights-lgort = sy-index + 2.
APPEND w_lights TO i_lights.
CLEAR w_lights.
ENDDO.
ENDIF.
"Just pass @0A@=red or @09@=yellow or @08@=green to lights fields
LOOP AT i_lights INTO w_lights .
IF sy-tabix BETWEEN 1 AND 3.
w_lights-lights = '@0A@'.
ELSEIF sy-tabix BETWEEN 4 AND 7.
w_lights-lights = '@09@'.
ELSEIF sy-tabix BETWEEN 8 AND 10.
w_lights-lights = '@08@'.
ENDIF.
MODIFY i_lights FROM w_lights INDEX sy-tabix TRANSPORTING lights.
ENDLOOP.
ENDFORM. " get_data
*& Form build_fieldcatlog
FORM build_fieldcatlog .
CLEAR:w_fieldcat,i_fieldcat[].
w_fieldcat-fieldname = 'MATNR'.
w_fieldcat-seltext_m = 'MATNR'.
APPEND w_fieldcat TO i_fieldcat.
CLEAR w_fieldcat.
w_fieldcat-fieldname = 'WERKS'.
w_fieldcat-seltext_m = 'WERKS'.
APPEND w_fieldcat TO i_fieldcat.
CLEAR w_fieldcat.
w_fieldcat-fieldname = 'LGORT'.
w_fieldcat-seltext_m = 'LGORT'.
APPEND w_fieldcat TO i_fieldcat.
CLEAR w_fieldcat.
w_fieldcat-fieldname = 'LIGHTS'.
w_fieldcat-icon = 'X'.
w_fieldcat-outputlen = 14.
w_fieldcat-seltext_l = 'Traffic Lights'.
w_fieldcat-seltext_s = 'Traffic Lights'.
w_fieldcat-seltext_m = 'Traffic Lights'.
APPEND w_fieldcat TO i_fieldcat.
CLEAR w_fieldcat.
ENDFORM. " build_fieldcatlog
*& Form build_layout
FORM build_layout .
w_layout-colwidth_optimize = 'X'.
w_layout-zebra = 'X'.
ENDFORM. " build_layout
*& Form list_display
FORM list_display .
DATA:
l_program TYPE sy-repid.
l_program = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = l_program
is_layout = w_layout
it_fieldcat = i_fieldcat
TABLES
t_outtab = i_lights
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. " list_display -
Hi all,
I am using 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'. I need to display traffic lights both in header and item level. here is the piece of code I used.
DATA : e_alvly TYPE slis_layout_alv.
e_alvly-expand_fieldname = 'LIGHT'.
e_alvly-lights_fieldname = 'LIGHT'.
e_alvly-lights_tabname = 'TS_HEADER_DETAILS'.
CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
EXPORTING
i_callback_program = w_prog
is_layout = e_alvly
it_fieldcat = it_fieldcat
it_events = ts_events
i_tabname_header = c_ts_header_details
i_tabname_item = c_ts_item_details
is_keyinfo = key
TABLES
t_outtab_header = ts_header_details
t_outtab_item = ts_item_details.
IF sy-subrc <> 0.
MESSAGE 'Error in ALV ' TYPE 'I'.
ENDIF.
Using this I could get traffic lights only at header level. if I replace 'TS_HEADER_DETAILS' with 'TS_ITEM_DETAILS' , i can see lights only at item level.
Insummary I can get lights eithere in Header or item level, but I need at both the levels.
Please suggest some solution to overcome this problem..
Thanks in Advance,
Vishal..H,
Have you tried this,
e_alvly-expand_fieldname = 'LIGHT'.
e_alvly-lights_fieldname = 'LIGHT'.
e_alvly-lights_tabname = 'TS_HEADER_DETAILS'.
append e_alvly-lights_tabname.
e_alvly-expand_fieldname = 'LIGHT'.
e_alvly-lights_fieldname = 'LIGHT'.
e_alvly-lights_tabname = 'TS_ITEM_DETAILS'.
append e_alvly-lights_tabname.
CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
EXPORTING
i_callback_program = w_prog
is_layout = e_alvly
it_fieldcat = it_fieldcat
it_events = ts_events
i_tabname_header = c_ts_header_details
i_tabname_item = c_ts_item_details
is_keyinfo = key
TABLES
t_outtab_header = ts_header_details
t_outtab_item = ts_item_details.
IF sy-subrc 0.
MESSAGE 'Error in ALV ' TYPE 'I'.
ENDIF.
hope it works,
Regards,
Abhijit G. Borkar -
How to change the Traffic light positioning in ALV?
Hai All,
I am displaying a traffic light field in my ALV Grid. Now i want to display another field in the first position and move the traffic light to second or any other position. COL_POS seems to be not working, is there any chance of doing this?
Best regards,
rama>
newtoAbap wrote:
> Hai All,
>
> I am displaying a traffic light field in my ALV Grid. Now i want to display another field in the first position and move the traffic light to second or any other position. COL_POS seems to be not working, is there any chance of doing this?
>
> Best regards,
> rama
If you are using EXCP_FNAME in the ALV layout to display your traffic lights, it may not be possible to move your light field to any other position..
One possiblity is to define your own field (as icon) in the internal table and assign the Traffic light icon to that field... By this approach, you can position that field in any place in your input structure while generating field catalog or defining your structure
Here is an example with SALV,
http://wiki.sdn.sap.com/wiki/display/Snippets/displayingiconsinalvusingclasscl_salv_table
Example with icons in REUSE FM (can be used in ALV OO) and there should be umpteen examples in SDN also
http://wiki.sdn.sap.com/wiki/display/Snippets/TrafficlightsinALVdisplay -
Hi,
I want to know the concept of Traffic light(Red=Error,Amber=Warning,Green=Information).
I want to know in which context we can enable Traffic lights in Production Planning. Can any one give the configuration path to enable Traffic light feature in the Production Order release. Traffic light should be green if the Production Order release has no error. Please suggest how to enable this feature during Order Release, Order confirmation etc.
Thanks in advanceHi,
Can anyone give some suggestions/inputs to my below query.
thanks in advance -
Traffic light showing the red colour in vl10g after all status completed
Hi Team,
My client facing one issue regarding the vl10g traffic light it show red colour after all document status is completed so please let me know I have to used which oss note / I have to debug the program(this is the standard T.code) or which way i have to used for resolved this issue so please replay argentely this great help to me and I am very thankful for corporation.
Regrads,
Ravi SAP SDRaviSAPSD wrote:
it show's the error i.e. "No delivery-relevant items in order 0527087193, order type OR"
With this in mind, I'd doubt the previous statement that the order status is 'completed'. Such orders wouldn't be picked up for the Delivery Due list. It is possible that either there is a line item that is not relevant to delivery yet it makes the order header status incomplete. Thus Delivery Due list picks up the order # based on the header status but when it checks the line items, there is nothing relevant for delivery.
Check again the order statuses, not just on screen but in the tables VBUK/VBUP. Additionally, you can search for the notes yourself using the message ID/number (e.g. VL 001, which you should see, along with the long text, when you double-click on the message). -
Traffic lights on reports disappears
Hi Experts,
I have made the traffic lights settings in WAD exceptions and saved that by Personalising it.Now this report is integrated in portal and it working fine with traffic light since its saved as an View,but in the report I have many fields in Free Chars as drag n drop functionality when I drag n drop anything from free chars column the trafffic lights disappears.
Can anyone guide me on this issue ASAP.
Regards,
PreethiHi Danny,
Yes after drill drop also my Keyfigure values show between exception ranges only,but traffic light disappears,
Can you guide me on this.
Regards,
Preethi
Maybe you are looking for
-
Unable to get the BPEL process in esb console
Hi, I am facing an issue with code generated using artifact generator in FP 2.4. When I deploy a Provider ABCS process(generated through artifcat generator), it does not appear in the BPEL system of my esb console because of which i am not able to cr
-
Is it possible to delete an unread message i sent on imessage?
hi sent a text via imessage, it hasnt been read, can this still be deleted so that the other person doesnt see it?
-
In lion os lost ability to scroll back into folders
In Lion OS have lost ability to scroll back and forth in folders within folders on mouse. Bought Trackpad - still cannot do it. Asked about it at Apple store - even had an employee create multiple folders within folders - could not get the mouse or t
-
Problem with GET PARAMETER in "O4K_LICENSE" Transaction
Hi folks, I am facing a problem with the usage of "GET PARAMETER ID" in the transaction O4K_LICENSE (IS-oil). I have written a BDC which feeds in the License Type, External License type and a few other Mandatory fields to the Transaction, and on savi
-
ACL won't work in 10.5.4 is it a bug??
Using a MacMini with System 10.5.4 as a simple file server for 6 persons doesn't work correctly: I made two groups: work and executive, 6 persons as sharing only (3 with access to work the others access to both groups. On the second partition I made