Multiple ALV display using SALV(Factory method)...
Hello Experts,
Please provide me any examples on how to display multiple ALV
displays in a screen using SALV(Factory method).
Hope you can help me guys.
Thank you and take care!
Hi Viraylab,
Kindly check the program below, this will help you..
*& Report Z101754_REPORT
REPORT z101754_report.
TABLES: zvbak_101754,zvbap_101754,mara.
TYPE-POOLS: slis.
DATA : i_fieldcat TYPE slis_t_fieldcat_alv.
DATA: FLDNAME(24).
DATA : BEGIN OF itab_zvbap OCCURS 0,
zvbeln LIKE zvbap_101754-zvbeln,
zposnr LIKE zvbap_101754-zposnr,
zmatnr LIKE zvbap_101754-zmatnr,
zbrgew LIKE zvbap_101754-zbrgew,
zgi_qty LIKE zvbap_101754-zgi_qty,
zinv_qty LIKE zvbap_101754-zinv_qty,
END OF itab_zvbap.
SELECTION-SCREEN BEGIN OF BLOCK block1 WITH FRAME TITLE text-t01.
SELECT-OPTIONS : s_zvbeln FOR zvbak_101754-zvbeln,
s_zkunwe FOR zvbak_101754-zkunwe,
s_zerdat FOR zvbak_101754-zerdat,
s_zmatnr FOR zvbap_101754-zmatnr.
SELECTION-SCREEN END OF BLOCK block1.
SELECTION-SCREEN: BEGIN OF BLOCK block2 WITH FRAME TITLE t02.
PARAMETERS : invoiced AS CHECKBOX,
s_gi AS CHECKBOX .
SELECTION-SCREEN: END OF BLOCK block2.
SELECTION-SCREEN: BEGIN OF BLOCK block3 WITH FRAME TITLE t03.
PARAMETERS : alv_list RADIOBUTTON GROUP g1,
alv_grid RADIOBUTTON GROUP g1,
s_class RADIOBUTTON GROUP g1.
SELECTION-SCREEN: END OF BLOCK block3.
Screen Field Validation event
AT SELECTION-SCREEN ON s_zvbeln.
SELECT SINGLE *
FROM zvbak_101754 WHERE zvbeln IN s_zvbeln.
IF sy-subrc NE 0.
MESSAGE e000(z754).
ENDIF.
AT SELECTION-SCREEN ON s_zkunwe.
SELECT SINGLE *
FROM zvbak_101754 WHERE zkunwe IN s_zkunwe.
IF sy-subrc NE 0.
MESSAGE e001(z754).
ENDIF.
AT SELECTION-SCREEN ON s_zerdat.
SELECT SINGLE *
FROM zvbak_101754 WHERE zerdat IN s_zerdat.
IF sy-subrc NE 0.
MESSAGE e002(z754).
ENDIF.
AT SELECTION-SCREEN ON s_zmatnr.
SELECT SINGLE *
FROM zvbap_101754 WHERE zmatnr IN s_zmatnr.
IF sy-subrc NE 0.
MESSAGE e003(z754).
ENDIF.
Start-Of-Selection Event
START-OF-SELECTION.
PERFORM select-data.
End-Of-Selection Event
END-OF-SELECTION.
PERFORM display.
*& Form select-data
text
--> p1 text
<-- p2 text
FORM select-data .
SELECT zvbeln zposnr zmatnr zbrgew zgi_qty zinv_qty
INTO CORRESPONDING FIELDS OF TABLE itab_zvbap
FROM zvbap_101754
WHERE zvbeln IN s_zvbeln.
ENDFORM. " select-data3
TOP-OF-PAGE.
AT LINE-SELECTION.
FORMAT HOTSPOT.
*GET THE FIELD NAME ON LINE SELECTION
GET CURSOR FIELD FLDNAME . "value field_value.
IF FLDNAME = 'itab_zvbap-zvbeln'.
SET PARAMETER ID 'BES' FIELD itab_zvbap-zvbeln.
CALL TRANSACTION 'ZVA01_101754'.
ENDIF.
*& Form DISPLAY
text
--> p1 text
<-- p2 text
FORM display .
IF s_class ='X'.
PERFORM display_header.
LOOP AT itab_zvbap.
WRITE : / sy-vline,
itab_zvbap-zvbeln ,
13 sy-vline,
itab_zvbap-zposnr ,
30 sy-vline,
itab_zvbap-zmatnr ,
45 sy-vline,
itab_zvbap-zbrgew UNIT mara-meins ,
65 sy-vline,
itab_zvbap-zgi_qty UNIT mara-meins,
85 sy-vline,
itab_zvbap-zinv_qty UNIT mara-meins,
105 sy-vline,
/ sy-uline(105).
ENDLOOP.
ENDIF.
*& Creating the fieldcatalog.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = sy-repid
i_internal_tabname = 'ITAB_ZVBAP'
I_STRUCTURE_NAME =
I_CLIENT_NEVER_DISPLAY = 'X'
i_inclname = sy-repid
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
CHANGING
ct_fieldcat = i_fieldcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
IF alv_list = 'X'.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
i_callback_program = sy-repid
i_callback_pf_status_set = ' '
i_callback_user_command = 'USER_COMMAND '
I_STRUCTURE_NAME =
IS_LAYOUT =
it_fieldcat = i_fieldcat
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IR_SALV_LIST_ADAPTER =
IT_EXCEPT_QINFO =
I_SUPPRESS_EMPTY_DATA = ABAP_FALSE
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = itab_zvbap[]
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.
IF alv_grid = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
i_callback_program = sy-repid
i_callback_pf_status_set = ' '
i_callback_user_command = 'USER_COMMAND '
I_CALLBACK_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT =
it_fieldcat = i_fieldcat
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_HTML_HEIGHT_TOP = 0
I_HTML_HEIGHT_END = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
IR_SALV_FULLSCREEN_ADAPTER =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = itab_zvbap[]
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.
ENDFORM. " DISPLAY
*& Form display_header
text
--> p1 text
<-- p2 text
FORM display_header .
WRITE : / sy-vline,
'ORDER NO',
13 sy-vline,
'ITEM NO',
30 sy-vline,
'MATERIAL NO',
45 sy-vline,
'ORDER QTY',
65 sy-vline,
'GI QTY',
85 sy-vline,
'INVOICED QTY',
105 sy-vline,
/ sy-uline(105).
ENDFORM. " display_header
Please let me know if you have any doubt.
Regards,
Amit.
Similar Messages
-
Multiple ALV display in one screen using SALV(Factory method)...
Hello Experts,
I tried using the old 'REUSE_ALV_BLOCK_LIST_APPEND' but it does not suit my
requirement. So will it be possible to display multiple ALV display(block) using
SALV?check the sample code..
REPORT zsalv_demo_multiple.
DATA: salv1 TYPE REF TO cl_salv_table,
salv2 TYPE REF TO cl_salv_table,
salv3 TYPE REF TO cl_salv_table.
DATA: g_custom TYPE REF TO cl_gui_custom_container,
o_splitter TYPE REF TO cl_gui_splitter_container,
o_grid1 TYPE REF TO cl_gui_container,
o_grid2 TYPE REF TO cl_gui_container,
o_grid3 TYPE REF TO cl_gui_container.
DATA: it_flight TYPE STANDARD TABLE OF sflight,
it_carr TYPE TABLE OF scarr,
it_book TYPE TABLE OF sbook.
START-OF-SELECTION.
SELECT * FROM sflight
INTO TABLE it_flight
UP TO 20 ROWS.
SELECT * FROM scarr
INTO TABLE it_carr
UP TO 20 ROWS.
SELECT * FROM sbook
INTO TABLE it_book
UP TO 20 ROWS.
CALL SCREEN 100.
*& Module STATUS_0100 OUTPUT
* text
MODULE status_0100 OUTPUT.
SET PF-STATUS 'ABC'.
CREATE OBJECT g_custom
EXPORTING container_name = 'CONT'.
CREATE OBJECT o_splitter
EXPORTING parent = g_custom
rows = 3
columns = 1.
CALL METHOD o_splitter->get_container
EXPORTING
row = 1
column = 1
RECEIVING
container = o_grid1.
CALL METHOD o_splitter->get_container
EXPORTING
row = 2
column = 1
RECEIVING
container = o_grid2.
CALL METHOD o_splitter->get_container
EXPORTING
row = 3
column = 1
RECEIVING
container = o_grid3.
cl_salv_table=>factory(
EXPORTING
r_container = o_grid1
IMPORTING
r_salv_table = salv1
CHANGING
t_table = it_flight
cl_salv_table=>factory(
EXPORTING
r_container = o_grid2
IMPORTING
r_salv_table = salv2
CHANGING
t_table = it_carr
cl_salv_table=>factory(
EXPORTING
r_container = o_grid3
IMPORTING
r_salv_table = salv3
CHANGING
t_table = it_book
CALL METHOD salv1->display.
CALL METHOD salv2->display.
CALL METHOD salv3->display.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
* text
MODULE user_command_0100 INPUT.
CASE sy-ucomm.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
Flow Logic..
PROCESS BEFORE OUTPUT.
MODULE STATUS_0100.
PROCESS AFTER INPUT.
MODULE USER_COMMAND_0100.
in the Screen i placed a custom control and named it as CONT -
Show popup window with LED lights using SALV(factory method)
Hello Experts,
I need to add a button that when the user clicks it, a popup window will appear
showing the meanings(legends) of the LED lights in my report. How do I do this guys?
Thanks you and take care!Please check the program SALV_TEST_TABLE_COLUMNS and
after setting up the values for ICON and showi it as in a popup by
data: gr_table type ref to cl_salv_table.
gr_table->set_screen_popup(
start_column = 1
end_column = 110
start_line = 1
end_line = 20 ).
gr_table->display( ).
a® -
End of page in ALV display using OOPS
Hi all,
How can i display end of page or footer in ALV display using OOPS concept.
Thanks,
vinitHi ,
Try using this code.
First add a handler method in your handler class definition as:
e.g. METHOD handle__end_of_page
FOR EVENT print_end_of_page OF cl_gui_alv_grid .
Then implement the method in the implementation part of your local class.
e.g. METHOD handle_print_end_of_page .
WRITE:/ 'Flights Made on ', sy-datum .
ENDMETHOD .
And register this method as the handler.
SET HANDLER gr_event_handler->handle_print_end_of_page FOR gr_alvgrid .
Hope this helps.
Regards,
Janaki. -
Toolbar in alv display using oops alv
i have written code for displaying toolbar in alv display using oops, but it is not displaying please find the below code and let me know reason.
*& Report ZTRANSFER_ORDER2 *
REPORT ZTRANSFER_ORDER2 .
*& Report ZTRANSFER_ORDER *
TABLES:sflight.
TYPE-POOLS : icon.
* G L O B A L I N T E R N A L T A B L E S
CLASS lcl_event_receiver DEFINITION DEFERRED.
types : begin of ty_mara,
matnr type matnr,
mtart type mtart,
mbrsh type mbrsh,
matkl type matkl,
bismt type bismt,
meins type meins,
end of ty_mara.
DATA: t_mara type STANDARD TABLE OF ty_mara.
* G L O B A L D A T A
DATA: ok_code LIKE sy-ucomm,
g_wa_mara type ty_mara.
DATA : t_fcat type LVC_T_FCAT.
DATA : l_VAR TYPE disvariant.
DATA : gs_layout type lvc_s_layo.
* Declare reference variables to the ALV grid and the container
G L O B A L D A T A
DATA: ok_code LIKE sy-ucomm.
Declare reference variables to the ALV grid and the container
DATA:
go_grid TYPE REF TO cl_gui_alv_grid,
go_custom_container TYPE REF TO cl_gui_custom_container.
data : it_toolbar TYPE stb_button,
event_receiver TYPE REF TO lcl_event_receiver.
* S T A R T - O F - S E L E C T I O N.
START-OF-SELECTION.
CALL SCREEN 100 .
*CLASS lcl_event_receiver DEFINITION.
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
CLASS-METHODS:
*handling toolbar for interactive
handle_toolbar
FOR EVENT toolbar OF cl_gui_alv_grid
IMPORTING e_object e_interactive,
*handling menu button
handle_menu_button
FOR EVENT menu_button OF cl_gui_alv_grid
IMPORTING e_object e_ucomm,
*On click of the menu button
handle_user_command
FOR EVENT user_command OF cl_gui_alv_grid
IMPORTING e_ucomm.
PRIVATE SECTION.
ENDCLASS.
CLASS lcl_event_receiver IMPLEMENTATION.
METHOD handle_toolbar.
handle toolbar
CLEAR it_toolbar.
MOVE 'DETAIL' TO it_toolbar-function.
MOVE icon_detail TO it_toolbar-icon.
MOVE 2 TO it_toolbar-butn_type.
APPEND it_toolbar TO e_object->mt_toolbar.
ENDMETHOD. "handle_toolbar
METHOD handle_menu_button.
handle own menubuttons
IF e_ucomm = 'DETAIL'.
CALL METHOD e_object->add_function
EXPORTING
fcode = 'DISPLAY'
text = 'DISPLAY'.
ENDIF.
ENDMETHOD. "handle_menu_button
METHOD handle_user_command.
*On click
CASE e_ucomm.
WHEN 'DISPLAY'.
MESSAGE 'Menu Clicked' TYPE 'I'.
ENDCASE.
ENDMETHOD. "handle_user_command
ENDCLASS. "lcl_event_receiver IMPLEMENTATION
*& Module USER_COMMAND_0100 INPUT
MODULE user_command_0100 INPUT.
CASE ok_code.
WHEN 'EXIT'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Module STATUS_0100 OUTPUT
MODULE status_0100 OUTPUT.
sET PF-STATUS 'STATUS'.
Create objects
IF go_custom_container IS INITIAL.
CREATE OBJECT go_custom_container
EXPORTING container_name = 'ALV_CONTAINER'.
CREATE OBJECT go_grid
EXPORTING
i_parent = go_custom_container.
PERFORM load_data_into_grid.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
*& Form load_data_into_grid
FORM load_data_into_grid.
Read data from table SFLIGHT
SELECT matnr mtart mbrsh matkl bismt meins
FROM mara
INTO corresponding fields of TABLE t_mara.
PERFORM fld_cate changing T_fcat.
l_var-report = sy-repid.
gs_layout-grid_title = 'Analysis Report'.
gs_layout-NO_TOOLBAR = 'X'.
gs_layout-BOX_FNAME = 'Selection'.
Load data into the grid and display them
caLL METHOD go_grid->set_table_for_first_display
EXPORTING
i_structure_name = 'S_MVKE'
i_save = 'A'
is_variant = l_var
is_layout = gs_layout
CHANGING
it_outtab = t_mara[]
it_fieldcatalog = t_fcat.
endform.
*& Module pai INPUT
text
MODULE pai INPUT.
data: l_valid type c.
clear ok_code.
break-point.
ok_code = sy-ucomm.
CASE ok_code.
WHEN 'EXIT'.
LEAVE TO SCREEN 0.
WHEN 'BACK'.
call method go_grid->check_changed_data
importing
e_valid = l_valid.
loop at t_mara into g_wa_mara.
endloop.
ENDCASE.
ENDMODULE. " pai INPUT
*& Form fld_cate
text
<--P_T_FCAT text
FORM fld_cate CHANGING P_T_FCAT TYPE lvc_t_fcat.
DATA : s_fcat type LVC_S_FCAT .
REFRESH: t_fcat.
CLEAR s_fcat.
s_fcat-fieldname = 'BOX1'.
s_fcat-coltext = 'Box1'.
s_fcat-seltext = 'Box1'.
s_fcat-CHECKBOX = 'X'.
s_fcat-EDIT = 'X'.
APPEND s_fcat TO P_T_FCAT.
CLEAR s_fcat.
s_fcat-row_pos = 1.
s_fcat-col_pos = 1.
s_fcat-fieldname = 'MATNR'.
s_fcat-ref_field = 'MATNR'.
s_fcat-ref_table = 'T_MARA'.
s_fcat-coltext = 'Material'.
s_fcat-seltext = 'Material'.
s_fcat-EDIT = 'X'.
APPEND s_fcat TO P_T_FCAT.
CLEAR s_fcat.
s_fcat-row_pos = 2.
s_fcat-col_pos = 2.
s_fcat-fieldname = 'MTART'.
s_fcat-ref_field = 'MTART'.
s_fcat-ref_table = 'T_MARA'.
s_fcat-coltext = 'Material type'.
s_fcat-seltext = 'Material type'.
APPEND s_fcat TO P_T_FCAT.
CLEAR s_fcat.
s_fcat-fieldname = 'BOX2'.
s_fcat-coltext = 'Box2'.
s_fcat-seltext = 'Box2'.
s_fcat-CHECKBOX = 'X'.
s_fcat-EDIT = 'X'.
APPEND s_fcat TO P_T_FCAT.
CLEAR s_fcat.
s_fcat-row_pos = 3.
s_fcat-col_pos = 3.
s_fcat-fieldname = 'MBRSH'.
s_fcat-ref_field = 'MBRSH'.
s_fcat-ref_table = 'T_MARA'.
s_fcat-coltext = 'Industry Sector'.
s_fcat-seltext = 'Industry Sector'.
APPEND s_fcat TO P_T_FCAT.
CLEAR s_fcat.
s_fcat-row_pos = 4.
s_fcat-col_pos = 4.
s_fcat-fieldname = 'MATKL'.
s_fcat-ref_field = 'MATKL'.
s_fcat-ref_table = 'T_MARA'.
s_fcat-coltext = 'Material Group'.
s_fcat-seltext = 'Material Group'.
APPEND s_fcat TO P_T_FCAT.
CLEAR s_fcat.
s_fcat-row_pos = 5.
s_fcat-col_pos = 5.
s_fcat-fieldname = 'BISMT'.
s_fcat-ref_field = 'BISMT'.
s_fcat-ref_table = 'T_MARA'.
s_fcat-coltext = 'Old material number'.
s_fcat-seltext = 'Old material number'.
APPEND s_fcat TO P_T_FCAT.
CLEAR s_fcat.
s_fcat-row_pos = 6.
s_fcat-col_pos = 6.
s_fcat-fieldname = 'MEINS'.
s_fcat-ref_field = 'MEINS'.
s_fcat-ref_table = 'T_MARA'.
s_fcat-coltext = 'Base Unit of Measure'.
s_fcat-seltext = 'Base Unit of Measure'.
APPEND s_fcat TO P_T_FCAT.
CLEAR s_fcat.
s_fcat-fieldname = 'BOX3'.
s_fcat-coltext = 'Box3'.
s_fcat-seltext = 'Box3'.
s_fcat-CHECKBOX = 'X'.
s_fcat-EDIT = 'X'.
APPEND s_fcat TO P_T_FCAT.
ENDFORM. " fld_cate .MOVE 2 TO it_toolbar-butn_type.
Try changing the 2 (menu) to 0 (button) and see if that helps
also you need to set the event handler after you create your alv object
set handler handle_toolbar for [whatever object is called].
Edited by: Kev Mycock on Jul 24, 2008 7:59 AM -
ALV display using dynamic field catalog and dynamic internal table
hi ,
please guide me for ALV display using dynamic field catalog and dynamic internal table.
Thank you.Hi Rahul,
maybe thread dynamic program for alv is helpful for you. More information about the [SAP List Viewer (ALV)|http://help.sap.com/saphelp_nw70/helpdata/EN/5e/88d440e14f8431e10000000a1550b0/frameset.htm]. Also have a look into the example programs SALV_DEMO_TABLE*.
Regards Rudi -
How to use singloeton factory methods ?
Hi Guys,
Can any one please help me like how to use singleton factory methods in oops? i am very new to OOPS concepts ?
Thanks in advancePRINTER - part2
METHOD constructor.
"initial printer cartridge fill
me->number = i_number.
me->cartridge = i_units.
me->cost = me->cartridge * 10.
ENDMETHOD.
METHOD increase_cost.
cost = cost + i_units.
ENDMETHOD.
METHOD consume_cartrigde.
cartridge = cartridge - i_units.
ENDMETHOD.
METHOD get_total_cost.
DATA lo_printer TYPE REF TO lcl_printer.
LOOP AT it_printers INTO lo_printer.
r_cost = r_cost + lo_printer->get_cost( ).
ENDLOOP.
ENDMETHOD.
METHOD get_cost.
r_cost = cost.
ENDMETHOD.
METHOD get_cartridge.
r_cartridge = cartridge.
ENDMETHOD.
METHOD get_number.
r_number = number.
ENDMETHOD.
* helper method to show current state of printers
METHOD show_printers.
DATA lv_mess TYPE string.
DATA lv_number TYPE i.
DATA lv_cartridge TYPE i.
DATA lv_cartridge_c TYPE c LENGTH 5.
DATA lv_cost TYPE i.
DATA lv_cost_c TYPE c LENGTH 5.
DATA lv_number_c TYPE c LENGTH 2.
DATA lo_printer TYPE REF TO lcl_printer.
LOOP AT it_printers INTO lo_printer.
lv_number_c = lv_number = lo_printer->get_number( ).
lv_cost_c = lv_cost = lo_printer->get_cost( ).
lv_cartridge_c = lv_cartridge = lo_printer->get_cartridge( ).
CONCATENATE lv_mess 'Printer:' lv_number_c ', cost:' lv_cost_c ', cartridge:' lv_cartridge_c
cl_abap_char_utilities=>cr_lf INTO lv_mess SEPARATED BY space.
ENDLOOP.
MESSAGE lv_mess TYPE 'I'.
ENDMETHOD.
ENDCLASS.
CLIENT
DATA go_printer TYPE REF TO lcl_printer. "printers
DATA go_job TYPE REF TO lcl_job. "job
DATA gv_mess TYPE string.
DATA: gv_number TYPE i,
gv_number_c TYPE c LENGTH 10.
SELECTION-SCREEN BEGIN OF BLOCK bl1 WITH FRAME.
PARAMETERS: pa_print TYPE i OBLIGATORY, "printer number
pa_units TYPE i DEFAULT 100. "initial printer filling
SELECTION-SCREEN PUSHBUTTON /10(15) addp USER-COMMAND fcadd VISIBLE LENGTH 15.
SELECTION-SCREEN PUSHBUTTON /10(15) refil USER-COMMAND fcref VISIBLE LENGTH 15.
SELECTION-SCREEN PUSHBUTTON /10(15) show USER-COMMAND fcshow VISIBLE LENGTH 15.
SELECTION-SCREEN PUSHBUTTON /10(15) print USER-COMMAND fcprnt VISIBLE LENGTH 15.
SELECTION-SCREEN PUSHBUTTON /10(15) total USER-COMMAND fctot VISIBLE LENGTH 15.
SELECTION-SCREEN END OF BLOCK bl1.
SELECTION-SCREEN BEGIN OF BLOCK bl2 WITH FRAME.
PARAMETERS: pa_col TYPE c1,
pa_pages TYPE i,
pa_numb TYPE i. "to which printer you want the job be send to
SELECTION-SCREEN END OF BLOCK bl2.
INITIALIZATION.
addp = 'Add printer'.
show = 'Show printers'.
print = 'Print'.
total = 'Total cost'.
refil = 'Refill'.
AT SELECTION-SCREEN.
CLEAR: gv_number, gv_number_c, gv_mess.
CASE sy-ucomm.
WHEN 'FCADD'.
go_printer = lcl_printer=>factory( i_number = pa_print
i_units = pa_units ).
WHEN 'FCSHOW'.
IF go_printer IS NOT BOUND.
MESSAGE 'Add at least one printer first' TYPE 'E'.
ELSE.
go_printer->show_printers( ).
ENDIF.
WHEN 'FCPRNT'.
IF pa_pages IS INITIAL.
MESSAGE 'Provide number of pages' TYPE 'E'.
ENDIF.
CREATE OBJECT go_job EXPORTING i_pages = pa_pages i_color = pa_col.
IF lcl_printer=>get_printer( pa_numb ) IS NOT BOUND.
gv_number_c = pa_numb.
condense gv_number_c.
CONCATENATE 'Printer' gv_number_c 'doesn`t exist, select correct one' INTO gv_mess SEPARATED BY space.
MESSAGE gv_mess TYPE 'E'.
ELSE.
go_printer->print( i_number = pa_numb
io_job = go_job ).
ENDIF.
WHEN 'FCTOT'.
IF go_printer IS BOUND.
gv_number_c = gv_number = go_printer->get_total_cost( ).
ENDIF.
CONCATENATE 'Total cost of all printers for printing and initial cartridge filling is: ' gv_number_c INTO gv_mess
SEPARATED BY space.
MESSAGE gv_mess TYPE 'I'.
WHEN 'FCREF'.
IF lcl_printer=>get_printer( pa_print ) IS NOT BOUND.
gv_number_c = pa_print.
CONCATENATE 'Printer doesn`t exist' gv_number_c INTO gv_mess SEPARATED BY space.
MESSAGE gv_mess TYPE 'E'.
ELSE.
go_printer->fill_cartridge( i_number = pa_print
i_units = pa_units ).
ENDIF.
ENDCASE.
Regards
Marcin -
DIfference between Reusable FM for ALV display and ALV display using class
Hi,
Is there any difference between alv display using Resuable FM and ALV display using classes except the later one uses OO concept.??
One mere thing i want to clarify is that is there any difference exist between REUSE_ALV_GRID_DISPLAY and REUSE_ALV_LIST_DISPLAY? If so, then let me know.
It could be easier to understand me if yuo give scenario where these FM comes into picture
Regards,
ParagHi,
(1) REUSE_ALV_LIST_DISPLAY
Display an ALV list as per parameters defined in the function call
(2) REUSE_ALV_GRID_DISPLAY
Display an ALV grid as per parameters defined in the function call
(3) REUSE_ALV_COMMENTARY_WRITE
List header information is output according to its type. The output information is put in an internal table. Output attributes are assigned to each line via the TYP field.This module outputs formatted simple header information at TOP-OF-PAGE.
(4) REUSE_ALV_HIERSEQ_LIST_DISPLAY
This module outputs two internal tables as a formated hierarchical-sequential list.
(5) REUSE_ALV_VARIANT_F4
Display variant selection dialog box.
(6) REUSE_ALV_VARIANT_EXISTENCE
Checks whether a display variant exists.
Other Useful Link :
Customize ALV grid layout at run time
Download ALV grid Control Tutorial
Understand ALV report ( Just Copy and paste )
Dynamic selection on ALV at run time
Dynamic selection on ALV at run time
Regards
Kiran -
How to display 3 level hierarchy alv report using SALV
Hi ,
I need to display a Hierarchy ALV report with 3 level.I thought of trying CL_SALV_HIERSEQ_TABLE but i am able to display only two level report.
How can i display the 3 - level heirarchy report using SALV. I don't want to use SALV_TREE.
Regards,
Aditya Tanguturi.Hi Aditya,
Please check this thread
Is it possible to display more than 2 levels us... | SCN
Thanks !
Amit -
Need to display texts on to the ALV grid using SALV
Hi evryone,
There is a requirement to print an ALV grid containing the row titles and their subsequent values. The display shouild look like as below
Summary ItemsA cost 111111
ItemsB cost 222222
ItemC cost 333333
New items
ItemD cost 111111
ItemE cost 222222
ItemF cost 333333
Total 666666 666666
The headings pertaining to ItemA to itemB should come in a single column and their subsequent values as shown above. The total should be displayed below the corresponding block of items. Can anyone please suggest me the way we can acheive this using SALV and container concept.Sorry my earlier did not get displayed as expected. Please find below the format how the ALV should get displayed.
Summary -
ITEMA----
1111
ITEMB----
2222
ITEMC----
3333
ITEMD----
1111
ITEME----
2222
ITEMF -
3333
Total--6666--
6666
Please ignore the dots here they are just written to indicate spaces between the texts. The text summary and the texts "ItemA, B, C etc" should have 1 coulmn gap and the prices for the first item block should have 1 column block from the texts and the prices for second Item block should have a 2 coulumn block from the texts and total value should be displayed below each block.
Edited by: Phaniacumen on May 8, 2010 1:59 PM -
Default Layout for Multiple ALV displays
Hello All,
I have a requirement where I am displaying multiple ALV grid displays on different tabs of a screen.
Now I have to set a default layout for each of the grids separately as they have different fields.
Please let me know how to do it, I am using OO ALV display.
Thanks a lot
RuchiHi,
According to your grid called pass the variant name
gs_variant-report = sy-repid.
gs_variant-username = sy-uname.
gs_variant-variant = v_vari. " Your variant Name
call method grid1->set_table_for_first_display
exporting
is_layout = gs_layout
is_variant = gs_variant "<<<<<<<<<
i_save = 'A'
it_toolbar_excluding = i_exclude[]
changing
it_outtab = i_output[]
it_fieldcatalog = i_fieldcat[]
exceptions
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
others = 4.
a® -
Hi ,
have been working on a ALV report using the class SALV cl_salv_hierseq_table
I am facing few issues pertaining to two things:
1. Displaying some subtotal text along with the subtotals.
Example refer the standard demo example: SALV_DEMO_HIERSEQ_FORM_EVENTS
Now instead of A 17 and A26 I would like to show text like Subtotal for the Carrid.for subtotals and grand totals
Like Subtotal for A 17 is : XXXXXXX
GrandTotal is : YYYYYY
2. We have a page break and a new page for every purchasing group as in the standard example SALV_DEMO_HIERSEQ_FORM_EVENTS for CARRID.
I need to display some variable values as number of documents ,total number of records etc at the end of each CARRID group before a new page starts for the next CARRID.Please note i do not want it on every page.it should only be diaplyed at the end of page whose next page would be for next CARRID.[basically at end of every carrid]Example:after displaying all details for AA need to display the number of records for that carrid at the end of the page[as page break is based on CARRID]/
Thanks
Jyotsnaat end of page event, for CL_SALV_EVENTS_HIERSEQ, has some useful parameters allowing to know where you are at the time of event
parameter VALUE is of type CL_SALV_FORM which contains public attribute IF_SALV_FORM~ACCDESCRIPTION; you can slo get contents of it
about text of total/subtotal, this is normally set in the layout -
Hi All,
How can i display Multiple ALV Grids at a time in the output screen ?
I have to create dynamic table structures for each ALV, but all this ALV's has to be displayed at 1 time in the first output screen!
Regards
Rakesh.Have a custom control on the screen.
Create a custom conatiner.
Use EASY splitter container.
Now you have two containers, in which each of the ALV grids can be displayed with the two dynamic tables you have.
Look at the BCALV examples in your system.
Regards,
Ravi
Note - Please mark all the helpful answers -
Create frozen alv grid using salv* classes
Hi Experts,
I want to create a frozen alv grid i.e the row selections are defined in the code and should not be able to modify on the screen . Please let me know if it is possible ? I am using salv* class for alv.
Thanks,
Kiran A.Hi,
You mean "preventing" the user to change the selection set or just not allowing him to change some rows content?
If you speak about selection only, I don't think this is feasible... (or a silly idea: highlight the rows instead of selecting them
Kr,
Manu. -
Problem in ALV display using OOPs
Hi,
I have a dynamic selection screen where i am submitting one report to the other using SUBMIT statement.
After entering values in the selection screen, the output should be displayed using ALV.so i created a screen in the 2nd report i.e ZARR_MASSUPDATEFORNOTES and wrote the code in the PBO module of the screen.But while executing the output is not getting displayed.
My code is as below.
INSERT REPORT 'ZARR_MASSUPDATEFORNOTES' FROM t_comm.
SUBMIT ZARR_MASSUPDATEFORNOTES VIA SELECTION-SCREEN .
Thanks in advance......
Thanks,
Kiran.Hi,
Try creting two different 'Z' programs without creating a different screen.
populate your internal table with data.
Do this.
Export the internal table using memory id.
Import the memory id in the 2nd report and pass the required value to the selection screen of the 2nd report and execute.
Regards,
Amit
Maybe you are looking for
-
Can not print from network share.
When a PDF document is printed from a network share whe're getting this error: Windows cannot find 'T:\temp\test.pdf'. Make sure you typed the name correctly, and then try again. To search for a file, click the Start button, and then click Search. Th
-
Is there going to be a new update to 2.0 that fixes these problems? When?
Hi, as my problems are iPod AND iTunes based, am posting question in both forums. I have a few problems that I need addressing as soon as possible, as day to day use of my iPod has got incredibly aggravating. When I access iTunes, I am immediately pr
-
Sync new iPhone 4 with old iPhone 4 settings?
I just received a replacement iPhone 4. When I plug it into iTunes to restore to the settings of my previous iPhone 4, the only options that I can restore it to are my old iPod touches which I haven't used since August. Help!
-
SP10 for WebLogic Server 5.1
Does anybody know when SP10 will be released. Thanks, Peter
-
Soundtrack Pro crashed. Now can't open or create new audio files.
I was editing an audio file in Soundtrack Pro v1.1. I also had Flash, Parallels and a few other applications open. I plugged in my USB headset. Parallels crashed. Then Soundtrack Pro hung up. Then I had a complete system crash and needed to restart.