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

ALV

Former Member
0 Likes
1,112

HI All,

I want to replicate the functionality of 'Export to local file' button provided in ALV grid.

Actually I am having an internal table in which 12 months data is stored and it is like when user enters from Jan to May, in the alv it is displaying only 5 months, ( using if-else condition while preparing field catalog ) but when user downloads the file, the file contains all the 12 months as i am passing complete internal table to the gui_download, but the button on alv display that is 'Export to local file' is downloading correct data, so i want to replicate the functionality of this button.

HI All,

I want to replicate the functionality of 'Export to local file' button provided in ALV grid.

Actually I am having an internal table in which 12 months data is stored and it is like when user enters from Jan to May, in the alv it is displaying only 5 months, ( using if-else condition while preparing field catalog ) but when user downloads the file, the file contains all the 12 months as i am passing complete internal table to the gui_download, but the button on alv display that is 'Export to local file' is downloading correct data, so i want to replicate the functionality of this button.

8 REPLIES 8
Read only

Former Member
0 Likes
996

Hi,

u can

 LOOP AT itab where date IN s_date.
 Move entries from  itab to itab1.
  APPEND  itab1.
 ENDLOOP.

Use this internal tabel for gui_download.

Read only

amit_khare
Active Contributor
0 Likes
996

Hi,

Welcome to SDN.

Why dont you pass the same table as you passing to ALV to download FM.

Since t the Reuse FM , you are passing table with your selection requiremenet only and not the whole table, so just pass the same table to download.

Now for the save to local file button, it is using the same table which is there in the Reuse FM and not the one with all the data.

Regards,

Amit

Reward all helpful replies.

Read only

Former Member
0 Likes
996

actually i have not a real clue on how to achieve this BUT,

i would just debug the functionality behind the button,

trying to find a user-exit, and then fill the table which is beeing used for the download with your full table which you passed to the ALV.

sry for not beeing more precisze but i though bette THAT than no answer

regards

Read only

Former Member
0 Likes
996

Hi Judith,

The structure of my internal table is having 12 months so even if i use this logic, the doanloaded file will have all the 12 months, which i dont want, and i want to avoid use of dynamic internal tables as it will make the program complex .

Read only

0 Likes
996

Hi,

Unless you fill ur internal table according to the input given u will get all 12 months.

You have to make it dynamic.

Read only

Former Member
0 Likes
996

Hi Florian,

I tried to debug it, it is using a method which is a private method of class cl_gui_alv_grid so I am not able to call it in my program, any pointers, how it can be called?

Read only

0 Likes
996

hmm why cant you call it? private means it can be called only from own class.

But to display an ALV grid you need at least one instance of the class cl_gui_alv_grid. Since you have an instance of that class you can as well call a method of it using the instance, and the instance-component-selector (->) and then just call the method.

I would define myself a new internal table of same structure, then i would fill the new one IN A LOOP from the old one, but just fill the first 5 month like you want it.

then use your instance of your ALV, call the method you found out, and give it your new table. this should work i think.

Read only

Former Member
0 Likes
996

hi florian,

As u have said, I tried calling the method using the instance but still it gave me error as, this method is private or protected to the class, so i am not able to call method.

The method which i want to call is 'export_to_local_file' and i am also pasting the part of code,

CALL METHOD g_grid1->export_to_local_file.

if you know how to deal with it, please help me.