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

pushbutton how to do added ?

Former Member
0 Likes
943

Hello first. I do not have a good of English. would be a question. add button. When I add the following to trigger the calculation result of the exam, I would like to come to print page. How can such a thing.

PARAMETERS: VIZE TYPE i,
            FINAL TYPE i.


"ortalama hesaplama
TABLES SSCRFIELDS.

Data: ORTALAMA TYPE i,
      DURUM(20) TYPE c.
ORTALAMA = ( VIZE * 40 ) / 100 + ( FINAL * 60 ) / 100.

if  ORTALAMA >= 50.
  write : SY-VLINE , 'VIZE:', SY-VLINE , VIZE, SY-VLINE ,'FINAL:', SY-VLINE , FINAL, SY-VLINE,  'ORTALAMA:', SY-VLINE , ORTALAMA, SY-VLINE , 'DURUM:', SY-VLINE, 'BAu015EARILI' color 5, SY-ULINE.

ELSEIF DURUM < 50.
  write : SY-VLINE , 'VIZE:', SY-VLINE , VIZE, SY-VLINE ,'FINAL:', SY-VLINE , FINAL, SY-VLINE,  'ORTALAMA:', SY-VLINE , ORTALAMA, SY-VLINE , 'DURUM:', SY-VLINE, 'BAu015EARISIZ' color 6, SY-ULINE.
ENDIF.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
899

I've just begun to learn the program. I do not know about alv. Could you tell me simply trigger buttons to create and do. Thank you.

7 REPLIES 7
Read only

Former Member
0 Likes
899

Hi,

could you please explain the meaning of print page?

you need to just display the result on screen when button is pressed?

Regards,

Gaurav.

Read only

Former Member
0 Likes
899

I want to go to print page.

Read only

0 Likes
899

Hi,

You can create an ALV report and output your calculation in Grid/List format. Use FM "REUSE_ALV_GRID_DISPLAY" or "REUSE_ALV_LIST_DISPLAY".

Output in ALV comes in a new screen that has built-in features (including print). When your output is displayed, select print from the menu 'List' (List-->Print). This was you can print your output.

Let us know if you need help in creating an ALV report.

- Saba

Read only

0 Likes
899

Also if you want to add new buttons in ALV report then you can add it in the toolbar.

Read only

Former Member
0 Likes
900

I've just begun to learn the program. I do not know about alv. Could you tell me simply trigger buttons to create and do. Thank you.

Read only

0 Likes
899

Simple ALV report:


*&---------------------------------------------------------------------*
*& Report  ZSIMPLE_ALV
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  zsimple_alv.

TABLES: spfli.

*   Type pools declarations
TYPE-POOLS: slis.

*   ALV data declarations

DATA: i_fieldcatalog TYPE slis_t_fieldcat_alv,
      wa_fieldcatalog TYPE slis_fieldcat_alv.


* SELECTION SCREEN
SELECT-OPTIONS: s_carrid FOR spfli-carrid.

* declare i_spfli
DATA: i_spfli TYPE STANDARD TABLE OF spfli.

DATA: wa_spfli TYPE spfli.


* selection
SELECT *
FROM spfli
INTO TABLE i_spfli
WHERE carrid IN s_carrid.

* return value sy-subrc = 0 if at least 1 record was found; otherwise it will have value 4
IF sy-subrc = 0.

** build a field catalog
  wa_fieldcatalog-fieldname = 'CARRID'.
  wa_fieldcatalog-seltext_m = 'Airline Code'.
  APPEND wa_fieldcatalog TO i_fieldcatalog.
  CLEAR wa_fieldcatalog.

  wa_fieldcatalog-fieldname = 'CONNID'.
  wa_fieldcatalog-seltext_m = 'Flight Connection Number'.
  APPEND wa_fieldcatalog TO i_fieldcatalog.
  CLEAR wa_fieldcatalog.

  wa_fieldcatalog-fieldname = 'FLDATE'.
  wa_fieldcatalog-seltext_m = 'Flight date'.
  APPEND wa_fieldcatalog TO i_fieldcatalog.
  CLEAR wa_fieldcatalog.

  wa_fieldcatalog-fieldname = 'PRICE'.
  wa_fieldcatalog-seltext_m = 'Airfare'.
  APPEND wa_fieldcatalog TO i_fieldcatalog.
  CLEAR wa_fieldcatalog.

* display values on screen

* Display ALV report
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
*      i_callback_program = sy-repid
      it_fieldcat        = i_fieldcatalog[]
*      i_save             = 'X'
    TABLES
      t_outtab           = i_spfli
    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.


ENDIF.

Read only

0 Likes
899

First screen will be selection screen where you have to enter some value say 'AA' (press F4 key to get a list of input values for the textbox). Execute (press F8 key)

This will navigate you to new screen displaying output (if any entry for AA exist in table SPFLI).

Here, in the first menu List, you have an option to print the output.

To add new buttons on the ALV toolbar will be complex. Since you are a beginner I think you should start with the basics and once you master (or have good understanding) on basics then go for the complex options.

For your reference, check the below link for adding custom buttons on ALV toolbar (the sample program uses object oriented ABAP i.e. classes, methods):

<link to blocked site removed by moderator>

Edited by: Thomas Zloch on Mar 8, 2012