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: 

Report

Former Member
0 Kudos
201

Hai friends,

in report program,hoe to create button in tool bar.

Thanks and regards,

Jinna

1 ACCEPTED SOLUTION

Former Member
0 Kudos
166

Hi Jinna,

Without using the SET PF-STATUS statement, you can set a button in toolbar in selection screen.

Just check this code.

TABLES: SSCRFIELDS.

  • Button on screen

selection-screen: begin of screen 200.

SELECTION-SCREEN FUNCTION KEY 1.

selection-screen: end of screen 200.

INITIALIZATION.

SSCRFIELDS-FUNCTXT_01 = 'Test'.

AT SELECTION-SCREEN.

CASE SSCRFIELDS-UCOMM.

WHEN 'FC01'.

message i001(zmess).

ENDCASE.

start-of-selection.

call selection-screen 200.

17 REPLIES 17

Former Member
0 Kudos
166

hi,

U can use PF-STATUS..

set pf-status 'stat1'.

u can create buttons in the appliation toolbar only.

u can control the buttons in the main toolbar..

<b>reward if useful..</b>

Message was edited by: Ashok Kumar Prithiviraj

0 Kudos
166

Hi,

This is not Module pool.this is report.

In report also not in sellecton screen. i wanto create second screen(display).

Thanks,

suresh

0 Kudos
166

Hi Jinna,

If you want to display a toolbar button in a particular screen (say 300).

In the PBO of 300,

1) set pf-status 'MENU'.

2) Add the buttons in the application toolbar.

3) Save it and activate it.

In PAI, corresponding to the Function Code, corresponding

code is written.

This will work.

Regards,

SP.

0 Kudos
166

Hi ,

I think you want buttons in your secondary list. if that is the case you can do it like this...

at line-selection.

set pf-status 'STATUS'. "double click add buttons

now for handling do it under

at user-command.

case sy-ucomm.

when 'TEST'.
"do action
endcase.

regards

vijay

former_member188685
Active Contributor
0 Kudos
166

hi,

you can do it using set pf-status 'STATUS'.

double click on status , and add the buttons which you want, and enable back, cnacel , exit buttons also.(green,yellow, red).

write that code in start of selection.


start-of-selection.
set pf-status 'STATUS'.

Regards

vijay

Former Member
0 Kudos
166

Hi,

You need to create a MENU using SE41 and attach that to the program, using SET PF-STATUS.

In the Menu, you can add buttons to the toolbar.

Regards,

Ravi

note : Please close the thread, if the problem is solved

former_member416164
Participant
0 Kudos
166

You can also check for the instruction :

SELECTION-SCREEN FUNCTION KEY n.

It let you add 5 buttons in the toolbar without having to manage a status

Regards

Former Member
0 Kudos
166

Hi Jinna,

1)In PBO of seln.screen, write SET PF-STATUS 'MENU'.

Double click on MENU and you will be taken to SE41 or Menu Painter.

In Application Toolbar ,provide your button, give it function code and other info.

Save it and activate it.

2)Provide the code to be executed when the button is clicked.

That is it.This will work.

Regards,

SP.

0 Kudos
166

Hi Jinna,

Without using the SET PF-STATUS statement, you can set a button in toolbar in selection screen.

Just check this code.

TABLES: SSCRFIELDS.

  • Button on screen

selection-screen: begin of screen 200.

SELECTION-SCREEN FUNCTION KEY 1.

selection-screen: end of screen 200.

INITIALIZATION.

SSCRFIELDS-FUNCTXT_01 = 'Test'.

AT SELECTION-SCREEN.

CASE SSCRFIELDS-UCOMM.

WHEN 'FC01'.

message i001(zmess).

ENDCASE.

start-of-selection.

call selection-screen 200.

This will work.

Regards,

SP.

0 Kudos
166

Hi SP i want button in report program in alv display screen.

Thanks

Suresh

0 Kudos
166

Hi,

Check this code..

and for setting up the status

go to SE41 and give program name <b>SAPLKKBL</b>

STATUS as <b>STANDARD</b>

click on Copy status , and now give your program name and status which you want to use it, after copy then save it and activate it, add your own buttons if you want any.(activate it) , and check the bold code

REPORT  ZTEST_ALV_CHECK     message-id zz           .


TYPE-POOLS: SLIS.
DATA: X_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
      IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
      L_LAYOUT type slis_layout_alv,
      x_events type slis_alv_event,
      it_events type SLIS_T_EVENT.

DATA: BEGIN OF ITAB OCCURS 0,
      VBELN LIKE VBAK-VBELN,
      POSNR LIKE VBAP-POSNR,
      CHK(1),
     END OF ITAB.

SELECT VBELN
       POSNR
       FROM VBAP
       UP TO 20 ROWS
       INTO TABLE ITAB.

X_FIELDCAT-FIELDNAME = 'CHK'.
X_FIELDCAT-TABNAME = 'ITAB'.
X_FIELDCAT-COL_POS = 1.
X_FIELDCAT-INPUT = 'X'.
X_FIELDCAT-EDIT = 'X'.
X_FIELDCAT-CHECKBOX = 'X'.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.

X_FIELDCAT-FIELDNAME = 'VBELN'.
X_FIELDCAT-SELTEXT_L = 'VBELN'.
X_FIELDCAT-TABNAME = 'ITAB'.
X_FIELDCAT-COL_POS = 2.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.

X_FIELDCAT-FIELDNAME = 'POSNR'.
X_FIELDCAT-SELTEXT_L = 'POSNR'.
X_FIELDCAT-TABNAME = 'ITAB'.
X_FIELDCAT-COL_POS = 3.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
L_LAYOUT-window_titlebar = 'Popup window'.

  x_events-NAME = SLIS_EV_END_OF_PAGE.
  x_events-FORM = 'END_OF_PAGE'.
  APPEND x_events  TO iT_EVENTS.
  CLEAR x_events .
  x_events-NAME = SLIS_EV_TOP_OF_PAGE.
  x_events-FORM = 'TOP_OF_PAGE'.
  APPEND x_events  TO iT_EVENTS.
  CLEAR x_events .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
  EXPORTING
    I_CALLBACK_PROGRAM       = SY-REPID
    IS_LAYOUT                = L_LAYOUT
    I_CALLBACK_PF_STATUS_SET = 'STATUS'
    I_CALLBACK_USER_COMMAND  = 'USER_COMMAND'
    IT_FIELDCAT              = IT_FIELDCAT
    it_events                = it_events
*    I_SCREEN_START_COLUMN    = 10
*    I_SCREEN_START_LINE      = 1
*    I_SCREEN_END_COLUMN      = 50
*    I_SCREEN_END_LINE        = 20
  TABLES
    T_OUTTAB                 = ITAB
  EXCEPTIONS
    PROGRAM_ERROR            = 1
    OTHERS                   = 2.
IF SY-SUBRC <> 0.
  MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
          WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

FORM TOP_OF_PAGE.
* BREAK-POINT.
  WRITE: / 'TOP_OF_PAGE'.
ENDFORM.

FORM END_OF_PAGE.
* BREAK-POINT.
  WRITE: / 'END_OF_PAGE'.
ENDFORM.
*&---------------------------------------------------------------------*
*&      Form  STATUS
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_EXTAB    text
*----------------------------------------------------------------------*
FORM STATUS USING P_EXTAB TYPE SLIS_T_EXTAB.
*- Pf status
"this 'STATUS' i copied using SE41
"here you can add your buttons.
  <b>SET PF-STATUS 'STATUS' EXCLUDING P_EXTAB.</b>
ENDFORM.                 " STATUS
*&---------------------------------------------------------------------*
*&      Form  USER_COMMAND
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->R_UCOMM      text
*      -->RS_SELFIELD  text
*----------------------------------------------------------------------*
FORM USER_COMMAND USING R_UCOMM     LIKE SY-UCOMM
                               RS_SELFIELD TYPE SLIS_SELFIELD.
"Handling is here 
  case r_ucomm.
    when 'BACK' or 'CANC' or 'EXIT'.
      leave to screen 0.
    when 'BUTTONCODE'.
*      message i000 with 'clicked on SO#' rs_selfield-value.

  endcase.
ENDFORM.                    "USER_COMMAND

regards

vijay

0 Kudos
166

Hi Jinna,

Can you tell us where you are displaying the ALV output?

Is it in lists or screen?

What I meant was "Are u using any statements like CALL SCREEN 200 to display the output?" or "Are u using a detailed list for displaying it"?

Regards,

SP.

0 Kudos
166

Hi Jinna,

If you want to display a button in the application toolbar , then just look at my solution given in this link..

I assume that you are using REUSE_ALV_GRID_DISPLAY.

Regards,

SP.

Former Member
0 Kudos
166

If you want to set the Pf-status for selection-screen,

then you have to use,

TABLES: SSCRFIELDS.

  • Button on screen

SELECTION-SCREEN FUNCTION KEY 1.

INITIALIZATION.

SSCRFIELDS-FUNCTXT_01 = 'Test'.

AT SELECTION-SCREEN.

CASE SSCRFIELDS-UCOMM.

WHEN 'FC01'.

      • do what you want.

ENDCASE.

--


OR--

" Statement 1 After the Report Statement.

1) Set PF-STATUS 'Menu1'. " Double click to create Menu.

2)Start-of-selection

AT user-command

If sy-ucomm = 'Command_Name'.

" name give to function Keys

*----


Enter ur logic

endif.

*-----U can use case statment also.

Message was edited by: Manoj Gupta

Former Member
0 Kudos
166

Hi

Good

go through this

REPORT zsiva_test

MESSAGE-ID zprecot.

TABLES : afru.

TYPES : BEGIN OF ty_test,

ism01 LIKE afru-ism01,

END OF ty_test.

TABLES sscrfields.

SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.

SELECT-OPTIONS : so_werks FOR afru-werks.

SELECTION-SCREEN PUSHBUTTON /79(10) charly USER-COMMAND abcd.

SELECTION-SCREEN END OF BLOCK b1.

INITIALIZATION.

MOVE 'Press' TO charly.

START-OF-SELECTION.

END-OF-SELECTION.

AT SELECTION-SCREEN.

IF sscrfields-ucomm = 'ABCD'.

MESSAGE i000 WITH so_werks-low 'Success' .

ENDIF.

Thanks

Mrutyunjaya Tripathy

Former Member
0 Kudos
166

Hi,

In report program you can create the buttons on application toolbar using

set pf-status 'STATUS_NAME'.

Now double click on the STATUS_NAME and create the status. All you have to do is, just add the function codes under Application Toolbar section. Then choose the function codes using sy-ucomm under at user-command event.

Former Member
0 Kudos
167

Hi Jinna,

Without using the SET PF-STATUS statement, you can set a button in toolbar in selection screen.

Just check this code.

TABLES: SSCRFIELDS.

  • Button on screen

selection-screen: begin of screen 200.

SELECTION-SCREEN FUNCTION KEY 1.

selection-screen: end of screen 200.

INITIALIZATION.

SSCRFIELDS-FUNCTXT_01 = 'Test'.

AT SELECTION-SCREEN.

CASE SSCRFIELDS-UCOMM.

WHEN 'FC01'.

message i001(zmess).

ENDCASE.

start-of-selection.

call selection-screen 200.