Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Editable Alv For Dynamic Internal Tables

Former Member
0 Likes
606

Dear Experts.

Alraedy I searched the forum regarding this.I didn't get correct solution.

That's why I am posting this query.

I have a requiremnet that in the Selection screen, Plant,from date & To date is giving.

Depends on the Number of days between From & To dates, Those many coloumns have to come in

the alv output.

And in the alv,they want to edit the data & want to save. All this data is saving in a Z table.

Thnaks In advance,

Regards,

Rahul

1 ACCEPTED SOLUTION
Read only

MarcinPciak
Active Contributor
0 Likes
393

Hi,

I guess you want to get all days in between these FROM - TO dates and dispaly separate column for each day, right?

What I suggest then:

- write a do loop starting from FROM date adding 1 day in each loop up to TO date.

- inside loop add new field named (i.e. like the day you currently have) to field catalog (type lvc_t_fcat )

- once you finish your loop, create dynamic table based on field catalog you prepared


data: r_table type ref to data.

  cl_alv_table_create=>create_dynamic_table(
    EXPORTING
      it_fieldcatalog = lt_fieldcat " here pass your field catalog with all the columns you added 
    IMPORTING
      ep_table = r_table ). "here you have a reference to your newly created table

- now simply dereference it


field-symbol <table> type any table.

assign r_table->* to <table> . "<table> now is empty but you can address it like you were using standard table 

- at the end fill your <table> by selecting data from Z table and display in alv (you can use cl_salv_table as well).

For more details regarding this refer Naimesh's blog [Dynamic Internal Table Creation using class CL_ALV_TABLE_CREATE|http://help-abap.blogspot.com/2008/11/dynamic-internal-table-creation-using.html] . Of course you can use RTTS classes as well but this one is easier to start with.

And in the alv,they want to edit the data & want to save. All this data is saving in a Z table.

For saving data refer programs * BC*EDIT * - don't know now which one, but you will easiy find the appropriate one for this.

Regards

Marcin

Dear Experts.

Alraedy I searched the forum regarding this.I didn't get correct solution.

That's why I am posting this query.

I have a requiremnet that in the Selection screen, Plant,from date & To date is giving.

Depends on the Number of days between From & To dates, Those many coloumns have to come in

the alv output.

And in the alv,they want to edit the data & want to save. All this data is saving in a Z table.

Thnaks In advance,

Regards,

Rahul

1 REPLY 1
Read only

MarcinPciak
Active Contributor
0 Likes
394

Hi,

I guess you want to get all days in between these FROM - TO dates and dispaly separate column for each day, right?

What I suggest then:

- write a do loop starting from FROM date adding 1 day in each loop up to TO date.

- inside loop add new field named (i.e. like the day you currently have) to field catalog (type lvc_t_fcat )

- once you finish your loop, create dynamic table based on field catalog you prepared


data: r_table type ref to data.

  cl_alv_table_create=>create_dynamic_table(
    EXPORTING
      it_fieldcatalog = lt_fieldcat " here pass your field catalog with all the columns you added 
    IMPORTING
      ep_table = r_table ). "here you have a reference to your newly created table

- now simply dereference it


field-symbol <table> type any table.

assign r_table->* to <table> . "<table> now is empty but you can address it like you were using standard table 

- at the end fill your <table> by selecting data from Z table and display in alv (you can use cl_salv_table as well).

For more details regarding this refer Naimesh's blog [Dynamic Internal Table Creation using class CL_ALV_TABLE_CREATE|http://help-abap.blogspot.com/2008/11/dynamic-internal-table-creation-using.html] . Of course you can use RTTS classes as well but this one is easier to start with.

And in the alv,they want to edit the data & want to save. All this data is saving in a Z table.

For saving data refer programs * BC*EDIT * - don't know now which one, but you will easiy find the appropriate one for this.

Regards

Marcin