10-12-2008 12:26 PM
Hello All,
I need to have a pushbutton (labelled Download) on the application bar on the abap report screen .
This button should enable me to download the report contents in a file format (like excel).
Please can you guys help me acheive this.How should the button with this functionality be placed in application bar?
Thanks in advance for the kind help
Swati
10-12-2008 12:29 PM
Hi,
1) Create a GUI status copying the GUI status : STANDARD from package SALV...
2) Add the Button for download in the Application menu of the GUI status.
3) Pass the GUI status/ Set the GUI status to the ALV Function module or to PBO of output screen based on your requirement...
Regards
Shiva
10-12-2008 12:37 PM
My report has been generated using the simple "Write" statement.
In this case how will i code the PBO and PAI stuff?
10-12-2008 12:40 PM
10-12-2008 12:52 PM
Hi Swathi,
In such case, as said above, create a new GUi status and then assign to the report using the below statement:
AT PFnn.
Effect
This obsolete statement defines an event block whose event is triggered by the ABAP runtime environment during list display - provided the screen cursor is on a list line and a function is selected using the function code PFnn. Here nn stands for a number between 01 and 24. In the standard list status, these function codes are assigned to the function keys of the input device.
Then what processing needs to be done when the user presses the button, will be written in the below control statement..
AT USER-COMMAND
Effect
This statement defines an event block whose event is triggered by the ABAP runtime environment if, during the display of a screen list, a function with a self-defined function code was chosen.
Note
Self-defined function codes are all those that include character combinations, except for the following:
The function codes "PICK" and "PFnn" ("nn"stands for 01 to 24) do not cause the event AT USER-COMMAND, but the events AT LINE-SELECTION and AT PFnn.
All function codes that start with the character "%" are interpreted as system functions and do not cause the event AT USER-COMMAND. The system functions for lists are listed in the following table 1.
The function codes in the following table 2, likewise, do not cause the event AT USER-COMMAND, but are handled by the list processor.
Table 1
Function code Function
%CTX Call a context menu
%EX Exit
%PC Save to file
%PRI Print
%SC Search for ...
%SC+ Find next
%SL Search in office
%ST Save to report tree
Table 2
Function code Function
BACK Back
P- Scroll to previous page
P-- Scroll to first page
P+ Scroll to next page
P++ Scroll to last page
PFILE name Store list lines in a text file named "abap.lst" in standard character representation in the standard directory of the application server. If a name is entered using name, this is converted to lowercase letters and used as the file name.
PL- Scroll to first line of the page
PL-n Scroll n lines back
PL+ Scroll to last line of the page
PL+n Scroll n lines up
PNOP No effect
PP- Scroll back one page
PP-n Scroll n pages back
PP+ Scroll one page forward
PP+n Scroll n pages forwad
PPn Scroll to beginning of page n
PRI, PRINT Print
PS-- Scroll to first column
PS++ Scroll to last column
PS- Scroll one column to the left
PS-n Scroll n columns to the left
PS+ Scroll one column to the right
PS+n Scroll n columns to the right
PSn Scroll to column n
PZn Scroll to line n
RW Cancel
Example
This program works with a self-defined GUI status MYLIST. The function that is linked there with the function code MY_SELECTION causes the event AT USER-COMMAND during list display and also creates details lists.
REPORT demo_at_user_command.
START-OF-SELECTION.
SET PF-STATUS 'MYLIST'.
WRITE 'List line'.
AT USER-COMMAND.
IF sy-lsind = 20.
SET PF-STATUS 'MYLIST' EXCLUDING 'MY_SELECTION'.
ENDIF.
CASE sy-ucomm.
WHEN 'MY_SELECTION'.
WRITE: / 'You worked on list', sy-listi,
/ 'You are on list', sy-lsind.
...
ENDCASE.
Regards
Shiva
10-12-2008 1:10 PM