Application Development 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: 

Download dynamic fields (based on changed layout) from ALV

I355602
Advisor
Advisor
0 Kudos

Hello All,

Currently i am displaying 28 firelds in my ALV output.

I have created my own button for downloading the contents displayed using GUI_DOWNLOAD.

Say if user changes the layout and say now we have 35 fields in the layout.

Now when we click the DOWNLOAD button, i want to download these 35 fields instead of 28 fields.

Can anyone please help me on this...

Thanks in advance....

Regards,

Tarun

1 ACCEPTED SOLUTION

Sandeep_Kumar
Advisor
Advisor
0 Kudos

after changing layout what entries you have in o/p table for GUI_DOWNLOAD ?

11 REPLIES 11

Sandeep_Kumar
Advisor
Advisor
0 Kudos

after changing layout what entries you have in o/p table for GUI_DOWNLOAD ?

0 Kudos

Hi,

Actually i need to identify which columns are now being displayed to the user, which may be dynamic..

what i want is if user is currently displaying 20 columns, when he clicks DOWNLOAD button only the data for those 20 columns should be downloaded.

And now if user wishes to see 30 columns and press DOWNLOAD, these 30 columns should be downloaded.

Hope you get it..

Regards,

Tarun

0 Kudos

hmm...

sounds interesting , could you paste your code here , i want to try it once with get_fieldcatalog and other options.

0 Kudos

Hi,

Buddy the code is too long...

What i have done is made an internal table of 20 columns and initially displaying only 20 columns when ALV is displayed..

Populated this internal table for 20 columns using the main table with 138 columns ...

and downloaded this internla table (of 20 columns)

But when user changes layout to say 30 columns, still the download is of 20 columns, but i need to download for 30 columns....

And again if user changes layout, the download should be accordingly.....

Hope you get my point....

Thanks & Regards,

Tarun

0 Kudos

I understood your requirement.

What i wanted to check is taht whether we can get the fields of teh alyout via using method "GET_FRONTEND_FIELDCATALOG" and then populate all these fields in teh output table for gui_download.

0 Kudos

Hi Tarun,

As the frontend layout is directly connected to this output table, standard excel download would work here (because it already knows which column to display and download).

But as you want custom solution I think the following might work:

- get fieldcatalog using GET_FRONTEND_FIELDCATALOG

- loop through it and check if field is in displayed mode ( NO_OUT ne 'X' ).

- create (or just copy above entries) to new fieldcatalog table

- use class CL_ALV_TABLE_CREATE to generate dynamic table with structure of displayed fields only (based on that new fieldcatalog)

- loop through output table and copy corresponding fields to your dynamic table appending to it

- download dynamic table using GUI_DOWNLOAD (parameter DATA_TAB here is generic so you can pass any table structure).

Regards

Marcin

0 Kudos

Hi,

Thanks for your valuable reply....

I did using NO_OUT option and created a dynamic internal table...

Regards,

Tarun

0 Kudos

Hi Marcin,

What object is GET_FRONTEND_FIELDCATALOG?? Is it a program or class??

Please let me know..

Thanks & regards,

Santhosh

0 Kudos

>

> Hi Marcin,

> What object is GET_FRONTEND_FIELDCATALOG?? Is it a program or class??

> Please let me know..

>

> Thanks & regards,

> Santhosh

This is a method of class cl_gui_alv_grid , so alv instance which you use for displaying your data on screen.

Regards

Marcin

Former Member
0 Kudos

Hi Tarun,

you may create the table for download dynamicly as you need it.

is your friend.

cause you allready have an alv the only thing is to copy the visible fields from one field catalog to another an create the table from the copied one.

afterwards you have to copy the data.

regards

Torsten

Former Member
0 Kudos

Hi Tarun,

you may create the table for download dynamicly as you need it.

is your friend.

cause you allready have an alv the only thing is to copy the visible fields from one field catalog to another an create the table from the copied one.

afterwards you have to copy the data.

regards

Torsten