CheckBox in Grid
Hi,
I have the status field in my table .it contains 0 and 1.
I bpund the table into grid in my view and chnage that column to CheckBox.
but its showing always checked.
I dont want to do any coding for this.
I am ready to change my column datatype.
so please let me know which datatype is sutable for bind correct
data into Checkbox column.
Regards,
Kumar K
Hi,
If you want the checkobxes to be unchekd then use this code before binding-
Pass the values space(abap_false) or X(abap_true).
X means checked, space means unchecked.
Loop at lt_table into ls_table
ls_table-flag = space .
modify table....
endloop....
lr_node->bind_table( lt_table ).
flag is char(1).
this flag is a context attribute that is inside the node to which the table is bound.
Regards,
Lekha.
Similar Messages
-
Hi,
i have 2 grid controls(grid1 & grid2). Grid2 values are displaying based on the selected values from grid1.Im getting the dynamic values in grid2.
now i have to dynamicaly inculde a checkbox in grid2 .so that user can select any one from the grid2 values. how to inculde a dynamice checkbox in a grid?
nullNainar,
I did this class for active CheckBox in Grid using Brian's note. the CheckBox will attached to Grid and link to database.The only problem is when I clicked on
CheckBox to change the value, got this error:
JBO-27010: Attribute set with value true for Saturday in Terminal has invalid precision/scale
Note:Saturday is a column of Terminal table.
should be something regarding DataType
import javax.swing.*;
import java.awt.*;
import oracle.dacf.control.swing.*;
import javax.swing.table.*;
// this class will customize a cell in GridControl as CheckBox(Dynamic)
// To instantiate this class, add the following step in your applet
// 0- add this class to your package.
// 1- Get a reference to your GridControl, same as below:
// JTable myTable = gridControl1.getTable();
// 2- instantiate an object from this class. same as below
// new myGridCheckBox(myTable,"SundayOpen");
public class myGridCheckBox extends Object {
public myGridCheckBox(JTable m_Table, String m_colName ) {
CheckBoxControl checkBx = new CheckBoxControl();
// get reference to a column
TableColumn ActiveColumn = m_Table.getColumn(m_colName);
// custom TableCellRenderer
TableCellRenderer myTCR = new CheckCellRenderer();
// forces this column to use the custom Cell Renderer
ActiveColumn.setCellRenderer(myTCR);
TableCellEditor myTCE = new DefaultCellEditor(checkBx);
ActiveColumn.setCellEditor(myTCE);
// inner class for custom CellRenderer (CheckBox)
class CheckCellRenderer extends CheckBoxControl implements TableCellRenderer{
public CheckCellRenderer()
super();
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
boolean hasFocus, int row, int column)
setBackground(isSelected && hasFocus ? table.getSelectionBackground() : table.getBackground());
setForeground(isSelected && hasFocus ? table.getSelectionForeground() : table.getForeground());
setFont(table.getFont());
setSelectionValue("Y");
setDeselectionValue("N");
setValue(value);
return this;
would appreciate to let me know if you solved the problem.
Thanks
Ali
null -
How can I define a Checkbox in Grid control
A cell in the GridConterol always has Y/N value. How can I define this cell as a
CheckBox. So, the checkbox be checked when
value is "Y" and be unChecked when value is
"N".
By the way this GridControl populates via
a RowSetInfo.
Would appreciate any help.
Ali
nullHi Ali,
This is not supported. -
How to Edit the CheckBox in Classic ALV GRID Display
Hi,
I want to Edit the checkbox in Grid Display.
I have one checkbox field in my internal Table,
Code Of the Program,
Data :
Begin of itab occurs 0,
CHK type C,
MATNR like MARA-MATNR,
end of itab.
Iam building the fieldcatelog using Merge Funcion module.
After that I am chaning the properties of the field
catelog like below,
loop at I_FCAT assigning <FCAT>.
Case <FCAT>-Fieldname
When 'CHK'.
<FCAT>-Checkbox = 'X'.
<FCAT>-INPUT = 'X'.
I dont have edit option in fieldcatelog.
modify I_FCAT from <FCAT>.
endcase.
endloop.
In the Layout,
I_LAYOUT-box_fieldname = 'CHK'.
I_LAYOUT-box_tabname = 'ITAB'.
It is displaying the Checkbox field.but I couldnt edit the checkBox.
I can able to edit in REUSE_ALV_LIST_DISPLAY.
But I have to use REUSE_ALV_GRID_DISPLAY.How to edit the checkbox.
Thanks in Advance,
SumithraHi vasu,
The below procedure explains you to create a checkbox cloumn in the grid and allows you to edit i hope this will helps u.
The ALV Grid Control displays the cells of a column as checkboxes if the column is marked as a checkbox column in the field catalog.
Add another field to the output table in which you want to display checkboxes
OR
Define an existing field as a checkbox.
Procedure
1. Add a field to your output table:
Data: gt_fieldcat type lvc_t_fcat.
Types: begin of gs_outtab.
Types: checkbox type c. "field for checkbox
Include structure <ABAP Dictionary structure> .
Types: end of gs_outtab.
Data: gt_outtab type gs_outtab occurs 0 with header line.
2 * Add an entry for the checkbox to the field catalog
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.
append ls_fcat to gt_fieldcat.
regards,
venu. -
HI experts,
I want to display data in grid with checkboxes.in grid some rows have a negative value and some row have possitive value(means one filed have /-).if row have negative value in that row checkbox must be in disable mode or possitive in that row checkbox must be in enble mode.<Urgency downgraded>+
Thanks
V.Venu
Edited by: Suhas Saha on Nov 14, 2011 4:21 PMThanks Venu For Putting this Question and Thanks Deepak For getting bang on the point.. It Works Perfctlty fine...
I am Sending Code For Guys Who are suffering from this Problem...
TYPES: BEGIN OF TY_MARA,
FLAG TYPE CHAR1,
MATNR TYPE MARA-MATNR,
ERSDA TYPE MARA-ERSDA,
ERNAM TYPE MARA-ERNAM,
WESCH TYPE MARA-WESCH,
STYLE TYPE LVC_T_STYL,
END OF TY_MARA.
DATA : IT_MARA TYPE STANDARD TABLE OF TY_MARA.
DATA : IT_MARA1 TYPE STANDARD TABLE OF TY_MARA,
WA_MARA TYPE TY_MARA,
WA_MARA1 TYPE TY_MARA.
DATA : WA_SETTINGS TYPE LVC_S_GLAY.
DATA : WA_LAYOUT TYPE LVC_S_LAYO.
DATA : IT_FIELDCATALOG TYPE LVC_T_FCAT,
WA_FIELDCATALOG TYPE LVC_S_FCAT.
DATA REF1 TYPE REF TO CL_GUI_ALV_GRID.
DATA: LS_EDIT TYPE LVC_S_STYL,
LT_EDIT TYPE LVC_T_STYL.
START-OF-SELECTION.
SELECT MATNR ERSDA ERNAM WESCH
FROM MARA INTO CORRESPONDING FIELDS OF TABLE IT_MARA
UP TO 10 ROWS.
WA_FIELDCATALOG-FIELDNAME = 'FLAG'.
WA_FIELDCATALOG-OUTPUTLEN = 6.
WA_FIELDCATALOG-CHECKBOX = 'X'. "as checkbox
WA_FIELDCATALOG-EDIT = 'X'.
WA_FIELDCATALOG-SELTEXT = 'Check box'.
APPEND WA_FIELDCATALOG TO IT_FIELDCATALOG.
CLEAR WA_FIELDCATALOG.
WA_FIELDCATALOG-FIELDNAME = 'MATNR'.
WA_FIELDCATALOG-OUTPUTLEN = 20.
WA_FIELDCATALOG-SELTEXT = 'Mat no'.
APPEND WA_FIELDCATALOG TO IT_FIELDCATALOG.
CLEAR WA_FIELDCATALOG.
WA_FIELDCATALOG-FIELDNAME = 'ERSDA'.
WA_FIELDCATALOG-OUTPUTLEN = 15.
WA_FIELDCATALOG-SELTEXT = 'Creation Date'.
APPEND WA_FIELDCATALOG TO IT_FIELDCATALOG.
CLEAR WA_FIELDCATALOG.
WA_FIELDCATALOG-FIELDNAME = 'ERNAM'.
WA_FIELDCATALOG-OUTPUTLEN = 20.
WA_FIELDCATALOG-SELTEXT = 'Creation Time'.
APPEND WA_FIELDCATALOG TO IT_FIELDCATALOG.
CLEAR WA_FIELDCATALOG.
WA_FIELDCATALOG-FIELDNAME = 'WESCH'.
WA_FIELDCATALOG-OUTPUTLEN = 20.
WA_FIELDCATALOG-SELTEXT = 'Quantity'.
APPEND WA_FIELDCATALOG TO IT_FIELDCATALOG.
CLEAR WA_FIELDCATALOG.
CONSTANTS : LC_X TYPE CHAR1 VALUE 'X'.
WA_LAYOUT-CWIDTH_OPT = LC_X.
WA_LAYOUT-ZEBRA = LC_X.
WA_LAYOUT-STYLEFNAME = 'STYLE'.
LS_EDIT-FIELDNAME = 'FLAG'.
LS_EDIT-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_DISABLED.
INSERT LS_EDIT INTO TABLE LT_EDIT.
INSERT LINES OF LT_EDIT INTO TABLE WA_MARA1-STYLE.
LOOP AT IT_MARA INTO WA_MARA..
IF WA_MARA-ERSDA EQ '20060809'.
MODIFY IT_MARA INDEX SY-TABIX FROM WA_MARA1 TRANSPORTING STYLE.
ENDIF.
ENDLOOP.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_PF_STATUS_SET = 'F_SET_STATUS'
I_CALLBACK_USER_COMMAND = 'F_USER_COMMAND'
I_GRID_TITLE = 'Example of select and deselect'
IS_LAYOUT_LVC = WA_LAYOUT
IT_FIELDCAT_LVC = IT_FIELDCATALOG
TABLES
T_OUTTAB = IT_MARA.
FORM F_SET_STATUS USING RT_EXTAB TYPE SLIS_T_EXTAB.
SET PF-STATUS 'STATUS1'.
ENDFORM.
FORM F_USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
CASE R_UCOMM.
WHEN 'ASEL'.
LOOP AT IT_MARA INTO WA_MARA.
WA_MARA-FLAG = 'X'.
MODIFY IT_MARA FROM WA_MARA.
ENDLOOP.
RS_SELFIELD-REFRESH = 'X'.
WHEN 'DSEL'.
LOOP AT IT_MARA INTO WA_MARA.
WA_MARA-FLAG = ' '.
MODIFY IT_MARA FROM WA_MARA.
ENDLOOP.
RS_SELFIELD-REFRESH = 'X'.
WHEN 'DELETE'.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
E_GRID = REF1.
CALL METHOD REF1->CHECK_CHANGED_DATA.
DELETE IT_MARA
WHERE FLAG = 'X'.
RS_SELFIELD-REFRESH = 'X'.
WHEN 'INSERT'.
CLEAR WA_MARA.
APPEND WA_MARA TO IT_MARA.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
E_GRID = REF1.
CALL METHOD REF1->REFRESH_TABLE_DISPLAY.
WHEN 'SAVEDB'.
ENDCASE.
ENDFORM. -
Pushbutton on ALV grid.
hi to all,
I have created a push button on ALV grid. The ALV is not created in OO.
Can anybody tell me how to select a row or multiple row and relate it to fuction attached to that push button. I have followed all links in forum but that all are for ALV created in OO.
The row should be selected on basis of grid available on left hand of grid or I have also putted checkbox in grid.
plz do the needful.
thanks
regards,
sachin d.Hi,
if you want multiple selection all lines. then
case r_ucomm.
when 'BUTTONCODE'.
loop at itab.
itab-check = 'X'. "Check is checkbox field
modify itab index sy-tabix.
endloop.
selfield-refresh = 'X'.
endcase.
Regards
vijay -
Hi,
I have problem with refresh on grid.
I have some checkboxes on grid and when I click on one of them some of another should get marked too. It works but unfotanetly very slow. After this action I use CALL METHOD sender->refresh_table_display.
Is there another solution, for axample make grid refresh only for one row or refresh only data but not specific grid style (like cells' colours, etc)?
Regards, JoannaHi,
I am not 100% sure but I think there is a method DELTA_REFRESH. This can be useful. Please have a look.
You can also try calling CALL METHOD cl_gui_cfw=>flush after CALL METHOD sender->refresh_table_display.
Just see if this helps.
Regards,
Saurabh -
All type of FAQ's. pls replyyyyyyyy
i have many questions . pls replyy..
1> how to make checkbox in grid ALV?
2>what we have to write in FIELD EXIT? (which is MUST)
3>wat is the t code to see the object which are in BOR?
4> tell all the details steps of performance tuning?
5> difference between parameter and parameters?3>wat is the t code to see the object which are in BOR?
BAPI
4> tell all the details steps of performance tuning?
Following are the different tools provided by SAP for performance analysis of an ABAP object
Run time analysis transaction SE30
This transaction gives all the analysis of an ABAP program with respect to the database and the non-database processing.
SQL Trace transaction ST05
The trace list has many lines that are not related to the SELECT statement in the ABAP program. This is because the execution of any ABAP program requires additional administrative SQL calls. To restrict the list output, use the filter introducing the trace list.
The trace list contains different SQL statements simultaneously related to the one SELECT statement in the ABAP program. This is because the R/3 Database Interface - a sophisticated component of the R/3 Application Server - maps every Open SQL statement to one or a series of physical database calls and brings it to execution. This mapping, crucial to R/3s performance, depends on the particular call and database system. For example, the SELECT-ENDSELECT loop on the SPFLI table in our test program is mapped to a sequence PREPARE-OPEN-FETCH of physical calls in an Oracle environment.
The WHERE clause in the trace list's SQL statement is different from the WHERE clause in the ABAP statement. This is because in an R/3 system, a client is a self-contained unit with separate master records and its own set of table data (in commercial, organizational, and technical terms). With ABAP, every Open SQL statement automatically executes within the correct client environment. For this reason, a condition with the actual client code is added to every WHERE clause if a client field is a component of the searched table.
To see a statement's execution plan, just position the cursor on the PREPARE statement and choose Explain SQL. A detailed explanation of the execution plan depends on the database system in use.
5> difference between parameter and parameters?
I think there is no difference between parameter and parameters. But i am not sure.
Diff between parameter and select-options:
The parameter statement does not create a selection table .
The second thing is select-option gives us a range for selection, whereas parameter doesn't .
Using the parameter you can define radio buttons and checkboxes where as select-options can't .
Hope this helps,
Regards,
Arunsri -
Malformed PDF generated from DocuMaker 11.0
Hi
While Integrating DocuMaker generated PDF to an eSignature Vendor(whose input is a PDF), we found that PDFs created using DocuMaker is malformed/invalid. For example, paths are drawn using page description such as:
176 2672 m
2953 2672 l
2953 2550 l
176 2550 l
176 2672 l
q
0.850 g
f
Q
which contradicts PDF spec. It should be:
q
176 2672 m
2953 2672 l
2953 2550 l
176 2550 l
176 2672 l
0.850 g
f
Q
Question: Due to this issue the checkboxes and Grid-lines do not appear properly on screen. Please let us know if there is any setting in DocuMaker that needs to be adjusted to resolve this PDF formatting issue. We have also opened a ticket with Oracle (Opened Oracle ticket # SR3-2563186951, Severity 2 issue) but no luck yet.
Please help
Thanks
zguptn
Edited by: zguptn on Dec 16, 2010 6:31 PMHi,
I am not very sure if the issue seen with the checkboxes and Grid-lines is due to the standard specs you have mentioned. But I see one reference in the latest PDF Driver handbook under the Section "LIMITATIONS" which clearly says that:
"Although Acrobat Reader supports variable fields, radio buttons, push buttons, and list
boxes, the PDF Print Driver does not support the creation of these objects within a PDF
file."
For your easy reference: PDF Handbook -> http://download.oracle.com/docs/cd/E16256_01/pdf_book.pdf
As mentioned, I am not sure if this applies to Checkboxes as well. I did not get a chance to explore much on this. Please explore further if it helps.
Thank you.
Edited by: Nirmalgarga on 17 Dec, 2010 3:19 AM -
Get checkbox values from alv grid
Hi,
I'm using the function REUSE_ALV_GRID_DISPLAY and I'm showing a table with a field like a checkbox.
In USER_COMMAND FORM to get selected values do as follow:
CALL METHOD REF_GRID->CHECK_CHANGED_DATA.
And then:
loop at i_pos (my table) with checkbox eq 'X'.
endloop.
The first time I execute the ALV every thing is OK but if I do any action (I use the function 'BAPI_GOODSMVT_CREATE' ...), I refresh the data and I raise the alv again. In USER COMMAND FORM the code is the same and I can not get checkbox values.
Can someone help me please?
Thanks and regards.Hi,
Check this
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
it_fieldcat = pt_grpfcat[]
it_excluding = p_grpexcltab2[]
is_layout = pt_grplayout2
i_callback_program = sy-repid
i_callback_html_top_of_page = p_header
i_callback_pf_status_set = v_status_set1
i_callback_user_command = f_user_command1
i_screen_start_column = 25
i_screen_start_line = 5
i_screen_end_column = 80
i_screen_end_line = 20
it_events = i_events[]
tables
t_outtab = i_grpoutput.
form f_user_command1 using p_ucomm type sy-ucomm
rs_selfield type slis_selfield.
data p_ref1 type ref to cl_gui_alv_grid.
call function 'GET_GLOBALS_FROM_SLVC_FULLSCR'
importing
e_grid = p_ref1.
call method p_ref1->check_changed_data.
case p_ucomm.
when 'YCNC'.
leave to screen 0.
endcase.
rs_selfield-refresh = c_x. " Grid refresh < You need to fill up this
endform. " F_user_command1
aRs -
Functionality of Checkbox in ALV Grid Report
Hi Experts,
I created a ALV grid report with the checkbox as my first coloum and other fields as shown below. Initially, my ALV report displays as below. It is working fine till here.
checkbox customer material quantity UOM Sales Order Delivery
C1 M1 1 KG
C1 M2 2 KG
C2 M1 1 KG
C2 M2 2 KG
C3 M1 1 KG
C3 M2 2 KG
C3 M3 3 KG
C4 M1 1 KG
C5 M5 1 KG
I have created a push button on application toolbar for creating sales order and delivery using bapi's. When I click on my pushbutton, as of now it creates the SO and delivery for the first customer C1 and updates my Internal table with the sales order number and delivery number. If I need to create sales order for the second customer I need to run my ALV report again and so on for 3rd, 4th and 5th customers. It is also working fine till here.
checkbox customer material quantity UOM Sales Order Delivery
C1 M1 1 KG SO1 DEL1
C1 M2 2 KG SO1 DEL1
C2 M1 1 KG
C2 M2 2 KG
C3 M1 1 KG
C3 M2 2 KG
C3 M3 3 KG
C4 M1 1 KG
C5 M5 1 KG
Need help on this:
When I select the check boxes as shown below and when I click the push button to create SO and Delivery then my program should create sales order and delivery for all the checked ones as shown below. What is the condition do I need to put here for selecting the checkbox.
checkbox customer material quantity UOM Sales Order Delivery
X C1 M1 1 KG SO1 DEL1
X C1 M2 2 KG SO1 DEL1
C2 M1 1 KG
C2 M2 2 KG
X C3 M1 1 KG SO3 DEL3
X C3 M2 2 KG SO3 DEL3
X C3 M3 3 KG SO3 DEL3
C4 M1 1 KG
X C5 M5 1 KG SO5 DEL5
I would really appreciate if somebody could help me / guide me on this. I will also post my code if someone needs to understand what I am doing exactly.
Thanks.You need to use OO ABAP
Use Class the class 1) CL_GUI_ALV_GRID, 2) CL_GUI_CUSTOM_CONTAINER
Create Sceen and container on same screen.
Check following COde it used for printing purpose.
Using AFTER_USER_COMMAND Event you will find Check box selected entries.
Capture those in another internal Table and use it for SO Creation
DATA: O_GRID TYPE REF TO CL_GUI_ALV_GRID,
O_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
T_FCAT TYPE LVC_T_FCAT,
CONTAINER(15) TYPE C VALUE 'ET_CONTAINER'.
CLASS EVENT_CLASS DEFINITION
CLASS EVENT_CLASS DEFINITION.
PUBLIC SECTION.
METHODS: BEFORE_COMMAND FOR EVENT AFTER_USER_COMMAND OF CL_GUI_ALV_GRID IMPORTING E_UCOMM,
DOUBLE_CLICK_N FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID IMPORTING E_ROW E_COLUMN,
TOOLBAR FOR EVENT TOOLBAR OF CL_GUI_ALV_GRID IMPORTING E_OBJECT.
ENDCLASS. "EVENT_CLASS DEFINITION
CLASS EVENT_CLASS IMPLEMENTATION
CLASS EVENT_CLASS IMPLEMENTATION.
METHOD BEFORE_COMMAND.
IF E_UCOMM = 'PRINT'.
CLEAR : W_FLAG.
T_FINAL2 = T_FINAL.
SORT T_FINAL2 BY COL_CHK .
DELETE T_FINAL2 WHERE COL_CHK = ' '.
IF NOT T_FINAL2 IS INITIAL.
LOOP AT T_FINAL2 INTO WA_FINAL.
IF W_FLAG IS INITIAL.
Does some of modification/s in control parameters
W_CONTROL_PARAM-NO_OPEN = 'X'.
W_CONTROL_PARAM-NO_CLOSE = 'X'.
W_CONTROL_PARAM-PREVIEW = 'X'.
W_CONTROL_PARAM-NO_DIALOG = SPACE.
W_OUTPUT_OPTIONS-TDNEWID = 'X'.
W_OUTPUT_OPTIONS-TDIMMED = SPACE.
Opens the smartform print-job
CALL FUNCTION 'SSF_OPEN'
EXPORTING
OUTPUT_OPTIONS = W_OUTPUT_OPTIONS
CONTROL_PARAMETERS = W_CONTROL_PARAM
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5.
IF SY-SUBRC EQ 0.
W_FLAG = 'X'.
ELSE.
LEAVE LIST-PROCESSING.
ENDIF.
ENDIF.
IF W_FLAG = 'X'.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = 'ZFORM_BIW_PRINT'
IMPORTING
FM_NAME = LF_FM_NAME
EXCEPTIONS
NO_FORM = 1
NO_FUNCTION_MODULE = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
ENDIF.
IF SY-SUBRC = 0.
CALL FUNCTION LF_FM_NAME
EXPORTING
CONTROL_PARAMETERS = W_CONTROL_PARAM
V_VBELN = WA_FINAL-VBELN
WA_FINAL = WA_FINAL.
TABLES
T_FINAL = T_FINAL.
ELSE.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
ENDLOOP.
* Close the smartform print job
IF W_FLAG EQ 'X'.
CALL FUNCTION 'SSF_CLOSE'
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
OTHERS = 4.
ENDIF.
ENDIF.
ENDIF.
ENDMETHOD. "BEFORE_COMMAND -
How to set a selected checkbox in output internal table of oops ALV grid
Hi All,
i have a checkbox as first column in my ALV grid output using oops alv, when i select some checkbox, that rows have to be selected and i need to process only selected rows in user command.
i have given the below code also in fieldcatolg.
f_fldcat-fieldname = 'checkbox'.
f_fldcat-tabname ='gi_output'
f_fldcat-checkbox = 'X'.
f_fldcat-edit = 'X'.
but the checkbox is not getting set in internal table when i select some checkboxes.
can anybody explain y the checkbox in internal table not getting set?
Thanks,
Srilakshmi.Hi,
i tried already whatever u said, but still not resolved.Pasted my code below..can u please look into it.
MODULE pbo OUTPUT.
PERFORM init_container.
PERFORM prepare_field_catalog.
PERFORM prepare_layout.
PERFORM display_output.
ENDMODULE. " PBO OUTPUT
*& Module PAI INPUT
text
MODULE pai INPUT.
DATA: lt_rows TYPE lvc_t_row.
CASE gv_okcode.
WHEN gc_exit OR gc_back OR gc_canc. " Finish program
LEAVE PROGRAM.
when 'PRINT'.
CALL METHOD gv_grid->get_selected_rows
IMPORTING et_index_rows = lt_rows.
CALL METHOD cl_gui_cfw=>flush.
ENDCASE.
ENDMODULE. " PAI INPUT
*& Form INIT_CONTAINER
text
FORM init_container .
CREATE OBJECT gv_custom_container
EXPORTING
container_name = gc_container.
CREATE OBJECT gv_grid
EXPORTING
i_parent = gv_custom_container.
CREATE OBJECT gv_document
EXPORTING
style = 'ALV_GRID'.
*& Form PREPARE_FIELD_CATALOG
text
FORM prepare_field_catalog .
PERFORM fill_catalog USING:
'Table Name' 'Field Name' 'NoZero' 'sel-text'
'GI_OUTPUT' 'CHECKBOX' ' ' text-013 'X',
'GI_OUTPUT' 'KUNNR' 'X' text-003 ' ',
'GI_OUTPUT' 'NAME1' ' ' text-004 ' ',
'GI_OUTPUT' 'BELNR' 'X' text-005 ' ',
'GI_OUTPUT' 'BLART' ' ' text-006 ' ',
'GI_OUTPUT' 'BUDAT' ' ' text-007 ' ',
'GI_OUTPUT' 'BLDAT' ' ' text-008 ' ',
'GI_OUTPUT' 'DMBTR' ' ' text-009 ' ',
'GI_OUTPUT' 'WAERS' ' ' text-010 ' '.
ENDFORM. " PREPARE_FIELD_CATALOG
*& Form FILL_CATALOG
text
FORM fill_catalog USING fv_tabname
fv_fldname
fv_nozero
fv_seltxt
fv_checkbox.
DATA f_fldcat TYPE lvc_s_fcat.
f_fldcat-fieldname = fv_fldname.
f_fldcat-tabname = fv_tabname.
f_fldcat-no_zero = fv_nozero.
f_fldcat-coltext = fv_seltxt.
f_fldcat-checkbox = fv_checkbox.
IF fv_checkbox = gc_x.
f_fldcat-edit = gc_x.
ENDIF.
APPEND f_fldcat TO gi_fieldcat.
ENDFORM. " FILL_CATALOG
*& Form PREPARE_LAYOUT
text
FORM prepare_layout .
gs_layout-info_fname = 'COL'.
gs_layout-cwidth_opt = gc_x.
gs_layout-zebra = gc_x.
gs_layout-no_toolbar = gc_x.
gs_layout-no_rowmark = '1'.
gs_layout-sel_mode = 'A'.
ENDFORM. " PREPARE_LAYOUT
*& Form DISPLAY_OUTPUT
text
FORM display_output .
CALL METHOD gv_grid->set_table_for_first_display
EXPORTING
is_layout = gs_layout
CHANGING
it_outtab = gi_output
it_fieldcatalog = gi_fieldcat.
CREATE OBJECT event_receiver.
SET HANDLER event_receiver->handle_user_command FOR gv_grid.
CALL METHOD cl_gui_control=>set_focus EXPORTING control = gv_grid.
ENDFORM. " DISPLAY_OUTPUT -
How to capture the checkbox status in ALV Grid display
I need some immediate help regarding Grid ALV.
My Requirement: I need to display an ALV grid report along with checkboxes. Further, I need to provide an option wherein the user can checkboxes and select the records that I need to process further (by clicking the process button on the ALV Report).
My Query: The problem here is that I am not able to capture the status of the checkboxes. This means that I am not able to capture which of the records have been selected by checking their resp checkboxes.
Solutions that I have tried: I have tried capturing the same at user command by checking the value in slis_selfield. But all the records show the value as 1 for the checkbox field.
Kinldy suggest how to go about it.
I am not using Object Oriented ALV. Please suggest something to be used in ALV Grid display in 4.6C version.
Regards,
NamrataHere is a Sample code , it might help you
TABLES : sflight.
TYPE-POOLS: slis.
DATA : w_repid LIKE sy-repid.
w_repid = sy-repid.
DATA: BEGIN OF it_sflight OCCURS 0,
checkbox(1),
carrid LIKE sflight-carrid,
END OF it_sflight.
*layout
DATA: wa_layout TYPE slis_layout_alv.
*field catalog
DATA: it_fieldcatalog TYPE slis_t_fieldcat_alv,
wa_fieldcatalog TYPE slis_fieldcat_alv.
START-OF-SELECTION.
SELECT carrid FROM sflight
INTO CORRESPONDING FIELDS OF TABLE it_sflight.
END-OF-SELECTION.
CLEAR it_fieldcatalog.
REFRESH it_fieldcatalog.
wa_fieldcatalog-fieldname = 'CHECKBOX'.
wa_fieldcatalog-outputlen = '3'.
wa_fieldcatalog-col_pos = '1'.
wa_fieldcatalog-seltext_m = 'Chk'.
wa_fieldcatalog-checkbox = 'X'.
wa_fieldcatalog-edit = 'X'.
APPEND wa_fieldcatalog TO it_fieldcatalog.
CLEAR wa_fieldcatalog.
wa_fieldcatalog-fieldname = 'CARRID'.
wa_fieldcatalog-outputlen = '10'.
wa_fieldcatalog-col_pos = '2'.
wa_fieldcatalog-seltext_m = 'Carrid'.
APPEND wa_fieldcatalog TO it_fieldcatalog.
CLEAR wa_fieldcatalog.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = w_repid
is_layout = wa_layout
i_callback_user_command = 'USER_COMMAND'
it_fieldcat = it_fieldcatalog
TABLES
t_outtab = it_sflight
EXCEPTIONS
program_error = 1
OTHERS = 2.
*& Form USER_COMMAND
FORM user_command USING p_ucomm TYPE sy-ucomm
p_selfld TYPE slis_selfield.
CASE p_ucomm.
WHEN '&DATA_SAVE'.
DATA ref1 TYPE REF TO cl_gui_alv_grid.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = ref1.
CALL METHOD ref1->check_changed_data.
LOOP AT it_sflight WHERE checkbox = 'X'.
DELETE it_sflight INDEX sy-tabix.
ENDLOOP.
p_selfld-refresh = 'X'.
ENDCASE.
ENDFORM. "user_command -
Reg: CheckBox in ALV Grid Display
Hi all,
My requirement is to display checkbox field in ALV Grid which is editable.
And i also need to get all the records that i have selected in ALV grid.
How can i do it. Kindly Help me with sample codes.
Its Urgent.
<REMOVED BY MODERATOR>
Regards
Naveen
Edited by: Alvaro Tejada Galindo on Feb 18, 2008 5:41 PMHi,
First declare ur itab with the first field of length 1 char,
Dont mention dat in the field cat.
Give that field name and itab name in the layout.
as
is_layout-box_fieldname = 'CHECK'.
is_layout-box_tabname = 'IT_FINAL'.
u can dispaly ur checkbox in the output dispaly.
now to read the selected checkboxes u need to read the display with the syntax..
first describe the table + headre length = w_count.
FORM sub_read_checkbox.
DATA: w_cbox TYPE char1.
REFRESH : it_mail,it_text,it_selected.
REFRESH : it_selected.
DO w_count TIMES.
READ LINE sy-index FIELD VALUE : is_final-cbox INTO w_cbox.
IF w_cbox = c_x.
READ TABLE it_header INTO is_header WITH KEY lifnr = is_header-lifnr
u_r = is_header-u_r.
IF sy-subrc = 0.
APPEND is_header TO it_selected .
CLEAR: is_header,w_cbox.
ENDIF.
ENDIF.
ENDDO.
endform.
This serves ur purpose.
Regards............ -
Problems with checkbox in ALV-GRID OO
Hi,
i have Problems by listing an editable checkbox
in ALV GRID OO and handle the itab with
the marked fields.
Here my Code extract. Has anybody an idea or a short example.
TYPES: BEGIN OF ALV_TAB,
SGTXT LIKE RK23B-SGTXT,
CHECK(1),
END OF ALV_TAB.
DATA: ITAB TYPE TABLE OF ALV_TAB.
Is this Declaration correct??
<b> GS_FIELDCAT-FIELDNAME = 'CHECK'.
GS_FIELDCAT-CHECKBOX = 'X'.
APPEND GS_FIELDCAT TO GT_FIELDCAT.
GS_LAYOUT-EDIT = 'X'.
GS_LAYOUT-BOX_FNAME = 'CHECK'.</b>
CALL METHOD GR_ALVGRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
IT_TOOLBAR_EXCLUDING = PT_EXCLUDE
IS_LAYOUT = GS_LAYOUT
CHANGING
IT_FIELDCATALOG = GT_FIELDCAT
IT_OUTTAB = ITAB.
FORM HANDLE_USER_COMMAND USING E_UCOMM.
CASE E_UCOMM.
WHEN 'REFR'.
<b> Here i will have the itab with the marked checkbox.
how can i refresh?</b>*
WHEN 'EXCEL'.
MESSAGE I010 WITH E_UCOMM.
ENDCASE.
ENDFORM. "HANDLE_USER_COMMAND
Regards, DieterHi, in reference to....
ASE E_UCOMM.
WHEN 'REFR'.
Here i will have the itab with the marked checkbox.
how can i refresh?*
Do you want to get rid of the checks in any checkbox?
If so, just loop at modify.
ASE E_UCOMM.
WHEN 'REFR'.
<b> Loop at itab where check = 'X'.
itab-check = space.
modify itab.
endloop.</b>
Regards,
Rich Heilman
Maybe you are looking for
-
Subsequent debit - different behaviour for PO based IR and GR based IR
Hy Guys, i am facing currently a problem with my understanding of system behaviour for GR Based Invoice Verification in combination with Subsequent Debit Postings... Example 1 - System Behaviour in case of PO based Invoice Verification: PO with 3000
-
Does anyone know if the SATA drivers offered for download will work (properly) with the 64 bit versions of XP and Win 2k3 server? I want to go ahead and at least put the 64 bit XP (Extended Systems) on there, but I don't want to waste my time if it w
-
2nd text of day that phone mended when not -since ...
2nd time today you have texted me to say phone mended- it is not- it remains out of order from 25 Jan- 88 father and 82 mother with no functioning phone
-
I rented yesterday a film into Itunes via my macbook air 13". I have my Sony Tv conected to my macbookair, and itunes says i cannot watch this film into my Sony Bravia TV. I want to refund the price of the film because i cant watch it. I dont want t
-
How to show argument variable names to webservice client
Hi java expert(S)! This is sri, i am creating a webservice using sun java studio enterprise 8.1 IDE, my problem is consumer(from .net) say ,parameter names are not clear or visible. say, for example, my webservice method look like public java.lang.St