cancel
Showing results for 
Search instead for 
Did you mean: 

Displaying default value for a field in ALV table

Former Member
0 Kudos

Hai all,

I am having an ALV table in which I want to display Requisition number by default using a value which i generated randomly and it is stored in a variable.

While displaying ALV table my req number field should display that value by default when ever user is inserting a row( all the coloumns n my alv are editable.

Is it possible??

Kindly give some suggestions.

Thanks in Advance,

Nalla.B

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

It is possible, you have to pass your default value to the context node/attribute binded to the ALV data node.

Former Member
0 Kudos

Hai Kris,

I took help from ur link and i declared a global attribute request_number.

and i created an event handler ON_ALV_INSERT and did the follwing coding for giving default value wen ever am inserting new row.

FIELD-SYMBOLS: <wa_row> LIKE LINE OF r_param->t_inserted_rows.

DATA bill_details TYPE REF TO zdom_bill_detail.

LOOP AT r_param->t_inserted_rows ASSIGNING <wa_row>.

bill_details ?= <wa_row>-r_value.

IF bill_details->REQ_NUMBER IS INITIAL.

DATA lo_nd_bill_detail TYPE REF TO if_wd_context_node.

DATA lo_el_bill_detail TYPE REF TO if_wd_context_element.

DATA ls_bill_detail TYPE wd_this->Element_bill_detail.

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

lo_nd_bill_detail = wd_context->get_child_node( name = wd_this->wdctx_bill_detail ).

lo_el_bill_detail = lo_nd_bill_detail->get_element( index = <wa_row>-index ).

lo_el_bill_detail->set_attribute(

EXPORTING

name = 'REQ_NUMBER'

value = wd_comp_controller->request_number

).

Wen am setting the value of wd_comp_controller->request_number to my context attribute am getting NULL object ref error.

lo_el_bill_detail->set_attribute(

name = `REQ_NUMBER`

value = wd_comp_controller->request_number ).

Pls give some suggestions,

Thanks in Advance,

Nalla.B

Former Member
0 Kudos

Probably the reason is that the lo_el_bill_detail is initial,not exists in the node.

lo_el_bill_detail = lo_nd_bill_detail->get_element( index = <wa_row>-index )

see it in debug what value does the index have.

Former Member
0 Kudos

Hi Nalla,

You are inserting one row everytime?? when click on add row button you want to add?

Or you want to display alv with one value by default?

Check this,.. when you are using standard append row in alv, to set defalut value

http://wiki.sdn.sap.com/wiki/display/Snippets/WebDynproABAP-ALVControllingStandard+Buttons

Cheers,

Kris.

Edited by: kissnas on Jun 2, 2011 2:01 PM