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

Adding button in classical report

Former Member
0 Likes
11,263

Hi All,

I have a requirement to add a button in the Classical report.

Iam new to abap.can anyone please guide me regarding this?

Thanks in advance

8 REPLIES 8
Read only

Former Member
0 Likes
3,593

Hi,

you can create button using following command:

SET PF-STATUS 'XXXX'.

In place of XXXX give relevant name.

Now handle corresponding function code given to the button in above step using event AT USER-COMMAND.

This will solve your problem.

Regards,

Brajvir Singh

Read only

Former Member
0 Likes
3,593

Please SEARCH in SCN before posting basic questions

Read only

Rocky1
Product and Topic Expert
Product and Topic Expert
0 Likes
3,593

Hi,

Where do you want to add the button? Is it in application toolbar or within the report. If you want to add button in application tool bar then do the following:

create a PF-STATUS for the program and list output screen number

PF-STATUS should contain a button and OK_CODE

Call SET PF-STAUS before you dispalying output

In AT USER-COMMAND

check for the ok code of the button and do necessary coding.

Thanks & Regards

Rocky

Read only

Former Member
0 Likes
3,593

This is the method to add button on Classical report Selection Screen.

Please note the steps :-

a )Declare TABLES : sscrfields.   at the top.
b) SELECTION-SCREEN: FUNCTION KEY 1.
c) declare this in Initialization :   MOVE 'button name' TO sscrfields-functxt_01.

d)under At selection-screen
    IF sy-ucomm = 'FC01'.
    Do what ever u want to do -- functionality.
  ENDIF.

Read only

tolga_polat
Active Participant
0 Likes
3,593

hi,

if you use reuse alv grid. you can define your button at pf status. here the example :


  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
   EXPORTING
     i_callback_program                = sy-repid
     i_callback_pf_status_set       = 'MY_PF_STATUS'
     i_callback_user_command     = 'MY_USER_COMMAND'
.
.
.

then :


FORM my_pf_status USING it_extab TYPE slis_t_extab.
  SET PF-STATUS 'MY_PF_STATUS'.
ENDFORM.                    "MY_PF_STATUS

FORM my_user_command USING ip_ucomm    TYPE sy-ucomm
                                                      ip_selfield TYPE slis_selfield.

  CASE ip_ucomm.
    WHEN 'VBELN'.
    SET PARAMETER ID 'AUN' FIELD ip_sellfield-value.

   CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
  ENDCASE.

  CLEAR : ip_ucomm.
  ip_selfield-refresh =
  ip_selfield-col_stable =
  ip_selfield-row_stable = 'X'.
ENDFORM.

if you use : write for output.


START-OF-SELECTION.
  SET PF-STATUS 'DENEME'.

  WRITE : 'EXAMPLE'.

AT USER-COMMAND.
  CASE sy-ucomm.
    WHEN 'EXAM'.
      BREAK-POINT.
  ENDCASE.

if you use Class for ALV u can find more info at here : [OO ALV Reference|http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d9719a415907]

Read only

Former Member
0 Likes
3,593

Hi,

use following code

SET PF-STATUS 'STATUS'.

CASE sy-ucomm.

WHEN 'CUSTOMER'.

GET CURSOR FIELD fs_kna1-kunnr

VALUE w_kunnr.

WHEN 'ORDER'.

GET CURSOR FIELD fs_kna1-vbeln

VALUE w_vbeln.

endcase.

double click on STATUS & create 2 buttons there.& in case you need to write coding whatever you want to perform

or else see the below link.

Regards,

Raj.

Read only

Former Member
0 Likes
3,593

Thanks to all..for the reply.

i need to format the classical report.how do i do that?

do we have any sytem variable for that?

Read only

Former Member
0 Likes
3,593

Moderator message - Please do not ask or answer basic questions - thread locked Rob