Urgent checkboxes handling in alv grid
helo all .i need to handle checkboxes in alv grid.
i did like
case u_comm.
when 'save'.
perform save.
endcase.
in the form.
form save.
loop at it_mara into it_mara1 where chk = 'X'
and moving the contents to it_mara1.
but after doing it is not looping when i have seen in debug .
plz help me
i need to have those selected values and move a head.
Hi rakhee,
First add a single charecter field into the internal table you want to display in the ALV.Then set the field cataloge and set the value for Checkbox as 'X'.it wil display the field as a check box.when you check the check box it will update the internal table also.
please check the below code.
TYPE-POOLS : slis.
TYPES : BEGIN OF st_mara.
TYPES : matnr TYPE mara-matnr.
TYPES : a,
END OF st_mara.
DATA : it_fieldcat TYPE slis_t_fieldcat_alv,
wa_fieldcat LIKE LINE OF it_fieldcat.
DATA : it_mara TYPE TABLE OF st_mara.
SELECT * FROM mara
INTO CORRESPONDING FIELDS OF TABLE it_mara UP TO 1 ROWS.
wa_fieldcat-col_pos = 1.
wa_fieldcat-fieldname = 'A'.
wa_fieldcat-checkbox = 'X'.
wa_fieldcat-edit = 'X'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = 2.
wa_fieldcat-fieldname = 'MATNR'.
APPEND wa_fieldcat TO it_fieldcat.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
it_fieldcat = it_fieldcat
TABLES
t_outtab = it_mara.
BREAK-POINT.
if you are using controls just call the method
CALL METHOD grid1->check_changed_data.
grid1 is the instance of the ALV grid.
when the method is called you will get the internal table with the field marked as 'X'.
Regards
Sandeep
Similar Messages
-
How to add an editable checkbox to an alv grid
Hi..
I need to add an editable checkbox to a alv grid.
I wouls appreciatet it if anyone could provide some sample code.
The standard example BCALV_EDIT_05 is an oops example... I need a simple example
Please help
thanks
Karenhi
after you pass a field as checkbox in fieldcat
then in layout populate edit
ex wa_layout-edit = 'X'.
try the following code
REPORT ZALV5.
TYPE-POOLS: slis.
tables: mara.
DATA: begin of it_mara OCCURS 0,
matnr like mara-matnr,
mbrsh like mara-mbrsh,
matkl like mara-matkl,
meins like mara-meins,
ersda like mara-ersda,
ernam like mara-ernam,
W_CHK type c ,
END OF it_mara.
*data: it_mara like mara occurs 0 with header line.
data:it_feildtab type slis_t_fieldcat_alv,
wa_fieldcat type slis_fieldcat_alv.
*DATA: i_private TYPE slis_data_caller_exit,
data: i_selfield TYPE slis_selfield,
W_exit(1) TYPE c.
PARAMETERS: p_title TYPE sy-title default 'ALV'.
START-OF-SELECTION.
SELECT matnr mbrsh matkl meins ersda ernam FROM mara
INTO corresponding fields of table it_mara.
wa_fieldcat-col_pos = '1'.
wa_fieldcat-fieldname = 'W_CHK'.
*wa_FIELDCAT-KEY = 'X'.
*wa_fieldcat-tabname = 'IT_MARA'.
*wa_fieldcat-seltext_s = 'units of measure'.
wa_fieldcat-checkbox = 'X'.
APPEND wa_fieldcat TO it_feildtab.
CLEAR wa_fieldcat .
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = '2'.
wa_fieldcat-tabname = 'IT_MARA'.
wa_fieldcat-fieldname = 'MATNR'.
wa_fieldcat-key = 'X'.
wa_fieldcat-hotspot = 'X'.
wa_fieldcat-seltext_s = 'no'.
APPEND wa_fieldcat TO it_feildtab.
CLEAR wa_fieldcat .
wa_fieldcat-col_pos = '3'.
wa_fieldcat-fieldname = 'MBRSH'.
*wa_FIELDCAT-KEY = 'X'.
wa_fieldcat-tabname = 'IT_MARA'.
wa_fieldcat-seltext_s = 'Ind.sec'.
APPEND wa_fieldcat TO it_feildtab.
CLEAR wa_fieldcat .
wa_fieldcat-col_pos = '4'.
wa_fieldcat-fieldname = 'MATKL'.
*wa_FIELDCAT-KEY = 'X'.
wa_fieldcat-tabname = 'IT_MARA'.
wa_fieldcat-seltext_s = 'Description'.
APPEND wa_fieldcat TO it_feildtab.
CLEAR wa_fieldcat .
wa_fieldcat-col_pos = '5'.
wa_fieldcat-fieldname = 'MEINS'.
*wa_FIELDCAT-KEY = 'X'.
wa_fieldcat-tabname = 'IT_MARA'.
wa_fieldcat-edit = 'X'.
wa_fieldcat-seltext_s = 'units of measure'.
APPEND wa_fieldcat TO it_feildtab.
CLEAR wa_fieldcat .
CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
EXPORTING
i_title = p_title
i_selection = 'X'
i_zebra = 'X'
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
i_checkbox_fieldname = 'W_CHK'
I_LINEMARK_FIELDNAME =
I_SCROLL_TO_SEL_LINE = 'X'
i_tabname = 'IT_MARA'
i_structure_name = 'IT_MARA'
IT_FIELDCAT = it_feildtab
IT_EXCLUDING =
I_CALLBACK_PROGRAM =
I_CALLBACK_USER_COMMAND =
IS_PRIVATE = I_PRIVATE
IMPORTING
es_selfield = i_selfield
e_exit = w_exit
TABLES
t_outtab = it_mara
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE i000(0k) WITH sy-subrc.
ENDIF.
LOOP AT it_mara WHERE W_CHK = 'X'.
WRITE: / it_mara-ersda, it_mara-ernam.
ENDLOOP.
reward if helpful
prasanth -
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 -
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. -
Moderator message: do not post the same question in more than one forum. Duplicate has been rejected
Hi,
I have 3 ALV Grids in my reports done by using containers with CL_GUI_ALV_GRID....
Each ALV Grid display a table....
Each toolbar of the grid has a print button.....
Here i have 2 questions...
i) when a print button of a grid is pressed..how can i know the grid of which the print button is pressed...i.e. if grid one print button is pressed..then how can i know it is triggered from Grid one and likewise for grid 2 and grid 3.
Im using same method for the event user_command for the three grids.......
ii) WHen layout is changed for a particular ALV grid...i.e. if some columns are made hidden...then when print button is pressed..Then i need to print only the columns of changed layout.............
How can i know the columns of the changed layout..........
<<Forbidden phrase removed>>
Thanks in Advanceeee
Sai Santosh
Edited by: Matt on Dec 15, 2008 3:45 PM1 - In local class definition, use the [SENDER|http://help.sap.com/saphelp_nw04s/helpdata/en/71/a8a77955bc11d194aa0000e8353423/frameset.htm] parameter of the event you manage.
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
METHODS:
handle_double_click
FOR EVENT double_click OF cl_gui_alv_grid
IMPORTING e_row e_column sender.
PRIVATE SECTION.
ENDCLASS.
Then in the implemented method check the value, or use the object sender like any alv grid object.
CLASS lcl_event_receiver IMPLEMENTATION.
METHOD handle_double_click.
CASE sender.
WHEN grid1.
(Doc: [Event Handling|http://help.sap.com/saphelp_sm32/helpdata/EN/9b/d080b49fc111d2bd68080009b4534c/frameset.htm])
2-use the method [GET_FRONTEND_FIELDCATALOG|https://www.sdn.sap.com/irj/scn/advancedsearch?query=get_frontend_fieldcatalog&cat=sdn_all] of CL_GUI_ALV_GRID to get the curent layout.
Regards -
Enabled and Desabled Checkboxes in an ALV Grid
Hallo Everybody!
I have an ALV grid made with CL_GUI_ALV_GRID methods.
As the first field of the list there's an editable checkbox that allows to make certain operations on the toolbar with the selected cells.
Now I need to disable some of these checkboxes only, for a precise kind of conditions of the IT_OUTTAB.
How can I do it?
Thanks in advance.
Regards
Alfonso GentileThis is some example code that does something close to what you are asking.
The output table definition
DATA: BEGIN OF gt_outtab OCCURS 0.
INCLUDE STRUCTURE zscemp_wk.
DATA: cellstyles TYPE lvc_t_styl.
DATA: END OF gt_outtab.
The logic that sets the field to disabled/enabled based on conditions.
*& Form adjust_editables
FORM adjust_editables USING pt_list LIKE gt_outtab[].
DATA: ls_listrow LIKE LINE OF pt_list.
DATA: ls_stylerow TYPE lvc_s_styl.
DATA: ls_styletab TYPE lvc_t_styl.
LOOP AT pt_list INTO ls_listrow.
REFRESH ls_listrow-cellstyles.
REFRESH ls_styletab.
IF edit_mode EQ 'D'.
ls_stylerow-fieldname = 'BRANCH'.
ls_stylerow-style = cl_gui_alv_grid=>mc_style_disabled.
APPEND ls_stylerow TO ls_styletab.
ENDIF.
ls_stylerow-fieldname = 'EMPNO'.
IF ls_listrow-empno IS INITIAL
AND edit_mode EQ 'E'.
ls_stylerow-style = cl_gui_alv_grid=>mc_style_enabled. "<== here setting to enabled
ELSE.
ls_stylerow-style = cl_gui_alv_grid=>mc_style_disabled.. "<== here setting to diabled
ENDIF.
APPEND ls_stylerow TO ls_styletab.
INSERT LINES OF ls_styletab INTO TABLE ls_listrow-cellstyles.
MODIFY pt_list FROM ls_listrow.
ENDLOOP.
ENDFORM. " adjust_editables -
Urgent : Problem with Editable ALV Grid for Quantity and Currency Fields
Hi All,
I am using Editable ALV Grid display and have quantity and value as editable fields in the display.
When user changes these values these values are not changing properly .
For the quantity field the domain is MENG13 with 3 deciamal places and here if we enter 500 it takes it as 0.500 .
The same problem is for the currency field. Here the Domain is WERT7 with 3 decimal places.
Here also it takes last 2 digits after decimal places by default.
Please advice how to get proper values in this case from ALV editable fields.
Thanks and Regards
Harshad
Edited by: Harshad Rahirkar on Dec 25, 2007 7:39 AMfor all the currency field , it will display like that only.
u have to manipulate uin program before displaying.
if they are giving 500, in program multiply with 100 and move it to table.
when u are getting from table, divinde and display.
this is what I am doing.
Reward if helpfull. -
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 -
Create unique handle for ALV grid layout
Hi,
in some generic classes we display internal tables in a grid. We want to activate the save&maintain layouts feature by passing the DISVARIANT structure, Here wen have to give Report and handle. As we display some more tables using the same method, we must set a unique handle so that saved ALV layouts do not get merged /confused. As we do not have a table name at this point, my idea is to create a hash key based on the fields in the field catalog (field catalog is only distinguishable object here).
I need an algorithm to create the 4-character handle as a hash value based on the (concatenated) field names in field catalog.
Or a better idea to create unique handles in the generic ALV calls in one program.
Please: Serious answers only.
Regards,
ClemensHere it is
function enqueuecomputehash.
*"*"Lokale Schnittstelle:
*" IMPORTING
*" VALUE(INPUT) TYPE STRING
*" VALUE(INPUT_LEN) TYPE I
*" VALUE(HASH_LEN) TYPE I
*" EXPORTING
*" REFERENCE(HASH) TYPE STRING
*" REFERENCE(TIME_USEC) TYPE I
*" EXCEPTIONS
*" INVALID_ARGUMENT
field-symbols <text>.
field-symbols <hash>.
data: tmp_input type text8192.
data: tmp_hash type text8192.
if input_len < 1 or hash_len < 1.
raise invalid_argument.
endif.
assign tmp_input(input_len) to <text>.
assign tmp_hash(hash_len) to <hash>.
data: t1 type i,
t2 type i.
<text> = input.
get run time field t1.
call 'C_ENQ_WILDCARD' id 'TEXT' field <text>
id 'TEXTHASH' field <hash>.
get run time field t2.
hash = <hash>.
time_usec = t2 - t1.
endfunction. -
Struggling with f4 handling in ALV grid - Minisap 46D
Hi to all,
I got an abap problem developing with my Minisap 46D,
and i can't realy struggle out for a solution,
Issue concern using of self defined F4 in ALV ( created via objects),
Each program (standard program as in eg.BCALV_GRID_EDIT )
given by SAP to show use of ALV self definded F4 doesn't wark at all this option,
and when i click on the cell in order to show F4 set of values, program brake down in ABAP error,
Always the same happen with my z programs when they calls method written to manage F4,
following existing examplaes i think i put instructions in the right place and in proper way:
I mean defining implementing and registering onf4 event,
Further i see that standard programs with f4 dumping on my minisap are working proper on the normal SAP at work place,
Does this depend on some Minisap strange bugs in standard ALV class? What can i do?
I would be grateful to anyone who help me solving this SAP mistery,
So I got:
Error analysis (and syntesys of the short dump )
ABAP runtime errors CALL_METHOD_CONFLICT_TYPE
The call to method "ON_F4" is incorrect
The system tried to pass field "%_DUMMY$$" to the formal parameter " ".
"CALL_METHOD_CONFLICT_TYPE"
"BCALV_GRID_EDIT " or "BCALV_GRID_EDIT "
"HANDLE_F4"
"HANDLE_F4"
000740 *----
000750 * CLASS lcl_event_receiver IMPLEMENTATION
000780
000790 class lcl_event_receiver implementation.
000800 method handle_data_changed.
000810 perform data_changed using er_data_changed.
000820 endmethod.
000830
> method handle_f4.
000850 perform f4 using e_fieldname
000860 es_row_no
000870 er_event_data
000880 et_bad_cells.
000890 endmethod.
or looking at my custom program:
ABAP runtime errors CALL_METHOD_CONFLICT_TYPE
Error analysis
The call to method "HANDLE_ON_F4" is incorrect.
The system tried to pass field "%_DUMMY$$" to the formal parameter "E_FIELDVALUE".
003430
> method handle_on_f4.
003450
003460 data: pe_fieldname type lvc_fname,
003470 pe_fieldvalue type lvc_value,
003480 pes_row_no type lvc_s_roid,
003490 per_event_data type ref to
cl_alv_event_data,
003500 pet_bad_cells type lvc_t_modi,
003510 pe_display type char01.
003520
003530
003540 perform f4_help using pe_fieldname
pes_row_no.
003550
003560 endmethod.
PS. I'm not showing here code section where I register
and set handling event but is the usual, as
indicated in standard procedure,I would recommend above all else simply upgrading:
https://www.sdn.sap.com/irj/sdn/downloads
NW04s is the latest FULL ABAP version available with Web Dynpro. -
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............ -
Multiple checkbox selection in ALV and updating internal table
Dear Expert,
Can anyone tell me how to handle the multiple checkbox selection in ALV Grid report and then updating the internal table.
I tried the option but it works only when i select only 1 row in ALV.
DO L_LINES TIMES.
read table icoas index rs_selfield-tabindex.
if sy-subrc = 0.
ICOAS-NOCHK = 'X'.
modify ICOAS INDEX rs_selfield-tabindex TRANSPORTING NOCHK.
ENDIF.
ENDDO.
Requires help....
Regards & Thanx,
Bhupathi.Hi,
Use this method to capture the check box event. Write this once you create your grid using CREATE OBJECT grid1.
DATA: GRID1 TYPE REF TO CL_GUI_ALV_GRID,
CALL METHOD grid1->register_edit_event
EXPORTING
i_event_id = CL_GUI_ALV_GRID=>MC_EVT_MODIFIED
EXCEPTIONS
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.
LOOP AT T_GRIDDETAILS INTO WA_GRIDDETAILS.
IF WA_GRIDDETAILS-CHECKBOX = 'X'.
"Do your operation
ENDIF.
CLEAR WA_GRIDDETAILS.
ENDLOOP. -
Regard check box concept in alv grid display
HI Friends,
i am displaying the sales order details with check box. so my first field is checkbox. When user click on check box then he press the details icon.
my question i need a logic for calling the tcode based on the vbeln when it is cheked.
thanks in advance.
Regards,
Purna.hi,
go through this program
program bcalv_edit_05.
Purpose:
~~~~~~~~
This example shows how to use checkboxes within an ALV Grid Control.
You learn:
o how to define a column for editable checkboxes for an attribute
of your list (see also remark below)
o how to evaluate the checked checkboxes
o how to switch between editable and non-editable checkboxes
Important Remark
~~~~~~~~~~~~~~~~
The checkbox functionality has been replaced by selection buttons
in front of each row (field SEL_MODE of the layout structure
set to 'A' or 'D'; when using the editable ALV Grid Control,
these selection buttons are always visible).
Class methods like GET_SELECTED_ROWS work only for this new
functionality and not for checkboxes.
Thus checkboxes should not be used for line selection but for
a column as an additional or for an already existing attribute
(like field SMOKER in SBOOK).
To check program behavior
~~~~~~~~~~~~~~~~~~~~~~~~~
Try out the functions displayed in the application toolbar:
o The first sets all checked lines to initial values.
(see form reset_selected_entries)
o The seconds marks all checkboxes that are input enabled
o The third unmarks all checkboxes that are input enabled
o To try the forth, you have to select a line first using
the selection buttons on the left.
The function deactivates/activates a checkbox.
Checkboxes may be locked/unlocked using a double click on the
checkbox cell.
Essential steps (search for '§')
~~~~~~~~~~~~~~~
This example focusses on two aspects of checkboxes in an
editable ALV Grid Control:
A How to integrate, set, reset and evaluate checkboxes
B What you must do to lock particular checkboxes against input
A) Integrate, set, reset and evaluate checkboxes
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
A1.Extend your output table by a checkbox field.
A2.Add an entry for the checkbox in the fieldcatalog
A3.Optionally, check checkboxes initially after selecting data.
A4.Before you (a)set, (b)reset, (c)(de)activate or
(d)evaluate checkboxes, you must check the input cells.
B) Lock particular checkboxes against input
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
B1.Extend your output table by a field to dis- or enable
cells for input.
B2.After selecting data,
assign a style for each row of your checkbox column.
B3.Use the layout structure to aquaint additional field to ALV.
B4.Switch the style to dis- or enable a cell for input
class lcl_event_receiver definition deferred. "for event handling
data: ok_code like sy-ucomm,
save_ok like sy-ucomm,
g_container type scrfname value 'BCALV_GRID_DEMO_0100_CONT1',
g_grid type ref to cl_gui_alv_grid,
g_custom_container type ref to cl_gui_custom_container,
g_event_receiver type ref to lcl_event_receiver,
gt_fieldcat type lvc_t_fcat,
gs_layout type lvc_s_layo,
g_max type i value 100.
*§A1.Extend your output table by a checkbox field.
If you do not want to lock sole checkboxes against input
you do not need field 'celltab'.
types: begin of gs_outtab.
types: checkbox type c. "field for checkbox
§B1.Extend your output table by a field to dis- or enable
cells for input.
types: celltab type lvc_t_styl. "field to switch editability
include structure sflight.
types: end of gs_outtab.
data: gt_outtab type gs_outtab occurs 0 with header line.
LOCAL CLASSES
This local class only handles event DOUBLE_CLICK.
Wenn the user double clicks on a checkbox cell the status of
this cell is switched from editable to not editable and vice versa.
class lcl_event_receiver definition.
public section.
methods: catch_doubleclick
for event double_click of cl_gui_alv_grid
importing
e_column
es_row_no
sender.
endclass.
class lcl_event_receiver implementation.
method catch_doubleclick.
data: ls_outtab type gs_outtab,
ls_celltab type lvc_s_styl.
Function:
Switch between 'editable' and 'not editable' checkbox.
If the user clicked on another column there is
nothing to do.
if e_column-fieldname ne 'CHECKBOX'.
exit.
endif.
read table gt_outtab into ls_outtab index es_row_no-row_id.
The loop is only needed if there are other columns that
use checkboxes. At this point the loop could be
replaced by a READ of the first line of CELLTAB.
loop at ls_outtab-celltab into ls_celltab.
if ls_celltab-fieldname eq 'CHECKBOX'.
§B4.Switch the style to dis- or enable a cell for input
if ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.
ls_celltab-style = cl_gui_alv_grid=>mc_style_disabled.
else.
ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.
endif.
modify ls_outtab-celltab from ls_celltab.
endif.
endloop.
modify gt_outtab from ls_outtab index es_row_no-row_id.
call method sender->refresh_table_display.
endmethod.
endclass.
MAIN *
end-of-selection.
call screen 100.
MODULE PBO OUTPUT *
module pbo output.
set pf-status 'MAIN100'.
set titlebar 'MAIN100'.
if g_custom_container is initial.
perform create_and_init_alv.
endif.
endmodule.
MODULE PAI INPUT *
module pai input.
save_ok = ok_code.
clear ok_code.
case save_ok.
when 'EXIT'.
perform exit_program.
when 'SELECT'.
perform select_all_entries changing gt_outtab[].
when 'DESELECT'.
perform deselect_all_entries changing gt_outtab[].
when 'RESET'.
perform reset_selected_entries changing gt_outtab[].
when 'SWITCH'.
perform switch_activation changing gt_outtab[].
endcase.
endmodule.
FORM EXIT_PROGRAM *
form exit_program.
leave program.
endform.
*& Form BUILD_FIELDCAT
text
<--P_GT_FIELDCAT text
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.
*& Form CREATE_AND_INIT_ALV
text
<--P_GT_OUTTAB text
<--P_GT_FIELDCAT text
<--P_GS_LAYOUT text
form create_and_init_alv.
data: lt_exclude type ui_functions.
create object g_custom_container
exporting container_name = g_container.
create object g_grid
exporting i_parent = g_custom_container.
perform build_fieldcat changing gt_fieldcat.
Exclude all edit functions in this example since we do not need them:
perform exclude_tb_functions changing lt_exclude.
perform build_data.
*§ B3.Use the layout structure to aquaint additional field to ALV.
gs_layout-stylefname = 'CELLTAB'.
call method g_grid->set_table_for_first_display
exporting is_layout = gs_layout
it_toolbar_excluding = lt_exclude
changing it_fieldcatalog = gt_fieldcat
it_outtab = gt_outtab[].
create object g_event_receiver.
set handler g_event_receiver->catch_doubleclick for g_grid.
Set editable cells to ready for input initially
call method g_grid->set_ready_for_input
exporting
i_ready_for_input = 1.
endform. "CREATE_AND_INIT_ALV
*& Form EXCLUDE_TB_FUNCTIONS
text
<--P_LT_EXCLUDE text
form exclude_tb_functions changing pt_exclude type ui_functions.
data ls_exclude type ui_func.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_copy_row.
append ls_exclude to pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_delete_row.
append ls_exclude to pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_append_row.
append ls_exclude to pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_insert_row.
append ls_exclude to pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_move_row.
append ls_exclude to pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_copy.
append ls_exclude to pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_cut.
append ls_exclude to pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_paste.
append ls_exclude to pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_paste_new_row.
append ls_exclude to pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_undo.
append ls_exclude to pt_exclude.
endform. " EXCLUDE_TB_FUNCTIONS
*& Form build_data
text
--> p1 text
<-- p2 text
form build_data.
data: lt_sflight type table of sflight,
ls_sflight type sflight,
ls_celltab type lvc_s_styl,
lt_celltab type lvc_t_styl,
l_index type i.
select * from sflight into table lt_sflight up to g_max rows.
if sy-subrc ne 0.
generate own entries if db-table is empty so that this example
still works
perform generate_entries changing lt_sflight.
endif.
*§A3.Optionally, check checkboxes initially after selecting data.
(Omitted in this example)
loop at lt_sflight into ls_sflight.
move-corresponding ls_sflight to gt_outtab.
if gt_outtab-connid eq '400'.
gt_outtab-checkbox = 'X'.
endif.
append gt_outtab.
endloop.
§B2.After selecting data,
assign a style for each row of your checkbox column.
Initially, set all checkbox cells editable.
ls_celltab-fieldname = 'CHECKBOX'.
ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.
loop at gt_outtab.
l_index = sy-tabix.
refresh lt_celltab.
ls_celltab-fieldname = 'CHECKBOX'.
ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.
insert ls_celltab into table lt_celltab.
insert lines of lt_celltab into table gt_outtab-celltab.
modify gt_outtab index l_index.
endloop.
endform. " build_data
*& Form generate_entries
text
<--P_LT_SLFIGHT text
form generate_entries changing pt_slfight type standard table.
This form is only needed for the case that there is no
data in database table SFLIGHT.
data: ls_sflight type sflight,
l_month(2) type c,
l_day(2) type c,
l_date(8) type c.
ls_sflight-carrid = 'LH'.
ls_sflight-connid = '0400'.
ls_sflight-currency = 'DEM'.
ls_sflight-planetype = '747-400'.
ls_sflight-seatsmax = 660.
do 110 times.
ls_sflight-price = sy-index * 100.
ls_sflight-seatsocc = 660 - sy-index * 6.
ls_sflight-paymentsum = ls_sflight-seatsocc * ls_sflight-price.
l_month = sy-index / 10 + 1.
do 2 times.
l_day = l_month + sy-index * 2.
l_date+0(4) = '2000'.
l_date4(2) = l_month0(2).
l_date6(2) = l_day0(2).
ls_sflight-fldate = l_date.
append ls_sflight to pt_slfight.
enddo.
enddo.
endform. " generate_entries
*& Form select_all_entries
text
<--P_GT_OUTTAB text
form select_all_entries changing pt_outtab type standard table.
data: ls_outtab type gs_outtab.
data: l_valid type c,
l_locked type c.
*§A4ad. Before you (a)set, reset or (d)evaluate checkboxes,
you must check the input cells.
If all entries are ok, ALV transferes new values to the output
table which you then can modify.
call method g_grid->check_changed_data
importing
e_valid = l_valid.
if l_valid eq 'X'.
loop at pt_outtab into ls_outtab.
perform check_lock using ls_outtab
changing l_locked.
if l_locked is initial
and not ls_outtab-checkbox eq '-'.
ls_outtab-checkbox = 'X'.
endif.
modify pt_outtab from ls_outtab.
endloop.
call method g_grid->refresh_table_display.
endif.
endform. " select_all_entries
*& Form deselect_all_entries
text
<--P_GT_OUTTAB[] text
form deselect_all_entries changing pt_outtab type standard table.
data: ls_outtab type gs_outtab.
data: l_valid type c,
l_locked type c.
*§A4ad. Before you (a)set, reset or (d)evaluate checkboxes,
you must check the input cells.
If all entries are ok, ALV transferes new values to the output
table which you then can modify.
call method g_grid->check_changed_data
importing
e_valid = l_valid.
if l_valid eq 'X'.
loop at pt_outtab into ls_outtab.
perform check_lock using ls_outtab
changing l_locked.
if l_locked is initial
and not ls_outtab-checkbox eq '-'.
ls_outtab-checkbox = ' '.
endif.
modify pt_outtab from ls_outtab.
endloop.
call method g_grid->refresh_table_display.
endif.
endform. " deselect_all_entries
*& Form reset_selected_entries
text
<--P_GT_OUTTAB[] text
form reset_selected_entries changing pt_outtab type standard table.
data: ls_outtab type gs_outtab.
data: l_valid type c.
*§A4b. Before you set, (b)reset or evaluate checkboxes,
you must check the input cells.
If all entries are ok, ALV transferes new values to the output
table which you then can modify.
call method g_grid->check_changed_data
importing
e_valid = l_valid.
if l_valid eq 'X'.
loop at pt_outtab into ls_outtab.
if not ls_outtab-checkbox is initial
and not ls_outtab-checkbox eq '-'.
clear ls_outtab.
modify pt_outtab from ls_outtab.
endif.
endloop.
call method g_grid->refresh_table_display.
endif.
endform. " reset_selected_entries
form switch_activation changing pt_outtab type standard table.
data: ls_outtab type gs_outtab.
data: l_valid type c,
lt_row_no type lvc_t_roid with header line.
*§A4c. Before you set, reset, (c)(de)activate
or evaluate checkboxes, you must check the input cells.
If all entries are ok, ALV transferes new values to the output
table which you then can modify.
call method g_grid->check_changed_data
importing
e_valid = l_valid.
if l_valid eq 'X'.
call method g_grid->get_selected_rows
importing
et_row_no = lt_row_no[].
loop at lt_row_no.
read table pt_outtab into ls_outtab index lt_row_no-row_id.
if ls_outtab-checkbox ne '-'.
ls_outtab-checkbox = '-'.
else.
ls_outtab-checkbox = ' '.
endif.
modify pt_outtab from ls_outtab index lt_row_no-row_id.
endloop.
call method g_grid->refresh_table_display.
endif.
endform. " switch_activation
*& Form check_lock
text
-->P_LS_OUTTAB text
<--P_L_LOCKED text
form check_lock using ps_outtab type gs_outtab
changing p_locked.
data ls_celltab type lvc_s_styl.
loop at ps_outtab-celltab into ls_celltab.
if ls_celltab-fieldname = 'CHECKBOX'.
if ls_celltab-style eq cl_gui_alv_grid=>mc_style_disabled.
p_locked = 'X'.
else.
p_locked = space.
endif.
endif.
endloop.
endform. " check_lock
Regards,
Sindhu -
Double click on list field in ALV grid control
Hello all,
I developed a report with a ALV grid control. I would like to move some functionality from marking a line and pressing a button in the status line to double clicking a specific field in the output list and execute a command there (i.e. double click on PO number and go to PO display TAC then). Can anybody provide some example coding for that?
Thanks so much for your help!
TorstenHere is your sample program. Copy this code into a z program. Create the screen 100 with a container in it and name it "ALV_CONTAINER". Create the gui-status with "BACK".
report zrich_0001.
tables: ekko.
data: begin of i_alv occurs 0,
ebeln type ekko-ebeln,
end of i_alv.
* CLASS cl_event_receiver DEFINITION Handles Double Click
class cl_event_receiver definition.
public section.
methods handle_double_click
for event double_click of cl_gui_alv_grid
importing e_row e_column.
private section.
endclass.
* CLASS CL_EVENT_RECEIVER IMPLEMENTATION Handles Double Click
class cl_event_receiver implementation.
method handle_double_click.
perform drill_down using e_row-index.
endmethod.
endclass.
data: alv_container type ref to cl_gui_custom_container.
data: event_receiver type ref to cl_event_receiver.
data: alv_grid type ref to cl_gui_alv_grid.
data: layout type lvc_s_layo.
data: fieldcat type lvc_t_fcat.
selection-screen begin of block b1 with frame title text-001 .
select-options: s_ebeln for ekko-ebeln.
selection-screen end of block b1.
start-of-selection.
perform get_data.
call screen 100.
* Module status_0100 OUTPUT
module status_0100 output.
set pf-status '0100'.
set titlebar '0100'.
data: variant type disvariant.
variant-report = sy-repid.
variant-username = sy-uname.
* Create Controls
create object alv_container
exporting
container_name = 'ALV_CONTAINER'.
create object alv_grid
exporting
i_parent = alv_container.
* Create Event Receiver
create object event_receiver.
* Populate Field Catalog
perform get_fieldcatalog.
call method alv_grid->set_table_for_first_display
exporting
is_layout = layout
is_variant = variant
i_save = 'U'
i_structure_name = 'I_ALV'
changing
it_outtab = i_alv[]
it_fieldcatalog = fieldcat[].
* handler for ALV grid
set handler event_receiver->handle_double_click for alv_grid.
endmodule.
* Module USER_COMMAND_0100 INPUT
module user_command_0100 input.
case sy-ucomm.
when 'BACK' or 'CANC'.
if not alv_container is initial.
call method alv_container->free.
clear: alv_container.
free : alv_container.
endif.
if sy-subrc = 0.
set screen 0.
leave screen.
else.
leave program.
endif.
when 'EXIT'.
if not alv_container is initial.
call method alv_container->free.
clear: alv_container.
free : alv_container.
endif.
leave program.
endcase.
endmodule.
* FORM GET_DATA
form get_data.
select * into corresponding fields of table i_alv
from ekko
where ebeln in s_ebeln.
sort i_alv ascending by ebeln.
endform.
* Form Get_Fieldcatalog - Set Up Columns/Headers
form get_fieldcatalog.
data: ls_fcat type lvc_s_fcat.
refresh: fieldcat.
clear: ls_fcat.
ls_fcat-reptext = 'PO Number'.
ls_fcat-coltext = 'PO Number'.
ls_fcat-fieldname = 'EBELN'.
ls_fcat-ref_table = 'I_ALV'.
ls_fcat-outputlen = '12'.
ls_fcat-col_pos = 1.
append ls_fcat to fieldcat.
endform.
* DRILL_DOWN
form drill_down using index.
read table i_alv index index.
if sy-subrc = 0.
set parameter id 'BES' field i_alv-ebeln.
call transaction 'ME23' and skip first screen.
if not alv_container is initial.
call method alv_container->free.
clear: alv_container.
free : alv_container.
endif.
endif.
endform.
Regards,
Rich Heilman -
All -
I'm realtively new to ALV grid reporting.
What should be done in order to not get the default setting like sorting,set filter screen Icons and the other icons in the report .
Thanks in advance.You mean that you want to exclude those icons from the toolbar? You can do it by using the exclude parameter.
Here's how. See the parts in bold, you can look at the other functions that can be execluded via SE24 in the attributes tab. Check the attributes that start with MC_FC_
REPORT ZRICH_0001.
TABLES: MARA.
DATA: BEGIN OF I_ALV OCCURS 0,
MATNR TYPE MARA-MATNR,
MAKTX TYPE MAKT-MAKTX,
END OF I_ALV.
* CLASS cl_event_receiver DEFINITION Handles Double Click
CLASS CL_EVENT_RECEIVER DEFINITION.
PUBLIC SECTION.
METHODS HANDLE_DOUBLE_CLICK
FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID
IMPORTING E_ROW E_COLUMN.
PRIVATE SECTION.
ENDCLASS.
* CLASS CL_EVENT_RECEIVER IMPLEMENTATION Handles Double Click
CLASS CL_EVENT_RECEIVER IMPLEMENTATION.
METHOD HANDLE_DOUBLE_CLICK.
PERFORM DRILL_DOWN USING E_ROW-INDEX.
ENDMETHOD.
ENDCLASS.
DATA: ALV_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER.
DATA: EVENT_RECEIVER TYPE REF TO CL_EVENT_RECEIVER.
DATA: ALV_GRID TYPE REF TO CL_GUI_ALV_GRID.
DATA: LAYOUT TYPE LVC_S_LAYO.
DATA: FIELDCAT TYPE LVC_T_FCAT.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001 .
SELECT-OPTIONS: S_MATNR FOR MARA-MATNR.
SELECTION-SCREEN END OF BLOCK B1.
START-OF-SELECTION.
PERFORM GET_DATA.
CALL SCREEN 100.
* Module status_0100 OUTPUT
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS '0100'.
SET TITLEBAR '0100'.
DATA: LT_EXCLUDE TYPE UI_FUNCTIONS.
DATA: VARIANT TYPE DISVARIANT.
VARIANT-REPORT = SY-REPID.
VARIANT-USERNAME = SY-UNAME.
* Create Controls
CREATE OBJECT ALV_CONTAINER
EXPORTING
CONTAINER_NAME = 'ALV_CONTAINER'.
CREATE OBJECT ALV_GRID
EXPORTING
I_PARENT = ALV_CONTAINER.
* Create Event Receiver
CREATE OBJECT EVENT_RECEIVER.
* ALV Specific. Data selection.
* Populate Field Catalog
PERFORM GET_FIELDCATALOG.
<b>* Optionally restrict generic functions to 'change only'.
* (The user shall not be able to add new lines).
PERFORM EXCLUDE_TB_FUNCTIONS CHANGING LT_EXCLUDE.</b>
CALL METHOD ALV_GRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
IS_LAYOUT = LAYOUT
IS_VARIANT = VARIANT
I_SAVE = 'U'
I_STRUCTURE_NAME = 'I_ALV'
<b> it_toolbar_excluding = lt_exclude</b>
CHANGING
IT_OUTTAB = I_ALV[]
IT_FIELDCATALOG = FIELDCAT[].
* handler for ALV grid
SET HANDLER EVENT_RECEIVER->HANDLE_DOUBLE_CLICK FOR ALV_GRID.
ENDMODULE.
* Module USER_COMMAND_0100 INPUT
MODULE USER_COMMAND_0100 INPUT.
CASE SY-UCOMM.
WHEN 'BACK' OR 'CANC'.
IF NOT ALV_CONTAINER IS INITIAL.
CALL METHOD ALV_CONTAINER->FREE.
CLEAR: ALV_CONTAINER.
FREE : ALV_CONTAINER.
ENDIF.
IF SY-SUBRC = 0.
SET SCREEN 0.
LEAVE SCREEN.
ELSE.
LEAVE PROGRAM.
ENDIF.
WHEN 'EXIT'.
IF NOT ALV_CONTAINER IS INITIAL.
CALL METHOD ALV_CONTAINER->FREE.
CLEAR: ALV_CONTAINER.
FREE : ALV_CONTAINER.
ENDIF.
LEAVE PROGRAM.
ENDCASE.
ENDMODULE.
* FORM GET_DATA
FORM GET_DATA.
SELECT * INTO CORRESPONDING FIELDS OF TABLE I_ALV
FROM MARA
INNER JOIN MAKT
ON MARA~MATNR = MAKT~MATNR
WHERE MARA~MATNR IN S_MATNR
AND MAKT~SPRAS = SY-LANGU.
SORT I_ALV ASCENDING BY MATNR.
ENDFORM.
* Form Get_Fieldcatalog - Set Up Columns/Headers
FORM GET_FIELDCATALOG.
DATA: LS_FCAT TYPE LVC_S_FCAT.
REFRESH: FIELDCAT.
CLEAR: LS_FCAT.
LS_FCAT-REPTEXT = 'Material Number'.
LS_FCAT-COLTEXT = 'Material Number'.
LS_FCAT-FIELDNAME = 'MATNR'.
LS_FCAT-REF_TABLE = 'I_ALV'.
LS_FCAT-OUTPUTLEN = '18'.
LS_FCAT-COL_POS = 1.
APPEND LS_FCAT TO FIELDCAT.
CLEAR: LS_FCAT.
LS_FCAT-REPTEXT = 'Material Description'.
LS_FCAT-COLTEXT = 'Material Description'.
LS_FCAT-FIELDNAME = 'MAKTX'.
LS_FCAT-REF_TABLE = 'I_ALV'.
LS_FCAT-OUTPUTLEN = '40'.
LS_FCAT-COL_POS = 2.
APPEND LS_FCAT TO FIELDCAT.
ENDFORM.
* DRILL_DOWN
FORM DRILL_DOWN USING INDEX.
READ TABLE I_ALV INDEX INDEX.
IF SY-SUBRC = 0.
SET PARAMETER ID 'MAT' FIELD I_ALV-MATNR.
CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.
IF NOT ALV_CONTAINER IS INITIAL.
CALL METHOD ALV_CONTAINER->FREE.
CLEAR: ALV_CONTAINER.
FREE : ALV_CONTAINER.
ENDIF.
ENDIF.
ENDFORM.
<b>***********************************************************************
* Form EXCLUDE_TB_FUNCTIONS
FORM EXCLUDE_TB_FUNCTIONS CHANGING PT_EXCLUDE TYPE UI_FUNCTIONS.
* Only allow to change data not to create new entries (exclude
* generic functions).
DATA LS_EXCLUDE TYPE UI_FUNC.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_COPY_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_DELETE_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_APPEND_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_INSERT_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_MOVE_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_SORT_ASC.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_SORT_DSC.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
** This excludes all buttons
* LS_EXCLUDE = '&EXCLALLFC'.
* APPEND LS_EXCLUDE TO PT_EXCLUDE.
ENDFORM.</b>
Regards,
RIch Heilman
Maybe you are looking for
-
Adobe Premiere Elements 9 Trial crash when creating/opening project
I've just installed Premiere Elements 9 Trial for testing Installation went with no problems When i try to create/open a project Premiere crashes with message like: Sorry, a serious error has occurred that requires Adobe Premier Elements to shut down
-
Mac slower after upgrade to mavericks
Hi everyone ! After upgrading to osx mavericks my mac is slower ....is it normal ??? thanks !
-
How do I prevent non-admin users from putting Lion to sleep?
I share a MacPro at home with a few others. I use it as a server as well as keep content on it that is streamed to all sorts of devices; they use it as a mac to check e-mail. Two of the users have a really bad habit of putting it to sleep because t
-
Auc to Main Asset Line Item wise details
Hi Expert, i have find and read number of thread regarding details of converted from AUC asset into Main Asset. in sap there is no any standard report where i got the details like AUC asset converted into Main Asset. scenario is , we have create Capi
-
Hello my name is Lino and I'm Portuguese (sorry the bad English) I have a problem, I want to know how do save a .jpg file with the FileChooser and FileWriter, that is in the Server and I want to save a copy in my computer, but it must with Applets! P