cancel
Showing results for 
Search instead for 
Did you mean: 

Web Dynpro ABAP - ALV - insert data

Former Member
0 Kudos

hi,

I have got the following task.

I need to insert a new row into an alv table that shall be editable (data to be edited in the table, where

a) the other rows of the table, that already exist must not be editable

b) some columns of the new row are to be initialized with values when creating new row

can you help here?

more precise description of the task/problem

to a) all I found is the possibility to make columns editable, if I wanted to edit new inserted fields directly in the table. This would give the possibility to also edit the rows that are already there and where the data should not be modified...

to b) I tried with a propriarity button in wddoinit. DATA lr_btn_new TYPE REF TO cl_salv_wd_fe_button.

DATA lr_fct_new TYPE REF TO cl_salv_wd_function.

CREATE OBJECT lr_btn_new.

lr_btn_new->set_text( 'Request New').

lr_fct_new = lo_model->if_salv_wd_function_settings~create_function( id = 'BTN_NEW' ).

lr_fct_new->set_editor( lr_btn_new ).

and than call an on_function event handler, but now got the problem that I do not know how to insert the row to the table....

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Inserting new row is very simple,just modify your internal table which is attached to the ALV table in the onFunction Event handler method like.

data: wa_tab type wd_this->elem_flights. "work area is of type context node(structure),now this is empty

it_flights type table of wd_this->elem_flights,

v_lines type i.

Now read the context node data into internal table.

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

lo_nd_flights = wd_context->get_child_node( name = wd_this->wdctx_flights ).

CALL METHOD LO_ND_FLIGHTS->GET_STATIC_ATTRIBUTES_TABLE

IMPORTING

TABLE = lt_flights.

Modify the internal table from workarea.

describe table lt_flights lines v_lines.

modify lt_flights from ls_flights index v_lines. This is to add empty row at the last in the table

Now bind the internal table to context node.

To make entire row is editable check this forum threads and articles which i already answered.

Also check this article for conditionally editable.

https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/f0625002-596c-2b10-46af-91cb31b7...

Former Member
0 Kudos

Hi Suman,

thanks a lot, this solved my problems!

Cheers

Ana

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi.

Check out this link for ALV.

Very useful. I hope this may help you too.

https://www.sdn.sap.com/irj/sdn/webdynpro?rid=/webcontent/uuid/60ea94e5-0901-0010-c3bb-aad5ea9620d8

Thanx.

Former Member
0 Kudos

Hi Saurav,

thank you for the link, but I knew these documents and did not find the answers to my questions there.