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: 

output screen basic list buttons

Former Member
0 Kudos

Hi frnds,

what are the steps to create buttons in the application toolbar in our output screen.

like i m getting sales header data in my basic list so in the output i m having a button which i press then i will get sales item details.

so can anyone help me how to create that button there in the ouput screen.

regards,

sanjay

4 REPLIES 4

Former Member
0 Kudos

Hi,

You can copy the GUI STATUS STANDARD of the program SAPLKKBL in SE41 and create a new one..

in that add a button in the application toolbar section..

Then use call back pf status parameter to pass the subroutine to display the gui status..

Then use call back subroutine parameter in the alv function module to give the subroutine name..

check this example for using double click to get the item details.


TYPE-POOLS: slis.
DATA: BEGIN OF itab1 OCCURS 0,
        vbeln TYPE vbeln,
        bstnk TYPE vbak-bstnk,
        erdat TYPE vbak-erdat,
        kunnr TYPE vbak-kunnr,
      END OF itab1.

DATA: BEGIN OF itab2 OCCURS 0,
        vbeln  TYPE vbeln,
        matnr  TYPE vbap-matnr,
        netpr  TYPE vbap-netpr,
        kwmeng TYPE vbap-kwmeng,
      END OF itab2.


DATA: t_fieldcatalog1 TYPE slis_t_fieldcat_alv.
DATA: t_fieldcatalog2 TYPE slis_t_fieldcat_alv.
DATA: v_repid         TYPE syrepid.


v_repid = sy-repid.

* Get the fieldcatalog1
PERFORM get_fieldcat1.

* Get the fieldcatalog2
PERFORM get_fieldcat2.


SELECT vbeln bstnk erdat kunnr UP TO 10 ROWS
       INTO TABLE itab1
       FROM vbak.

IF NOT itab1[] IS INITIAL.
  SELECT vbeln matnr netpr kwmeng UP TO 10 ROWS
         INTO TABLE itab2
         FROM vbap
         FOR ALL ENTRIES IN itab1
         WHERE vbeln = itab1-vbeln.

ENDIF.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
     EXPORTING
          i_callback_program      = v_repid
          i_callback_user_command = 'DISPLAY_DETAIL'
          it_fieldcat             = t_fieldcatalog1
     TABLES
          t_outtab                = itab1.

*---------------------------------------------------------------------*
*       FORM display_detail                                           *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
*  -->  UCOMM                                                         *
*  -->  SELFIELD                                                      *
*---------------------------------------------------------------------*
FORM display_detail USING ucomm LIKE sy-ucomm
                        selfield TYPE slis_selfield.

  DATA: itab2_temp LIKE itab2 OCCURS 0 WITH HEADER LINE.

  IF ucomm = '&IC1'.

    READ TABLE itab1 INDEX selfield-tabindex.

    IF sy-subrc = 0.

      LOOP AT itab2 WHERE vbeln = itab1-vbeln.
        MOVE itab2 TO itab2_temp.
        APPEND itab2_temp.
      ENDLOOP.

      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
           EXPORTING
                i_callback_program = v_repid
                it_fieldcat        = t_fieldcatalog2
           TABLES
                t_outtab           = itab2_temp.

    ENDIF.

  ENDIF.

ENDFORM.

*---------------------------------------------------------------------*
*       FORM GET_FIELDCAT1                                            *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
FORM get_fieldcat1.

  DATA: s_fieldcatalog TYPE slis_fieldcat_alv.

  s_fieldcatalog-col_pos = '1'.
  s_fieldcatalog-fieldname = 'VBELN'.
  s_fieldcatalog-tabname   = 'ITAB1'.
  s_fieldcatalog-rollname  = 'VBELN'.
  s_fieldcatalog-hotspot   = 'X'.
  APPEND s_fieldcatalog TO t_fieldcatalog1.
  CLEAR s_fieldcatalog.

  s_fieldcatalog-col_pos = '2'.
  s_fieldcatalog-fieldname = 'BSTNK'.
  s_fieldcatalog-tabname   = 'ITAB1'.
  s_fieldcatalog-rollname  = 'BSTNK'.
  APPEND s_fieldcatalog TO t_fieldcatalog1.
  CLEAR s_fieldcatalog.

  s_fieldcatalog-col_pos = '3'.
  s_fieldcatalog-fieldname = 'ERDAT'.
  s_fieldcatalog-tabname   = 'ITAB1'.
  s_fieldcatalog-rollname  = 'ERDAT'.
  APPEND s_fieldcatalog TO t_fieldcatalog1.
  CLEAR s_fieldcatalog.

  s_fieldcatalog-col_pos = '4'.
  s_fieldcatalog-fieldname = 'KUNNR'.
  s_fieldcatalog-tabname   = 'ITAB1'.
  s_fieldcatalog-rollname  = 'KUNNR'.
  APPEND s_fieldcatalog TO t_fieldcatalog1.
  CLEAR s_fieldcatalog.

ENDFORM.
*
*---------------------------------------------------------------------*
*       FORM GET_FIELDCAT2                                            *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
FORM get_fieldcat2.

  DATA: s_fieldcatalog TYPE slis_fieldcat_alv.

  s_fieldcatalog-col_pos = '1'.
  s_fieldcatalog-fieldname = 'VBELN'.
  s_fieldcatalog-tabname   = 'ITAB2'.
  s_fieldcatalog-rollname  = 'VBELN'.
  APPEND s_fieldcatalog TO t_fieldcatalog2.
  CLEAR s_fieldcatalog.

  s_fieldcatalog-col_pos = '2'.
  s_fieldcatalog-fieldname = 'MATNR'.
  s_fieldcatalog-tabname   = 'ITAB2'.
  s_fieldcatalog-rollname  = 'MATNR'.
  APPEND s_fieldcatalog TO t_fieldcatalog2.
  CLEAR s_fieldcatalog.

  s_fieldcatalog-col_pos = '3'.
  s_fieldcatalog-fieldname = 'NETPR'.
  s_fieldcatalog-tabname   = 'ITAB2'.
  s_fieldcatalog-rollname  = 'NETPR'.
  APPEND s_fieldcatalog TO t_fieldcatalog2.
  CLEAR s_fieldcatalog.

  s_fieldcatalog-col_pos = '4'.
  s_fieldcatalog-fieldname = 'KWMENG'.
  s_fieldcatalog-tabname   = 'ITAB2'.
  s_fieldcatalog-rollname  = 'KWMENG'.
  APPEND s_fieldcatalog TO t_fieldcatalog2.
  CLEAR s_fieldcatalog.
ENDFORM.

Thanks

Naren

Former Member
0 Kudos

Hi

Create GUI STATUS

using SET PF-STATUS 'AAA' from SE41 and use it in the Program

create button in the application tool bar withsome icon and text and give some Function code

and use the field SY-UCOMM to handle that Fcode

And write the code accordingly.

Case SY-Ucomm.

when 'DISP'

...fetch and display the data

endcase.

Regards

Anji

Former Member
0 Kudos

hi

good

go through this code.

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.

reward point if helpful.

thanks

mrutyun^

Former Member
0 Kudos

Hi,

1. In your program find the SET PF-STATUS [Under PBO].

2. Then give any name to it and doble click.

3. Fro that screen you can design your own menu and assign the function code for each Buttons.

4. Then write the code under PAI like,

Case sy-ucomm.

when 'new'. -


> Here new is the Fun.code assinged in menu painter.

call screen 100.

Endcase.

Thanks,

Reward If Helpful.