Editable ALV tutorial -Field "R_PARAM" is unknown.
Hi,
I am practicing [ALV Editable Tutorial|https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/3133474a-0801-0010-d692-81827814a5a1].
I am stuck at Implement event handler ONDATACHECK.
METHOD ondatacheck .
DATA: node_node_flighttab TYPE REF TO if_wd_context_node,
elem_node_flighttab TYPE REF TO if_wd_context_element,
lt_sflight TYPE if_resultview=>elements_node_flighttab.
* save data only if no error has occured
CHECK r_param->t_error_cells IS INITIAL.
* navigate from <CONTEXT> to <NODE_FLIGHTTAB> via lead selection
node_node_flighttab
= wd_context->get_child_node( name = `NODE_FLIGHTTAB` ).
When I do a syntax check I am etting following message.
I guess I need to create a parameter R_PARAM.. What Should i refer it to? or am i doing something
wrong?
Error:
Method ONDATACHECK
Field "R_PARAM" is unknown. It is neither in one of the specified
tables nor defined by a "DATA" statement. .
Rgds
Vara
Resolved it.
I missed this.. part
1 Select Method type as 'Event Handler'
2. In the Event Column, Do F4 and select 'On DATA' Event.
Rgds
vara
Similar Messages
-
Editable ALV- Quantity field value is getting changed while double clicking
Hi all,
I have created Editable ALV grid using Class concepts. Quantity field is editable in dat. but after changing value and if im double clicking on that field, value is getting changed. eg: 45 is changing to .045. How can i resolve this problem.
Could u plz help.Hi Anu,
One question from my side.
U have displayed the ALV.In that grid u have quantity field.U have changed the value of that field to 45.
When u press enter the value has been changed to .045.Is this u r problem.
U can do onething anu.
Declare one varaible with the local field.
Pass u r quantity field value into that variable.
While displaying thriugh SET_TABLE_FIRST_DISPLAY in your internal table pass this variable.
It will solve u r problem.I think.
Let me if yu have any problem
IF u want u can refer to the program BCALV_EDIT* in se38.
There also u have needful info
Thanks, -
Hi all,
In Editable ALV quanity fields store wrong result .
Quanity is of packed type with 3 decomals.
For eg - During display like quanity is 22.245 when i insert quantity like 9 then it makes .009.
Any suggestion welcome.
Regards,Hi Navdeep singh
Specify the number of decimal places for that field in field catalogue. So that your problem will be resolved.
Venkat -
Editable ALV - how to throw an error message for a specific line & field
Hi all,
I've implemented an editable ALV and also the ON_DATA_CHECK event to check the values, entered in the ALV. So this works fine and I can check the values.
But now, I want to throw an error message corresponding to the field in the ALV, where the error occured.
How can I throw this error message corresponding to a specific line/field in the ALV?
I was using REPORT_ATTRIBUTE_ERROR_MESSAGE and REPORT_ELEMENT_ERROR_MESSAGE but without success.
I'm also using a loop over the "CHANGES" in the ALV and within this loop, I use
elem_alv = node_alv->get_element( index = <change>-element_index )
to get the element for the message.
CALL METHOD lo_message_manager->REPORT_ELEMENT_ERROR_MESSAGE
EXPORTING
MESSAGE_TEXT = 'my message'
ELEMENT = elem_alv
* ATTRIBUTES =
* PARAMS =
* MSG_USER_DATA =
* IS_PERMANENT = ABAP_FALSE
* SCOPE_PERMANENT_MSG = CO_MSG_SCOPE_CTXT_ELEMENT
* MSG_INDEX =
* CANCEL_NAVIGATION =
* IS_VALIDATION_INDEPENDENT = ABAP_FALSE.
2.) is it right, that for an editable ALV, I can't use the WDDOBEFOREACTION to do the checks?
If I try to use this, I can't get the values of my ALV table to check it.
Thanks,
AndreasHi Andreas,
I have tried to replicate your problem and I am getting the desired output. I have a row by name TEMP_NEW in my ALV and I want to throw an error message whenever the user enters a value of 4 for that particular field. Please find my coding as below. The important thing is where we perform the actual comparison between the r_value and 4. r_value is defined in SALV_WD_S_TABLE_MOD_CELL as reference to type DATA. So suppose the user enters a value of say 3 in the TEMP_NEW field of the ALV then r_value would contain 3 but if you observe its type in debugging mode it would be as TYPE REF TO I and not TYPE I. So you cannot directly say something like:
"if ls_modified_cells-r_value = 3" as this would lead to a syntax error. Define a field-symbol say <temp> and then use it to get the actual value into it by saying like:
ASSIGN ls_modified_cells-r_value->* TO <temp>.
Then you can use this <temp> for comparison in your IF statement like:
IF <temp> = 3.
Find the entire coding as below:
METHOD check_data.
DATA: lr_node TYPE REF TO if_wd_context_node,
lr_element TYPE REF TO if_wd_context_element,
ls_modified_cells TYPE salv_wd_s_table_mod_cell.
FIELD-SYMBOLS <temp> TYPE data.
" get message manager
DATA lo_api_controller TYPE REF TO if_wd_controller.
DATA lo_message_manager TYPE REF TO if_wd_message_manager.
lo_api_controller ?= wd_this->wd_get_api( ).
CALL METHOD lo_api_controller->get_message_manager
RECEIVING
message_manager = lo_message_manager.
lr_node = wd_context->get_child_node( name = 'NODE' ).
LOOP AT r_param->t_modified_cells INTO ls_modified_cells.
lr_element = lr_node->get_element( index = ls_modified_cells-index ).
IF ls_modified_cells-attribute = 'TEMP_NEW'.
" Get the value extracted into the field symbol from the reference variable
ASSIGN ls_modified_cells-r_value->* TO <temp>.
" Use the value present in this field-symbol for your comparison
IF <temp> = 4.
" report message
CALL METHOD lo_message_manager->report_attribute_error_message
EXPORTING
message_text = 'Sample message text'
element = lr_element
attribute_name = ls_modified_cells-attribute.
ENDIF.
ENDIF.
ENDLOOP.
ENDMETHOD.
Hope this helps resolve your problem.
Regards,
Uday -
Search help for date field in Editable ALV
Hello Friends,
I am using editable alv using 'reuse_* '.
I have used date as input field. While creating fieldcatlog also i have declared dat as a mkpf-budat.
But i am not getting serach help for date in output.
Is it possible with reuse or i have to go by object oriented ?Hi,
Just pass the Edit option of the fieldcatalog for those specific fields...
fcat-edit = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-cprog
i_callback_pf_status_set = 'PF_STATUS_SET'
i_callback_user_command = 'USER_COMMAND' "<---- pass this
i_callback_top_of_page = 'TOP'
is_layout = it_layout
it_fieldcat = it_fcat
i_default = 'X'
i_save = 'A'
it_events = it_event
TABLES
t_outtab = it_final
EXCEPTIONS
program_error = 1
OTHERS = 2.
*& Form USER_COMMAND
* text
* -->R_UCOMM text
* -->RS_SELFIELD text
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
CASE r_ucomm.
WHEN '&DATA_SAVE'. "<-------check this
PERFORM save_data.
ENDCASE.
ENDFORM. "USER_COMMAND -
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. -
Match code for an editable ALV field
Hi everyone,
I have an ALV with an editable field. I want to add matchcode with predefined 2 values to it.
I used EDIT option for field catalog to make this field editable.
I defined this field as a custom field in one of the DB table.
The possible values of the field are in the declaration of the DOMAIN. But I still can't see the matchcode with those values when I want to enter a value into this field in ALV.
What should I do?
Thank you in advance,
DianaHi Diana,
Welcome to SDN
When you set the field catalog you have to set option F4AVAILABL to 'X'.
If w_fcat is the field catalog structure then set as
w_fact-F4AVAILABL = 'X'
w_fact-CHECKTABLE = 'SCARR'
w_fact-REF_TABLE = 'SPFLI'
w_fact-REF_FIELD = 'CARRID'.
Refer the standard program BCALV_TEST_GRID_F4_HELP and BCALV_GRID_EDIT_DELTA
Please go through this thread for sample code
Re: F4 for fields in ALV Grid
Hope this would help you.
Good luck
Narin -
Mandatory field in Editable ALV
Hi everyone,
How to make a field as mandatory in an Editable ALV?
Is there any field catalog parameter avaialble??
or how can we do it.
Please give me a solution.
Regards
HemanthHi!
I use this solution. With this code, you can manage the mandantory filels via fileld cat.
METHOD handle_data_changed.
DATA: ls_fcat TYPE lvc_s_fcat,
structure TYPE REF TO data,
ls_modi TYPE lvc_s_modi,
tabix TYPE i,
index TYPE sytabix,
lr_str_desc TYPE REF TO cl_abap_structdescr,
ls_comp_desc TYPE abap_compdescr,
ls_structure type ty_zt921_alv.
FIELD-SYMBOLS: <itab> TYPE ANY TABLE,
<struct> TYPE ANY,
<fs_strukture> TYPE ANY,
<fs_field> TYPE ANY.
IF e_onf4 IS INITIAL.
READ TABLE er_data_changed->mt_fieldcatalog INTO ls_fcat
INDEX 1.
CREATE DATA structure TYPE (ls_fcat-ref_table).
ASSIGN structure->* TO <struct> CASTING TYPE (ls_fcat-ref_table).
ASSIGN er_data_changed->mp_mod_rows->* TO <itab>.
LOOP AT <itab> ASSIGNING <struct>.
MOVE-CORRESPONDING <struct> TO ls_structure.
ASSIGN ls_structure TO <fs_strukture>.
lr_str_desc ?= cl_abap_typedescr=>describe_by_data( <fs_strukture> ).
index = index + 1.
LOOP AT lr_str_desc->components INTO ls_comp_desc.
ASSIGN COMPONENT ls_comp_desc-name OF STRUCTURE <fs_strukture> TO <fs_field>.
READ TABLE er_data_changed->mt_fieldcatalog
INTO ls_fcat
WITH KEY fieldname = ls_comp_desc-name
mark = 'X'.
IF sy-subrc = 0.
IF <fs_field> IS INITIAL.
CALL METHOD er_data_changed->add_protocol_entry
EXPORTING
i_msgid = 'ZH'
i_msgno = '044'
i_msgty = 'E'
* i_msgv1 = text-m03
i_msgv2 = <fs_field>
* i_msgv3 = text-m05
i_fieldname = ls_comp_desc-name
i_row_id = index.
error_in_data = 'X'.
ENDIF.
ENDIF.
ENDLOOP.
ENDLOOP.
ENDIF.
ENDMETHOD. "handle_before_user_command -
HI,
Ive made an editable alv using my z-table. The z-table has a field sqty which is of type 'QUAN' referring to 'sunit' field(type UNIT) of same ztable .
Whenever i try to edit this sqty field it behaves weirdly. If i enter 123456 value in sqty , it takes it as 123.456 , or if i enter 1 in sqty it takes it as .001.
Why does it divide by 1000 always. IS it something to do with unit conversion? how do i overcome this problem.
I also had written a program to upload in this table using flat file, that program works fine.
Can anyone guide me please.
ByeHi,
There is a conversion routine attached to the Unit field. ( Conversion routine -CUNIT). Check in output characteristics of the domain.
One of the ways is to clone the domain and datatype and use them without the conversion routine.
Hope it helps.
Thanks,
Saipriya -
Exception while creating f4 help for editable alv field
hi experts
i have created search help for editable alv field by following link
http://scn.sap.com/docs/DOC-39832
But i m getting an exception : Field symbol has not yet been assigned.
exception area code
read table <tab1> into <ls_wa> index i_row_id.
assign component m_cl_variant->ms_layout-stylefname
of structure <ls_wa> to <l_field>.
read table <l_field> into ls_style
with table key fieldname = is_col_id-fieldname.
if sy-subrc eq 0.
if ls_style-style o mc_style_enabled.
ready_for_input = 1.
exit.
elseif ls_style-style o mc_style_disabled.
ready_for_input = 0.
exit.
endif.
first read statement is giving sy-subrc =4.
PS: exception from method..:IS_READY_FOR_INPUT
kindly helpHello Ankush,
read table <tab1> ASSIGNING <ls_wa> index i_row_id.
IF <ls_wa> IS ASSIGNED.
assign component m_cl_variant->ms_layout-stylefname
of structure <ls_wa> to <l_field>.
read table <l_field> into ls_style
with table key fieldname = is_col_id-fieldname.
if sy-subrc eq 0.
if ls_style-style o mc_style_enabled.
ready_for_input = 1.
exit.
elseif ls_style-style o mc_style_disabled.
ready_for_input = 0.
exit.
endif.
ENDIF.
Regards,
TP -
Mandatory Fields on Editable ALV Grid
Hi. I am using oops method to make an editable ALV grid.
How do I sent some columns for mandatory data entry?
Here are my declarations
gs_layout TYPE lvc_s_layo, "Layout declaration
go_grid TYPE REF TO cl_gui_alv_grid, "Grid
go_custom_container TYPE REF TO cl_gui_custom_container,"Container
go_fieldcat type lvc_t_fcat, "Field Catalog
Thanks,
ShareenHi Shareen Hegde ,
Try this program.
report zshail_alv_new .
tables: sflight.
type-pools: icon.
data: pt_sort type lvc_t_sort.
data: my_column type table of lvc_s_ceno with header line.
data: t_hype type LVC_T_HYPE.
class shail_event definition.
public section.
methods:
handle_toolbar for event toolbar of cl_gui_alv_grid
importing e_object e_interactive,
handle_user_command for event user_command of cl_gui_alv_grid importing
e_ucomm,
handle_contextmenu_request for event context_menu_request of
cl_gui_alv_grid importing e_object.
endclass.
class shail_event implementation.
method handle_toolbar.
perform handler_toolbar using e_object e_interactive.
endmethod.
method handle_user_command.
perform handler_user_command using e_ucomm.
endmethod.
method handle_contextmenu_request.
perform handler_contextmenu_request using e_object.
endmethod.
endclass.
data: go_container type ref to cl_gui_custom_container,
go_grid type ref to cl_gui_alv_grid,
field_catalog type lvc_t_fcat,
layout type lvc_s_layo.
data: begin of itab occurs 0.
include structure sflight.
data: end of itab.
data: obj type ref to shail_event.
data: button_exclude type ui_functions.
start-of-selection.
call screen 200.
*& Module STATUS_0100 OUTPUT
text
module status_0100 output.
SET PF-STATUS 'xxxxxxxx'.
SET TITLEBAR 'xxx'.
if go_container is initial.
create object go_container
exporting
PARENT =
container_name = 'ALV_CONTAINER'
STYLE =
LIFETIME = lifetime_default
REPID =
DYNNR =
NO_AUTODEF_PROGID_DYNNR =
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
CREATE_ERROR = 3
LIFETIME_ERROR = 4
LIFETIME_DYNPRO_DYNPRO_LINK = 5
others = 6
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
create object go_grid
exporting
I_SHELLSTYLE = 0
I_LIFETIME =
i_parent = go_container
I_APPL_EVENTS = space
I_PARENTDBG =
I_APPLOGPARENT =
I_GRAPHICSPARENT =
I_USE_VARIANT_CLASS = SPACE
I_NAME =
EXCEPTIONS
ERROR_CNTL_CREATE = 1
ERROR_CNTL_INIT = 2
ERROR_CNTL_LINK = 3
ERROR_DP_CREATE = 4
others = 5
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
create object obj.
set handler obj->handle_toolbar for go_grid.
set handler obj->handle_user_command for go_grid.
set handler obj->handle_contextmenu_request for go_grid.
select * from sflight into corresponding fields of table itab.
perform catalog_fill changing field_catalog.
perform layout_fill changing layout.
perform prepare_sort_table changing pt_sort.
call method go_grid->set_table_for_first_display
exporting
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
I_CONSISTENCY_CHECK =
I_STRUCTURE_NAME = 'SFLIGHT'
IS_VARIANT =
I_SAVE =
I_DEFAULT = 'X'
is_layout = layout
IS_PRINT =
IT_SPECIAL_GROUPS =
it_toolbar_excluding = button_exclude
IT_HYPERLINK = t_hype
IT_ALV_GRAPHICS =
IT_EXCEPT_QINFO =
changing
it_outtab = itab[]
it_fieldcatalog = field_catalog
it_sort = pt_sort
IT_FILTER =
EXCEPTIONS
INVALID_PARAMETER_COMBINATION = 1
PROGRAM_ERROR = 2
TOO_MANY_LINES = 3
others = 4
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
else.
call method go_grid->refresh_table_display
EXPORTING
IS_STABLE =
I_SOFT_REFRESH =
EXCEPTIONS
FINISHED = 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.
endif.
endmodule. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
text
module user_command_0100 input.
case sy-ucomm.
when 'BACK'.
LEAVE TO SCREEN 0.
endcase.
endmodule. " USER_COMMAND_0100 INPUT
*& Form CATALOG_FILL
text
<--P_FIELD_CATALOG text
form catalog_fill changing p_field_catalog.
data ls_fcat type lvc_s_fcat .
ls_fcat-fieldname = 'CARRID' .
ls_fcat-inttype = 'C' .
ls_fcat-outputlen = '20' .
ls_fcat-coltext = 'Carrier ID' .
ls_fcat-web_field = 'carrid_handle'.
ls_fcat-edit = 'X'.
*ls_fcat-emphasize = 'C310'. "needed for column coloring
append ls_fcat to field_catalog .
clear ls_fcat .
ls_fcat-fieldname = 'FLDATE' .
ls_fcat-ref_table = 'SFLIGHT' .
ls_fcat-ref_table = 'FLDATE' .
ls_fcat-outputlen = '20' .
ls_fcat-coltext = 'Flight Date' .
ls_fcat-web_field = 'fldate_handle'.
append ls_fcat to field_catalog .
clear ls_fcat .
ls_fcat-fieldname = 'PRICE' .
ls_fcat-ref_table = 'SFLIGHT' .
ls_fcat-ref_table = 'PRICE' .
ls_fcat-outputlen = '20' .
ls_fcat-coltext = 'Airfare' .
append ls_fcat to field_catalog .
clear ls_fcat .
ls_fcat-fieldname = 'SEATSMAX' .
ls_fcat-ref_table = 'SFLIGHT' .
ls_fcat-ref_table = 'SEATSMAX' .
ls_fcat-outputlen = '20' .
ls_fcat-coltext = 'Maximum seats' .
append ls_fcat to field_catalog .
endform. " CATALOG_FILL
*& Form LAYOUT_FILL
text
<--P_LAYOUT text
form layout_fill changing p_layout type lvc_s_layo.
p_layout-zebra = 'X' .
p_layout-grid_title = 'Flights' .
p_layout-smalltitle = 'X' .
p_layout-no_merging = 'X'.
*p_layout-sel_mode = 'A'.
*p_layout-info_fname = 'rowcolor'.
endform. " LAYOUT_FILL
*& Form exclude_std_buttons
text
<--P_BUTTON_EXCLUDE text
form exclude_std_buttons changing p_button_exclude type ui_functions.
the various buttons are details,sort asc,sort desc,find,set filter,
total, subtotal,
print,view,export,changelayout,display graphic, eu documentation
MC_FC_DETAIL,MC_FC_FIND,MC_FC_FILTER,MC_FC_GRAPHIC,MC_FC_SORT_ASC,
MC_FC_SORT_DSC,MC_FC_SUBTOT,MC_FC_SUM,MC_FC_PC_FILE,MC_FC_VIEWS
data: ls_exclude type ui_func.
ls_exclude = cl_gui_alv_grid=>mc_fc_detail.
append ls_exclude to p_button_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_find.
append ls_exclude to p_button_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_filter.
append ls_exclude to p_button_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_graph.
append ls_exclude to p_button_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_sort_asc.
append ls_exclude to p_button_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_sort_dsc.
append ls_exclude to p_button_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_subtot.
append ls_exclude to p_button_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_sum.
append ls_exclude to p_button_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_print.
append ls_exclude to p_button_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_views.
append ls_exclude to p_button_exclude.
endform. " exclude_std_buttons
*& Form handle_toolbar
text
-->P_E_OBJECT text
-->P_E_INTERACTIVE text
-->P_ENDMETHOD text
form handler_toolbar using p_e_object type ref to
cl_alv_event_toolbar_set
p_e_interactive .
data: ls_toolbar type stb_button.
clear ls_toolbar.
move 'PER' to ls_toolbar-function. "#EC NOTEXT
move icon_display_text to ls_toolbar-icon.
move 'Test Info'(201) to ls_toolbar-quickinfo.
move 'Test Info'(201) to ls_toolbar-text.
move ' ' to ls_toolbar-disabled. "#EC NOTEXT
append ls_toolbar to p_e_object->mt_toolbar.
endform. " handle_toolbar
*& Form handle_user_command
text
-->P_E_UCOMM text
form handler_user_command using p_e_ucomm.
case p_e_ucomm.
when 'PER'.
perform selected_columns.
when 'CREA'.
message i001(zmess).
endcase.
endform. " handle_user_command
*& Form prepare_sort_table
text
<--P_PT_SORT text
form prepare_sort_table changing p_pt_sort type lvc_t_sort.
data: ls_sort type lvc_s_sort.
ls_sort-spos = '1'.
ls_sort-fieldname = 'FLDATE'.
ls_sort-up = space.
ls_sort-down = 'X'.
append ls_sort to p_pt_sort.
endform. " prepare_sort_table
*& Form handler_contextmenu_request
text
-->P_E_OBJECT text
form handler_contextmenu_request using p_e_object type ref to
cl_ctmenu.
*CALL METHOD p_e_object->hide_functions
EXPORTING
fcodes = LT_FCODES
CALL METHOD p_e_object->clear
*break-point.
CALL METHOD p_e_object->add_function
EXPORTING
fcode = 'CREA'
text = 'Add Function'
ICON =
FTYPE =
DISABLED =
HIDDEN =
CHECKED =
ACCELERATOR =
endform. " handler_contextmenu_request
*& Form selected_columns
text
--> p1 text
<-- p2 text
form selected_columns.
CALL METHOD go_grid->get_selected_cells_id
IMPORTING
ET_CELLS = my_column[]
loop at my_column.
this will specify the id of the selected cell
message i001(zmess) with my_column-row_id.
message i002(zmess) with my_column-col_id.
endloop.
endform. " selected_columns
*& Form display_values
text
-->P_ROW_ID text
*& Form prepare_hyp_tab
text
<--P_T_HYPE text
form prepare_hyp_tab changing p_t_hype type lvc_t_hype.
endform. " prepare_hyp_tab
*& Module STATUS_0200 OUTPUT
text
module STATUS_0200 output.
SET PF-STATUS 'xxxxxxxx'.
SET TITLEBAR 'xxx'.
endmodule. " STATUS_0200 OUTPUT
*& Module USER_COMMAND_0200 INPUT
text
module USER_COMMAND_0200 input.
CASE SY-UCOMM.
WHEN 'NEXT'.
CALL SCREEN 100.
WHEN 'EXIT'.
LEAVE PROGRAM.
ENDCASE.
endmodule. " USER_COMMAND_0200 INPUT
Good Luck and REWARD ME for the same
Thanks
Ashok.N -
Mark fields (columns) in editable ALV Grid as mandatory
Hi,
could you please help me to set up a column in an editable alv grid as mandatory? I had a look in several references and also did not find anything in the fieldcatalog structure.
Best regards,
FabianHello Fabian
Here is some coding to explain what I meant.
*& Report ZUS_SDN_ALV_ERROR_LOG
REPORT zus_sdn_alv_error_log.
DATA:
er_data_changed TYPE REF TO cl_alv_changed_data_protocol.
START-OF-SELECTION.
* Dynpro is empty (contains no elements)
CALL SCREEN '0100'.
END-OF-SELECTION.
*& Module PBO_0100 OUTPUT
* text
MODULE pbo_0100 OUTPUT.
* Event DATA_CHANGED was fired due to changes in the editable ALV grid
IF ( er_data_changed IS BOUND ).
* User did not change any values
ELSE.
CREATE OBJECT er_data_changed
* EXPORTING
* I_CONTAINER =
* I_CALLING_ALV = <your ALV grid instance>
ENDIF.
* That is how your code probably looks like
* LOOP AT gt_outtab INTO gs_outtab.
* IF ( gs_outtab-obligatory IS INITIAL ).
* CALL METHOD go_alvlog->add_protocol_entry
* EXPORTING
* i_msgid = '00'
* i_msgty = 'E'
* i_msgno = '398'
* I_MSGV1 = 'Field OBLIGATORY must not be empty'
** I_MSGV2 =
** I_MSGV3 =
** I_MSGV4 =
* i_fieldname = 'OBLIGATORY'
** I_ROW_ID =
* I_TABIX = syst-tabix
* ENDIF.
* ENDLOOP.
* Generate a protocol for testing purposes
DO 5 TIMES.
CALL METHOD er_data_changed->add_protocol_entry
EXPORTING
i_msgid = '00'
i_msgty = 'E'
i_msgno = '398'
i_msgv1 = 'Field OBLIGATORY must not be empty'
* I_MSGV2 =
* I_MSGV3 =
* I_MSGV4 =
i_fieldname = 'OBLIGATORY'
i_row_id = syst-index
i_tabix = syst-index
ENDDO.
CALL METHOD er_data_changed->display_protocol
* EXPORTING
* I_CONTAINER =
ENDMODULE. " PBO_0100 OUTPUT
Please note that this report dumps as soon as you close the log popup. However, this will not happen within your event handler method.
Regards
Uwe -
Editable ALV - editable fields after copying row
Hi all!
I've got a (simple?) problem. I created an editable ALV (by using class CL_GUI_ALV_GRID). There it is possible to add, delte or change entries. That's work!
The problem is, when the user copies an entry, the fields are not ready for input. It's the default function of the ALV. My questions is, how can I make the new line editable (including the key fields). I tried to replace the "copy line" function of the ALV with my own function code (on event TOOLBAR) and process it on event BEFORE_USER_COMMAND.
In my own copy routine I read the selected line to create a new one with the same values, set the attributes (field table type LVC_T_STYL) for the new line and append it to my internal table. After that, I make a refresh of the ALV. Unfortunately the DATA_CHANGED event does not work anymore. So it is not possible for me to check for double entries and validitiy. It doesn't help to call method CHECK_CHANGED_DATA on the grid instance.
Does anybody has an idea or an example??
Thank you a lot!
Best regards,
Florian
PS: I used the report BCALV_EDIT_04 as example, but unfortunatley there is no copy functionality implemented!Hi,
Please check this [thread|Re: ALV Function module to Copy the row;.
Hope this helps.
Regards,
Chandravadan -
ALV Grid fields from editable to non-editable mode
Hi,
I am displaying my data through ALV Grid. In my grid the non-key fields are in editable mode.
When I edit any of the editable fields and place the cursor on other field the field which I have edited should become disable(non-editable). Again if I want to edit the same field which is now in non-editable mode should again change to editable mode when the cursor is placed on it.
Thanks & Regards,
Adithya M.Hi Adithya,
I am confused by your statement "place the cursor on other field the field which I have edited should become disable" -- are you stating that this is the requirement or what is currently happening with your program. The way the edit fields should work by default is they are editable at all times unless you tell it otherwise.
If you are saying your requirement is to change the field to disabled once the field is edited (runtime change), first you want to handle the event on data changed then within your method of handling on data changed, you can disable the field from being edited by using cell styles and changing the value to disabled.
If you look at program BCALV_GRID_EDIT,
You will find code where it disables the field for edit using Cell Style -- this will give you an idea how Cell Style controls editable fields and display fields:
ls_cell-style = cl_gui_alv_grid=>mc_style_enabled.
ls_cell-maxlen = 4.
ls_cell-fieldname = 'CARRNAME'.
append ls_cell to gt_sflight-cell.
This specific code will set the field disabled when the program is first exectued, in your case if you need to do this at run time, after someone edits the field, you need to implement handling the event on data changed, in the same program you will find:
method handle_data_changed.
perform data_changed using er_data_changed.
endmethod.
It is within this method that you can disable a field for editing.
However, once it is disabled you will not get back into the handle_data_changed method. I'm not sure I understand your statement "Again if I want to edit the same field which is now in non-editable mode should again change to editable mode when the cursor is placed on it." Why would you want the user to be able to edit something, then show it disabled, then let them click on it and edit it again? Why not just leave it in edit mode? Maybe if I understand the requirement better, I can answer this portion of the question.
If this is based on security or changing from edit to display for the entire grid, you can run the same program mentioned above and click on the Change/Display button in the top left to see how it enables and disables the entire grid for editing.
Cheers,
Bonnie -
Editable ALV - Standard F4 on Date field not choosable
Hi all,
Have made an editable ALV (All rows) . One date field where i can use F4 help (mean i can see date when i press f4) but selection is not possible. I cant double click the date. when i click on particular date and and press the TICK button ,value not populated in AVL ..
Thanks,
SriniHi Sri_neo,
I tried your scenario its working fine, when we double click on the date which is from F4 help it is reflecting on ALV grid.
Thanks & Regards,
Sridhar S.
Maybe you are looking for
-
Can I monitor multiple iPad screens on a single iPad?
I'm a teacher and we have distributed iPads to many of our students recently. We have a few issues with ensuring the pupils are using the iPads as we have asked and are not using it to access social media, games and messaging etc during class time. I
-
After iOS 7.1.2 update my bluetooth
After updating my Iphone 5s to iOS 7.1.2 my bluetooth conection which is manufacturer built in to my car, is no longer connecting properly. When I ring or someone rings me, all I can hear is interference in car speakers. Is anyone else experiencing
-
When I try to buy music, I get message saying that my credit card information does not match the bank records. My information, formatting are exactly the same as the bank. Help!
-
Activation of Batch Specific Unit of Measure in IS-Retail System
Hi experts, In our scenario for Articles, Client work with kg, but also want to keep track of the number of pieces. I am trying to MAP this Process using Batch Specific Unit of Measure functionality in IS-Retail. Is it Possible to Use the Batch Speci
-
Custom package layout problem when there are more than 6 pages
When I add a seventh page to a custom package layout for printing whatever changes that are made to that page take affect on page 1 not on page 7, i.e. if a I rotate a cell on page 7 the affect is not seen on page 7 but it is on page 1 which messes u