Cl_gui_alv_grid-check_changed_data issue
Hello,
I am using method "cl_gui_alv_grid->check_changed_data" in an editable ALV program like this.
module user_command_0100 input.
data: l_valid type c.
case ok_code.
when 'EDIT'.
call method plan_grid->check_changed_data
importing e_valid = l_valid.
if l_valid = 'X'.
perform update_data.
endif.
The issue is, even if no records were changed on the ALV output, the method is returning l_valid = 'X'.
Can I use l_valid as a flag to determine the data was changed?
Thanks.
Edited by: ravi kumar on Dec 17, 2009 12:35 PM
I think that the method tells you if there is any error on your ALV so you can save it without problems...remember that you can control errors when a particular field has changed.
In that case, the 'l_valid" is not a "true" flag for finding out if the data was changed or not but it is for determining if there are any errors or not.
Similar Messages
-
hi all,
i have requirement to d update , delete and insert a customized table through report .. i created the report and able to insert the record and delete , the fields displayed in the report output are order number, description and functional location in the report output . the order number is editable field .
my issue when we enter any order in new row i want to display the other fields automatically when we press enter key in keyboard..
Kindly let send the codeFirst of all you should have an event handler method for data changed event of cl_gui_alv_grid
then you will have to use cl_gui_alv_grid->check_changed_data( ) method for triggering the data changed event
register the event_enter of grid using
l_grid->register_edit_event(
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_entr ).
Inside the event handler method you have access er_data_changed .
then use
LOOP AT er_data_changed->mt_good_cells INTO l_good.
er_data_changed->get_cell_value(
EXPORTING
i_row_id = l_good-row_id
i_fieldname = 'ORDER'
IMPORTING
e_value = l_order ) .
if l_order is not initial.
select the other field values from l_order
then use
er_data_changed->modify_cell(
i_row_id = l_good-row_id
i_fieldname = 'DESCRIPTION'
i_value = l_description ).
endif. -
Quantity field for user input in interactive alv
hi,
i have created an interactive alv report that allows user to key in quantity fields using fm "REUSE_ALV_LIST_DISPLAY'. then quantity field is referred to MARD-LABST for instance, with 3 decimals point. When i tried to key in quantity as '9', it then will be converted into 0.009 by using cl_gui_alv_grid->check_changed_data( ). May i know what the root causes are and also how to resolve it using same fm??? Thanks.Hi,
In the field catalog, for the field set the attribute DECIMALS to 3.
This should resolve your issue.
Regards,
Sagar -
ALV GRID (add_protocol_entry)
Dear SDN,
I'm using edit grid.
How could I use the method call method p_data_changed->add_protocol_entry, outside event data_changed?
I need to check the data (all lines of te grid) at an (Z) user-comand.
Thanks!
Best regards,
Maria João RochaCall this method in your Z user command
call method cl_gui_alv_grid=>check_changed_data
importing
e_valid = v_valid.
if not v_valid is initial.
" Data changed
else.
" Data not changed
endif.
a® -
Need method to disable checkbox
Hi,
My alv Grid report contains checkbox at end of each row, when ever user select the checkbox , I am taking the particular line to internal Table by using below code.
DATA cl_gui_alv_grid TYPE REF TO cl_gui_alv_grid.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = cl_gui_alv_grid.
CALL METHOD cl_gui_alv_grid->check_changed_data.
My problem is whenever user selects the checkbox the checkbox should go Gray(Disabled).
Is there any method to do this, If so pls give sample code.
I tried with SET_VISIBLE, but not working
I am using version 4.6C
Thanks
kar
Edited by: karthik karthik on Jan 9, 2008 7:52 PMhi karthik,
this may be helpful to u
You have to have in the Output Table:
Types: begin of lt_io.
include structure mara. " Your Structure
Types: style_table type lvc_t_style.
Types: end of lt_io.
data: lt_io type table of lt_io,
ls_layout type lvc_s_layo,
lt_fcat type lvc_t_fcat,
lo_grid type ref to cl_gui_alv_grid.
field-symbols: <io> type lt_io,
<fcat> type lvc_s_fcat.
... fill your output table ....
ls_layout-stylefname = 'STYLE_TABLE'.
loop at lt_io assigning <io>.
PERFORM set_style USING 'CHECKBOX' "Your Filename
CHANGING <io>.
endloop.
... Fill Your Field Catalog lt_fcat
read table lt_fcat assigning <fcat>
where fieldname = 'CHECKBOX'.
<fcat>-checkbox = 'X'.
create grid control lo_grid.
CALL METHOD lo_grid->set_table_for_first_display
EXPORTING
is_layout = ls_layout
CHANGING
it_fieldcatalog = lt_fcat
it_outtab = lt_io[].
FORM set_style
USING iv_fieldname TYPE lvc_fname
CHANGING cs_io TYPE io.
DATA: ls_style TYPE lvc_s_styl,
lt_style TYPE lvc_t_styl.
ls_style-fieldname = iv_fieldname.
if cs_io-checkbox = ' '.
ls_style-style = cl_gui_alv_grid=>mc_style_enabled.
else.
ls_style-style = cl_gui_alv_grid=>mc_style_disabled.
endif.
ls_style-maxlen = 2.
INSERT ls_style INTO TABLE io-style_table.
ENDFORM. "set_style
regards,
sravanthi -
ALV grid using methods: how to get modified cells
Hi all,
IAM USING alv grid using methods,
i have few fields as editable
if the user edits any of those fields how can i know which cell is modified and what is the new value.
i tried to use method get_modified_cells
but iam getting a msg saying protected method and u can not use.
please advise.
thanks
JAfarJafar,
You need to Take the Help of DATA_CHANGED event, when ever there is a change in the Grid, it will trigger, here you can capture the Cells which are modified.
in your PAI call the method check changed data
CL_GUI_ALV_GRID-->CHECK_CHANGED_DATA
You need to set the handler for datachanged.
set the handler for this, and register the event modified or enter.
**Handler to Check the Data Change
HANDLE_DATA_CHANGED FOR EVENT DATA_CHANGED
OF CL_GUI_ALV_GRID
IMPORTING ER_DATA_CHANGED
E_ONF4
E_ONF4_BEFORE
E_ONF4_AFTER,
**Handle Data Change
METHOD HANDLE_DATA_CHANGED.
DATA: X_CHANGE TYPE LVC_S_MODI. "modified cells
LOOP AT ER_DATA_CHANGED->MT_GOOD_CELLS INTO X_CHANGE.
ENDLOOP.
ENDMETHOD. "HANDLE_DATA_CHANGED
Regards
Vijay -
Issue with CHECK_CHANGED_DATA method of CL_GUI_ALV_GRID class
HI,
I want to check whether my grid has any changes or not, for that i am using the CHECK_CHANGED_DATA method of CL_GUI_ALV_GRID class,
What i am doing is.... I am doing some changes in my grid data and clicking on SAVE . This time CHECK_CHANGED_DATA is saying the grid have changes ,and i am displaying a pop up whether to save the changes or not. And i am saving changes.
Till now Fine.
If i click on SAVE again CHECK_CHANGED_DATA is showing again the Grid has changes.
So how can i solve this problem.
Thanks in advance.Hello Narendra
If you do not need to do any validations of the changed ALV list data then you can use a very simple approach which does not even require an event handler for event DATA_CHANGED.
The crucial part of the coding is shown below, followed by the entire sample report ZUS_SDN_ALV_EDITABLE_1A. Basically, the ALV list is stored as a "PBO" image of the data (GT_OUTTAB_PBO). And only if the user changed the data (i.e. GT_OUTTAB_PBO <> GT_OUTTAB) the save option including the popup is executed.
*& Module USER_COMMAND_0100 INPUT
* text
MODULE user_command_0100 INPUT.
" NOTE: retrieve changed data from frontend (grid control) into
" the backend (itab in ABAP)
go_grid->check_changed_data( ).
CASE gd_okcode.
WHEN 'BACK' OR
'EXIT' OR
'CANC'.
SET SCREEN 0. LEAVE SCREEN.
WHEN 'SAVE'.
IF ( gt_outtab = gt_outtab_pbo ).
MESSAGE 'No data changed' TYPE 'S'.
ELSE.
CLEAR: gd_answer.
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
* TITLEBAR = ' '
* DIAGNOSE_OBJECT = ' '
text_question = 'Save data?'
IMPORTING
answer = gd_answer
* TABLES
* PARAMETER =
EXCEPTIONS
text_not_found = 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.
IF ( gd_answer = '1' ). " yes
MESSAGE 'Data successfully saved' TYPE 'S'.
gt_outtab_pbo = gt_outtab. " update PBO data !!!
ELSE.
MESSAGE 'Action cancelled by user' TYPE 'S'.
ENDIF.
ENDIF.
WHEN OTHERS.
ENDCASE.
CLEAR: gd_okcode.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Report ZUS_SDN_ALV_EDITABLE
* Flow logic of screen '100' (no elements, ok-code => gd_okcode ):
**PROCESS BEFORE OUTPUT.
** MODULE STATUS_0100.
**PROCESS AFTER INPUT.
** MODULE USER_COMMAND_0100.
REPORT zus_sdn_alv_editable_1a.
TYPE-POOLS: abap.
CONSTANTS:
gc_tabname TYPE tabname VALUE 'KNB1'.
TYPES: BEGIN OF ty_s_outtab.
INCLUDE TYPE knb1.
TYPES: END OF ty_s_outtab.
TYPES: ty_t_outtab TYPE STANDARD TABLE OF ty_s_outtab
WITH DEFAULT KEY.
DATA:
gd_okcode TYPE ui_func,
gd_repid TYPE syst-repid,
gt_fcat TYPE lvc_t_fcat,
gs_layout TYPE lvc_s_layo,
gs_variant TYPE disvariant,
go_docking TYPE REF TO cl_gui_docking_container,
go_grid TYPE REF TO cl_gui_alv_grid.
DATA:
gs_outtab TYPE ty_s_outtab,
gt_outtab TYPE ty_t_outtab,
gt_outtab_pbo TYPE ty_t_outtab.
DATA:
gd_answer TYPE c.
START-OF-SELECTION.
SELECT * FROM (gc_tabname) INTO TABLE gt_outtab UP TO 99 ROWS.
gt_outtab_pbo = gt_outtab. " set PBO data
PERFORM init_controls.
* ok-code field = GD_OKCODE
CALL SCREEN '0100'.
END-OF-SELECTION.
*& Form INIT_CONTROLS
* text
* --> p1 text
* <-- p2 text
FORM init_controls .
* Create docking container
CREATE OBJECT go_docking
EXPORTING
parent = cl_gui_container=>screen0
ratio = 90
EXCEPTIONS
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 ALV grid
CREATE OBJECT go_grid
EXPORTING
i_parent = go_docking
EXCEPTIONS
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.
" NOTE: not required
* set handler:
* lcl_eventhandler=>handle_data_changed for go_grid.
* Build fieldcatalog and set hotspot for field KUNNR
PERFORM build_fieldcatalog.
PERFORM set_layout_and_variant.
* Display data
CALL METHOD go_grid->set_table_for_first_display
EXPORTING
is_layout = gs_layout
is_variant = gs_variant
i_save = 'A'
CHANGING
it_outtab = gt_outtab
it_fieldcatalog = gt_fcat
EXCEPTIONS
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.
* NOTE:
* Documenation of I_SAVE ("An Easy Reference for ALV Grid Control")
*I_SAVE
*Determines the options available to the user for saving a layout:
*? 'X': global saving only
*? 'U': user-specific saving only
*? 'A': corresponds to 'X' and 'U'
*? SPACE: no saving
* Link the docking container to the target dynpro
gd_repid = syst-repid.
CALL METHOD go_docking->link
EXPORTING
repid = gd_repid
dynnr = '0100'
* CONTAINER =
EXCEPTIONS
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.
ENDFORM. " INIT_CONTROLS
*& Module STATUS_0100 OUTPUT
* text
MODULE status_0100 OUTPUT.
SET PF-STATUS 'STATUS_0100'.
* SET TITLEBAR 'xxx'.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
* text
MODULE user_command_0100 INPUT.
" NOTE: retrieve changed data from frontend (grid control) into
" the backend (itab in ABAP)
go_grid->check_changed_data( ).
CASE gd_okcode.
WHEN 'BACK' OR
'EXIT' OR
'CANC'.
SET SCREEN 0. LEAVE SCREEN.
WHEN 'SAVE'.
IF ( gt_outtab = gt_outtab_pbo ).
MESSAGE 'No data changed' TYPE 'S'.
ELSE.
CLEAR: gd_answer.
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
* TITLEBAR = ' '
* DIAGNOSE_OBJECT = ' '
text_question = 'Save data?'
* TEXT_BUTTON_1 = 'Ja'(001)
* ICON_BUTTON_1 = ' '
* TEXT_BUTTON_2 = 'Nein'(002)
* ICON_BUTTON_2 = ' '
* DEFAULT_BUTTON = '1'
* DISPLAY_CANCEL_BUTTON = 'X'
* USERDEFINED_F1_HELP = ' '
* START_COLUMN = 25
* START_ROW = 6
* POPUP_TYPE =
* IV_QUICKINFO_BUTTON_1 = ' '
* IV_QUICKINFO_BUTTON_2 = ' '
IMPORTING
answer = gd_answer
* TABLES
* PARAMETER =
EXCEPTIONS
text_not_found = 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.
* Triggers PAI of the dynpro with the specified ok-code
IF ( gd_answer = '1' ). " yes
MESSAGE 'Data successfully saved' TYPE 'S'.
gt_outtab_pbo = gt_outtab. " update PBO data !!!
ELSE.
MESSAGE 'Action cancelled by user' TYPE 'S'.
ENDIF.
ENDIF.
WHEN OTHERS.
ENDCASE.
CLEAR: gd_okcode.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form BUILD_FIELDCATALOG
* text
* --> p1 text
* <-- p2 text
FORM build_fieldcatalog .
* define local data
DATA:
ls_fcat TYPE lvc_s_fcat.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
* I_BUFFER_ACTIVE =
i_structure_name = gc_tabname
* I_CLIENT_NEVER_DISPLAY = 'X'
* I_BYPASSING_BUFFER =
* I_INTERNAL_TABNAME =
CHANGING
ct_fieldcat = gt_fcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ls_fcat-edit = abap_true.
MODIFY gt_fcat FROM ls_fcat
TRANSPORTING edit
WHERE ( key NE abap_true ).
ENDFORM. " BUILD_FIELDCATALOG
*& Form SET_LAYOUT_AND_VARIANT
* text
* --> p1 text
* <-- p2 text
FORM set_layout_and_variant .
CLEAR: gs_layout,
gs_variant.
gs_layout-cwidth_opt = abap_true.
gs_layout-zebra = abap_true.
gs_variant-report = syst-repid.
gs_variant-handle = 'GRID'.
ENDFORM. " SET_LAYOUT_AND_VARIANT
Regards
Uwe -
Hi guys,
I use the following method (register_edit_event) in the PBO soon after first display of an editable ALV grid to register enter as an event to do validations on fields like qty. If user enters some character like 'abc' for qty and hits enter on keyboard, ALV grid pop's up a standard message ( I haven't coded for this.Since I use DDIC structure in field catalog, the Std. ALV program takes care of it. ). THis takes care of the validation before I click on save.
call method alv_grid->register_edit_event
exporting
i_event_id = cl_gui_alv_grid=>mc_evt_enter.
This works fine. But I want this validation to run when I also click the SAVE button of the screen. Is it possible to run this standard validation in my PAI event eg. SAVE ? I thought I will be, by calling the method check_changed_data in my PAI event. But this is doing nothing. Does this method conflict with register_edit_event or something ? So , basically what I am looking for is to trigger the event or call the method which does the same work as the "check" button on ALV grid.
Any advice or tips or sample code is greatly appreciated.
Thanks,
ShareenHi Shareen,
Handle the data_changed event in the grid.
Whenever you make changes in the data in ALV Grid this event would be triggered. Here you can perform additional validations that you may need to perform.
METHODS handle_data_changed
FOR EVENT data_changed OF cl_gui_alv_grid
IMPORTING er_data_changed.
Implementation:
METHOD handle_data_changed.
PERFORM validations USING er_data_changed.
ENDMETHOD.
FORM validations USING er_data_changed TYPE REF TO cl_alv_changed_data_protocol.
DATA: ls_good TYPE lvc_s_modi.
DATA wa LIKE LINE OF lt_good_cells.
CALL METHOD g_grid->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_modified.
LOOP AT er_data_changed->mt_good_cells INTO ls_good.
CASE ls_good-fieldname.
WHEN 'FIELDNAME'. "Your fieldname
CALL METHOD er_data_changed->get_cell_value "Get the changed value
EXPORTING
i_row_id = ls_good-row_id
i_fieldname = ls_good-fieldname
IMPORTING
e_value = temp. "Your temp variable
"Make your validations here.
ENDCASE.
Ps: Reward points if helpful.
Regards,
Wenceslaus. -
Issue with editable alv using cl_gui_alv_grid
Hello all,
its a table update program . user can save create new entry and delete the entires . the screen should be avaiable for multiple time inputs by the user . i achived it by method handle double click and i am refreshing the scrren and making the alv for ready for input . but user wants the screen shoukld get refreshed automatically once user clicks on save button .
how can I achive plz advise .
I am working on ALV by cl_gui_alv_grid , I am using the followingmethods of the class
1) METHODS: handle_toolbar FOR EVENT toolbar OF cl_gui_alv_grid
IMPORTING e_object e_interactive.
2) METHODS: handle_user_command FOR EVENT
user_command OF cl_gui_alv_grid
IMPORTING e_ucomm,
check_changed_data.
3) METHODS: handle_double_click FOR EVENT
double_click OF cl_gui_alv_grid
IMPORTING e_row e_column.
4) METHODS: handle_data_changed
FOR EVENT data_changed OF cl_gui_alv_grid
IMPORTING er_data_changed.
Thanks in advance .Hi Soumyaprakash,
SAve is an user command . I want to have the values which are changed by the user and again the output should be ready for any actions like change the data , create new and delete any entry .
basically the alv output screen should be reday for inputs any number of times untill user clicks on back button .
Thanks
Basavaraj -
Hello Experts,
I am using the said method(handle_data_changed) in my ALV grid using cl_gui_alv_grid.
My question is, The value that I enter in one of the editable columns(TREAS_TRANSACTIONS) is not being passed
into structure ls_good. By the way, I am using BCALV_EDIT_03 as my reference.
Below is my code guys:
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
METHODS:
handle_data_changed FOR EVENT data_changed OF cl_gui_alv_grid
IMPORTING
er_data_changed.
PRIVATE SECTION.
DATA: ls_good TYPE lvc_s_modi.
METHODS: check_input
IMPORTING
im_amount TYPE lvc_s_modi
im_data_changed TYPE REF TO cl_alv_changed_data_protocol.
ENDCLASS. "lcl_event_receiver DEFINITION
CLASS lcl_event_receiver IMPLEMENTATION.
METHOD handle_data_changed.
LOOP AT er_data_changed->mt_good_cells INTO ls_good.
CASE ls_good-fieldname.
WHEN 'TREAS_TRANSACTIONS'.
CALL METHOD check_input
EXPORTING
im_amount = ls_good
im_data_changed = er_data_changed.
ENDCASE.
ENDLOOP.
ENDMETHOD. "handle_data_changed
METHOD check_input.
DATA: ls_input TYPE lvc_s_modi.
READ TABLE im_data_changed->mt_good_cells INTO ls_input
WITH KEY row_id = im_amount-row_id
fieldname = 'TOT_CASH_BAL'.
ENDMETHOD. "check_input
ENDCLASS. "lcl_event_receiver IMPLEMENTATIONAt which point exactly do you want the "Check_changed_data" to trigger? When you hit Enter on grid after you changed data on grid or when you hit any other button on toolbar after you changed data on grid?
Also post your code after
CALL METHOD gt_grid->set_table_for_first_display
when you are registering the event by
CALL METHOD gt_grid->register_edit_event
and set the handler
SET HANDLER go_ref->handle_data_changed FOR gt_grid.
Cheers,
Sougata. -
CL_GUI_ALV_GRID - field f4 help issue
Hi Experts,
I have a requirement to develop a module pool with a ALV grid (CL_GUI_ALV_GRID with a container). In edit mode of the grid, I have a F4 help for a field which comes because i have attached a input help to that field in that particular table. I can see the help window but when I select one from that help it will not populate in that field, even I can't select anything from that list only displaying the help.
Do I need to handle that event (onf4) of the grid? Or do I need to attach the F4 help separately to that particular field in the grid?
Could you please help me on this?
Thanks,
chaminda.Hi,
In search help ( F4 help ) for your input field,please use these Function Module calls
1 .Use F4IF_INT_TABLE_VALUE_REQUEST for fetching the request value from the input.
2. Then call DYNP_VALUES_READ for reading the selected input from the table ( search help table for your input field).
3. Then use DYNP_VALUES_UPDATE for updating your input field with the selected input from search help.
Here is a sample code for you
* function call for F4 display.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = ''"field for search help
dynpprog = sy-cprog "'prog name'
dynpnr = sy-dynnr
dynprofield = ''"screen field
value_org = 'S'
TABLES
value_tab =
return_tab = return_values
EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3
IF sy-subrc NE 0.
MESSAGE ().
ENDIF.
REFRESH itab_dynpfields.
CLEAR : itab_dynpfields.
t_dynpfields-fieldname = ''."screen field
APPEND t_dynpfields TO itab_dynpfields.
t_dynumb = sy-dynnr.
t_dyname = sy-repid.
* This function module must have the values added to
* the internal table that you need to read.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
dyname = t_dyname
dynumb = t_dynumb
TABLES
dynpfields = itab_dynpfields
EXCEPTIONS
invalid_abapworkarea = 1
invalid_dynprofield = 2
invalid_dynproname = 3
invalid_dynpronummer = 4
invalid_request = 5
no_fielddescription = 6
invalid_parameter = 7
undefind_error = 8
double_conversion = 9
stepl_not_found = 10
OTHERS = 11
IF sy-subrc NE 0.
MESSAGE ().
ENDIF.
LOOP AT itab_dynpfields INTO wa_itab_dynpfields.
LOOP AT return_values INTO wa_return_values.
CASE wa_itab_dynpfields-fieldname.
WHEN 'screen field'.
wa_itab_dynpfields-fieldvalue = wa_return_values-fieldval.
MODIFY itab_dynpfields
INDEX sy-tabix
FROM wa_itab_dynpfields.
ENDCASE.
ENDLOOP.
ENDLOOP.
CALL FUNCTION 'DYNP_VALUES_UPDATE'
EXPORTING
dyname = t_dyname
dynumb = t_dynumb
TABLES
dynpfields = itab_dynpfields
EXCEPTIONS
invalid_abapworkarea = 1
invalid_dynprofield = 2
invalid_dynproname = 3
invalid_dynpronummer = 4
invalid_request = 5
no_fielddescription = 6
undefind_error = 7
OTHERS = 8.
IF sy-subrc NE 0.
MESSAGE ().
ENDIF.
Ben -
How to insert line with values in ALV (CL_GUI_ALV_GRID)?
Hi,
Does anyone know how to get control of new line inserted in ALV (I am using class CL_GUI_ALV_GRID) before the new line is shown to the user. What I want the user to see is not a completely blank line, but a new line with certain fields filled with data.
I have tried with ALL events in CL_GUI_ALV_GRID but without any luck. If I create my own user command and insert it in the alv menu I get control, but not with the standards. Why?
Please help
Kind regards - Keld GregersenHi,
I created a nice work around...
CLASS lcl_event_handler DEFINITION.
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.
ENDCLASS. "lcl_event_handler DEFINITION
CLASS lcl_event_handler IMPLEMENTATION.
METHOD handle_toolbar.
DATA:
l_toolbar TYPE stb_button.
Here I replace SAP standard functions with own functions
READ TABLE e_object->mt_toolbar INTO l_toolbar
WITH KEY function = '&LOCAL&APPEND'.
IF sy-subrc = 0.
l_toolbar-function = 'OWN_APPEND'.
MODIFY e_object->mt_toolbar FROM l_toolbar INDEX sy-tabix.
ENDIF.
READ TABLE e_object->mt_toolbar INTO l_toolbar
WITH KEY function = '&LOCAL©_ROW'.
IF sy-subrc = 0.
l_toolbar-function = 'OWN_COPY_ROW'.
MODIFY e_object->mt_toolbar FROM l_toolbar INDEX sy-tabix.
ENDIF.
ENDMETHOD. "handle_toolbar
METHOD handle_user_command.
CASE e_ucomm.
WHEN 'OWN_APPEND'.
CALL METHOD ref_alv->check_changed_data
IMPORTING
e_valid =
CHANGING
c_refresh = 'X'
CREATE YOUR OWN CODE HERE
CALL METHOD ref_alv->refresh_table_display
EXPORTING
is_stable = 'X'
i_soft_refresh =
EXCEPTIONS
finished = 1
others = 2
ENDMETHOD. "handle_user_command
ENDCLASS. "lcl_event_handler IMPLEMENTATION
Kind regards
Keld Gregersen -
How to retreive data from alv when using CL_GUI_ALV_GRID
Hi All,
I am using two subscreens to display 2 ALV grids in a screen using the OOPs concept and the class CL_GUI_ALV_GRID. I would like to download data from these two alv grids into an excel after any changes, i.e sort, filter or summation. I was able to capture data for sort and filter. The logic to capture summation and subtotals is becoming very complex. I need to simplify for better. I need help to see if there is any method which captures the changed data on the screen so that i can just call the method and retrieve the data to push into an internal table before downlaoding to excel.
Your help is greatly appreciated.
Thanks in advance.
RoopaStep 1, define the method in class grid_hdr:
METHODS:handle_data_changed CHANGING e_valid TYPE c.
Step 2, process the method:
METHOD handle_data_changed.
CALL METHOD zgrid->check_changed_data
IMPORTING
e_valid = e_valid.
ENDMETHOD. "handle_data_changed
Step 3, use the method in PAI:
DATA l_valid TYPE c.
CALL METHOD grid_hdr->handle_data_changed
CHANGING
e_valid = l_valid.
IF l_valid = 'X'.
ENDIF.
Also you can search BCALV_EDIT_* in your system.
Edited by: SAM XIAO on Nov 17, 2009 8:03 AM -
Cl_gui_alv_grid - I get a blank screen
I seem to be having a problem with my screen. The issue is that I am using cl_gui_alv_grid to display an ALV. However, I call set_table_for_first_display, I get a blank screen. I have verified that I have data in the field cat, outtab, and sort tables. Any ideas?
SCREEN 2000
PROCESS BEFORE OUTPUT.
MODULE status_2000.
MODULE create_fieldcat.
MODULE create_obj.
MODULE call_alv.
PROCESS AFTER INPUT.
module user_command_2000.
module exit at exit-command.
MODULE STATUS_2000 OUTPUT.
SET pf-status '2000'.
SET TITLEBAR '2000'.
ENDMODULE. " STATUS_2000 OUTPUT
*& Module CREATE_FIELDCAT OUTPUT
* text
MODULE CREATE_FIELDCAT OUTPUT.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'PSPID'.
wa_fieldcat-tabname = 'IT_CONTRACT'.
wa_fieldcat-ref_field = 'PSPID'.
wa_fieldcat-ref_Table = 'PROJ'.
wa_fieldcat-KEY = 'X'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'POST1'.
wa_fieldcat-tabname = 'IT_CONTRACT'.
wa_fieldcat-ref_field = 'POST1'.
wa_fieldcat-ref_Table = 'PROJ'.
wa_fieldcat-KEY = 'X'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'SO_VALUE'.
wa_fieldcat-coltext = 'Sales Order Value'.
wa_fieldcat-do_sum = 'X'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'BILLED'.
wa_fieldcat-coltext = 'Amount Billed'.
wa_fieldcat-do_sum = 'X'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'NEBTR'.
wa_fieldcat-coltext = 'Cash Received'.
wa_fieldcat-do_sum = 'X'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'DMBTR'.
wa_fieldcat-coltext = 'Retention'.
wa_fieldcat-do_sum = 'X'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'PERCENT_BILLED'.
wa_fieldcat-coltext = 'Percent Billed'.
wa_fieldcat-no_sum = 'X'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_sort.
wa_sort-spos = '1'.
wa_sort-fieldname = 'PSPID'.
wa_sort-SUBTOT = 'X'.
APPEND wa_sort TO it_sort.
ENDMODULE. " CREATE_FIELDCAT OUTPUT
MODULE CREATE_OBJ OUTPUT.
IF g_custom_container IS INITIAL.
CREATE object g_custom_container
EXPORTING
container_name = 'CCONTAINER'.
CREATE object grid
EXPORTING
i_parent = g_custom_container.
CREATE object g_handler.
SET HANDLER g_handler->top_of_page FOR grid.
ENDIF.
ENDMODULE. " CREATE_OBJ OUTPUT
MODULE CALL_ALV OUTPUT.
CALL METHOD grid->set_table_for_first_display
EXPORTING
* i_buffer_active =
* i_bypassing_buffer =
* i_consistency_check =
* i_structure_name =
* is_variant =
* i_save =
* i_default = 'X'
* is_layout =
is_print = wa_print
* it_special_groups =
* it_toolbar_excluding =
* it_hyperlink =
* it_alv_graphics =
* it_except_qinfo =
* ir_salv_adapter =
CHANGING
it_outtab = it_contract
it_fieldcatalog = it_fieldcat
it_sort = it_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.
Regards,
Davis
I believe the problem may be that I don't have the container in the attributes list of the screen. I am not sure why it isn't there.I did, if this is what you mean:
MODULE CREATE_OBJ OUTPUT.
IF g_custom_container IS INITIAL.
CREATE object g_custom_container
EXPORTING
container_name = 'CCONTAINER'.
CREATE object grid
EXPORTING
i_parent = g_custom_container.
CREATE object g_handler.
SET HANDLER g_handler->top_of_page FOR grid.
ENDIF.
ENDMODULE. " CREATE_OBJ OUTPUT
Regards,
Davis -
Issue with the ABAP program to find BI lookups and code Patterns
Hello dears,
I'm trying to use the ABAP program LOOKUP_FINDER:
http://wiki.sdn.sap.com/wiki/display/BI/ABAPprogramtofindBIlookupsandcodePatterns
But I have the following issue:
Runtime Errors
RAISE_EXCEPTION
Short text
Exception condition "NO_FIELDCATALOG_AVAILABLE" raised.
Error analysis
A RAISE statement in the program "CL_GUI_ALV_GRID===============CP" raised the
exception
condition "NO_FIELDCATALOG_AVAILABLE".
Since the exception was not intercepted by a superior
program, processing was terminated.
Source Code Extract
Line SourceCde
1 method set_sort_criteria.
2
3 *... (1) Trace?
4 if not mr_trace is initial.
5 call method mr_trace->add_trace_item
6 exporting
7 i_trace_item = 'SET_SORT_CRITERIA'
8 ir_variant = m_cl_variant
9 it_data = mt_data
10 it_info = mt_info.
11 endif.
12
13 if m_cl_variant->mt_fieldcatalog is initial.
>>>>> raise no_fieldcatalog_available.
15 endif.
16
17 m_cl_variant->mt_sort = it_sort.
18
19 call function 'LVC_SORT_COMPLETE'
20 exporting
21 it_fieldcat = m_cl_variant->mt_fieldcatalog
22 changing
23 ct_sort = m_cl_variant->mt_sort.
24
25 endmethod.
This issue is located in the FM 'REUSE_ALV_GRID_DISPLAY' called at the end of the program.... maybe because the catalog is empty?
For your information, I called the program 'ZLOOKUP_FINDER'.
Can you help me to fix this issue?
Regards,
Vince.Hi Vince,
If a table is empty field catalog usually return no error it just display your field catalog with headers .
I think the issue is with building of field catalog .
May be some settings are missing there .
Please check FM REUSE_ALV_FIELDCATALOG_MERGE where field catalog is getting generated.
Regards,
Jaya Tiwari
Maybe you are looking for
-
6 Plus: Screen rotation for pre-installed apps
Having a bit of an argument on this one with the fiance, so some input would be greatly appreciated: With the Phone app on the iPhone 6 Plus, is the screen supposed to rotate or not? My fiance called Apple Support and was told that it was supposed to
-
Using the dynamic width and dynamic height properties of a chart I will change the size of the chart dynamically. However, when exporting the chart to an image I want it to export at the chart size and not be restricted to the static size of the page
-
Domain Controller CPU Spike - Due to system logs
Hi all, Wondering if anybody out there is having the same issue as me, and if they have found a solution to it. A number of our Domain Controllers 2008 forest on physical and virtual 2008r2 servers with full patches were having a heart rhythm spike i
-
Downloading of DW keeps failing
Trying to download Dw CC 2014 keeps failing I am new member of Creative Cloud Welcome. We're glad you've joined us. Thanks for joining Creative Cloud. We thought we'd send along a few ideas to help you get started. Get 30-day trials of all-new versio
-
Im building a new application for our intranet.. and need some suggestions on how to accomplish this.. Right now the process has been broken down into 5 pages.. they are asking alot of questions, similar to an online job application.. What i need to