Set editable/non-editable checkbox in alv grid
Hi all,
How to set a checkbox in alv grid in editable/non-editable. i am using alv gird display function module for this. i tried to used method cl_gui_alv_grid=>mc_style_disabled. but its not working. is it possible to have this functionality in grid? please help. thanks in advance.
Hi,
Try like this.
CALL METHOD gr_alvgrid->set_table_for_first_display
EXPORTING
I_BUFFER_ACTIVE =
I_CONSISTENCY_CHECK =
I_STRUCTURE_NAME =
IS_VARIANT =
I_SAVE =
I_DEFAULT = 'X'
is_layout = gs_layout
IS_PRINT =
IT_SPECIAL_GROUPS =
IT_TOOLBAR_EXCLUDING =
IT_HYPERLINK =
CHANGING
it_outtab = gt_list[]
it_fieldcatalog = gt_fieldcat
IT_SORT =
IT_FILTER =
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4
regards
Rajesh kumar
Similar Messages
-
How to Set Checkbox of ALV Grid Dark on Display Mode
ABAP experts, I want to switch between display mode and edit mode for some columns of ALV Grid. So I set "LVC_S_FCAT-EDIT" "X" for the columns which need to switch mode, and use method "SET_READY_FOR_INPUT" to switch.
Currently, the function of switch mode has been achieved. But icons of checkbox columns are light but not dark when display mode, although the columns can't be edited. (Please refer to the image below.) I want to make checkbox columns dark as other columns on display mode.
I tried to use "CL_GUI_ALV_GRID=>MC_STYLE_ENABLED" and "CL_GUI_ALV_GRID=>MC_STYLE_DISABLED", but failed. I also studied sample program "BCALV_EDIT_05" which is related to checkbox in ALV Grid, and compared my program with this program. But I still have not found problems.
Help me solve this problem, please.
Part of my codes are as follows.
Part 1:
IF iv_is_create_group = abap_true OR iv_is_edit_group = abap_true.
set_enable( iv_flag = 1 ).
LOOP AT gt_acct_group_item ASSIGNING <lfs_acct_group_item>.
CLEAR ls_celltab.
IF <lfs_acct_group_item>-celltab IS INITIAL.
CLEAR ls_celltab.
ls_celltab-fieldname = 'CHECK_BOX'.
ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.
APPEND ls_celltab TO <lfs_acct_group_item>-celltab.
CLEAR ls_celltab.
ls_celltab-fieldname = 'XPORE'.
ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.
APPEND ls_celltab TO <lfs_acct_group_item>-celltab.
ELSE.
LOOP AT <lfs_acct_group_item>-celltab ASSIGNING <lfs_celltab>.
<lfs_celltab>-style = cl_gui_alv_grid=>mc_style_enabled.
ENDLOOP.
ENDIF.
ENDLOOP.
ELSE.
set_enable( iv_flag = 0 ).
LOOP AT gt_acct_group_item ASSIGNING <lfs_acct_group_item>.
IF <lfs_acct_group_item>-celltab IS INITIAL.
CLEAR ls_celltab.
ls_celltab-fieldname = 'CHECK_BOX'.
ls_celltab-style = cl_gui_alv_grid=>mc_style_disabled.
APPEND ls_celltab TO <lfs_acct_group_item>-celltab.
CLEAR ls_celltab.
ls_celltab-fieldname = 'XPORE'.
ls_celltab-style = cl_gui_alv_grid=>mc_style_disabled.
APPEND ls_celltab TO <lfs_acct_group_item>-celltab.
ELSE.
LOOP AT <lfs_acct_group_item>-celltab ASSIGNING <lfs_celltab>.
<lfs_celltab>-style = cl_gui_alv_grid=>mc_style_disabled.
ENDLOOP.
ENDIF.
ENDLOOP.
ENDIF.
CALL METHOD gr_grid->refresh_table_display
* EXPORTING
* is_stable =
* i_soft_refresh =
EXCEPTIONS
finished = 1
OTHERS = 2
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
Part 2:
METHOD set_enable.
gr_grid->set_ready_for_input(
i_ready_for_input = iv_flag
ENDMETHOD.Hi Liu,
Please go through the below code.
*& Report YEDIT_DISPLAY
REPORT YEDIT_DISPLAY.
TABLES : VBAK.
TYPE-POOLS SLIS.
TYPES : BEGIN OF TY_VBAK,
VBELN TYPE VBAK-VBELN,
END OF TY_VBAK,
BEGIN OF TY_FINAL,
BOX TYPE C,
VBELN TYPE VBAK-VBELN,
END OF TY_FINAL.
DATA : IT_VBAK TYPE TABLE OF TY_VBAK,
WA_VBAK TYPE TY_VBAK,
IT_FINAL TYPE TABLE OF TY_FINAL,
WA_FINAL TYPE TY_FINAL,
IT_FCAT TYPE TABLE OF SLIS_FIELDCAT_ALV,
WA_FCAT TYPE SLIS_FIELDCAT_ALV.
START-OF-SELECTION.
PERFORM FETCH_DATA.
PERFORM FCAT_DATA.
PERFORM DISPLAY.
*& Form FETCH_DATA
* text
* --> p1 text
* <-- p2 text
FORM FETCH_DATA .
SELECT VBELN INTO TABLE IT_VBAK FROM VBAK UP TO 10 ROWS.
LOOP AT IT_VBAK INTO WA_VBAK.
WA_FINAL-VBELN = WA_VBAK-VBELN.
APPEND WA_FINAL TO IT_FINAL.
CLEAR : WA_FINAL , WA_VBAK.
ENDLOOP.
ENDFORM. " FETCH_DATA
*& Form FCAT_DATA
* text
* --> p1 text
* <-- p2 text
FORM FCAT_DATA .
WA_FCAT-COL_POS = 1.
WA_FCAT-FIELDNAME = 'BOX'.
WA_FCAT-TABNAME = 'IT_FINAL'.
WA_FCAT-OUTPUTLEN = '3'.
WA_FCAT-SELTEXT_M = 'BOX'.
wa_fcat-checkbox = 'X'.
WA_FCAT-EDIT = 'X'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.
WA_FCAT-COL_POS = 2.
WA_FCAT-FIELDNAME = 'VBELN'.
WA_FCAT-TABNAME = 'IT_FINAL'.
WA_FCAT-OUTPUTLEN = '3'.
WA_FCAT-SELTEXT_M = 'Sales Document'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.
ENDFORM. " FCAT_DATA
*& Form DISPLAY
* text
* --> p1 text
* <-- p2 text
FORM DISPLAY .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER = ' '
* I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = SY-REPID
* I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
* I_CALLBACK_TOP_OF_PAGE = ' '
IT_FIELDCAT = IT_FCAT
* I_DEFAULT = 'X'
* I_SAVE = ' '
TABLES
T_OUTTAB = IT_FINAL
* EXCEPTIONS
* PROGRAM_ERROR = 1
* OTHERS = 2
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
ENDFORM. " DISPLAY
FORM USER_COMMAND USING UCOMM TYPE SY-UCOMM
RTAB TYPE slis_selfield.
CASE UCOMM.
WHEN '&IC1'.
MESSAGE 'SUCESSFUL' TYPE 'S'.
WHEN '&DATA_SAVE'.
PERFORM FIL_FCAT.
PERFORM DISPLAY1.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
WHEN OTHERS.
LEAVE TO SCREEN 0.
ENDCASE.
ENDFORM.
*& Form FIL_FCAT
* text
* --> p1 text
* <-- p2 text
FORM FIL_FCAT .
CLEAR IT_FCAT.
WA_FCAT-COL_POS = 1.
WA_FCAT-FIELDNAME = 'BOX'.
WA_FCAT-TABNAME = 'IT_FINAL'.
WA_FCAT-OUTPUTLEN = '3'.
WA_FCAT-SELTEXT_M = 'BOX'.
wa_fcat-checkbox = 'X'.
** WA_FCAT-EDIT = 'X'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.
WA_FCAT-COL_POS = 2.
WA_FCAT-FIELDNAME = 'VBELN'.
WA_FCAT-TABNAME = 'IT_FINAL'.
WA_FCAT-OUTPUTLEN = '3'.
WA_FCAT-SELTEXT_M = 'Sales Document'.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.
ENDFORM. " FIL_FCAT
*& Form DISPLAY1
* text
* --> p1 text
* <-- p2 text
FORM DISPLAY1 .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER = ' '
* I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = SY-REPID
* I_CALLBACK_TOP_OF_PAGE = ' '
IT_FIELDCAT = IT_FCAT
* I_DEFAULT = 'X'
* I_SAVE = ' '
TABLES
T_OUTTAB = IT_FINAL
* EXCEPTIONS
* PROGRAM_ERROR = 1
* OTHERS = 2
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
ENDFORM. " DISPLAY1
Here i written code under the SAVE button , if requires you create your own status and apply.
Regards,
Krishna -
Is it possible that a particular row of IWDTable set to non editable?
Hi All,
Is it possible that a particular row of IWDTable set to non editable on the basis of a field value ?? Plz help.Context
+ Rows (node)
+ value (integer)
+ readOnly (boolean,calculated=true)
Bind the "readOnly" property of the InputField (cell editor) to the "readOnly" attribute shown above. Implement the calculated attribute getter like
boolean getRowsReadOnly(IRowsElement element)
return element.getValue() == 42; /* or whatever */
Armin -
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 -
User command for checkbox in alv grid output
Hi,
Does anyone knows the user command for checkbox in alv grid display. My requirement is to have a column for checkbox in alv output. When the user checks the checkbox, a pop-up dialog box will appear. This dialog box was created in screen painter. I can't find the user command for this. Please help.
Thanks in advance.Hi,
there r two ways for creating checkbox col on the ALV grid.
1.) take an extra field in your internal table i.e
data:
checkbox type c.
loop at internal_table into wa.
checkbox.
endloop.
or
the fieldcatalog attribute
2.) wa_fcat-checkbox = 'X'.
append wa_fcat to t_fcat.
clear wa_fcat.
if itab-checkbox = 'X'.
call screen <dialogbox screen number>.
endif.
regards
ravi -
ALV grid field editable/non editable at runtime
Hi All,
I am working on alv grid using containers. I have to make few cells in grid to editable and few othres to non editable which I did using styles by defining table type lvc_t_styl and updating my main internal table. Now once grid is displayed for first time (using set_table_for_first_display) it has required fields in editable and non editable as required. But now on triggering of data_changed event I have to change the editable cells to non editable and the non editable cells to editable. I tried doing this as same way as I have done before calling set_table_for_first_display method i.e. by defining table of type lvc_t_styl in data_changed event and modifying my main internal table but this time the editable fields are changed to non editable and again becomes editable. Same problem with non editable cells also. They become editable and again becomes non ediatble of there own. Can anyone suggest any solution.
<b>Note: Points awarded for helpful answers</b>
nullHi,
Check this link.I am explaining the steps for this.
Kindly reward points by clicking the star on the left of reply,if it helps.<a href="https://wiki.sdn.sap.com/wiki/display/Snippets/ALV-Editingandsavingtheeditedvaluesin+Database(OOPS)">Editing OOPS ALV</a> -
EDIT THE FIELV VALUE IN ALV GRID DISPLAY
Hi Guru ,
How can I edit the value of a particular one or two fields in ALV GRID DISPLAY .
Please reply mehi,
1.Set status of all cells to editable using the layout structure.
2.Use SET_READY_FOR_INPUT to activate the edit feature initially.
(state "editable activated").
3.Use IS_READY_FOR_INPUT to fetch current substate of editable cells.
4.Use SET_READY_FOR_INPUT to switch between the substates.
CALL METHOD g_grid->set_table_for_first_display
EXPORTING i_structure_name = 'SFLIGHT'
is_layout = gs_layout
CHANGING it_outtab = gt_outtab.
*§2.Use SET_READY_FOR_INPUT to allow editing initially.
* (state "editable and ready for input").
CALL METHOD g_grid->set_ready_for_input
EXPORTING i_ready_for_input = 1.
*Use IS_READY_FOR_INPUT to fetch current substate of editable cells.
IF g_grid->is_ready_for_input( ) EQ 0.
*Use SET_READY_FOR_INPUT to switch between the substates.
CALL METHOD g_grid->set_ready_for_input
EXPORTING i_ready_for_input = 1.
ELSE.
CALL METHOD g_grid->set_ready_for_input
EXPORTING i_ready_for_input = 0.
ENDIF. -
Payment Term field to be set as Non Editable in Sales Order
Hi,
I have a requirement, in which the user wants to make the Payment Term field in Sales Order as Non Editable in case the Payment terms is copied from Customer Master to Sales order.
In case no value is copied, it should be editable.
Is there any setting to make this happen.
Can anyone help on this?
Please advise.
Regards,
HarshHarsh,
2 Options,
1 by changing screen variants by SHD0
2. By modifying USEr Exit.
Thanks,
Raja -
Setting ComboBox editable/non-editable in JTable
Hi,
I had a problem I am having a JTable and one of the column in ComboBox.Basing on a cell value the ComboBox should be editabl.e/Non-editable.
I used the setValueAt() method of JTable to set the comboBox and also implemented the cellChangeListener.But it did not work while loading the data intially..Plz help me....
Regards
KiranKiran,
You ignore the words of a goddess at your peril: http://forum.java.sun.com/thread.jsp?forum=57&thread=556061&tstart=15&trange=15
It sounds like some of the values in your TableModel are JComboBoxes, no? That's seems an odd thing.
Are you confusing the data with cell editors? What is your data design? -
hi all,
Is there any way to handle the single click/tick on checkbox. Is there user command on that? For now, if we will click on the checkbox, the changes made on it does not reflect. I checked on the debugging mode, checkbox is not populated/ marked even if it was ticked by the user.
thanks in advance.Hi Akira,
For Controling Check Box , you have to use grid display using customised Container screen.
From there you can control check Box .
CREATE OBJECT custom_container
EXPORTING container_name = o_container.
CREATE OBJECT o_grid
EXPORTING i_parent = custom_container.
Form for building the fieldcatalog
PERFORM build_fieldcat CHANGING it_fieldcat.
Form for excluding the unwanted functionalities from the toolbar.
PERFORM exclude_tb_functions CHANGING it_exclude.
Method for displaying the ALV grid.
CALL METHOD o_grid->set_table_for_first_display
EXPORTING
is_layout = it_layout
it_toolbar_excluding = it_exclude
CHANGING
it_fieldcatalog = it_fieldcat
it_outtab = it_final.
CREATE OBJECT o_event_receiver.
Setting the event handlers for events toolbar, usercommand and datachange.
SET HANDLER o_event_receiver->catch_toolbar FOR o_grid.
SET HANDLER o_event_receiver->catch_user_command FOR o_grid.
SET HANDLER o_event_receiver->catch_datachange FOR o_grid.
Set editable cells to ready for input.
CALL METHOD o_grid->set_ready_for_input
EXPORTING
i_ready_for_input = 1. -
To activate/deactivate checkbox in ALV grid report
Hi All,
I am trying to create an ALV Grid that contains check-box as column fields. I am able to either activate or deactivate all the check-boxes in the entire column. But, I need to keep only certain check-boxes for editing based on certain conditions. The other check-boxes in the column should be deactivated for editing by the user. Any help is appreciated.
-DineshHi dinesh babu ,
In this example, i use 'REUSE_ALV_GRID_DISPLAY_LVC'
FORM display_alv .
DATA: ls_event_exit TYPE slis_event_exit,
lt_event_exit TYPE slis_event_exit OCCURS 1.
DESCRIBE TABLE itab_data LINES lv_cont.
PERFORM layout_build USING gs_layout.
PERFORM eventtab_build USING gt_events[].
PERFORM comment_build USING gt_lheader[].
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'ZHRESS_FORMACION_ALV'
i_client_never_display = 'X'
i_bypassing_buffer = 'X'
CHANGING
ct_fieldcat = gt_fieldcat[]
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT gt_fieldcat INTO ls_fcat.
Active check field
IF ls_fcat-fieldname EQ 'CHECK'.
ls_fcat-checkbox = 'X'.
ls_fcat-edit = 'X'.
ls_fcat-fix_column = 'X'.
ls_fcat-reptext = 'Check'.
ENDIF.
PERFORM field_attributes.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
EXPORTING
i_background_id = 'ALV_BACKGROUND'
i_callback_program = g_repid
i_callback_pf_status_set = 'PF_STATUS'
i_callback_user_command = 'USER_COMMAND'
is_layout_lvc = gs_layout
it_fieldcat_lvc = gt_fieldcat[]
i_save = g_save
is_variant = g_variant
it_events = gt_events[]
it_event_exit = lt_event_exit
i_default = 'X'
TABLES
t_outtab = itab_data.
ENDFORM. " DISPLAY_ALV
FORM field_attributes .
DATA ls_stylerow TYPE lvc_s_styl .
DATA lt_styletab TYPE lvc_t_styl .
LOOP AT itab_data INTO wa_data.
IF wa_data-status NE c_status_p. " Condition for enable / disable check
ls_stylerow-fieldname = 'CHECK' .
ls_stylerow-style = cl_gui_alv_grid=>mc_style_disabled. "set field to disabled
APPEND ls_stylerow TO wa_data-field_style.
MODIFY itab_data FROM wa_data.
ENDIF.
ENDLOOP.
ENDFORM.
Regards,
José
Edited by: Jose Luzardo on Oct 6, 2009 3:37 PM -
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............ -
Total and non-total lines in ALV grid
Hi all,
Does anyone know if there is any standard SAP functionality for retrieving the non-total/raw item lines that lies beneath a total line in an ALV grid (after the user has selected the total line)?
All helpful answers will be rewarded!
Best regards,
MVTry the ALV event AFTER-LINE-OUTPUT may be it can help u to achieve ur requirement.
Append AFTER-LINE-OUTPUT event to the internal table T_EVENT.
CLEAR W_EVENT.
W_EVENT-FORM = SLIS_EV_AFTER_LINE_OUTPUT.
W_EVENT-NAME = SLIS_EV_AFTER_LINE_OUTPUT.u201CAFTER_LINE_OUTPUT event
APPEND W_EVENT TO T_EVENT.
FORM AFTER_LINE_OUTPUT
USING P_RS_LINEINFO TYPE SLIS_LINEINFO.
Here you have to write the logic to retrieve the 'total' line
ENDFROM.
Now call the alv FM
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = L_REPID "Program Name
IS_LAYOUT = W_LAYOUT "Layout of the Report
IT_FIELDCAT = T_FIELDCAT "Field Catalog for Report
IT_EVENTS = T_EVENT "For setting the events
TABLES
T_OUTTAB = T_OUTPUT "Report data Internal Table
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2. -
Handling checkboxes in ALV Grid.
Hi guys.
I have displayed an ALV grid with checkboxes. I want to opearate on the selected checkboxes by the user by clicking on a added button.
I am using oops and using function set_table_for_first_display.
if no box is selected the function works properly. If i select a checkbox, i get a dump.
ThanksHi arun
here is the required code.
<b>Form to register events</b>
FORM register_events .
CREATE OBJECT gr_event_handler .
SET HANDLER gr_event_handler->handle_toolbar FOR gr_alvgrid .
SET HANDLER gr_event_handler->handle_user_command FOR gr_alvgrid.
SET HANDLER gr_event_handler->handle_hotspot_click FOR gr_alvgrid.
SET HANDLER gr_event_handler->handle_double_click FOR gr_alvgrid.
ENDFORM.
<b>Class Defination and implementation</b>
CLASS LCL_EVENT_HANDLER DEFINITION.
PUBLIC SECTION .
METHODS:
*To add new functional buttons to the ALV toolbar
handle_toolbar FOR EVENT toolbar OF cl_gui_alv_grid
IMPORTING e_object e_interactive,
*To implement user commands.
handle_user_command
FOR EVENT user_command OF cl_gui_alv_grid
IMPORTING e_ucomm,
To handle hotspot click.
handle_hotspot_click
FOR EVENT hotspot_click OF cl_gui_alv_grid
IMPORTING e_row_id e_column_id es_row_no,
To handle Double Click
handle_double_click
FOR EVENT double_click OF cl_gui_alv_grid
IMPORTING e_row e_column .
ENDCLASS. "LCL_EVENT_HANDLER DEFINITION
*& Class (Implementation) lcl_event_handler
Text
CLASS lcl_event_handler IMPLEMENTATION.
METHOD handle_toolbar.
PERFORM handle_toolbar USING e_object.
ENDMETHOD . "handle_toolbar
METHOD handle_user_command.
perform handler_user_command using e_ucomm .
ENDMETHOD. "handle_user_command
METHOD handle_hotspot_click .
PERFORM handle_hotspot_click USING e_row_id e_column_id es_row_no .
ENDMETHOD . "handle_hotspot_click
METHOD handle_double_click .
PERFORM handle_double_click USING e_row e_column .
ENDMETHOD . "handle_hotspot_click
ENDCLASS. "lcl_event_handler
<b>
PBO of screen that is called after the pushbutton is pressed.</b>
MODULE STATUS_9400 OUTPUT.
SET PF-STATUS 'SCREEN9400'.
perform diaply_checkbox.
<b>and the method display_checkbox.</b>
FORM diaply_checkbox .
data: count type i.
count = 0.
loop at za004_t_t into wa_a004_t_t.
if wa_a004_t_t-checkboc = 'X'.
count = count + 1.
endif.
count = count + 1.
endloop.
ENDFORM. " diaply_checkbox
thanks
Abhinav Dhasmana -
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
Maybe you are looking for
-
I get the above error whenever I try to logon to InfoView. My LDAP accounts work for CMC. Any Suggestions? I read somewhere it has something to do with my dn having the following content: distinguisheName CN=Hill\, Patrick,OU-Users,OU=GBH,OU=Faci
-
Monitor calibratio​n problems after installing windows 8.1
I have a hp envy m6-1105tx and right after installing windows 8.1 my monitor changed completely. When i have a photo open in photoshop tones, colors luminosity, gamma etc are all wrong. Before i never had problems, when i looked at a photo in photosh
-
Trouble Shooting Acrobat Installation
I receiced these errors when I tried to reinstall Acrobat. It was installed previously but now I'm getting error messages. Exit Code: 6 Please see specific errors and warnings below for troubleshooting. For example, ERROR: DW050 ... WARNING: DW065,
-
How to avoid having to accept the same outlook invitation in iCal on both my iPad and my MBP?
Hi all, I manage my agenda on both my MBP that I use at work, as my iPad. On both I sync with the outlook agenda that is used at work. All fine, except for one annoying thing: when work invitations are send from outlook, they rightfully appear as inv
-
I had a computer crash last week and i lost al my music, documents, photos and videos. I had a back-up from al those things except from the photos. They are still on my iPod, but not on my computer. Is there a way to get them back? I would really app