cancel
Showing results for 
Search instead for 
Did you mean: 

WebDynpro - Prepopulating ALV

former_member199351
Active Participant
0 Kudos

Hello,

I have made ALV input enabled, but when I display the View for the first time all records in ALV are grayed out. I need to click on Append Row to be able to enter data. I need to make ALV ready for input as soon as the view appears.

I did it by inserting several blank rows in the tables within WDDOINIT.

Is there any other, more elegant, way to accomplish this?

Thanks,

Alex

Accepted Solutions (0)

Answers (3)

Answers (3)

former_member199351
Active Participant
0 Kudos

Hi Priyank,

Thanks for the link to the document. This is pretty much what I already did.

Hi Suman,

What I already did works fine, I just want to confirm if there is a better way to do it. My ALV initial content is null and therefore it is grayed out. Once I append the rows to the table it becomes input ready. Here is my code:

  • create an instance of ALV component

DATA:

lr_salv_wd_table_usage TYPE REF TO if_wd_component_usage.

lr_salv_wd_table_usage = wd_this->wd_cpuse_materials( ).

IF lr_salv_wd_table_usage->has_active_component( ) IS INITIAL.

lr_salv_wd_table_usage->create_component( ).

ENDIF.

  • get ALV component

DATA:

lr_salv_wd_table TYPE REF TO iwci_salv_wd_table.

lr_salv_wd_table = wd_this->wd_cpifc_materials( ).

wd_this->materials_config_table = lr_salv_wd_table->get_model( ).

  • set visible row count

DATA:

lr_table_settings TYPE REF TO if_salv_wd_table_settings.

lr_table_settings ?= wd_this->materials_config_table.

lr_table_settings->set_visible_row_count( '10' ).

lr_table_settings->set_read_only( abap_false ).

  • make columes input ready

DATA:

lr_column_settings TYPE REF TO if_salv_wd_column_settings,

lr_column TYPE REF TO cl_salv_wd_column,

lr_input_field TYPE REF TO cl_salv_wd_uie_input_field.

lr_column_settings ?= wd_this->materials_config_table.

lr_column = lr_column_settings->get_column( 'QUANTITY' ).

CREATE OBJECT lr_input_field EXPORTING value_fieldname = 'QUANTITY'.

lr_column->set_cell_editor( lr_input_field ).

lr_column = lr_column_settings->get_column( 'MATERIAL' ).

CREATE OBJECT lr_input_field EXPORTING value_fieldname = 'MATERIAL'.

lr_column->set_cell_editor( lr_input_field ).

  • lr_column->set_visible( if_wdl_core=>visibility_none ).

  • Populate Blank Line in ALV Table

data lo_nd_cnt_items type ref to if_wd_context_node.

data lo_el_cnt_items type ref to if_wd_context_element.

data ls_cnt_items type wd_this->element_cnt_items.

data lt_cnt_items type wd_this->elements_cnt_items.

  • navigate from <CONTEXT> to <CNT_ITEMS> via lead selection

lo_nd_cnt_items = wd_context->get_child_node( name = wd_this->wdctx_cnt_items ).

DO 10 TIMES.

APPEND ls_cnt_items TO lt_cnt_items.

ENDDO.

call method lo_nd_cnt_items->bind_table

exporting

new_items = lt_cnt_items.

Thanks,

Alex

Former Member
0 Kudos

Can you paste your code here....

and also make it clear that you want to show the blank rows which you append to the internal table are editable as soon as view appears am i right?

Thanks

Suman

Former Member
0 Kudos

if you want that you should be able to add new rows (and not modify the existing ones) as soon as your alv shows up then you are doing it the right way...

however, if you also want that the existing records in the alv should also be editable, in addition to having new blank rows, then you need to explore on how to make alv cells editable.

you can have a look at this article to achieve the same...

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/3133474a-0801-0010-d692-81827814...