Hi Experts, oo hierarchical alv, how to add checkbox on every header?
Hi Experts,
I am working on oo hierarchical alv, how can I add checkbox on every header? thanks in advance!
Kind regards
Dawson
Hi Dawson,
Just refer the below program & pass the check box functionality (mentioned in bold) in REUSE_ALV_HIERSEQ_LIST_DISPLAY in your program.
TYPE-POOLS : slis.
Data
DATA : BEGIN OF itab OCCURS 0.
INCLUDE STRUCTURE t001.
DATA : flag tyPE c,
END OF itab.
DATA : alvfc TYPE slis_t_fieldcat_alv.
DATA : alvly TYPE slis_layout_alv.
Select Data
SELECT * FROM t001 INTO TABLE itab.
*------- Field Catalogue
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = sy-repid
i_internal_tabname = 'ITAB'
i_inclname = sy-repid
CHANGING
ct_fieldcat = alvfc
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
Display
alvly-box_fieldname = 'FLAG'.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
it_fieldcat = alvfc
i_callback_program = sy-repid "<-------Important
i_callback_user_command = 'ITAB_USER_COMMAND' "<------ Important
is_layout = alvly
TABLES
t_outtab = itab
EXCEPTIONS
program_error = 1
OTHERS = 2.
CALL BACK FORM
FORM itab_user_command USING whatcomm TYPE sy-ucomm whatrow TYPE
slis_selfield.
LOOP AT itab.
itab-flag = 'X'.
MODIFY itab.
ENDLOOP.
IMPORTANT.
WHATROW-REFRESH = 'X'.
ENDFORM. "ITAB_user_command
Regards
Abhii...
Similar Messages
-
How to add a image to header of exporting pdf in devexpress gridview
hi guys ;
how to add a image to header of exporting pdf in devexpress gridview contentHi Aly14,
I am not sure what the type of your project was, is it a C# project or an asp.net project?
If would be helpful if you could share us more information about your issue.
In addition, I made a research about your issue and I think the links below might be useful to you:
# ASPxGridView insert an image for Header and Footer sections for pdf export
https://www.devexpress.com/Support/Center/Question/Details/Q37155
# Adding an "Export Header" to PDF export in MvcGridView
https://www.devexpress.com/Support/Center/Question/Details/T141918
Best Regards,
Edward
This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore,
Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you
completely understand the risk before retrieving any software from the Internet.
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey. -
How to add color only in header
how to add color only in header and arrange a background color selected from desktop
You can place rectangle in header section on master page which would be applied on sub pages and then fill rectangle with color.
If you are after a specific color then simply use color code and fill.
Thanks,
Sanjit -
how to add colore to the particular fields in alvs?
could u plz explain clearly with code and commentsHi,
go thr below code,
tables used -
tables: mkpf,
mseg,
lfa1,
makt.
global hashed tables used
data: begin of wa_mkpf, "header
mblnr like mkpf-mblnr,
mjahr like mkpf-mjahr,
budat like mkpf-budat,
xblnr like mkpf-xblnr,
end of wa_mkpf.
data: ht_mkpf like hashed table of wa_mkpf
with unique key mblnr mjahr
with header line.
data: st_mkpf like standard table of wa_mkpf
with header line.
data: begin of wa_mseg, " line items
mblnr like mseg-mblnr,
mjahr like mseg-mjahr,
zeile like mseg-zeile,
bwart like mseg-bwart,
charg like mseg-charg,
matnr like mseg-matnr,
lifnr like mseg-lifnr,
erfmg like mseg-erfmg,
erfme like mseg-erfme,
end of wa_mseg.
data ht_mseg like hashed table of wa_mseg
with unique key mblnr mjahr zeile
with header line.
data st_mseg like standard table of wa_mseg
with header line.
cache structure for lfa1 records
data: begin of wa_lfa1,
lifnr like lfa1-lifnr,
name1 like lfa1-name1,
end of wa_lfa1.
data ht_lfa1 like hashed table of wa_lfa1
with unique key lifnr
with header line.
cache structure for material related data
data: begin of wa_material,
matnr like makt-matnr,
maktx like makt-maktx,
end of wa_material.
data: ht_material like hashed table of wa_material
with unique key matnr
with header line.
result table
data: begin of wa_lst, "
budat like mkpf-budat,
mblnr like mseg-mblnr,
lifnr like mseg-lifnr,
name1 like lfa1-name1,
xblnr like mkpf-xblnr,
zeile like mseg-zeile,
charg like mseg-charg,
matnr like mseg-matnr,
maktx like makt-maktx,
erfmg like mseg-erfmg,
erfme like mseg-erfme,
mjahr like mseg-mjahr,
end of wa_lst.
data: ht_lst like hashed table of wa_lst
with unique key mblnr mjahr zeile
with header line.
data: begin of wa_lst1, " sumary by material
matnr like mseg-matnr,
maktx like makt-maktx,
erfmg like mseg-erfmg,
erfme like mseg-erfme,
color_line(4) TYPE c, " Line color
color_cell TYPE lvc_t_scol, " Cell color
celltab type LVC_T_STYL,
end of wa_lst1.
data: ht_lst1 like hashed table of wa_lst1
with unique key matnr
with header line.
structures for alv grid display.
itabs
type-pools: slis.
data: it_lst like standard table of wa_lst with header line,
it_fieldcat_lst type slis_t_fieldcat_alv with header line,
it_sort_lst type slis_t_sortinfo_alv,
it_lst1 like standard table of wa_lst1 with header line,
it_fieldcat_lst1 type slis_t_fieldcat_alv with header line,
it_sort_lst1 type slis_t_sortinfo_alv.
structures
data: wa_sort type slis_sortinfo_alv,
ls_layout type slis_layout_alv.
color management.
DATA : wa_color TYPE lvc_s_scol.
Internal table for color management.
DATA : it_color TYPE TABLE OF lvc_s_scol.
itab for input enabling.
DATA: lt_celltab TYPE lvc_t_styl. "
global varialbes
data: g_lines type i.
data: g_repid like sy-repid,
ok_code like sy-ucomm.
selection-screen
"text: Dates:
select-options: so_budat for mkpf-budat default sy-datum.
"text: Material numbers.
select-options: so_matnr for mseg-matnr.
selection-screen uline.
selection-screen skip 1.
"Text: show summary by material.
parameters: gp_bymat as checkbox default ''.
parameters: gp_hier as checkbox default 'X'.
start-of-selection.
perform get_data.
perform show_data.
end-of-selection.
FORM get_data *
form get_data.
select mblnr mjahr budat xblnr
into table ht_mkpf
from mkpf
where budat in so_budat. " make use of std index.
have we retrieved data from mkpf?
describe table ht_mkpf lines g_lines.
if g_lines > 0.
if true then retrieve all related records from mseg.
Doing this way we make sure that the access is by primary key
of mseg.
The reason is that is faster to filter them in memory
than to allow the db server to do it.
select mblnr mjahr zeile bwart charg
matnr lifnr erfmg erfme
into table ht_mseg
from mseg
for all entries in ht_mkpf
where mblnr = ht_mkpf-mblnr
and mjahr = ht_mkpf-mjahr.
endif.
fill t_lst or t_lst1 according to user's choice.
if gp_bymat = ' '.
perform fill_ht_lst.
else.
perform fill_ht_lst1.
endif.
endform.
form fill_ht_lst.
refresh ht_lst.
Example: how to discard unwanted data in an efficient way.
loop at ht_mseg.
filter unwanted data
check ht_mseg-bwart = '101' or ht_mseg-bwart = '901'.
check ht_mseg-matnr in so_matnr.
read header line.
read table ht_mkpf with table key mblnr = ht_mseg-mblnr
mjahr = ht_mseg-mjahr.
clear ht_lst.
* note : this may be faster if you specify field by field.
move-corresponding ht_mkpf to ht_lst.
move-corresponding ht_mseg to ht_lst.
perform read_lfa1 using ht_mseg-lifnr changing ht_lst-name1.
perform read_material using ht_mseg-matnr changing ht_lst-maktx.
insert table ht_lst.
endloop.
endform.
form fill_ht_lst1.
data: colorear.
refresh ht_lst1.
Example: how to discard unwanted data in an efficient way.
hot to simulate a collect in a faster way
loop at ht_mseg.
filter unwanted data
check ht_mseg-bwart = '101' or ht_mseg-bwart = '901'.
check ht_mseg-matnr in so_matnr.
* note : this may be faster if you specify field by field.
read table ht_lst1 with table key matnr = ht_mseg-matnr
transporting erfmg.
if sy-subrc <> 0. " if matnr doesn't exist in sumary table
" insert a new record
clear ht_lst1.
ht_lst1-matnr = ht_mseg-matnr.
perform read_material using ht_mseg-matnr changing ht_lst1-maktx.
ht_lst1-erfmg = ht_mseg-erfmg.
ht_lst1-erfme = ht_mseg-erfme.
if colorear = ''.
colorear = 'X'.
refresh it_color.
ht_lst1-color_cell[] = it_color[].
MOVE 'C410' TO ht_lst1-color_line.
else.
colorear = ' '.
refresh it_color. clear it_color.
MOVE 'MATNR' TO wa_color-fname.
MOVE '6' TO wa_color-color-col.
MOVE '1' TO wa_color-color-int.
MOVE '1' TO wa_color-color-inv.
APPEND wa_color TO it_color.
MOVE 'MAKTX' TO wa_color-fname.
MOVE '3' TO wa_color-color-col.
MOVE '1' TO wa_color-color-int.
MOVE '1' TO wa_color-color-inv.
APPEND wa_color TO it_color.
MOVE 'ERFMG' TO wa_color-fname.
MOVE '5' TO wa_color-color-col.
MOVE '1' TO wa_color-color-int.
MOVE '1' TO wa_color-color-inv.
APPEND wa_color TO it_color.
ht_lst1-color_cell[] = it_color[].
clear ht_lst1-color_line.
endif.
insert table ht_lst1.
else." a record was found.
" collect erfmg. To do so, fill in the unique key and add
" the numeric fields.
ht_lst1-matnr = ht_mseg-matnr.
add ht_mseg-erfmg to ht_lst1-erfmg.
modify table ht_lst1 transporting erfmg.
endif.
endloop.
endform.
implementation of cache for lfa1.
form read_lfa1 using p_lifnr changing p_name1.
read table ht_lfa1 with table key lifnr = p_lifnr
transporting name1.
if sy-subrc <> 0.
clear ht_lfa1.
ht_lfa1-lifnr = p_lifnr.
select single name1
into ht_lfa1-name1
from lfa1
where lifnr = p_lifnr.
if sy-subrc <> 0. ht_lfa1-name1 = 'n/a in lfa1'. endif.
insert table ht_lfa1.
endif.
p_name1 = ht_lfa1-name1.
endform.
implementation of cache for material data
form read_material using p_matnr changing p_maktx.
read table ht_material with table key matnr = p_matnr
transporting maktx.
if sy-subrc <> 0.
ht_material-matnr = p_matnr.
select single maktx into ht_material-maktx
from makt
where spras = sy-langu
and matnr = p_matnr.
if sy-subrc <> 0. ht_material-maktx = 'n/a in makt'. endif.
insert table ht_material.
endif.
p_maktx = ht_material-maktx.
endform.
form show_data.
if gp_hier = 'X'. "no anda.
perform show_hierarchicalALV.
else.
if gp_bymat = ' '.
perform show_ht_lst.
else.
perform show_ht_lst1.
endif.
endif.
endform.
form show_hierarchicalALV.
st_mkpf[] = ht_mkpf[].
st_mseg[] = ht_mseg[].
call function 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
exporting
I_INTERFACE_CHECK = ' '
I_CALLBACK_PROGRAM =
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
IS_LAYOUT =
IT_FIELDCAT =
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
i_tabname_header =
i_tabname_item =
I_STRUCTURE_NAME_HEADER =
I_STRUCTURE_NAME_ITEM =
is_keyinfo =
IS_PRINT =
IS_REPREP_ID =
I_BUFFER_ACTIVE =
I_BYPASSING_BUFFER =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
tables
t_outtab_header = st_mkpf
t_outtab_item = st_mseg
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.
form show_ht_lst.
"needed because the FM can't use a hashed table.
it_lst[] = ht_lst[].
perform fill_layout using 'full display'
changing ls_layout.
perform fill_columns_lst.
perform sort_lst.
g_repid = sy-repid.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = g_repid
i_callback_pf_status_set = 'SET_PF_STATUS'
is_layout = ls_layout
it_fieldcat = it_fieldcat_lst[]
it_sort = it_sort_lst
tables
t_outtab = it_lst
exceptions
program_error = 1
others = 2.
endform.
form show_ht_lst1.
"needed because the FM can't use a hashed table.
it_lst1[] = ht_lst1[].
perform fill_layout using 'Sumary by matnr'
changing ls_layout.
perform fill_columns_lst1.
perform sort_lst.
g_repid = sy-repid.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = g_repid
i_callback_pf_status_set = 'SET_PF_STATUS'
is_layout = ls_layout
it_fieldcat = it_fieldcat_lst1[]
it_sort = it_sort_lst
tables
t_outtab = it_lst1
exceptions
program_error = 1
others = 2.
endform.
form fill_layout using p_window_titlebar
changing cs_layo type slis_layout_alv.
clear cs_layo.
cs_layo-window_titlebar = p_window_titlebar.
cs_layo-edit = 'X'.
cs_layo-edit_mode = space.
MOVE 'COLOR_LINE' TO cs_layo-info_fieldname.
Field that identify cell color in inetrnal table
MOVE 'COLOR_CELL' TO cs_layo-coltab_fieldname.
move 'CELLTAB' TO cs_layo-stylefname.
endform. " armar_layout_stock
form set_pf_status using rt_extab type slis_t_extab.
create a new status
and then select extras -> adjust template -> listviewer
set pf-status 'VISTA'.
endform. "set_pf_status
define add_lst.
clear it_fieldcat_lst.
it_fieldcat_lst-fieldname = &1.
it_fieldcat_lst-outputlen = &2.
it_fieldcat_lst-ddictxt = 'L'.
it_fieldcat_lst-seltext_l = &1.
it_fieldcat_lst-seltext_m = &1.
it_fieldcat_lst-seltext_m = &1.
if &1 = 'MATNR'.
it_fieldcat_lst-emphasize = 'C111'.
endif.
append it_fieldcat_lst.
end-of-definition.
define add_lst1.
clear it_fieldcat_lst.
it_fieldcat_lst1-fieldname = &1.
it_fieldcat_lst1-outputlen = &2.
it_fieldcat_lst1-ddictxt = 'L'.
it_fieldcat_lst1-seltext_l = &1.
it_fieldcat_lst1-seltext_m = &1.
it_fieldcat_lst1-seltext_m = &1.
append it_fieldcat_lst1.
end-of-definition.
form fill_columns_lst.
set columns for output.
refresh it_fieldcat_lst.
add_lst 'BUDAT' 10.
add_lst 'MBLNR' 10.
add_lst 'LIFNR' 10.
add_lst 'NAME1' 35.
add_lst 'XBLNR' 15.
add_lst 'ZEILE' 5.
add_lst 'CHARG' 10.
add_lst 'MATNR' 18.
add_lst 'MAKTX' 30.
add_lst 'ERFMG' 17.
add_lst 'ERFME' 5.
add_lst 'MJAHR' 4.
endform.
form fill_columns_lst1.
set columns for output.
refresh it_fieldcat_lst1.
add_lst1 'MATNR' 18.
add_lst1 'MAKTX' 30.
add_lst1 'ERFMG' 17.
add_lst1 'ERFME' 5..
endform.
Horacio Zapettini
Program to Calculate FI Opening Balance
How to find the Opening balance for a given period in FI Module for a Particular GL A/c.
I was calculated opening balance, code is below maybe it will be helpful.
*find period.
CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
EXPORTING
i_date = s_budat-low
i_periv = i_tab-periv "'K4'
IMPORTING
e_buper = v_donem
e_gjahr = v_gjahr
EXCEPTIONS
input_false = 1
t009_notfound = 2
t009b_notfound = 3
OTHERS = 4.
*calc opening balance hesabý
SELECT * FROM knc1 WHERE kunnr = i_tab-kunnr
AND bukrs = i_tab-bukrs " s_bukrs
AND gjahr EQ v_gjahr.
v_dnm = v_donem.
opening balance first calc > old year ,
WHILE v_dnm > 1.
v_dnm = v_dnm - 1.
CONCATENATE 'knc1-um' v_dnm 's' INTO v_field_name_borc.
CONCATENATE 'knc1-um' v_dnm 'h' INTO v_field_name_alacak.
ASSIGN (v_field_name_borc) TO old
add days which is from selected date-low month
IF v_donem > 1.
v_dnm = v_donem - 1.
ELSE.
v_dnm = v_donem.
ENDIF.
SELECT SINGLE * FROM t009b WHERE periv = i_tab-periv "'K4'
AND bdatj = s_budat-low+0(4)
AND poper = v_dnm.
t009b-butag = t009b-butag + 1.
IF s_budat-low+6(2) NE t009b-butag.
v_date_high = s_budat-low - 1.
IF v_donem = 1.
v_date_low = s_budat-low.
v_date_low+4(4) = '0101'.
ELSE.
CONCATENATE t009b-bdatj t009b-bumon t009b-butag INTO
v_date_low.
ENDIF.
SELECT * FROM bsad WHERE bukrs EQ i_tab-bukrs "IN s_bukrs
AND kunnr = i_tab-kunnr
AND budat BETWEEN v_date_low AND
v_date_high
AND umskz = space
AND blart IN s_blart.
IF bsad-shkzg = 'S'.
i_tab-dmbtr_s = i_tab-dmbtr_s + ( bsad-dmbtr ).
ELSEIF bsad-shkzg = 'H'.
i_tab-dmbtr_h = i_tab-dmbtr_h + ( bsad-dmbtr ).
ENDIF.
ENDSELECT.
SELECT * FROM bsid WHERE bukrs EQ i_tab-bukrs "IN s_bukrs
AND kunnr = i_tab-kunnr
AND budat BETWEEN v_date_low AND
v_date_high
AND umskz = space
AND blart IN s_blart.
AND gsber IN gsber.
IF bsid-shkzg = 'S'.
i_tab-dmbtr_s = i_tab-dmbtr_s + ( bsid-dmbtr ).
ELSEIF bsid-shkzg = 'H'.
i_tab-dmbtr_h = i_tab-dmbtr_h + ( bsid-dmbtr ).
ENDIF.
ENDSELECT.
ENDIF.
"opening balance ( þirket bazlý )z1 degeri
i_tab-z1 = i_tab-z1 + ( knc1-umsav + i_tab-dmbtr_s - i_tab-dmbtr_h ).
for israel
i_tab-dmbtril_s = i_tab-dmbtr_s .
i_tab-dmbtril_h = i_tab-dmbtr_h .
ENDSELECT.
reward if useful. -
How to Add Checkbox and icon in ALVGRID
Hi Experts,
i have one Requirement. i need to add Checkbox, Selectall,icon(Unlock or inactive) infront of Contracts of ALV GRID.How to achive that.
Thanks,
Venkat.Hi
For check box
At declaring field catalog using structure LVC_S_FCAT
mark CHECKBOX = 'X' and also EDIT = 'X'.
For reference check below subroutine in program BCALV_EDIT_05.
form build_fieldcat changing pt_fieldcat type lvc_t_fcat.
data ls_fcat type lvc_s_fcat.
call function 'LVC_FIELDCATALOG_MERGE'
exporting
i_structure_name = 'SFLIGHT'
changing
ct_fieldcat = pt_fieldcat.
*§A2.Add an entry for the checkbox in the fieldcatalog
clear ls_fcat.
ls_fcat-fieldname = 'CHECKBOX'.
* Essential: declare field as checkbox and
* mark it as editable field:
ls_fcat-checkbox = 'X'.
ls_fcat-edit = 'X'.
* do not forget to provide texts for this extra field
ls_fcat-coltext = text-f01.
ls_fcat-tooltip = text-f02.
ls_fcat-seltext = text-f03.
* optional: set column width
ls_fcat-outputlen = 10.
append ls_fcat to pt_fieldcat.
endform.
For Icon:
CONSTANTS:
icon_id_failure LIKE icon-id VALUE ' ((Content component not found.)) @',
icon_id_okay LIKE icon-id VALUE ' ((Content component not found.)) @'.
TYPES: BEGIN OF ls_tab,
matnr LIKE equi-matnr,
maktx LIKE makt-maktx,
b_werk LIKE equi-werk,
b_lager LIKE equi-lager,
lgobe LIKE t001l-lgobe,
sernr LIKE equi-sernr,
icon LIKE icon-id,
objnr LIKE equi-objnr,
END OF ls_tab.
*Table that display the data for the ALV.
DATA: itab TYPE ls_tab OCCURS 0 WITH HEADER LINE.
PERFORM get_h_date .
IF h_date => sy-datum .
itab-icon = icon_id_okay.
ELSE .
itab-icon = icon_id_failure.
ENDIF.
Regards
Sudheer -
How to add checkboxes to frame
So I have two classes in my package. I am having trouble adding the checkbox group to my frame. I got it to add to my applet but I can not figure out how to add it to my frame. Here is what I have so far. When I run this program it puts the checkboxes in my applet and not in my frame.
this is my painter class:
package pt;
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2006</p>
* <p>Company: </p>
* @author unascribed
* @version 1.0
import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;
public class painter extends Applet {
private int xValue=-10, yValue=-10;
MyFrame x;
Checkbox Red, Black, Magenta, Blue, Green, Yellow;
CheckboxGroup cbg;
public void init()
x= new MyFrame("Christie's Window");
x.show();
x.resize(250,100);
cbg = new CheckboxGroup();
Red = new Checkbox("Red", cbg,true);
Black = new Checkbox("Black", cbg,false);
Magenta = new Checkbox("Magenta",cbg,false);
Blue = new Checkbox("Blue", cbg, false);
Green = new Checkbox("Green", cbg, false);
Yellow = new Checkbox("Yellow", cbg, false);
add(Red);
add(Black);
add(Magenta);
add(Blue);
add(Green);
add(Yellow);
addMouseMotionListener(new MotionHandler(this));
public void paint(Graphics g)
g.drawString("Drag the mouse to draw", 10, 20);
g.fillOval(xValue, yValue, 4,4);
//Override Component class update method to allow all ovals
// to remain on the screen by not clearing the background
public void update(Graphics g) { paint(g); }
// set the drawing coordinates and repaint
public void setCoordinates(int x, int y)
xValue = x;
yValue = y;
repaint();
// Class to handle only mouse drag events for the Drag applet
class MotionHandler extends MouseMotionAdapter {
private painter dragger;
public MotionHandler(painter d) { dragger = d; }
public void mouseDragged( MouseEvent e)
{ dragger.setCoordinates( e.getX(), e.getY() ); }
} and here is MyFrame class:
package pt;
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2006</p>
* <p>Company: </p>
* @author unascribed
* @version 1.0
import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;
public class MyFrame extends Frame {
MyFrame(String x){
super(x);
public boolean handleEvent(Event evtObj) {
if(evtObj.id==Event.WINDOW_DESTROY) {
hide();
return true;
return super.handleEvent(evtObj);
}here's your conversion, with listeners to change the color
//import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;
//public class painter extends Applet {
class painter extends Frame {
Color color = Color.RED;
private int xValue=-10, yValue=-10;
//MyFrame x;
Checkbox Red, Black, Magenta, Blue, Green, Yellow;
CheckboxGroup cbg;
//public void init()
public painter()
//x= new MyFrame("Christie's Window");
setTitle("Christie's Window");
//x.show();
//x.resize(250,100);
setSize(600,400);
setLocation(200,100);
cbg = new CheckboxGroup();
Red = new Checkbox("Red", cbg,true);
Red.addItemListener(new ItemListener(){
public void itemStateChanged(ItemEvent ie){
if(Red.getState()) color = Color.RED;}});
Black = new Checkbox("Black", cbg,false);
Black.addItemListener(new ItemListener(){
public void itemStateChanged(ItemEvent ie){
if(Black.getState()) color = Color.BLACK;}});
Magenta = new Checkbox("Magenta",cbg,false);
Magenta.addItemListener(new ItemListener(){
public void itemStateChanged(ItemEvent ie){
if(Magenta.getState()) color = Color.MAGENTA;}});
Blue = new Checkbox("Blue", cbg, false);
Blue.addItemListener(new ItemListener(){
public void itemStateChanged(ItemEvent ie){
if(Blue.getState()) color = Color.BLUE;}});
Green = new Checkbox("Green", cbg, false);
Green.addItemListener(new ItemListener(){
public void itemStateChanged(ItemEvent ie){
if(Green.getState()) color = Color.GREEN;}});
Yellow = new Checkbox("Yellow", cbg, false);
Yellow.addItemListener(new ItemListener(){
public void itemStateChanged(ItemEvent ie){
if(Yellow.getState()) color = Color.YELLOW;}});
Panel p = new Panel();
p.add(Red);
p.add(Black);
p.add(Magenta);
p.add(Blue);
p.add(Green);
p.add(Yellow);
add(p,BorderLayout.NORTH);
addMouseMotionListener(new MotionHandler(this));
addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent we) { System.exit(0); }});
public void paint(Graphics g)
super.paint(g);
g.setColor(color);
g.drawString("Drag the mouse to draw", 10, 75);
g.fillOval(xValue, yValue, 4,4);
//Override Component class update method to allow all ovals
// to remain on the screen by not clearing the background
public void update(Graphics g) { paint(g); }
// set the drawing coordinates and repaint
public void setCoordinates(int x, int y)
xValue = x;
yValue = y;
repaint();
// Class to handle only mouse drag events for the Drag applet
class MotionHandler extends MouseMotionAdapter {
private painter dragger;
public MotionHandler(painter d) { dragger = d; }
public void mouseDragged( MouseEvent e)
{ dragger.setCoordinates( e.getX(), e.getY() ); }
public static void main(String[] args){new painter().setVisible(true);}
} -
How to add item in column header
How can i add an messageStyled item(or any item) in column header? if so how can i do this
Standard framework feature allows to add only a sortable header bean in a column header which holds some of the UI and runtime properties for that column.
If you can explain your requirement, we can suggest the way to achieve that.
--Shiv -
Hi,
I want to add CheckBox in Table. my requirement is multiselection. I Implemented the following steps, but it's not working. anyone can tell me,what mistake i did?
I created two "Value Attribute"(check,Name) under a "Value Node"(Student) in context.
check - Boolean
Name - mapped a Dictionary simple Type(5 values)
Include a Table in Layout and select Create Binding on right clicking of Table.
Checked only Student and check -> Next
Selected the Editor as checkbox -> Finish
Selected Name from context and assigned to checkbox text property.
Then I deployed the application. But only one checkbox is displayed in Table without any text.
Please give me the suggestion, how to do this.
Thanks in Advance
RajakumarHello,
I think you have a fundamental misunderstanding on how Checkboxes work. A Checkbox triggers a boolean value with true (checked) or false (uncheked).
When you map your name attribut to text you will see the content of that attribute as text behind. But not the metadata.
You may want to use a RadiobuttonGroup or CheckboxGroup for your purpose.
Frank -
How to add month to dashboard header?
Hi Experts,
we have calmonth coming from a cube and that is supplied to a query and this query is the source for the dashboard. i need to add calmonth to dashboard header ? please give ur inputs..
we are broadcasting to portal with bex broadcaster settings.
points will be assigned.
ThanksYou can place rectangle in header section on master page which would be applied on sub pages and then fill rectangle with color.
If you are after a specific color then simply use color code and fill.
Thanks,
Sanjit -
How to add new custom SOAP header when generate webservice?
Hi
When invoke an external webservice, SOA Gateway provide a method to add new customized SOAP Header, via extending seeded java function "WebServiceInvokerSubscription".
And in case of generating a new webservice in EBS, is there some similar method to add new customized SOAP header in the webservice?
Thanks
JamesLook at your Payment Process Profile. THere should be a reporting subtab and within that subtab is a Separate Remittance Advice region. I believe that is where you specify the format for the remittance advice document (which is built in XML Publisher). Take a look at that.
John Dickey -
How to add bullet on every enter event in text field
Hello, Can someone please point me in the right direction. I am trying to add a bullet every time someone presses enter on the keyboard. this is within a textfield.
Thank you,
HowardHi
I would solve it by a script that checks your multiline field for newlines by ENTER key and insert "* " in the beginning of each line.
1) create a multiline field in your form
2) insert the script below in exit event... and enjoy the magic ;)
just 7 lines of code without comments. The split function is very powerful, I really use it alot now!
===== script start =====
//value of the field to insert "* " in each line
var sFldValue = this.rawValue;
//you split text in field for each '\r' = newLines made with enter
var tmpFldArray = sFldValue.split("\r");
//tmp string you concat your out text in
var sOutStr = "";
//for each line of text insert '* ' in beginning
for(var i = 0; i < tmpFldArray.length; i++){
//need to add '\r' because split removed it
sOutStr += "* " + tmpFldArray[i] + "\r";
//return manipulated string to your field
this.rawValue = sOutStr;
===== script end =====
/Thomas Groenbaek
Jyske Bank
Denmark -
How to add CheckBoxs to a scrollPane
I have a file I�m getting user info out of and finding certain information the
User enters, I�m making a query, I�m taking the found items and making an array of Checkboxes out of them witch is working my problem is adding the Checkboxes to the scroll Pane
public class Frame1 extends JFrame{
public static Panel listan = new Panel();
JCheckBox[] jCheckBox1 ;
JScrollPane scrollPane1 = new JScrollPane(list);
//other Window objects
//first method
private void jbInit() throws Exception {
//puts all window objects together
// Constructs user screen
list.setLayout(verticalFlowLayout1);
panel1.add(scrollPane1, new XYConstraints(118, 32, 128, 195));
// i have a find buttion that takes all infoamtion out of file
// and puts in an array then finds user enterd infomation
// this is just example code that just adds CheckBoxs to the scrollPane
// and is Basically the same way the other program does
// second method
void addcheckbox_actionPerformed(ActionEvent e) {
jCheckBox1 = new JCheckBox[50];
for (int i = 0; i < 50; i++) {
String checkboxText = ("Checkbox #: " + (i + 1));
jCheckBox1[i] = new JCheckBox(checkboxText);
for (int i = 0; i < 50; i++) {
list.add(jCheckBox1, null);
My problem is that I can�t add the checkboxes at the second method but it works in the first, I can add in the first because I initialize in the second.If you want something to compile here is all my example code
I will incorporate it to my 30 page program
Here is what I want my code to do
package list;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import com.borland.jbcl.layout.*;
import java.awt.Checkbox;
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2008</p>
* <p>Company: </p>
* @author not attributable
* @version 1.0
public class Frame1 extends JFrame {
public static boolean ch=true;
JPanel contentPane;
GridLayout gridLayout1 = new GridLayout();
JPanel panel1 = new JPanel();
XYLayout xYLayout1 = new XYLayout();
JButton jButton1;
JButton jButton2;
JButton addcheckbox;
JCheckBox[] jCheckBox1 ;
JScrollPane scrollPane1 = new JScrollPane();
JPanel list = new JPanel();
VerticalFlowLayout verticalFlowLayout1 = new VerticalFlowLayout();
//Construct the frame
public Frame1() {
enableEvents(AWTEvent.WINDOW_EVENT_MASK);
try {
jbInit();
catch (Exception e) {
e.printStackTrace();
//Component initialization
// method one
private void jbInit() throws Exception {
contentPane = (JPanel)this.getContentPane();
jButton1 = new JButton();
jButton2 = new JButton();
addcheckbox = new JButton();
this.setContentPane(contentPane);
this.setLocale(java.util.Locale.getDefault());
this.setResizable(false);
this.setSize(new Dimension(400, 300));
this.setState(Frame.NORMAL);
this.setTitle("Frame Title");
contentPane.setOpaque(true);
contentPane.setRequestFocusEnabled(true);
contentPane.setLayout(gridLayout1);
panel1.setLayout(xYLayout1);
jButton1.setSelected(false);
jButton1.setText("Print");
jButton1.addActionListener(new Frame1_jButton1_actionAdapter(this));
jButton2.setText("select all/none");
jButton2.addActionListener(new Frame1_jButton2_actionAdapter(this));
addcheckbox.setBorderPainted(true);
addcheckbox.setText("add");
addcheckbox.addActionListener(new Frame1_addcheckbox_actionAdapter(this));
scrollPane1.setLocale(java.util.Locale.getDefault());
list.setLayout(verticalFlowLayout1);
contentPane.add(panel1, null);
panel1.add(scrollPane1, new XYConstraints(118, 32, 128, 195));
scrollPane1.getViewport().add(list, null);
//scrollPane1.add(listan, null);
panel1.add(jButton1, new XYConstraints(261, 92, 90, 39));
panel1.add(jButton2, new XYConstraints(262, 152, 108, 30));
panel1.add(addcheckbox, new XYConstraints(25, 49, -1, 35));
//Overridden so we can exit when window is closed
protected void processWindowEvent(WindowEvent e) {
super.processWindowEvent(e);
if (e.getID() == WindowEvent.WINDOW_CLOSING) {
System.exit(0);
void jButton1_actionPerformed(ActionEvent e) {
String checkprint = "selected:\n";
for (int x = 0; x < jCheckBox1.length; x++) {
if (jCheckBox1[x].isSelected()) {
checkprint = checkprint + jCheckBox1[x].getText()+"\n";
System.out.println(checkprint);
void jButton2_actionPerformed(ActionEvent e) {
for (int x = 0; x < jCheckBox1.length; x++) {
if (ch == true) {
jCheckBox1[x].setSelected(true);
else{
jCheckBox1[x].setSelected(false);
if (ch == true)
ch=false;
else
ch=true;
//method two
void addcheckbox_actionPerformed(ActionEvent e) {
jCheckBox1 = new JCheckBox[50];
for (int i = 0; i < 50; i++) {
String checkboxText = ("Checkbox #: " + (i + 1));
jCheckBox1[i] = new JCheckBox(checkboxText);
for (int i = 0; i < 50; i++) {
list.add(jCheckBox1, null);
class Frame1_jButton1_actionAdapter implements java.awt.event.ActionListener {
Frame1 adaptee;
Frame1_jButton1_actionAdapter(Frame1 adaptee) {
this.adaptee = adaptee;
public void actionPerformed(ActionEvent e) {
adaptee.jButton1_actionPerformed(e);
class Frame1_jButton2_actionAdapter implements java.awt.event.ActionListener {
Frame1 adaptee;
Frame1_jButton2_actionAdapter(Frame1 adaptee) {
this.adaptee = adaptee;
public void actionPerformed(ActionEvent e) {
adaptee.jButton2_actionPerformed(e);
class Frame1_addcheckbox_actionAdapter implements java.awt.event.ActionListener {
Frame1 adaptee;
Frame1_addcheckbox_actionAdapter(Frame1 adaptee) {
this.adaptee = adaptee;
public void actionPerformed(ActionEvent e) {
adaptee.addcheckbox_actionPerformed(e);
}doesn�t work but if I take all of method two and put it in one it workspackage list;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import com.borland.jbcl.layout.*;
import java.awt.Checkbox;
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2008</p>
* <p>Company: </p>
* @author not attributable
* @version 1.0
public class Frame1 extends JFrame {
public static boolean ch=true;
JPanel contentPane;
GridLayout gridLayout1 = new GridLayout();
JPanel panel1 = new JPanel();
XYLayout xYLayout1 = new XYLayout();
JButton jButton1;
JButton jButton2;
JButton addcheckbox;
JCheckBox[] jCheckBox1 ;
JScrollPane scrollPane1 = new JScrollPane();
JPanel list = new JPanel();
VerticalFlowLayout verticalFlowLayout1 = new VerticalFlowLayout();
//Construct the frame
public Frame1() {
enableEvents(AWTEvent.WINDOW_EVENT_MASK);
try {
jbInit();
catch (Exception e) {
e.printStackTrace();
//Component initialization
private void jbInit() throws Exception {
// this is the same code in method two
jCheckBox1 = new JCheckBox[50];
for (int i = 0; i < 50; i++) {
String checkboxText = ("Checkbox #: " + (i + 1));
jCheckBox1[i] = new JCheckBox(checkboxText);
for (int i = 0; i < 50; i++) {
list.add(jCheckBox1[i], null);
contentPane = (JPanel)this.getContentPane();
jButton1 = new JButton();
jButton2 = new JButton();
addcheckbox = new JButton();
this.setContentPane(contentPane);
this.setLocale(java.util.Locale.getDefault());
this.setResizable(false);
this.setSize(new Dimension(400, 300));
this.setState(Frame.NORMAL);
this.setTitle("Frame Title");
contentPane.setOpaque(true);
contentPane.setRequestFocusEnabled(true);
contentPane.setLayout(gridLayout1);
panel1.setLayout(xYLayout1);
jButton1.setSelected(false);
jButton1.setText("Print");
jButton1.addActionListener(new Frame1_jButton1_actionAdapter(this));
jButton2.setText("select all/none");
jButton2.addActionListener(new Frame1_jButton2_actionAdapter(this));
addcheckbox.setBorderPainted(true);
addcheckbox.setText("add");
addcheckbox.addActionListener(new Frame1_addcheckbox_actionAdapter(this));
scrollPane1.setLocale(java.util.Locale.getDefault());
list.setLayout(verticalFlowLayout1);
contentPane.add(panel1, null);
panel1.add(scrollPane1, new XYConstraints(118, 32, 128, 195));
scrollPane1.getViewport().add(list, null);
//scrollPane1.add(listan, null);
panel1.add(jButton1, new XYConstraints(261, 92, 90, 39));
panel1.add(jButton2, new XYConstraints(262, 152, 108, 30));
panel1.add(addcheckbox, new XYConstraints(25, 49, -1, 35));
//Overridden so we can exit when window is closed
protected void processWindowEvent(WindowEvent e) {
super.processWindowEvent(e);
if (e.getID() == WindowEvent.WINDOW_CLOSING) {
System.exit(0);
void jButton1_actionPerformed(ActionEvent e) {
String checkprint = "selected:\n";
for (int x = 0; x < jCheckBox1.length; x++) {
if (jCheckBox1[x].isSelected()) {
checkprint = checkprint + jCheckBox1[x].getText()+"\n";
System.out.println(checkprint);
void jButton2_actionPerformed(ActionEvent e) {
for (int x = 0; x < jCheckBox1.length; x++) {
if (ch == true) {
jCheckBox1[x].setSelected(true);
else{
jCheckBox1[x].setSelected(false);
if (ch == true)
ch=false;
else
ch=true;
void addcheckbox_actionPerformed(ActionEvent e) {
class Frame1_jButton1_actionAdapter implements java.awt.event.ActionListener {
Frame1 adaptee;
Frame1_jButton1_actionAdapter(Frame1 adaptee) {
this.adaptee = adaptee;
public void actionPerformed(ActionEvent e) {
adaptee.jButton1_actionPerformed(e);
class Frame1_jButton2_actionAdapter implements java.awt.event.ActionListener {
Frame1 adaptee;
Frame1_jButton2_actionAdapter(Frame1 adaptee) {
this.adaptee = adaptee;
public void actionPerformed(ActionEvent e) {
adaptee.jButton2_actionPerformed(e);
class Frame1_addcheckbox_actionAdapter implements java.awt.event.ActionListener {
Frame1 adaptee;
Frame1_addcheckbox_actionAdapter(Frame1 adaptee) {
this.adaptee = adaptee;
public void actionPerformed(ActionEvent e) {
adaptee.addcheckbox_actionPerformed(e);
}Edited by: deme on Feb 27, 2008 6:48 AM
Edited by: deme on Feb 27, 2008 6:51 AM -
How to add checkboxes to frames?
Hi,
I am trying to add checkboxes to a frame which will then be instantiated from an applet. I can launch the frame correctly from my applet but it always displays the last checkbox added only. So in my code below it would always display the 'Black' checkbox.
Could anyone please tell me what I am doing wrong or not doing here?
import java.awt.*;
import java.applet.*;
class Chooser extends Frame {
Chooser(String title) {
super(title);
Checkbox cRed;
Checkbox cBlack;
CheckboxGroup cbg = new CheckboxGroup( );
cRed = new Checkbox("Red", cbg, true);
cBlack = new Checkbox("Black", cbg, false);
add(cRed);
add(cBlack);
public boolean handleEvent(Event evtObj) {
if (evtObj.id == Event.WINDOW_DESTROY) {
hide( );
return true;
return super.handleEvent(evtObj);
public void paint(Graphics g) {
g.drawString("Chooser Frame",10,40);
}Thanks
Avi
Message was edited by:
avi22
Message was edited by:
avi22add a pack() statement to your Chooser constructor as the last statement before the end of the constructor
Chooser(String title){
// your code here
this.pack(); -
ALV , How to add a Field after it has been deleted
Hi,
I am formating a ABAP Webdynpro ALV: I remove a field by using :
l_value->if_salv_wd_column_settings~delete_column( lv_field_name).
How will I be able to add the field again ?
I tried the following :
l_value->if_salv_wd_column_settings~CREATE_COLUMN( lv_field_name).
but getting a 'null' object reference in the following standard code :
if ls_column-r_column->r_cell_editor->visible_fieldname is initial.
RegardsHi.
After create_column method you have to create cl_salv_wd_uie_text_view object:
data:
" Variables para configurar los ALVs.
lr_alv_config_table type ref to cl_salv_wd_config_table,
lr_lr_wd_table_usage TYPE REF TO if_wd_component_usage,
lr_wd_table TYPE REF TO iwci_salv_wd_table,
lr_table_settings TYPE REF TO if_salv_wd_table_settings,
lr_column_settings TYPE REF TO if_salv_wd_column_settings,
lr_column TYPE REF TO cl_salv_wd_column,
lr_text type ref to cl_salv_wd_uie_text_view,
lr_header type ref to cl_salv_wd_column_header.
" Initialize variables
lr_lr_wd_table_usage = wd_this->wd_cpuse_alv_1001( ).
if lr_lr_wd_table_usage->has_active_component( ) is initial.
lr_lr_wd_table_usage->create_component( ).
endif.
lr_wd_table = wd_this->wd_cpifc_alv_1001( ).
lr_alv_config_table = lr_wd_table->get_model( ).
lr_column_settings ?= lr_alv_config_table.
lr_table_settings ?= lr_alv_config_table.
" Delete Column.
lr_column_settings->delete_column( 'OBJID' ).
" Create column.
lr_column = lr_column_settings->create_column( 'OBJID' ).
create object lr_text.
lr_text->set_text_fieldname( 'OBJID' ).
lr_column->set_cell_editor( lr_text ).
" Change the header of the column.
lr_column->GET_HEADER( receiving value = lr_header ).
if lr_header is bound.
lr_column->delete_HEADER( receiving value = lr_header ).
endif.
lr_column->create_HEADER( receiving value = lr_header ).
lr_header->SET_TEXT( exporting value = 'Objid Field' ). -
How to add field to the header for FBL5N ALV report
Hi,
I need to add fields to the customer line item display ALV report(FBL5N) header part.Right now there are four fields in the header like customer, company code, name and city, after that I need to add first name last name and phone no. Can any one tell me where exactly I need to add and populate there fields to be appear in ALV output list.
Thanks in Advance
SwapnaYes I have tried, I have place a break point in that perform but it does not stop. I think that is not the correct place to added and populate fields. That routine is for populate selection screen ranges single and multiple values and parameters only.
Thanks
Swapna
Maybe you are looking for
-
Bad working mail after moving to icloud on my 2nd generation iPod touch
I moved to iCloud. But since then, when i load mail in my 2nd generation iPod touch, it gives a lot of errors. ( For example 'wrong password' ) . It still works , but i get too much errors when i'm loading mail, and it doesnt pushes my mail automatic
-
10.4.11 breaks .dmg mounting - now I get fsck errors.
I am having problems. About 75% of my .dmg files give me errors. Many of these .dmg files have been working flawlessly on three computers since the 10.3 days... The others were created more recently (including two which were created using 10.4.11). B
-
Hi, I have installed Oracle DB Enterprise Edition and Client 10.1.0.3.0 on Linux. I create the schema SH using the scripts sh_main.sql, csh_v3.sql, lsh_v3.sql, psh_v3.sql and olp_v3.sql from the directory $ORACLE_HOME/demo/schema/sales_history. So fa
-
Bonjour, Can somebody help me to go back to mac OS ? When i open my computer in anyway i have windows XP ; I can't boot to mac OS; Before this day i could pass to one système to another without problèmes. I use bootcamp and macOS (tiger) open first b
-
Export and import in different OS.
Hi, Source :- Oracle 11.2.0.2 OS :- Linux Target :- Oracle1 11.2.0.2 OS:- Windows 2003 My database is running in Linux machine. Can i do the export ( expdp or exp ) the data from linux server and import it into windows 2003. Thanks,