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: 

how to call ALV Report and Classical report through Pushbutton

Former Member
0 Kudos

hi,

i have created a report.My task is to create two buttons:

1)ALV Report.

2)classical report

Through these button i have to call ALV Report and classical report. i have created both button and when i execute the program,

it shows me the button and alv part is working properly but classical report is not working when i click on it.

plz do needful.

thanks and regards,

john

5 REPLIES 5

Former Member
0 Kudos

Hello,

If you click a button and if something is not working, the best thing to do is debug the code. Am not sure what kind of a reply are you expecting here without sharing the source of your problem.

Vikranth

former_member196079
Active Contributor
0 Kudos

how's the code of AT-SELECTION-SCREEN and declaration of button???

Regards

Marco

venkat_o
Active Contributor
0 Kudos

Hi, <li>Try this way.


 REPORT  ztest_notepad.

 DATA ucomm TYPE sy-ucomm.
 SELECTION-SCREEN:
   BEGIN OF BLOCK b1,
     PUSHBUTTON 2(10)  but1 USER-COMMAND comm1,
     PUSHBUTTON 12(30) but2 USER-COMMAND comm2
                            VISIBLE LENGTH 10,
   END OF BLOCK b1.

 AT SELECTION-SCREEN OUTPUT.

   but1 = 'ALV'.
   but2 = 'Classical report'.

 AT SELECTION-SCREEN.
   IF ucomm IS INITIAL.
     ucomm = sy-ucomm.
   ENDIF.

 START-OF-SELECTION.

   CASE ucomm.
     WHEN 'COMM1'.
       WRITE 'Code for ALV'.
     WHEN 'COMM2'.
       WRITE 'Code for Classical Report'.
   ENDCASE.
   CLEAR ucomm.
<font color=red>Note</font>:You can go for Radiobuttons options instead of pushbuttons Thanks Venkat.O

Former Member
0 Kudos

hi john!

R u have two user id [SAPPK25|] because here also same question?

TABLES:vbap.
TYPE-POOLS:slis.
TYPES:BEGIN OF ty_output,
  vbeln TYPE vbeln_va,
  posnr	TYPE posnr_va,
  matnr	TYPE matnr,
END OF ty_output.
DATA:it_alv TYPE slis_t_fieldcat_alv,
          wa_alv LIKE LINE OF it_alv,
          it_out TYPE STANDARD TABLE OF ty_output,
          wa_out LIKE LINE OF it_out.

SELECTION-SCREEN: BEGIN OF SCREEN 500 AS WINDOW TITLE tit,
BEGIN OF LINE,
PUSHBUTTON 2(18) but1 USER-COMMAND cli1,
END OF LINE,
BEGIN OF LINE,
PUSHBUTTON 2(18) but2 USER-COMMAND cli2,
END OF LINE,
END OF SCREEN 500.


START-OF-SELECTION.
  CALL SELECTION-SCREEN 500.

AT SELECTION-SCREEN.
  IF sy-ucomm = 'CLI1'.
    wa_alv-fieldname = 'VBELN'.
    wa_alv-seltext_m =' Sales no'.
    APPEND wa_alv  TO it_alv.
    wa_alv-fieldname = 'POSNR'.
    wa_alv-seltext_m = 'Item '.
    APPEND wa_alv  TO it_alv.
    wa_alv-fieldname = 'MATNR'.
    wa_alv-seltext_m = 'Material '.
    APPEND wa_alv  TO it_alv.

    SELECT vbeln
         posnr
         matnr FROM vbap
         INTO CORRESPONDING FIELDS OF TABLE it_out.

    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
      EXPORTING
        i_callback_program = sy-repid
        it_fieldcat        = it_alv[]
      TABLES
        t_outtab           = it_out[].
    IF sy-subrc <> 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.

  ELSEIF  sy-ucomm = 'CLI2'.

    DATA: fm_name TYPE rs38l_fnam.
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
  EXPORTING
    formname                 = 'ZDR_SM_SO1'
*   VARIANT                  = ' '
*   DIRECT_CALL              = ' '
 IMPORTING
   fm_name                  = fm_name .

how have to do Smartform in SMARTFORMS tcode

ENDIF.

former_member196079
Active Contributor
0 Kudos

TRY this one



    PUSHBUTTON 2(10)  button1 USER-COMMAND b1
     PUSHBUTTON 12(30) but2 USER-COMMAND b2

 
 AT SELECTION-SCREEN OUTPUT.
  if sy-ucomm eq 'b1'.
       perform call_alv.
  elseif sy-ucomm eq 'b2'
     perform call_std_report.
  endif.
 

Marco