F4 Help in ALV GRID class based
hi
you have any idea about how to invoke the F4 help in ALV GRID Class based program.,
if u have any other related document or program using F4 function in ALV GRId please send to me for reference
Thanks & Regards
K.G
hi for what kind of fields you need to give f4.
are they std or custom...
please let me know about the fields..
try to check my logic which i gave in the below post..
it will give f4 help to the fields(if thet are standard table fieldS)
Message was edited by: Vijay Babu Dudla
Similar Messages
-
How to get f4 help in alv grid in container-urgent
hi,
how to get f4 help in alv grid in container using abap objects
ganeshHi Ganesh,
Did you have a look at sample report BCALV_TEST_GRID_F4_HELP ?
Here is part of the header documentation:
*& Report BCALV_GRID_F4_HELP *
Purpose:
~~~~~~~~
This report illustrates the use of f4-Help in an alv grid control.
Background:
~~~~~~~~~~~
There a two possibilities to implement an f4-Help in the alv grid
control: one can either use standard f4-help or write one by Hand.
For the former there is nothing to do at all. This report shows how
to implement user-defined f4-help.
I am sure you will find within this report the solution you are looking for.
Reward points if this Helps.
Manish -
F4 help in ALV grid using existing search help
Hi All,
It would be appreciable , if some help on problem. Thanks in advance.
How to provide user defined F4 help in ALV grid using existing search help?
ALV grid has developed using OOPS concept.
Thanks,
Sudhakar.Hi,
if you already developed using OO concept, it should be possible to:
create a handler for event ONF4
The interface will tell you actual field name and value where F4 is pressed. This will enable you to call your own routine (see FM F4-IF....).
Please check how the standard handles F4 - if you have standard and customer-F4 mixed you shouldtake care that the standard handling is triggered.
Regards,
Clemens -
What is shortest way to attach particular Search Help in ALV grid using OOPS ?
Thanks Gurpreet,
Through search helps attached to data element it is possible but is there any other way to attach searchhelp differet from from the search help attached to the data element ? The new search-elp is not customized search help as given in the above threads ?
Eg. - If I want to attach MAT2 to a field named MATNR in the table instead of the MAT1 which is standard.
Thanks in advance -
F4 help in ALV grid by using function module?
Hi,
I need to get f4 search help in ALV grid for a certain fields by using function module method.
Please guide me.
Thank You.Hi
F4IF_INT_TABLE_VALUE_REQUEST use this fm to get f4 search help for a certain fields .
Regards
Divya -
F4 help in ALV Grid Control (using classes)
Hi All,
I have created a report using ALV Grid control (using classes). I need to provide F4 help for some of the fields in the Grid control. I couldn't understand the standard demo program BCALV_GRID_F4_HELP. So Can anyone please provide me sample code for the same.
Regards
Jaker.hi check this..programs also
BCALV_GRID_EDIT_DELTA
BCALV_TEST_GRID_F4_HELP
https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/how%2bto%2bimplement%2bf4%2bsearch%2bhelp%2bin%2boo%2balv%2bgrid
Struggling with f4 handling in ALV grid - Minisap 46D
regards,
venkat -
Hello Experts,
I am using cl_salv_table=>factory to display ALV grid.
Now I also want to attach f4 help in one of the field of ALV grid.
I am unable to locate any event or method.
Please help.Hello,
@Marcin: The aim to display values in search help is not to select values for editable field in alv grid but to display some additional information based on value in that field.
If search help is not possible, then dropdown can also work for me or pls provide any other solution to this.
I had tried implementing dropdown, for that I am using class "cl_salv_column_list" method "set_dropdown_entry".
From this I am able to see dropdown icon for my field but not able to populate values in dropdown.
Pls help in populating values in dropdown.
My logic is:-
Based on the values in the field in alv grid I have to calculate value dynamically to be displayed in search help or drop down list. -
How clear own f4 help in ALV GRID OO
Hi experts,
I have to create OWN F4 Help for 4 different cells in a ALV Grid list. I create one and it works.
But how can I create the another ones without copy all the abapcode? (dynpro, classes, methods, etc.)
To create one I use de BCALV_EDIT_08 standard report by example.
Please help me.
Thanks in advance.
Oscar.Hi Ganesh,
Did you have a look at sample report BCALV_TEST_GRID_F4_HELP ?
Here is part of the header documentation:
*& Report BCALV_GRID_F4_HELP *
Purpose:
~~~~~~~~
This report illustrates the use of f4-Help in an alv grid control.
Background:
~~~~~~~~~~~
There a two possibilities to implement an f4-Help in the alv grid
control: one can either use standard f4-help or write one by Hand.
For the former there is nothing to do at all. This report shows how
to implement user-defined f4-help.
I am sure you will find within this report the solution you are looking for.
Reward points if this Helps.
Manish -
Hi Experts,
I have created an ALV grid using classes. I need to bring standard F4 help in the ALV Grid.
Also the value that user enters should be returned back to the ALV.
Please provide some inputs.
Thanks.Hi,
cosider the below steps :
1.in Fieldcatalog set the field as editable like for eg.
WA_FIELDCAT-COL_POS = L_LIN.
WA_FIELDCAT-FIELDNAME = 'DATAB'.
WA_FIELDCAT-DATATYPE = 'DATS'.
WA_FIELDCAT-REPTEXT = 'Valid From'(T06).
WA_FIELDCAT-F4AVAILABL = 'X'.
WA_FIELDCAT-EDIT = 'X'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
2. Define F4 on the fields you want:
DATA:
* Line of F4 table
L_S_F4 TYPE LVC_S_F4,
* Table for F4 relevant fields
L_T_F4 TYPE LVC_T_F4.
* F4 on datab
L_S_F4-FIELDNAME = 'DATAB'.
L_S_F4-REGISTER = 'X'.
L_S_F4-GETBEFORE = SPACE.
L_S_F4-CHNGEAFTER = SPACE.
APPEND L_S_F4 TO L_T_F4.
CLEAR L_S_F4.
similarly you can add other fields on which you want to provide F4
CALL METHOD P_G_ALV_GRID->REGISTER_F4_FOR_FIELDS
EXPORTING
IT_F4 = L_T_F4[].
3.Implement the metohds for Event handler:
METHOD HANDLE_ONF4.
<here you can call the F4 help>
Regards,
Neha -
Help on ALV grid needed...
HI, I am a new comer to SAP and I have some material on ALV grid but not enough to write code to display from an internal table to the grid. I have written the code using 2 methods:
1. set_table_for_first_display and
2. reuse_alv_grid_display
The code with reuse_alv_grid_disply works fine but am not able to add more functionality to the code as I dont have any material explaining the methods to be used with it. The code with set_table_for_first_display has some problem in it. The code for it is:
tables kna1.
data: BEGIN OF itkna1 OCCURS 0,
ktokd like kna1-ktokd,
kunnr like kna1-kunnr,
name1 like kna1-name1,
name2 like kna1-name2,
end of itkna1.
*creating an instance of grid
data it_custom_control_name type scrfname value 'CC_ALV'.
data it_container type ref to cl_gui_custom_container.
data it_alvgrid type ref to cl_gui_alv_grid.
data it_lyo type lvc_s_layo.
Selection-screen begin of block Enter_data with frame title text-001.
PARAMETERS pktokd like KNA1-ktokd OBLIGATORY.
SELECT-OPTIONS skunnr FOR KNA1-kunnr.
Selection-screen end of block Enter_data.
SELECT ktokd kunnr name1 name2
FROM kna1 into CORRESPONDING FIELDS OF TABLE itkna1
WHERE ktokd = pktokd AND kunnr IN skunnr.
*loop at itkna1.
write:/ itkna1-ktokd, itkna1-kunnr, itkna1-name1, itkna1-name2.
*ENDLOOP.
*prepare field catalog
data it_fcat type lvc_t_fcat.
data tmp_fcat like LINE OF it_fcat.
clear: it_fcat, tmp_fcat.
tmp_fcat-fieldname = 'KTOKD'.
tmp_fcat-ref_table = 'KNA1'.
tmp_fcat-ref_field = 'KTOKD'.
tmp_fcat-col_pos = '1'.
*tmp_fcat-inttype = 'C'.
*tmp_fcat-coltext = 'Customer Group'.
*tmp_fcat-seltext = 'Customer Group'.
*tmp_fcat-outputlen = '4'.
append tmp_fcat to it_fcat.
tmp_fcat-fieldname = 'KUNNR'.
tmp_fcat-ref_table = 'KNA1'.
tmp_fcat-ref_field = 'KUNNR'.
tmp_fcat-col_pos = '2'.
*tmp_fcat-inttype = 'N'.
*tmp_fcat-coltext = 'Customer Number'.
*tmp_fcat-seltext = 'Customer Number'.
*tmp_fcat-outputlen = '10'.
append tmp_fcat to it_fcat.
tmp_fcat-fieldname = 'NAME1'.
tmp_fcat-ref_table = 'KNA1'.
tmp_fcat-ref_field = 'NAME1'.
tmp_fcat-col_pos = '3'.
*tmp_fcat-inttype = 'C'.
*tmp_fcat-coltext = 'name'.
*tmp_fcat-seltext = 'name'.
*tmp_fcat-outputlen = '12'.
append tmp_fcat to it_fcat.
tmp_fcat-fieldname = 'NAME2'.
tmp_fcat-ref_table = 'KNA1'.
tmp_fcat-ref_field = 'NAME2'.
tmp_fcat-col_pos = '4'.
*tmp_fcat-inttype = 'C'.
*tmp_fcat-coltext = 'name2'.
*tmp_fcat-seltext = 'name2'.
*tmp_fcat-outputlen = '12'.
append tmp_fcat to it_fcat.
*prepare layout
it_lyo-grid_title = 'Custormer details'.
*creating an instance of container class
create OBJECT it_container
EXPORTING
container_name = it_custom_control_name
EXCEPTIONS
cntl_error = 1
create_error = 2
OTHERS = 3.
*creating an instance of the grid
create OBJECT it_alvgrid
EXPORTING
i_parent = it_container
EXCEPTIONS
error_dp_create = 1
OTHERS = 2.
*displaying the grid
call METHOD it_alvgrid->set_table_for_first_display
EXPORTING
is_layout = it_lyo
i_structure_name = 'KNA1'
CHANGING
it_outtab = itkna1[]
it_fieldcatalog = it_fcat
EXCEPTIONS
invalid_parameter_combination = 1
others = 2.
It would be really helpful if some one could tell me what is wrong with this code and tell me where to get the material for extending code using type-pools-slis.
Thanks in advance!!!i cant see any call screen in your prog... if you have to display an alv first you have to create a screen and in that screen you have to create a custom control which will contain the grid... pls go thrugh the prog
here i have changed your code and it is working in my system just try this..
tables kna1.
data: BEGIN OF itkna1 OCCURS 0,
ktokd like kna1-ktokd,
kunnr like kna1-kunnr,
name1 like kna1-name1,
name2 like kna1-name2,
end of itkna1.
*creating an instance of grid
data it_custom_control_name type scrfname value 'CC_ALV'.
data it_container type ref to cl_gui_custom_container.
data it_alvgrid type ref to cl_gui_alv_grid.
data it_lyo type lvc_s_layo.
DATA : OKCODE LIKE SY-UCOMM.
Selection-screen begin of block Enter_data with frame title text-001.
PARAMETERS pktokd like KNA1-ktokd OBLIGATORY.
SELECT-OPTIONS skunnr FOR KNA1-kunnr.
Selection-screen end of block Enter_data.
SELECT ktokd kunnr name1 name2
FROM kna1 into CORRESPONDING FIELDS OF TABLE itkna1
WHERE ktokd = pktokd AND kunnr IN skunnr.
*loop at itkna1.
* write:/ itkna1-ktokd, itkna1-kunnr, itkna1-name1, itkna1-name2.
*ENDLOOP.
*prepare field catalog
data it_fcat type lvc_t_fcat.
data tmp_fcat like LINE OF it_fcat.
clear: it_fcat, tmp_fcat.
tmp_fcat-fieldname = 'KTOKD'.
tmp_fcat-ref_table = 'KNA1'.
tmp_fcat-ref_field = 'KTOKD'.
tmp_fcat-col_pos = '1'.
*tmp_fcat-inttype = 'C'.
*tmp_fcat-coltext = 'Customer Group'.
*tmp_fcat-seltext = 'Customer Group'.
*tmp_fcat-outputlen = '4'.
append tmp_fcat to it_fcat.
tmp_fcat-fieldname = 'KUNNR'.
tmp_fcat-ref_table = 'KNA1'.
tmp_fcat-ref_field = 'KUNNR'.
tmp_fcat-col_pos = '2'.
*tmp_fcat-inttype = 'N'.
*tmp_fcat-coltext = 'Customer Number'.
*tmp_fcat-seltext = 'Customer Number'.
*tmp_fcat-outputlen = '10'.
append tmp_fcat to it_fcat.
tmp_fcat-fieldname = 'NAME1'.
tmp_fcat-ref_table = 'KNA1'.
tmp_fcat-ref_field = 'NAME1'.
tmp_fcat-col_pos = '3'.
*tmp_fcat-inttype = 'C'.
*tmp_fcat-coltext = 'name'.
*tmp_fcat-seltext = 'name'.
*tmp_fcat-outputlen = '12'.
append tmp_fcat to it_fcat.
tmp_fcat-fieldname = 'NAME2'.
tmp_fcat-ref_table = 'KNA1'.
tmp_fcat-ref_field = 'NAME2'.
tmp_fcat-col_pos = '4'.
*tmp_fcat-inttype = 'C'.
*tmp_fcat-coltext = 'name2'.
*tmp_fcat-seltext = 'name2'.
*tmp_fcat-outputlen = '12'.
append tmp_fcat to it_fcat.
*prepare layout
it_lyo-grid_title = 'Custormer details'.
call screen 100.
*creating an instance of container class
*& Module STATUS_0100 OUTPUT
* text
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'ZSPD'.
* SET TITLEBAR 'xxx'.
create OBJECT it_container
EXPORTING
container_name = it_custom_control_name
EXCEPTIONS
cntl_error = 1
create_error = 2
OTHERS = 3.
*creating an instance of the grid
create OBJECT it_alvgrid
EXPORTING
i_parent = it_container
EXCEPTIONS
error_dp_create = 1
OTHERS = 2.
*displaying the grid
call METHOD it_alvgrid->set_table_for_first_display
EXPORTING
is_layout = it_lyo
*i_structure_name = 'KNA1'
CHANGING
it_outtab = itkna1[]
it_fieldcatalog = it_fcat
EXCEPTIONS
invalid_parameter_combination = 1
others = 2.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
* text
MODULE USER_COMMAND_0100 INPUT.
call method cl_gui_cfw=>dispatch.
CASE OKCODE.
WHEN 'EXIT' OR 'BACK'.
LEAVE PROGRAM.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
regards
shiba dutta -
Hi,
I have written a program to display the details of customer in ALV Grid. I have also added code to add a hyperlink to the field name - KTOKD of the table KNA1. It would be helpful if anyone could tell me what is wrong with the code. The list is correctly displayed but the hyperlink is not working.
tables kna1.
data: BEGIN OF itkna1 OCCURS 0,
ktokd like kna1-ktokd,
kunnr like kna1-kunnr,
name1 like kna1-name1,
name2 like kna1-name2,
ktokd_hdl type int4,
end of itkna1.
*creating an instance of grid
data it_custom_control_name type scrfname value 'C_C_ALV'.
data it_container type ref to cl_gui_custom_container.
data it_alvgrid type ref to cl_gui_alv_grid.
data it_lyo type lvc_s_layo.
data it_fcat type lvc_t_fcat.
data tmp_fcat like LINE OF it_fcat.
data it_hype type lvc_t_hype.
data tmp_hype type lvc_s_hype.
Selection-screen begin of block Enter_data with frame title text-001.
PARAMETERS pktokd like KNA1-ktokd OBLIGATORY.
SELECT-OPTIONS skunnr FOR KNA1-kunnr.
Selection-screen end of block Enter_data.
SELECT ktokd kunnr name1 name2
FROM kna1 into CORRESPONDING FIELDS OF TABLE itkna1
WHERE ktokd = pktokd AND kunnr IN skunnr.
*prepare field catalog
clear: it_fcat, tmp_fcat.
tmp_fcat-fieldname = 'KTOKD'.
tmp_fcat-ref_table = 'KNA1'.
tmp_fcat-ref_field = 'KTOKD'.
tmp_fcat-col_pos = '1'.
tmp_fcat-web_field = 'ktokd_hdl'.
append tmp_fcat to it_fcat.
tmp_fcat-fieldname = 'KUNNR'.
tmp_fcat-ref_table = 'KNA1'.
tmp_fcat-ref_field = 'KUNNR'.
tmp_fcat-col_pos = '2'.
append tmp_fcat to it_fcat.
tmp_fcat-fieldname = 'NAME1'.
tmp_fcat-ref_table = 'KNA1'.
tmp_fcat-ref_field = 'NAME1'.
tmp_fcat-col_pos = '3'.
append tmp_fcat to it_fcat.
tmp_fcat-fieldname = 'NAME2'.
tmp_fcat-ref_table = 'KNA1'.
tmp_fcat-ref_field = 'NAME2'.
tmp_fcat-col_pos = '4'.
append tmp_fcat to it_fcat.
data: c_lines type I, count type I.
DESCRIBE table itkna1 LINES c_lines.
loop at itkna1.
count = count + 1.
tmp_hype-handle = count.
tmp_hype-href = itkna1-ktokd.
APPEND tmp_hype to it_hype.
itkna1-ktokd_hdl = count.
MODIFY itkna1.
ENDLOOP.
*prepare layout
it_lyo-grid_title = 'Custormer details'.
call screen 200.
module status_0200 OUTPUT.
*creating an instance of container class
CREATE OBJECT it_container
EXPORTING container_name = it_custom_control_name.
*creating an instance of the grid
create OBJECT it_alvgrid
EXPORTING i_parent = it_container.
*displaying the grid
call METHOD it_alvgrid->set_table_for_first_display
EXPORTING
is_layout = it_lyo
it_hyperlink = it_hype
CHANGING
it_outtab = itkna1[]
it_fieldcatalog = it_fcat
EXCEPTIONS
invalid_parameter_combination = 1
others = 2.
ENDMODULE.Try this..
give the field name in CAPITAL LETTERS..
*prepare field catalog
clear: it_fcat, tmp_fcat.
tmp_fcat-fieldname = 'KTOKD'.
tmp_fcat-ref_table = 'KNA1'.
tmp_fcat-ref_field = 'KTOKD'.
tmp_fcat-col_pos = '1'.
tmp_fcat-web_field =<b> 'KTOKD_HDL'.</b>
REGARDS,
SAI RAMESH -
Problems with F4 help in ALV grid
Hi all,
I am trying to create a F4 help for the field Payee number in my reprot output (ALV Grid OO), i am able to get the window for selection of the value in the F4 help , but i am unable to pass the value back on to the screen.
I need to insert the selected value from the F4 help and aslo need to populate the Name of the payee into the Payee field.
Can some one help me in finding what error have i done in the code.
Thanks in advance for all.
I have the following code
*& Include ZRMM_ALV_TOP *
data: gc_control100 type ref to cl_gui_custom_container,
gc_control101 type ref to cl_gui_custom_container.
data: gi_outtab100 type table of ty_purchase.
data: g_cont0100 type ref to cl_gui_custom_container,
g_grid0100 type ref to cl_gui_alv_grid, " For Screen 100 Grid
gi_fcat0100 type lvc_t_fcat, " Field Catalog for Screen 100
gi_sort0100 type lvc_t_sort,
g_lout0100 type lvc_s_layo.
data: okcode_100 like sy-ucomm,
save_0100 like sy-ucomm,
okcode_200 like sy-ucomm,
save_0200 like sy-ucomm.
types: begin of f4_itab_type,
LIFNR type lifnr,
BUKRS type name1,
end of f4_itab_type.
data: f4_itab type table of f4_itab_type,
ls_f4_itab type f4_itab_type.
data : it_IZEMTAB type table of IZEMTAB,
wa_IZEMTAB type IZEMTAB.
Class Definitions.
class event_receiver_0100 definition.
PUBLIC SECTION.
types: begin of onf4_event_parameters_type,
c_fieldname type lvc_fname,
cs_row_no type lvc_s_roid,
cr_event_data type ref to cl_alv_event_data,
ct_bad_cells type lvc_t_modi,
c_display type char01,
end of onf4_event_parameters_type.
data: fieldcatalog type lvc_t_fcat.
data : f4_alv type ref to cl_gui_alv_grid,
f4_cont type ref to cl_gui_custom_container.
data: f4_params type onf4_event_parameters_type.
METHODS:
ON_F4 FOR EVENT ONF4 of cl_gui_alv_grid
importing sender
e_fieldname
e_fieldvalue
es_row_no
er_event_data
et_bad_cells
e_display.
on_data_changed for event
data_changed of cl_gui_alv_grid
importing e_onf4
e_onf4_before
e_onf4_after
er_data_changed
e_ucomm
sender.
endclass. "lcl_event_receiver DEFINITION
data: gs_variant type disvariant,
gc_save value 'A',
gs_toolbar TYPE stb_button,
gs_toolbar1 type stb_button,
gs_toolbar2 type stb_button.
DATA : T_RETURN TYPE STANDARD TABLE OF DDSHRETVAL WITH HEADER LINE.
DATA : event_receiver_0100 TYPE REF TO EVENT_RECEIVER_0100.
Class Implementation.
class event_receiver_0100 implementation.
For f4 help.
method on_f4.
data: ls_outtab type ty_purchase.
field-symbols <itab> type lvc_t_modi.
data: ls_modi type lvc_s_modi,
ls_f4_itab type f4_itab_type.
f4_params-c_fieldname = e_fieldname.
f4_params-cs_row_no = es_row_no.
f4_params-cr_event_data = er_event_data.
f4_params-ct_bad_cells = et_bad_cells.
f4_params-c_display = e_display.
read table it_purchase into ls_outtab index f4_params-cs_row_no-row_id.
Clear f4_itab[].
CALL FUNCTION 'FI_VENDOR_ALTERN_PAYERS_READ'
EXPORTING
I_LIFNR = ls_outtab-lifnr
I_BUKRS = ls_outtab-bukrs
TABLES
T_ZEMTAB = it_izemtab.
clear f4_itab[].
if not ls_outtab-lifnr is initial.
loop at it_izemtab into wa_izemtab.
ls_f4_itab-LIFNR = wa_izemtab-empfb.
ls_f4_itab-BUKRS = wa_izemtab-name1.
append ls_f4_itab to f4_itab.
endloop.
endif.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
RETFIELD = 'LIFNR'
DYNPPROG = sy-repid
DYNPNR = '100'
WINDOW_TITLE = 'f4 help for PAYEE'
VALUE_ORG = 'S'
TABLES
VALUE_TAB = f4_itab
RETURN_TAB = T_RETURN.
IF SY-SUBRC <> 0.
ENDIF.
assign f4_params-cr_event_data->m_data->* to <itab>.
ls_modi-row_id = f4_params-cs_row_no-row_id.
read table f4_itab into ls_f4_itab index es_row_no-row_id.
if not f4_itab is initial.
ls_modi-row_id = es_row_no-row_id.
ls_modi-value = ls_f4_itab-LIFNR.
ls_modi-FIELDNAME = 'LIFNR'.
append ls_modi to <itab>.
ls_modi-row_id = es_row_no-row_id.
ls_modi-value = ls_f4_itab-BUKRS.
ls_modi-FIELDNAME = 'NAME1'.
append ls_modi to <itab>.
endif.
er_event_data->m_event_handled = 'X'.
ENDMETHOD.
*--ENDMETHOD SHOW_F4--
endclass. "lcl_event_receiver IMPLEMENTATIONI have used the following FM for F4 help on editable ALV grid column and it worked fine.Try the below.
Call function for Input helps
CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
EXPORTING
i_title = text-049
i_selection = c_check
i_zebra = c_check
i_screen_start_column = 55
i_screen_end_column = 125
i_screen_start_line = 10
i_screen_end_line = 20
i_tabname = c_fcat_str
it_fieldcat = tl_fieldcat
IMPORTING
es_selfield = wal_selfield
TABLES
t_outtab = tl_code
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSEIF sy-subrc = 0 AND NOT wal_selfield IS INITIAL.
wl_index = wal_selfield-tabindex.
READ TABLE tl_code ASSIGNING <l_code>
INDEX wl_index.
IF sy-subrc = 0.
<l_fgis_lots>-status = <l_code>.
ENDIF.
ENDIF.
ENDIF. -
Hi,
I am trying to use class CL_ALV_CHANGED_DATA_PROTOCOL to update a database table from an ALV grid.
I have used program BCALV_EDIT_04 as an example.
I am able to successfully processed inserted or deleted lines using the attributes
MT_DELETED_ROWS
MT_INSERTED_ROWS
but I also want to process modified lines.
I was just wondering whether anyone out there has some example code for this.
I can see that there are the following attributes available
MT_MOD_CELLS
MP_MOD_ROWS.
I would ideally like to use MP_MOD_ROWS rather than MT_MOD_CELLS but it is not clear to me what type MP_MOD_ROWS is.
If anyone has any example code for this sort of thing, please let me know.
Thanks,
Rubyhi Ruby,
Yes we can use that *data reference variable *.
It is a variable( something comparable to a pointer ) that points to a int table( table with changed contents )
which ll be created at run-time based on the data type ot the internal table that we pass to the parameter it_outtab of method set_table_for_first_display ...
assign er_data_changed->mp_mod_rows->* to a field-symbol and use it...
Check the below code for example -> method refresh_changed_data
screen flow logic.
PROCESS BEFORE OUTPUT.
MODULE pbo.
PROCESS AFTER INPUT.
MODULE pai.
main program.
* CLASS lcl_event_responder DEFINITION *
CLASS lcl_event_responder DEFINITION.
PUBLIC SECTION.
DATA : ls_changed_cell TYPE lvc_s_modi,
lv_language TYPE spras..
METHODS refresh_changed_data FOR EVENT data_changed
OF cl_gui_alv_grid
IMPORTING er_data_changed
e_ucomm.
ENDCLASS. "event_responder DEFINITION
TYPES tt_makt TYPE STANDARD TABLE OF makt.
DATA: go_handler TYPE REF TO lcl_event_responder,
go_grid TYPE REF TO cl_gui_alv_grid,
gt_fieldcat TYPE lvc_t_fcat,
gv_language TYPE spras VALUE 'E',
gt_outtab TYPE tt_makt,
gs_tableline TYPE LINE OF tt_makt.
FIELD-SYMBOLS : <changed_rows> TYPE tt_makt.
CALL SCREEN 100.
* MODULE PBO OUTPUT *
MODULE pbo OUTPUT.
SET PF-STATUS 'BASIC'.
PERFORM create_and_init_alv CHANGING gt_outtab[]
gt_fieldcat.
ENDMODULE. "pbo OUTPUT
* MODULE PAI INPUT *
MODULE pai INPUT.
LEAVE PROGRAM.
ENDMODULE. "pai INPUT
FORM create_and_init_alv CHANGING pt_outtab LIKE gt_outtab[]
pt_fieldcat TYPE lvc_t_fcat.
CHECK go_grid IS NOT BOUND.
CREATE OBJECT go_grid
EXPORTING
i_parent = cl_gui_container=>default_screen.
PERFORM build_display_table.
PERFORM build_fieldcat CHANGING pt_fieldcat.
go_grid->set_table_for_first_display( CHANGING it_fieldcatalog = pt_fieldcat
it_outtab = pt_outtab ).
go_grid->set_ready_for_input( 1 ).
* raises the 'data_changed' event when we select another cell/any action after changing the data
go_grid->register_edit_event( EXPORTING i_event_id = cl_gui_alv_grid=>mc_evt_enter ).
CREATE OBJECT go_handler.
SET HANDLER go_handler->refresh_changed_data FOR go_grid.
ENDFORM. "CREATE_AND_INIT_ALV
FORM build_display_table.
FREE gt_outtab.
SELECT * FROM makt UP TO 20 ROWS INTO TABLE gt_outtab WHERE spras EQ gv_language.
ENDFORM. "build_display_table
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 = 'MAKT'
CHANGING
ct_fieldcat = pt_fieldcat.
LOOP AT pt_fieldcat INTO ls_fcat.
ls_fcat-edit = abap_true.
MODIFY pt_fieldcat FROM ls_fcat.
ENDLOOP.
ENDFORM. "build_fieldcat
* CLASS event_responder IMPLEMENTATION *
CLASS lcl_event_responder IMPLEMENTATION.
METHOD refresh_changed_data.
ASSIGN er_data_changed->mp_mod_rows->* TO <changed_rows>.
LOOP AT <changed_rows> INTO gs_tableline.
BREAK-POINT.
ENDLOOP.
ENDMETHOD. "click
ENDCLASS. "event_responder IMPLEMENTATION
Cheers,
Jose. -
F4 help in ALV grid, how to check the entries?
Hello,
I have created F4 help on the cells in a ALV using OO ABAP. The F4 Help works fine and the user can select the entries from it. BUt in F4 help, the user can manually enter values also.
I want to either disallow the user the enter values manually or validate his entries and ask him to choose from F4 only.
How to achieve this??Use this in Top Include
class local_event_handler definitin deferred.
data handler type ref to local_event_handler
After ALV Grid, register the edit event as shown below after the SET_TABLE_FOR_FIRST_DISPLAY and also set the handler as event handler
if handler is initial.
create object handler.
endif.
set handler handler->handle_data_changed
for main_grid. " Main Grid is your ALV Grid
call method main_grid->register_edit_event
exporting
i_event_id = cl_gui_alv_grid=>mc_evt_modified.
Class Definition / Implementation
class local_event_handler definition.
public section.
methods
handle_data_changed
for event data_changed of cl_gui_alv_grid
importing er_data_changed.
methods
local_event_handler .
endclass. "local_event_handler DEFINITION
class local_event_handler implementation.
method local_event_handler.
" do nothing
endmethod. "llocal_event_handler
method handle_data_changed.
read table er_data_changed->mt_mod_cells into ls_mod_cell index 1.
perform handle_data_changed using er_data_changed.
" ls_mod_cell-row_id contains the row number that changed. More details in er_data_changed
endmethod. "handle_data_changed
endclass. "handle_btn_click -
Need to help in alv grid graph
Hi All,
I made alv grid report.I put graph button in screen using pf status(&graph).
Now when I execute the report output come and my graph button is also working fine.But when I click
the graph button, the graph shows defalut column wise.Now I right click on graph and select chart type and then select LINES wise then graph shows LINES wise. Can we do default LINES wise so that
when I click on graph button then it should come LINES wise default.
Thanks,
RakeshHI,
You can do this using the FM GFW_PRES_SHOW
Check the sample program : DEMO_GFW_PRES_SHOW.
For more infomation:
refer to links:
Re: How to plot graph in ALV?
http://help.sap.com/saphelp_erp2005/helpdata/en/7e/daf830b46411d2961200a0c9308b1f/frameset.htm
hope this infromation helps you.
Thanks!
Maybe you are looking for
-
Error: While downloading the concurrent program
I am trying to download the concurrent program using FNDLOAD command and I getting the error. Can anyone help me to resolve this FNDLOAD Command > FNDLOAD apps/PASSWORD@RTCDV1 O Y DOWNLOAD $FND_TOP/patch/115/import/afcpprog.lct XXAR3006_PROCA_CP.ldt
-
running latest version of firefox and email server address is @msn.com
-
Is there a way to change usage right with the SDK?
Working on a web application that populates a PDF form based on interview questions using a third party tool. Everything works correctly except when there is a signature field on the form. Looking at the document properties, the Signing right has bee
-
Input screen for Variable in Bex
Hi , I have created variable based on calender month and this variable is used in reports,but for this variable i am unable to get the input screen where as when iam trying to execute same report in RSRT it is allowing me to enter the date. Its lots
-
How to get photos in order for burning to disc !
Hi, I am new to LR 3 , after downloading photo's from 3 CF cards from a wedding then editing I put chosen best shots into a smart collection and all seemed in order numbers wise etc, when I burnt to a disc they are now not in order of the days event,