cancel
Showing results for 
Search instead for 
Did you mean: 

ALV cell data type changes dynamically

Former Member
0 Kudos

Hi

I have very specific requirement in which i have a ALV :

1. it inputs time entry if entry type is of 'T'

2. it inputs amount if entry type is of 'Q'.

now i need to create input field in same column.

means if entry type is of 'T' then alv row data must contain time

and if entry type is of 'Q' then same alv row data must contain amount.

so how can i change the column type from time to currency dynamically for particular row only ??

Thanks in Advance

Edited by: Nidhi Sharma on Dec 1, 2009 3:47 PM

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Nidhi

try to use cell variants as follows

Firstly create 7 attribute of type Q in ur node lets say Q_Entry1...7.

after that write this code in ALV initialisation method where ALV is defined

DATA lo_cell_var TYPE REF TO cl_salv_wd_cv_standard.

DATA lo_input_time TYPE REF TO cl_salv_wd_uie_input_field.

DATA lo_input_unit TYPE REF TO cl_salv_wd_uie_input_field.

lo_column = lo_column_settings->get_column( 'TIME_ENTRY' ).

  • Create Time entry type object

CREATE OBJECT lo_input_time

EXPORTING

value_fieldname = 'TIME_ENTRY1'.

lo_column->set_cell_editor( lo_input_time ).

  • Create Q entry type object

CREATE OBJECT lo_input_unit

EXPORTING

value_fieldname = 'Q_ENTRY1'.

CREATE OBJECT lo_cell_var.

lo_cell_var->set_key( value = 'Q' ).

lo_cell_var->set_editor( value = lo_input_unit ).

lo_column->add_cell_variant( r_cell_variant = lo_cell_var ).

lo_column->set_sel_cell_variant_fieldname( 'ENTRY_TYPE').

This will automatically convert the cell type to Q_TYPE when it gets Q in your entry type attribute

iterate this for TIME_ENTRY1 to 7...

Hope it will solve ur problem

Nawal Kishor Mittal

Edited by: Nawal Kishor Mittal on Dec 2, 2009 12:25 PM

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Lekha

i have around 25 columns in alv which are displayed in which 7 columns are to be changed based on type of entry.

My node contains 49 attributes which are mostly of type catsdb structure.

i dont want to add more 7attributes as it becomes massive .

Is there any way to change data type only for those 7 attributes based on entry type?

NIdhi

Former Member
0 Kudos

is the column T/Q is a part of the ALV table.

Former Member
0 Kudos

Hi Lekha

Yes entry type ( T/Q) is the part of the alv.

Regards

Nidhi

Former Member
0 Kudos

Hi,

i think it is difficult to implement changing of datatypes dynamically.. i havenot tried it out...

take a string type variable and based on the type of entry you need to validate the data

in those cells...

or

else

you need to hide/unhide the columns as per my earlier post..

or

One thing you can try out with normal TABLE ui element.

Try to create 3 attributes for amount tyoe and other 3 for time type.

now based on theT/Q selection, provide an option for table popin so that you an show

only those columns required...

popins are now possible with ALV..

try the things first with TABLE ..

Edited by: Lekha on Dec 2, 2009 11:16 AM

Former Member
0 Kudos

Hi,

Thanks for ur reply but i have to change the data type ,i cant use popin.

Regards

Nidhi

Former Member
0 Kudos

How manyc coulumns are there that needs to be changeed....i mean when you select T or Q how many columns thatneeds to be changed..

what is the strcuture of your internal table/node to which the ALV is bound....

One thiong you can do is create that many columns of both time and amount time then based ont eh T or Q value show only those columns...

Regards,

Lekha.