cancel
Showing results for 
Search instead for 
Did you mean: 

Change length of an attribute dynamically

Former Member
0 Kudos

Hello Everyone,

I am displaying data from a node in an ALV.

The node has an attribute whose length has been set to 30.

There are 3 cases.

In 2 of the cases, the length of one attribute in the node has to be restricted to 10, and the user would be allowed to enter in values in the ALVs.

Whereas in the third case, the length of the same attribute should be 30 and there also the user would be able to enter in values to that particular column.

Is there any way we can use the same node and change the length of the attribute dynamically based on the condition.

I believe I can bind a different node dynamically which has the respective length based on the case. But can this done by using just one node and changing the length of the attribute dynamically?

I hope I was able to explain my scenario clearly. Could someone give me valuable suggestions.

Cheers,

Vishnu

Accepted Solutions (0)

Answers (1)

Answers (1)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

>But can this done by using just one node and changing the length of the attribute dynamically?

I don't believe that you can change the lenght of the attribute dynamically. At least not with a static attribute. Perhaps with a dynamic attribute, but then it wouldn't be usable in the ALV. There is just too much going on with the generation of RTTIs and Field Catalogs behind the scenes.

Although you could swap nodes or dynmically generate the entire node, perhaps the easier approach would be to use two different attributes. You could then setup two different cell editors pointing to these two different attributes. Cell editors can be placed in a column, but use the attributes of another column. You would need to disable one of the columns generated for one of the attributes. The other column would dynamically set which cell editor it was using.

ChrisPaine
Active Contributor
0 Kudos

>The other column would dynamically set which cell editor it was using.

I'm guessing that this means using cell variants?

NB ALV does seem to have an issue with exporting to Excel when cell variants are used. So you would be trading off one functionality for another...

Former Member
0 Kudos

Thank You, Thomas and Chris for the response.

I might try with two different attributes then.