Append/Insert(not Single) Mutliple rows on ALV Webdynpro
Hello Friends,
We all know that the std button Append/Insert , can insert only one row on a single click.
My specific requirement is :
1) that when User clicks on this button(single click), we need to see 'n' rows( n will be provided as a input box for th user to provide like 5,10,12 etc) appended/inserted at the end of the ALV list .
2) In all the new rows, some of the columns should be defaulted to some data.
Is there any approach to achieve this requirement?
Regards
Vinay.
Hello Kiran,
As i mentioned earlier, I already implemented the above said approach. Its working..
But just wanted to check if there is any facility as these new rows will not be captured centrally in the
r_param->t_inserted_rows (in data check event). So that i can move on with other processing .
FYI... there is a method in the class CL_SALV_WD_CONFIG_TABLE - IF_SALV_WD_STD_FUNCTIONS~SET_EDIT_APPEND_ROWS_ALLOWED( which is obsolete now).
I dont know why this facility is not provided.
May be we need to check this faciltiy as well with Thomas Jung to re-add this in future.
Anyways..i continue with my approach...
Regards
Vinay.
Similar Messages
-
Insert ,Delete & Add a row in ALV
HI,
I have a ztable and i have used REUSE_ALV_GRID_DISPLAY to display all the data.
But the problem is i have want to give the user an option to Delete , Insert & Modify the data.
Can any please give me some i/p's
thanks
RanjitContinued..
IF NOT git_selected_rows IS INITIAL.
* Pass the selected rows into a internal table
LOOP AT git_selected_rows INTO ls_selected_row.
LOOP AT git_po INTO gwa_po.
lv_idx = sy-tabix.
IF lv_idx EQ ls_selected_row-index. "row_id.
lwa_po_temp = gwa_po.
APPEND lwa_po_temp TO git_po_temp.
ENDIF.
ENDLOOP.
ENDLOOP.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
for grid dispaly this is the code
DATA : lc_custom_control_name_100 TYPE scrfname VALUE 'CC_GRID_100',
lr_container_100 TYPE REF TO cl_gui_custom_container.
DATA : lit_po TYPE TABLE OF zpo_approver,
lwa_po LIKE LINE OF lit_po.
IF gr_alvgrid_100 IS INITIAL .
*----Creating custom container instance
CREATE OBJECT lr_container_100
EXPORTING
container_name = lc_custom_control_name_100
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.
*--Exception handling
ENDIF.
*----Creating ALV Grid instance
CREATE OBJECT gr_alvgrid_100
EXPORTING
i_parent = lr_container_100
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
OTHERS = 5.
*----Preparing field catalog.
PERFORM prepare_field_catalog_100 CHANGING gt_fieldcat_100.
*----Preparing layout structure
PERFORM prepare_layout CHANGING gs_layout .
CALL METHOD gr_alvgrid_100->set_table_for_first_display
EXPORTING
is_layout = gs_layout
CHANGING
it_outtab = git_po
it_fieldcatalog = gt_fieldcat_100
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
Regards,
Nagaraj -
How to split a single column row in alv report
Hi All,
I need to split a row of the particular coolumn in alv report.
for example row size is 10 that should be split into 5 & 5.
Thanks
RamHi Ram,
You can add one more column for that..
while processing your internal table you can split the value for that column using offset..
DATA : FIELD_STR(10) TYPE C.
VAR1 = FIELD_STR+0(5) .
VAR2 = FIELD_STR+5(5) .
Now you can print this both VAR1 and VAR2 in seperate column.
Please search on SCN before posting any question..
Hope it will solve your problem..
Thanks & Regards
ilesh 24x7
ilesh Nandaniya -
How to set a single cell editable in alv Webdynpro Abap
I am trying to edit a single cell on lead selection. here the steps i did to achive this.
1. I added a Attribute READ_ONLY inside my node of type WDY_BOOLEAN.
2. i am conditionally making this Attribute - READ_ONLY = 'X'.
3. i am binding my node with new values.
4. for ALV here is the code i have added.
DATA :lo_cmp_usage TYPE REF TO if_wd_component_usage,
lr_column TYPE REF TO cl_salv_wd_column,
lr_table_settings TYPE REF TO if_salv_wd_table_settings,
lt_columns TYPE salv_wd_t_column_ref,
ls_columns TYPE salv_wd_s_column_ref,
lr_input_field TYPE REF TO cl_salv_wd_uie_input_field,
lo_interfacecontroller TYPE REF TO iwci_salv_wd_table ,
lv_value TYPE REF TO cl_salv_wd_config_table.
*Taking reference of the Component Usage
lo_cmp_usage = wd_this->wd_cpuse_cu_alv( ).
IF lo_cmp_usage->has_active_component( ) IS INITIAL.
lo_cmp_usage->create_component( ).
ENDIF.
lo_interfacecontroller = wd_this->wd_cpifc_cu_alv( ).
lv_value = lo_interfacecontroller->get_model( ).
CALL METHOD lv_value->if_salv_wd_column_settings~get_columns
RECEIVING
value = lt_columns.
LOOP AT lt_columns INTO ls_columns.
lr_column = ls_columns-r_column.
CASE ls_columns-id.
WHEN 'USR_ACT_RT'.
CREATE OBJECT lr_input_field
EXPORTING
value_fieldname = ls_columns-id.
lr_column->set_cell_editor( value = lr_input_field ).
lr_input_field->set_read_only_fieldname( value = 'READ_ONLY' ).
ENDCASE.
ENDLOOP.
lr_table_settings ?= lv_value.
lr_table_settings->set_read_only( abap_false ).
lv_value->if_salv_wd_column_settings~delete_column( id = 'READ_ONLY' ).
but instead of changing the particular cell where i have marked READ_ONLY = 'X' it is changing whole column 'USR_ACT_RT' data as editable .
If anybody can please help ASAPHi Tashi,
Thanks for your reply,i have did the same way u are doing here for setting the READ_ONLY Attribute conditionally.
here is my code for setting the read only attribute .
IF NOT lo_nd_nd_cost_rate IS INITIAL.
lo_nd_nd_cost_rate->get_static_attributes_table( IMPORTING table = lt_nd_cost_rate ).
ENDIF.
IF NOT lo_el_nd_cost_rate IS INITIAL.
* get all declared attributes
lo_el_nd_cost_rate->get_static_attributes(
IMPORTING
static_attributes = ls_nd_cost_rate_sel ).
ENDIF.
lv_datum = sy-datum.
lv_month = lv_datum+4(2).
** @TODO handle non existant child
LOOP AT lt_nd_cost_rate INTO ls_nd_cost_rate WHERE quarter = ls_nd_cost_rate_sel-quarter.
IF ls_nd_cost_rate-quarter = 'Q1'.
IF ( lv_month EQ '01' OR lv_month EQ '02' OR lv_month EQ '03' ).
ls_nd_cost_rate-read_only = 'X'.
ELSE.
ls_nd_cost_rate-read_only = ''.
* report message
CALL METHOD lo_message_manager->report_warning
EXPORTING
message_text = lv_text.
ENDIF.
ELSEIF ls_nd_cost_rate-quarter = 'Q2'.
IF ( lv_month EQ '04' OR lv_month EQ '05' OR lv_month EQ '06' ).
ls_nd_cost_rate-read_only = 'X'.
ELSE.
ls_nd_cost_rate-read_only = ''.
* report message
CALL METHOD lo_message_manager->report_warning
EXPORTING
message_text = lv_text.
ENDIF.
ELSEIF ls_nd_cost_rate-quarter = 'Q3'.
IF ( lv_month EQ '07' OR lv_month EQ '08' OR lv_month EQ '09' ).
ls_nd_cost_rate-read_only = 'X'.
ELSE.
ls_nd_cost_rate-read_only = ''.
* report message
CALL METHOD lo_message_manager->report_warning
EXPORTING
message_text = lv_text.
ENDIF.
ELSEIF ls_nd_cost_rate-quarter = 'Q4'.
IF ( lv_month EQ '10' OR lv_month EQ '11' OR lv_month EQ '12' ).
ls_nd_cost_rate-read_only = 'X'.
ELSE.
ls_nd_cost_rate-read_only = ''.
* report message
CALL METHOD lo_message_manager->report_warning
EXPORTING
message_text = lv_text.
ENDIF.
ENDIF.
MODIFY lt_nd_cost_rate FROM ls_nd_cost_rate INDEX sy-tabix TRANSPORTING read_only .
CLEAR ls_nd_cost_rate.
ENDLOOP.
lo_nd_nd_cost_rate->bind_table( lt_nd_cost_rate ).
please see in the below sceen shot the last two cells are editable in the User Actual Rate Column whlie the selected rows cell is not editable. Please revert if u have any input for same. -
Hi experts...
I want single row in alv report.
I have use loop for fatch data into internal table using loop when i am passing data in alv report then the data comes according loop. i want onlu one data in alv row.
how can i do such, plz help me.decleare two internal table.
read table itab into wa index 1.
append wa to itab2.
pass itab2 only one record display. -
Hi ,
I need to insert a row in ALV output. On click of a Inser Row button a pop up should show with a parameter.Once the value in entered in the parameter enter is hit , the first column of the new row should have value put in that parameter as non editable field.
The Insert row of standard toolbar inserts a blank row . Is there any way to incorporate the above logic in the standard toolbar?
I'm using CL_GUI_ALV_GRID to display the ALV.
It would be helpful if you provide sample coding.
Thanks.
Ajith
Edited by: Ajith Krishna on Oct 28, 2008 8:01 PMHello Ajith
The enhanced version of sample report ZUS_SDN_ALVGRID_EDITABLE_8A demonstrates how to implement your requirement.
*& ZUS_SDN_ALVGRID_EDITABLE_8A
*& Thread: Insert a row in ALV
*& <a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="1105097"></a>
*& Thread: Blanking values on ALV Grid Row Duplicate
*& <a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="1057161"></a>
*& Thread: Delete line event in ALV
*& <a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="945471"></a>
REPORT zus_sdn_alvgrid_editable_8a.
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,
go_docking TYPE REF TO cl_gui_docking_container,
go_grid TYPE REF TO cl_gui_alv_grid.
DATA:
gt_outtab TYPE ty_t_outtab.
* CLASS lcl_eventhandler DEFINITION
CLASS lcl_eventhandler DEFINITION.
PUBLIC SECTION.
CLASS-DATA:
mt_sel_rows TYPE lvc_t_row.
CLASS-METHODS:
handle_toolbar
FOR EVENT toolbar OF cl_gui_alv_grid
IMPORTING
e_object
sender,
handle_user_command
FOR EVENT user_command OF cl_gui_alv_grid
IMPORTING
e_ucomm
sender.
ENDCLASS. "lcl_eventhandler DEFINITION
* CLASS lcl_eventhandler IMPLEMENTATION
CLASS lcl_eventhandler IMPLEMENTATION.
METHOD handle_toolbar.
* define local data
DATA: ls_button TYPE stb_button.
LOOP AT e_object->mt_toolbar INTO ls_button.
CASE ls_button-function.
when cl_gui_alv_grid=>MC_FC_LOC_INSERT_ROW.
ls_button-function = 'INSERT_ROW'.
MODIFY e_object->mt_toolbar FROM ls_button INDEX syst-tabix.
WHEN cl_gui_alv_grid=>mc_fc_loc_delete_row.
ls_button-function = 'DELETE_ROW'.
MODIFY e_object->mt_toolbar FROM ls_button INDEX syst-tabix.
WHEN cl_gui_alv_grid=>mc_fc_loc_copy_row OR
cl_gui_alv_grid=>mc_fc_loc_copy.
ls_button-function = 'COPY_ROW'.
MODIFY e_object->mt_toolbar FROM ls_button INDEX syst-tabix.
WHEN OTHERS.
CONTINUE.
ENDCASE.
ENDLOOP.
ENDMETHOD. "handle_toolbar
METHOD handle_user_command.
* define local data
DATA: lt_rows TYPE lvc_t_row,
ls_row TYPE lvc_s_row.
REFRESH: mt_sel_rows.
CASE e_ucomm.
when 'INSERT_ROW'.
WHEN 'DELETE_ROW'.
WHEN 'COPY_ROW'.
WHEN OTHERS.
RETURN.
ENDCASE.
" User wants to delete or copy rows => store them in class attribute
" and trigger PAI afterwards where we actually delete /copy the rows
" and do the recalculations (in case of deletion)
CALL METHOD sender->get_selected_rows
IMPORTING
et_index_rows = mt_sel_rows
* et_row_no =
* Trigger PAI
CALL METHOD cl_gui_cfw=>set_new_ok_code
EXPORTING
new_code = e_ucomm
* IMPORTING
* rc =
ENDMETHOD. "user_command
ENDCLASS. "lcl_eventhandler IMPLEMENTATION
PARAMETERS:
p_bukrs TYPE bukrs DEFAULT '2000' OBLIGATORY.
START-OF-SELECTION.
SELECT * FROM knb1 INTO CORRESPONDING FIELDS OF TABLE gt_outtab
UP TO 15 ROWS
WHERE bukrs = p_bukrs.
PERFORM init_controls.
SET HANDLER:
lcl_eventhandler=>handle_toolbar FOR go_grid,
lcl_eventhandler=>handle_user_command FOR go_grid.
" Used to replace standard toolbar function code with custom FC
go_grid->set_toolbar_interactive( ).
* 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.
* ok-code field = GD_OKCODE
CALL SCREEN '0100'.
END-OF-SELECTION.
*& Module STATUS_0100 OUTPUT
* text
MODULE status_0100 OUTPUT.
SET PF-STATUS 'STATUS_0100'.
* SET TITLEBAR 'xxx'.
** CALL METHOD go_grid1->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.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
* text
MODULE user_command_0100 INPUT.
CASE gd_okcode.
WHEN 'BACK' OR
'END' OR
'CANC'.
SET SCREEN 0. LEAVE SCREEN.
WHEN 'INSERT_ROW'.
perform INSERT_ROW.
WHEN 'DELETE_ROW'.
PERFORM delete_rows.
WHEN 'COPY_ROW'.
PERFORM copy_rows.
WHEN OTHERS.
ENDCASE.
CLEAR: gd_okcode.
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.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form BUILD_FIELDCATALOG_KNB1
* text
* --> p1 text
* <-- p2 text
FORM build_fieldcatalog_knb1 .
* define local data
DATA:
ls_fcat TYPE lvc_s_fcat.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
* I_BUFFER_ACTIVE =
i_structure_name = 'KNB1'
* 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.
* Only non-key fields are editable
ls_fcat-edit = 'X'.
MODIFY gt_fcat FROM ls_fcat
TRANSPORTING edit
WHERE ( key NE 'X' ).
ENDFORM. " BUILD_FIELDCATALOG_KNB1
*& 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.
* Build fieldcatalog and set hotspot for field KUNNR
PERFORM build_fieldcatalog_knb1.
* Display data
CALL METHOD go_grid->set_table_for_first_display
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.
ENDFORM. " INIT_CONTROLS
*& Form delete_rows
* text
* --> p1 text
* <-- p2 text
FORM delete_rows .
* define local data
DATA: ls_row TYPE lvc_s_row.
SORT lcl_eventhandler=>mt_sel_rows BY index DESCENDING. " !!!
LOOP AT lcl_eventhandler=>mt_sel_rows INTO ls_row.
DELETE gt_outtab INDEX ls_row-index.
ENDLOOP.
" After deleting rows do RE-CALCULATION
* perform RECALCULATION.
ENDFORM. " delete_rows
*& Form COPY_ROWS
* text
* --> p1 text
* <-- p2 text
FORM copy_rows .
* define local data
DATA: ld_next TYPE i,
ls_row TYPE lvc_s_row,
ls_outtab TYPE ty_s_outtab.
SORT lcl_eventhandler=>mt_sel_rows BY index DESCENDING. " !!!
LOOP AT lcl_eventhandler=>mt_sel_rows INTO ls_row.
READ TABLE gt_outtab INTO ls_outtab INDEX ls_row-index.
CLEAR: ls_outtab-akont. " In your case: clear GUID
ld_next = ls_row-index + 1.
INSERT ls_outtab INTO gt_outtab INDEX ld_next.
ENDLOOP.
ENDFORM. " COPY_ROWS
*& Form INSERT_ROW
* text
* --> p1 text
* <-- p2 text
form INSERT_ROW .
* define local data
DATA: ld_value1 type SPOP-VARVALUE1,
ls_outtab TYPE ty_s_outtab.
CALL FUNCTION 'POPUP_TO_GET_ONE_VALUE'
EXPORTING
textline1 = 'Enter Value (4 Chars):'
* TEXTLINE2 = ' '
* TEXTLINE3 = ' '
titel = 'Enter Value'
valuelength = 4
IMPORTING
* ANSWER =
VALUE1 = ld_value1
EXCEPTIONS
TITEL_TOO_LONG = 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.
ls_outtab-kunnr = ld_value1.
ls_outtab-bukrs = ld_value1.
append ls_outtab to gt_outtab.
endform. " INSERT_ROW
Regards
Uwe -
Insert Blank row After every Row in alv report
How to insert blank row After every row in Alv report
what do you mean by a 'blank row'? ALV displays tabular data with 'any' number of columns. Now if you actually want a blank row (no columns at all, just a row), then that is just not possible. If I'm not mistaken, this question was posted before, so try to do a search on SCN. See what is says.
-
How to remove the the standard button APPEND/INSERT/DELETE in webdynpro alv
Hello,
how to remove the the standard button APPEND/INSERT/DELETE in webdynpro-abap alv
Thanks
RaksharUse this.
data lo_cmp_usage type ref to if_wd_component_usage.
lo_cmp_usage = wd_this->wd_cpuse_alv1( ).
if lo_cmp_usage->has_active_component( ) is initial.
lo_cmp_usage->create_component( ).
endif.
data lo_interfacecontroller type ref to iwci_salv_wd_table .
lo_interfacecontroller = wd_this->wd_cpifc_alv1( ).
data lo_value type ref to cl_salv_wd_config_table.
lo_value = lo_interfacecontroller->get_model(
data: lr_std type ref to if_salv_wd_std_functions.
lr_std ?= lo_value.
lr_std->set_export_allowed( abap_false ).
NOte: ALV1 is alv component name
Regards
Srinivas
Edited by: sanasrinivas on Dec 1, 2011 6:11 AM -
How to display multiple lines of texts in a single rows in ALV
Hi,
I have a unique requirement in which i have to display multiple lines if texts for a single rows in ALV Grid. Right now in my output it is coming in single line which is not visible fully because that text is more than 255 character. So i want to display the test by splitting into multiple lines and show it on output. Please suggest some solution for this if this is possible in ALV.
Thanks,
RaghavHi Raghavendra,
Its not possible to display multiple line in one row of an alv, but i think you can acheive it by splitting the whole text into multiple sub-text.
For example, if your requirement is as below:
Field #1 Field #2
1 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx(200 characters)
2 yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy(220 character)
then you can break Field#2 value into say 50 character and then populate the internal table with repetative entries of Field#1 and the finally sort it by Field#1 value... as a result of which you output will be somewhat as below:
Field#1 Field#2
1 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
2 yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
yyyyyyyyyyyyyyyyyyyy
Hope it will help you in meeting your requirement.
Regards,
Shradha -
Not able to select a row in ALV?
Hi Experts,
I am enhancing a standard e-recruiting WD ABAP component.
It produces a search result as ALV.
I am not able to select any row in ALV by clicking it like we normally do in ALV.
I wrote below code to allow selection:
lo_value->if_wd_salv_table_settings~set_selection_mode( cl_wd_table=>e_selection_mode-single).
Even after this I am not able to select any row by clicking it.
Need help to solve this.
Regards,
Sumit OberoiHi,
To have the inputfields for the ALV.
Get the column references of the ALV table and for each column rference create a inputfield object
type CL_SALV_WD_UIE_INPUT_FIELD.
lo_value is model object.
CALL METHOD lo_value->if_salv_wd_column_settings~get_columns
RECEIVING
value = wd_this->lit_columns.
LOOP AT wd_this->lit_columns INTO wd_this->lis_columns.
lv_id = wd_this->lis_columns-id.
wd_this->gref_column = wd_this->lis_columns-r_column.
case lv_id.
when ' colname'.
CREATE OBJECT lr_input
EXPORTING
value_fieldname = lv_id.
CALL METHOD wd_this->gref_column->set_cell_editor
EXPORTING
value = lr_input.
when ' colname'.
CREATE OBJECT lr_input
EXPORTING
value_fieldname = lv_id.
CALL METHOD wd_this->gref_column->set_cell_editor
EXPORTING
value = lr_input.
endcase.
endloop.
Or you can take a attribute READ_ONLY for the node to which ALV table is bound.
Set the readonly property to abap_false (for input field) by looping through the table.
Get the column references and get the textview reference for each column and use the set_read_only
method by passing the attribute name.
This way the textview will now become the inputfield when the read_only property is set to abap_false.
Regards,
Lekha. -
Remove standard button in ALV LIKE APPEND/INSERT/DELETE
Hi Expert,
I have a requirement in which we do not need APPEND/INSERT/DELETE button in ALV,Can you please tell how i can remove that.
Pleaae suggest.
Thanks
MaheshCheck this
data lo_cmp_usage type ref to if_wd_component_usage.
lo_cmp_usage = wd_this->wd_cpuse_alv1( ). " alv1 is my used alv component
if lo_cmp_usage->has_active_component( ) is initial.
lo_cmp_usage->create_component( ).
endif.
data lo_interfacecontroller type ref to iwci_salv_wd_table .
lo_interfacecontroller = wd_this->wd_cpifc_alv1( ).
data lo_value type ref to cl_salv_wd_config_table.
lo_value = lo_interfacecontroller->get_model( ).
data: lr_std type ref to if_salv_wd_std_functions.
lr_std ?= lo_value.
lr_std->SET_EDIT_APPEND_ROW_ALLOWED( abap_false ).
lr_std->SET_EDIT_DELETE_ROW_ALLOWED( abap_false ).
lr_std->SET_EDIT_INSERT_ROW_ALLOWED( abap_false ).
Regards
Srinivas -
About inserting color to rows in alv
hi ,
could any one tell me how to insert colors to rows in alv.
regards,
pavan.hi,
try like this
TABLES: ekko.
TYPE-POOLS: slis. "ALV Declarations
*Data Declaration
TYPES: BEGIN OF t_ekko,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
statu TYPE ekpo-statu,
aedat TYPE ekpo-aedat,
matnr TYPE ekpo-matnr,
menge TYPE ekpo-menge,
meins TYPE ekpo-meins,
netpr TYPE ekpo-netpr,
peinh TYPE ekpo-peinh,
line_color(4) TYPE c, "Used to store row color attributes
END OF t_ekko.
DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
wa_ekko TYPE t_ekko.
*ALV data declarations
DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE,
gd_tab_group TYPE slis_t_sp_group_alv,
gd_layout TYPE slis_layout_alv,
gd_repid LIKE sy-repid.
*Start-of-selection.
START-OF-SELECTION.
PERFORM data_retrieval.
PERFORM build_fieldcatalog.
PERFORM build_layout.
PERFORM display_alv_report.
*& Form BUILD_FIELDCATALOG
Build Fieldcatalog for ALV Report
FORM build_fieldcatalog.
fieldcatalog-fieldname = 'EBELN'.
fieldcatalog-seltext_m = 'Purchase Order'.
fieldcatalog-col_pos = 0.
fieldcatalog-outputlen = 10.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'EBELP'.
fieldcatalog-seltext_m = 'PO Item'.
fieldcatalog-col_pos = 1.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'STATU'.
fieldcatalog-seltext_m = 'Status'.
fieldcatalog-col_pos = 2.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'AEDAT'.
fieldcatalog-seltext_m = 'Item change date'.
fieldcatalog-col_pos = 3.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'MATNR'.
fieldcatalog-seltext_m = 'Material Number'.
fieldcatalog-col_pos = 4.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'MENGE'.
fieldcatalog-seltext_m = 'PO quantity'.
fieldcatalog-col_pos = 5.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'MEINS'.
fieldcatalog-seltext_m = 'Order Unit'.
fieldcatalog-col_pos = 6.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'NETPR'.
fieldcatalog-seltext_m = 'Net Price'.
fieldcatalog-col_pos = 7.
fieldcatalog-outputlen = 15.
fieldcatalog-datatype = 'CURR'.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'PEINH'.
fieldcatalog-seltext_m = 'Price Unit'.
fieldcatalog-col_pos = 8.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
ENDFORM. " BUILD_FIELDCATALOG
*& Form BUILD_LAYOUT
Build layout for ALV grid report
FORM build_layout.
gd_layout-no_input = 'X'.
gd_layout-colwidth_optimize = 'X'.
gd_layout-info_fieldname = 'LINE_COLOR'.
ENDFORM. " BUILD_LAYOUT
*& Form DISPLAY_ALV_REPORT
Display report using ALV grid
FORM display_alv_report.
gd_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = gd_repid
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
i_save = 'X'
TABLES
t_outtab = it_ekko
EXCEPTIONS
program_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.
ENDFORM. " DISPLAY_ALV_REPORT
*& Form DATA_RETRIEVAL
Retrieve data form EKPO table and populate itab it_ekko
FORM data_retrieval.
DATA: ld_color(1) TYPE c.
SELECT ebeln ebelp statu aedat matnr menge meins netpr peinh
UP TO 10 ROWS
FROM ekpo
INTO TABLE it_ekko.
*Populate field with color attributes
LOOP AT it_ekko INTO wa_ekko.
Populate color variable with colour properties
Char 1 = C (This is a color property)
Char 2 = 3 (Color codes: 1 - 7)
Char 3 = Intensified on/off ( 1 or 0 )
Char 4 = Inverse display on/off ( 1 or 0 )
i.e. wa_ekko-line_color = 'C410'
ld_color = ld_color + 1.
Only 7 colours so need to reset color value
IF ld_color = 8.
ld_color = 1.
ENDIF.
CONCATENATE 'C' ld_color '10' INTO wa_ekko-line_color.
wa_ekko-line_color = 'C410'.
MODIFY it_ekko FROM wa_ekko.
ENDLOOP.
ENDFORM. " DATA_RETRIEVAL
reward if usefull.... -
Append, Insert controlling in ALV
Hello,
Currently I have to manually select the new line to that is appended or inserted. I want that when use press Append or Insert button in ALV it should pass the control and the new line to become the lead select row. My requirement is that when user make changes in the default fields and press append or insert, these default values should be replaced in the Item Detail section for that particular new row. I am able to capture the event when user press Append or Insert.
Shall appreciate soonest response.
Thks & Rgds,
Hemal
Edited by: Hemal Gandhi on May 12, 2010 4:45 PMit sounds like you want to used the Append/Insert functionality to just validate your inputs and re-wrote the whole row with the new changes; you don't really want to add a new row?
if I understand correct I think you will need to create your own custom APPEND/INSERT BUTTON to disable standard functionality of Adding a new row to the ALV and run ON_DATA_CHECK to modify current entries behind your custom button.
I will hide the APPEND/INSERT standard button and add a custom button at the same position with the same text calling ON_DATA_CHECK and binding new values to the row that has been change.
Maybe someone else has a better approach but that's what I will do, and I know it works!
thanks!
Jason PV -
How to get Inserted and Deleted Rows in ALV
I have looked at the BC_EDIT* examples but I still can't figure out how to determine which rows were Inserted and Deleted from the ALV list. Can someone please provide me the code to do this?
Thanks.
SandyHi sandy,
i dont think you will have issue in inserting a row in ALV because whenever the user done some actions say for eg clicking the pushbutton at the toolbar you could insert the a new row into the ALV.for creating pushbutton you need to use the events TOOLBAR,USER_COMMAND.
deleting a row may also follow the above procedure.
Have a look at the demo program
BCALV_GRID_05
Cheers,
Abdul Hakim -
How to restrict append row upto 5 in ALV Webdynpro.
how to restrict append row up to 5 in ALV Webdynpro.
how did you resolve it?
thank in advance.
Maybe you are looking for
-
IPhone 4 and network extender troubles
I live in an area where I need a network extender to receive a signal. All has worked perfectly fine in the last 4 years I've been with Verizon, until about 4 weeks ago when my daughter was trying to send me pictures that I never received. I then n
-
How can u pass value in SAP Script?& where?
-
Can we settle refurbishment order(Plant Maintenance) periodically
Hi All our client want to settle refurbishment order periodically to material. In standard SAP will allow this after TECO. They r taking more time to complete these orders and costs are setteled in Orders and not reflecting in monthly cost balance sh
-
Updates getting stuck in V2 processed state
Hi, In our ERP production system EP0, update entries are getting stuck in 'V2 Processed' state. Details of the same show that the collective run state is in initial state for functional module 'MCEX_UPDATE_03'. Please find the attached screenshot of
-
Speaker stays showing constantly in middle of screen
How do we remove the speaker icon which shows constantly in the middle of the screen no matter what we try to do to remove it? We have tried to do a factory reset yet still it remains. Anyone have a clue how to remove this speaker icon in middle of s