cancel
Showing results for 
Search instead for 
Did you mean: 

table with dynamic number of columns

former_member199125
Active Contributor
0 Kudos

Hi guys,

I know how to create a dyanmic table with dynamic number of columns.

problem here is, I will know the number of columns after dropdown selection of one filed,

actually we have to write the code in wddomodiftyview method and have to use first_time parameter...

but here i can;t use first time parameter, because after dropdown action i have to write the code...(

Any ideas guys? you guys understand the issue?

Regards

Srinivas

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Srinivas,

  Take two attributes in your view one to store the calculated no. of days(DAYS) and other(SET) of boolean type.

Now first in onselect event of your dropdown calculate your no. of days and bind to attribute DAYS.

and make the SET attribute as true.

In wddomodifyview check the SET variable, If it is true then write your code using the no.of days(DAYS) attribute and then make the SET attribute to false.

Method wddomodifyview.

if SET = true.

<<<code>>>

SET=false.

endif.

Endmethod.

Answers (5)

Answers (5)

sahai
Contributor
0 Kudos

Hi,

for this you will need to create the attributes dynamically and also the table would be a dynamic one.

Try it urself else let me know if you need a ready to use code for the same.

Thanks,

Shitanshu Sahai

former_member222068
Active Participant
0 Kudos

Hi Shitanshu,

Can you share me the ready to use code, this would help me .

Thanks & Regards,

Sankar Gelivi

former_member222068
Active Participant
0 Kudos

Hi Srinivas,

can you share the code. i have similar requirement. i have to create table with no of days of a month.

Thanks & Regards,
Sankar Gelivi

Former Member
0 Kudos

Hi Srinivas,
I am not sure whether your issue is resolve or not.

I had a same kind of requirement though little different, What I can suggest is that take two flags in Assistance class like lv_year and lv_month and on the onselect action of the drop downs fill the respective vaiables with 'X' and then in the WDOMODIFY check if both the variables are 'X' if yes then write your respective code for building table abd then clear both the variables .

Let me know if this was of any help to you.

Thanks

Kumar

former_member199125
Active Contributor
0 Kudos

Thanks for your response Phani,

The issue solved with similar logic.

Regards

srinivas

0 Kudos

Hi Srinivas,Will you be kind enough sharing ypur code to me? I also have same requirement and couldn't make it work. Thank you.

Ako

Former Member
0 Kudos
former_member199125
Active Contributor
0 Kudos

Hi Sayan,

the link which you gave wont suitable for me, because in link number of columns known in wddoint method it self, so we can write dynamic code in wddmodifyview method.

but here I know the number of columns , once wddoint method executed...so i cant use first_time parameter in wddomodifyview method.

Any guess?

Regards

Srinivas

chengalarayulu
Active Contributor
0 Kudos

Hi Srinivas,

here dropdown UI element name(ID) will takes place. like TabStrip(Tab Name)

1. In dropdown action add one parameter ID as importing (String) ---- dropdown UI name DRP_YEAR

2. Declare one string type attribute at component controller level and store the ID there.

      wd_comp_controller->drop_id = ID.

3. now go to modify view and compare the ID

      IF WD_COMP_CONTROLLER->DROP_ID EQ 'DRP_YEAR'.

            <<<<< process your dynamic table coding >>>>>>>>>

     ENDIF.

4. Now test.

hope it will resolve your issue.

Former Member
0 Kudos

Hi Srinivas,

The link contains the various methods and classes wchich can be used to dynamically create the table columns. Create a separate method to create the context node and then bind it with the table and call it in wddomodifyview method.

Regards,

Sayan

Former Member
0 Kudos

Hi srinivas,

srinivas sana wrote:

I will know the number of columns after dropdown selection of one filed

You mean the drop down field is present in a column of the table? ALV or table UI you are using.

Regards,

Fareez

former_member199125
Active Contributor
0 Kudos

See my requirement is  I have two drop downs , one for selection of month and one for year.

After selecting year and month, i will calculate number of days in that month.

Then i have to create a table with that many number of columns.


Regards

Srinvias    

Former Member
0 Kudos

Hi,

At wddomodify, create a node in the context dynamically and then bind it with the table dynamically. I hope this will work

Regards,

Fareez

manigandan_d2
Explorer
0 Kudos

HI Sana,

See your requirement was to create the dynamic table based on the 2 drop down values right,

Initially while view was loaded the drop down has no lead selection.

Once the drop down are selected, in the respected action method you can save it in the view local variable by the way you can check in the modifyview if your local variable is not initial, procedure you dynamic table creation based on the value else set the table visible as false.

i think it may work for your requirement

Regards,
Mani