‎2012 Mar 07 5:27 PM
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.
‎2012 Mar 07 8:41 PM
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.
‎2012 Mar 07 8:03 PM
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.
‎2012 Mar 07 8:24 PM
‎2012 Mar 07 8:31 PM
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
‎2012 Mar 07 8:35 PM
Also if you want to add new buttons in ALV report then you can add it in the toolbar.
‎2012 Mar 07 8:41 PM
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.
‎2012 Mar 07 8:53 PM
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.
‎2012 Mar 07 9:00 PM
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