03-18-2009 4:52 AM
Dear all
I need the first column of the internal table as a checkbox. Please give me the syntax to do that.
Itried like
types:begin of is_ty,
a type c as checkbox,
matnr type matnr,
end of is_ty.
But its throw an error in the first row...Please give me the correct syntax....i am not writing my internal table in the output.I am just passing it to a Container alv and i am not using any table controls...So please tell me how can we make a Checkbox in Container ALV......plz help
thanks
03-18-2009 4:57 AM
HI,
Refer to the demo program BCALV_EDIT_05 .. you can find the code init.
03-18-2009 4:59 AM
Hi,
declare your structure as,
types:begin of is_ty,
a type c, "Check box field
matnr type matnr,
end of is_ty.
for the check box logic, when you build the field catalog write like this:
wa_fieldcat-col_pos = 1.
wa_fieldcat-fieldname = 'A'. "Check box field name
wa_fieldcat-seltext_m = 'Select'.
wa_fieldcat-checkbox = 'X'. "It's a checkbox!
wa_fieldcat-edit = 'X'.
APPEND wa_fieldcat TO it_fieldcat.
Regards,
Manoj Kumar P
03-18-2009 5:03 AM
BEGIN OF T_final ,
chk(1) TYPE c, " for checkbox
ebeln LIKE ekko-ebeln,
ebelp LIKE ekpo-ebelp,
bstyp LIKE ekko-bstyp,
bsart LIKE ekko-bsart,
lifnr LIKE ekko-lifnr,
ekorg LIKE ekko-ekorg,
ekgrp LIKE ekko-ekgrp,
matnr LIKE ekpo-matnr,
werks LIKE ekpo-werks,
lgort LIKE ekpo-lgort,
menge LIKE ekpo-menge,
meins LIKE ekpo-meins,
eindt LIKE eket-eindt,
END OF T_final.
IT_final TYPE STANDARD TABLE OF T_final,
at the time of building field catalog
WA_fieldcat-fieldname = 'CHK'.
WA_fieldcat-seltext_m = 'CheckBox'.
WA_fieldcat-checkbox = 'X'. "This declaration create the checkbox
WA_fieldcat-edit = 'X' .
WA_fieldcat-input = 'X'.
WA_fieldcat-tabname = 'IT_FINAL'.
WA_fieldcat-col_pos = 1.
APPEND WA_fieldcat TO IT_fieldcat.
CLEAR WA_fieldcat.
Thanks and Regards.
Sarbajit
Edited by: Sarbajit Majumdar on Mar 18, 2009 11:23 AM
03-18-2009 5:59 AM
Hi,
There is no need to declare the first field as checkbox in your internal table, inseat declare your internal table as:
types : begin of t_final,
chk(1) type c, " <-- check box field
"other fields,
end of t_final.
data : it_final TYPE TABLE OF t_final,
wa_final TYPE t_final.
Now to include check box in alv, build the field catalog as:-
wa_fieldcat-fieldname = 'CHK'. "<--check box field in internal table
wa_field-tabname = 'IT_FINAL'. "<--internal table
wa_fieldcat-seltext_m = ' '.
wa_fieldcat-checkbox = 'X'. "<--display as checbox
wa_fieldcat-edit = 'X'.
APPEND wa_fieldcat TO it_fieldcat.
When checkbox is selected the field chk in internal table is X else it is blank.
Hope this helps you.
Regards,
Tarun
03-18-2009 6:41 AM
03-18-2009 6:53 AM
Hi,
instead of taking a variable in intrenla table as checkbox just declare as C type only
types:begin of is_ty,
a type c ," as checkbox,
matnr type matnr,
end of is_ty.
Then at the time of setting the field catalog set the value of Checkbox foe 'a' as X. this will set the 'a' as a checkbox.
Pooja
03-18-2009 7:03 AM
Hi Biju,
As also said by other's create your internal table with first field as type c length 1 and just pass the value as 'X' in your fieldcat-checkbox. cause a type c as checkbox will help when you are using classical report there youe can use write a as checkbox.,
With luck,
Pritam.
11-26-2009 7:33 AM