I need simple example for alv grid
hi
i need code for simple example for alv grid.
thanks.
hi bharat,
this is report with most of the functionality.
report zus_alv_demo_grid .
tables: ekko.
type-pools: slis.
types: begin of t_ekko,
ebeln type ekpo-ebeln,
ebelp type ekpo-ebelp,
statu type ekpo-statu,
aedat type ekpo-aedat,
matnr type ekpo-matnr,
menge type ekpo-menge,
meins type ekpo-meins,
netpr type ekpo-netpr,
peinh type ekpo-peinh,
line_color(4) type c, "Used to store row color
end of t_ekko.
data: it_ekko type standard table of t_ekko initial size 0,
wa_ekko type t_ekko.
*ALV data declarations
data: fieldcatalog type slis_t_fieldcat_alv with header line,
gd_tab_group type slis_t_sp_group_alv,
gd_layout type slis_layout_alv,
gd_repid like sy-repid.
Data declaration for EVENT and PRINT PARAMETER.
data: gt_events type slis_t_event,
gd_prntparams type slis_print_alv.
data declaration for sorting.
data : it_sortcat type slis_sortinfo_alv occurs 1,
wa_sort like line of it_sortcat.
data : i_list_comments type slis_t_listheader.
start-of-selection.
perform data_retrieval.
perform user_command.
perform build_fieldcatalog.
perform build_layout.
perform build_events.
perform build_print_params.
perform build_sortcat.
perform display_alv_report.
end-of-selection.
*TOP-OF-PAGE.
PERFORM top-of-page.
end-of-page.
*& Form build_fieldcatalog
text
--> p1 text
<-- p2 text
form build_fieldcatalog.
fieldcatalog-fieldname = 'EBELN'.
fieldcatalog-seltext_m = 'Purchase Order'.
fieldcatalog-col_pos = 0.
fieldcatalog-outputlen = 10.
fieldcatalog-emphasize = 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'EBELP'.
fieldcatalog-seltext_m = 'PO Item'.
fieldcatalog-col_pos = 1.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'STATU'.
fieldcatalog-seltext_m = 'Status'.
fieldcatalog-col_pos = 2.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'AEDAT'.
fieldcatalog-seltext_m = 'Item change date'.
fieldcatalog-col_pos = 3.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MATNR'.
fieldcatalog-seltext_m = 'Material Number'.
fieldcatalog-col_pos = 4.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MENGE'.
fieldcatalog-seltext_m = 'PO quantity'.
fieldcatalog-col_pos = 5.
fieldcatalog-do_sum = 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MEINS'.
fieldcatalog-seltext_m = 'Order Unit'.
fieldcatalog-col_pos = 6.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'NETPR'.
fieldcatalog-seltext_m = 'Net Price'.
fieldcatalog-col_pos = 7.
fieldcatalog-outputlen = 15.
fieldcatalog-datatype = 'CURR'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'PEINH'.
fieldcatalog-seltext_m = 'Price Unit'.
fieldcatalog-col_pos = 8.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
endform. " build_fieldcatalog
*& Form build_layout
text
--> p1 text
<-- p2 text
form build_layout.
gd_layout-no_input = 'X'.
gd_layout-colwidth_optimize = 'X'.
gd_layout-totals_text = 'Totals'(201).
Set layout field for row attributes(i.e. color)
gd_layout-info_fieldname = 'LINE_COLOR'.
gd_layout-totals_only = 'X'.
gd_layout-f2code = 'DISP'. "Sets fcode for
*when double
"click(press f2)*
gd_layout-group_change_edit = 'X'.
gd_layout-header_text = 'helllllo'.
endform. " build_layout
*& Form data_retrieval
text
--> p1 text
<-- p2 text
form data_retrieval.
data: ld_color(1) type c.
select ebeln ebelp statu aedat matnr menge meins netpr
peinh from ekpo into table it_ekko.
*Populate field with color attributes
loop at it_ekko into wa_ekko.
Populate color variable with colour properties
Char 1 = C (This is a color property)
Char 2 = 3 (Color codes: 1 - 7)
Char 3 = Intensified on/off ( 1 or 0 )
Char 4 = Inverse display on/off ( 1 or 0 )
i.e. wa_ekko-line_color = 'C410'
ld_color = ld_color + 1.
Only 7 colours so need to reset color value
if ld_color = 8.
ld_color = 1.
endif.
concatenate 'C' ld_color '10' into wa_ekko-line_color.
wa_ekko-line_color = 'C410'.
modify it_ekko from wa_ekko.
endloop.
endform. " data_retrieval
*& Form display_alv_report
text
--> p1 text
<-- p2 text
form display_alv_report.
gd_repid = sy-repid.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = gd_repid
is_layout = gd_layout
i_callback_top_of_page = 'TOP-OF-PAGE'
i_callback_user_command = 'USER_COMMAND'
i_callback_pf_status_set = 'SET_PF_STATUS'
it_event = gt_events
is_print = gd_prntparams
it_fieldcat = fieldcatalog[]
it_sort = it_sortcat
i_save = 'X'
tables
t_outtab = it_ekko
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.
endform. " DISPLAY_ALV_REPORT
*& Form user_command
text
--> p1 text
<-- p2 text
*& Form top-of-page
text
--> p1 text
<-- p2 text
form top-of-page.
*ALV Header declarations
data: t_header type slis_t_listheader,
wa_header type slis_listheader,
t_line like wa_header-info,
ld_lines type i,
ld_linesc(10) type c.
Title
wa_header-typ = 'H'.
wa_header-info = 'EKKO Table Report'.
append wa_header to t_header.
clear wa_header.
Date
wa_header-typ = 'S'.
wa_header-key = 'Date: '.
concatenate sy-datum+6(2) '.'
sy-datum+4(2) '.'
sy-datum(4) into wa_header-info."todays date
append wa_header to t_header.
clear: wa_header.
Total No. of Records Selected
describe table it_ekko lines ld_lines.
ld_linesc = ld_lines.
concatenate 'Total No. of Records Selected: ' ld_linesc
into t_line separated by space.
wa_header-typ = 'A'.
wa_header-info = t_line.
append wa_header to t_header.
clear: wa_header, t_line.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = t_header
i_logo = 'GANESH_LOGO'.
endform. " top-of-page
FORM user_command *
--> R_UCOMM *
--> RS_SELFIELD *
form user_command using r_ucomm like sy-ucomm
rs_selfield type slis_selfield.
case r_ucomm.
when '&IC1'.
if rs_selfield-fieldname = 'EBELN'.
read table it_ekko into wa_ekko index rs_selfield-tabindex.
set parameter id 'BES' field wa_ekko-ebeln.
call transaction 'ME23N' and skip first screen.
endif.
when 'ULHAS'.
if rs_selfield-fieldname = 'EBELN'.
read table it_ekko into wa_ekko index rs_selfield-tabindex.
set parameter id 'BES' field wa_ekko-ebeln.
call transaction 'ME23N' and skip first screen.
endif.
endcase.
endform.
FORM set_pf_status *
--> RT_EXTAB *
form set_pf_status using rt_extab type slis_t_extab.
set pf-status 'ZNEWSTATUS'.
endform.
*& Form build_events
text
--> p1 text
<-- p2 text
form build_events.
data: ls_event type slis_alv_event.
call function 'REUSE_ALV_EVENTS_GET'
exporting
i_list_type = 0
importing
et_events = gt_events[]
EXCEPTIONS
LIST_TYPE_WRONG = 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.
read table gt_events with key name = slis_ev_end_of_page
into ls_event.
if sy-subrc = 0.
move 'END_OF_PAGE' to ls_event-form.
append ls_event to gt_events.
endif.
read table gt_events with key name = slis_ev_end_of_list
into ls_event.
if sy-subrc = 0.
move 'END_OF_LIST' to ls_event-form.
append ls_event to gt_events.
endif.
endform. " build_events
*& Form build_print_params
text
--> p1 text
<-- p2 text
form build_print_params.
gd_prntparams-reserve_lines = '3'. "Lines reserved for footer
gd_prntparams-no_coverpage = 'X'.
endform. " build_print_params
FORM END_OF_PAGE *
form end_of_page.
data: listwidth type i,
ld_pagepos(10) type c,
ld_page(10) type c.
write: sy-uline(50).
skip. write:/40 'Page:', sy-pagno .
endform.
FORM END_OF_LIST *
form end_of_list.
data: listwidth type i,
ld_pagepos(10) type c,
ld_page(10) type c.
skip. write:/40 'Page:', sy-pagno .
endform.
*& Form build_sortcat
text
--> p1 text
<-- p2 text
form build_sortcat.
wa_sort-spos = 1.
wa_sort-fieldname = 'EBELN'.
append wa_sort to it_sortcat.
wa_sort-spos = 2.
wa_sort-fieldname = 'EBELP'.
append wa_sort to it_sortcat.
endform. " build_sortcat
Rewards if helpfull
regards
vijay dwivedi
Similar Messages
-
I need model program for alv grid control
hi all,
i need example program and detailed description of alv grid control . what is the features of alv grid control over normal alv.Hi,
Check out the below sample code.I have pasted even the include programs, u can copy the program.
SAP-User : BWR2KOR *
Author (name) : Bharadwaja R *
Created on/in : 07.02.2006 *
Description : Report for Listing IDOC-Informations for the given *
segment on the selection screen *
Changes: - for each change: add chapter *
- changes get a changes number (ascending) *
- source code has to be marked with SAP-user-name *
change date and number *
Change number : *
Enhance/Change numer: 90xxxx (900001-909999) -> /RB11/YBF_MODIF *
SAP-User : *
Author (name) : *
Created on/in : *
Reason for the change: *
REPORT Y16S_VIEW_IDOC_CONTENT LINE-SIZE 230
NO STANDARD PAGE HEADING.
Data declarations
INCLUDE Y16S_VIEW_IDOC_CONTENT_D01I.
Selection screen
INCLUDE Y16S_VIEW_IDOC_CONTENT_S01I.
Events
INCLUDE Y16S_VIEW_IDOC_CONTENT_E01I.
Routines for program
INCLUDE Y16S_VIEW_IDOC_CONTENT_F01I.
START-OF-SELECTION.
Get the fieldcatalog
PERFORM get_fcat.
**Method for getting the reference for the structure
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING it_fieldcatalog = g_t_fieldcat
IMPORTING ep_table = dref.
**Passing the reference of the structure to field-symbol of type table
ASSIGN dref->* TO .
Fill IDoc data
PERFORM fill_data.
Display ALV
perform display_grid.
INCLUDE Y16S_VIEW_IDOC_CONTENT_D01I *
Data declaration : Tables used *
TABLES : edidd, "Data record (IDoc)
edidc, "Control record (IDoc)
edid4, "IDoc Data Records from 4.0 onwards
dd03d, "Dynpro fields for table fields
edsappl, "EDI: IDoc Segment Application Structure
int_seg, "Data record details display
dd03l, "Table Fields
edisegment. "IDoc Development : IDoc Segment
Name of segment
DATA : g_f_segment LIKE dntab-tabname.
*--Data Declaration.
FIELD-SYMBOLS : TYPE ANY.
DATA : BEGIN OF g_t_edid OCCURS 0,
docnum LIKE edid4-docnum,
segnum LIKE edid4-segnum,
sdata LIKE edid4-sdata,
END OF g_t_edid.
*DATA : g_t_edid LIKE edid4 OCCURS 0 WITH HEADER LINE.
DATA : BEGIN OF g_t_edidc OCCURS 0,
docnum LIKE edidc-docnum,
credat LIKE edidc-credat,
mestyp LIKE edidc-mestyp,
END OF g_t_edidc.
DATA : BEGIN OF g_t_appl OCCURS 0,
fieldname LIKE edsappl-fieldname,
END OF g_t_appl.
DATA : g_v_tabix LIKE sy-tabix.
ALV Declarations
*Declaration of type groups
TYPE-POOLS :
slis. "Globale Typen für generische Listbausteine
DATA: g_f_okcode LIKE sy-ucomm,
g_container TYPE scrfname VALUE 'G_C_ALV',
grid1 TYPE REF TO cl_gui_alv_grid,
g_custom_container TYPE REF TO cl_gui_custom_container.
FIELD-SYMBOLS: .
Class
CLASS: g_cl_event DEFINITION DEFERRED.
Alv Grid Constants
DATA : g_c_handle(4) TYPE c VALUE '0100',
g_c_save(1) TYPE c VALUE 'A',
g_c_exit(4) TYPE c VALUE 'EXIT'.
DATA: g_v_layout TYPE lvc_s_layo,
g_f_print TYPE lvc_s_prnt,
g_f_variant TYPE disvariant,
g_v_recv TYPE REF TO g_cl_event.
CONSTANTS : gc_ucomm_sel_criteria(12) VALUE 'SEL_CRITERIA'.
CLASS G_Cl_EVENT DEFINITION
Class to handle GRID Events *
CLASS g_cl_event DEFINITION.
PUBLIC SECTION.
METHODS:
constructor IMPORTING value(grid_name) TYPE REF TO
cl_gui_alv_grid,
handle_toolbar
FOR EVENT toolbar OF cl_gui_alv_grid
IMPORTING e_object e_interactive,
handle_user_command
FOR EVENT user_command OF cl_gui_alv_grid
IMPORTING e_ucomm.
PRIVATE SECTION.
DATA: g_v_alv TYPE REF TO cl_gui_alv_grid.
ENDCLASS. "g_cl_event DEFINITION
CLASS g_cl_events IMPLEMENTATION
Class to handle GRID Events *
CLASS g_cl_event IMPLEMENTATION.
Handling methods
METHOD constructor.
g_v_alv = grid_name.
ENDMETHOD. "constructor
Tool bar
METHOD handle_toolbar.
CONSTANTS:
lc_quickinfo_sel_criteria(111) VALUE 'Show Selection Criteria'.
DATA:
l_toolbar TYPE stb_button.
CLEAR l_toolbar.
MOVE 0 TO l_toolbar-butn_type.
MOVE gc_ucomm_sel_criteria TO l_toolbar-function.
MOVE icon_select_with_condition TO l_toolbar-icon.
MOVE lc_quickinfo_sel_criteria TO l_toolbar-quickinfo.
MOVE space TO l_toolbar-disabled.
APPEND l_toolbar TO e_object->mt_toolbar.
ENDMETHOD. "handle_toolbar
User Command
METHOD handle_user_command.
CASE e_ucomm.
When Exit button is used
WHEN 'EXIT'.
PERFORM exit_program.
WHEN OTHERS.
ENDCASE.
ENDMETHOD. "handle_user_command
ENDCLASS. "g_cl_event IMPLEMENTATION
INCLUDE Y16S_VIEW_IDOC_CONTENT_S01I *
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
Creation Date of IDoc
SELECT-OPTIONS : s_date FOR edidc-credat.
IDoc Number
SELECT-OPTIONS : s_idocnm FOR edidc-docnum.
Basic IDoc type
SELECT-OPTIONS : s_idoctp FOR edidc-idoctp.
*Message type
SELECT-OPTIONS : s_mestyp FOR edidc-mestyp.
Segment name
PARAMETERS : p_segnam LIKE edisegment-segtyp OBLIGATORY.
Field name
SELECT-OPTIONS : s_fldnam FOR dd03d-fieldname NO INTERVALS.
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME.
Field name
PARAMETERS : p_fldnam LIKE dd03d-fieldname.
Field contents of a field of an IDoc segment
SELECT-OPTIONS : s_fldval FOR int_seg-string.
SELECTION-SCREEN END OF BLOCK b2.
INCLUDE Y16S_VIEW_IDOC_CONTENT_E01I *
Check for IDoc number on selection screen
AT SELECTION-SCREEN ON s_idocnm.
IF NOT s_idocnm IS INITIAL.
Data fetch : Control record (IDoc)
SELECT COUNT( * ) FROM edidc
WHERE docnum IN s_idocnm.
IF sy-subrc NE 0.
MESSAGE e429(mo).
ENDIF.
ELSE.
message for required entry.
MESSAGE e055(00).
ENDIF.
Check for segment name on selection screen
AT SELECTION-SCREEN ON p_segnam.
Check segment name is an input on selection screen
IF NOT p_segnam IS INITIAL.
Data fetch : Table Fields
SELECT SINGLE * FROM dd03l
WHERE tabname EQ p_segnam.
IF sy-subrc NE 0.
MESSAGE e429(mo).
ENDIF.
ENDIF.
F4 help for fieldname
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_fldnam-low.
DATA : l_rc LIKE sy-subrc.
Check segment name on selection screen is not empty
IF NOT p_segnam IS INITIAL.
PERFORM get_f4help USING l_rc.
IF l_rc = 0.
Fill the selected field name
READ TABLE g_t_appl INDEX g_v_tabix.
CHECK sy-subrc = 0.
s_fldnam-low = g_t_appl-fieldname.
s_fldnam-sign = 'I'.
s_fldnam-option = 'EQ'.
APPEND s_fldnam.
ENDIF.
ENDIF.
Check for field name on selection screen
AT SELECTION-SCREEN ON s_fldnam.
IF NOT p_fldnam IS INITIAL.
Data fetch : Table Fields
SELECT SINGLE * FROM dd03l
WHERE tabname EQ p_segnam
AND fieldname IN s_fldnam.
IF sy-subrc NE 0.
MESSAGE e429(mo).
ENDIF.
ENDIF.
F4 help for fieldname
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_fldnam.
DATA : l_rc LIKE sy-subrc.
Check segment name on selection screen is not empty
IF NOT p_segnam IS INITIAL.
F4 Help for fieldname
PERFORM get_f4help USING l_rc.
IF l_rc = 0.
Fill the selected field name
READ TABLE g_t_appl INDEX g_v_tabix.
CHECK sy-subrc = 0.
p_fldnam = g_t_appl-fieldname.
ENDIF.
ENDIF.
Check for field name on selection screen
AT SELECTION-SCREEN ON p_fldnam.
IF NOT p_fldnam IS INITIAL.
Data fetch : Table Fields
SELECT SINGLE * FROM dd03l
WHERE tabname EQ p_segnam
AND fieldname EQ p_fldnam.
IF sy-subrc NE 0.
MESSAGE e429(mo).
ENDIF.
ENDIF.
Check for field name on selection screen
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_fldval-low.
Check field name is an input on selection screen
IF NOT p_fldnam IS INITIAL.
Get the domain values as F4 help
PERFORM get_domain_value.
ENDIF.
*Check for Message type on selection screen
AT SELECTION-SCREEN ON s_mestyp.
IF NOT s_mestyp IS INITIAL.
Data fetch : Logical message types
SELECT COUNT( * ) FROM edmsg
WHERE msgtyp IN s_mestyp.
IF sy-subrc NE 0.
MESSAGE e429(mo).
ENDIF.
ENDIF.
*Check for Basic type on selection screen
AT SELECTION-SCREEN ON s_idoctp.
IF NOT s_idoctp IS INITIAL.
Data fetch : Basic types
SELECT COUNT( * ) FROM edbas
WHERE idoctyp IN s_idoctp.
IF sy-subrc NE 0.
MESSAGE e429(mo).
ENDIF.
ENDIF.
*& Form GET_F4HELP
text
-->P_L_RC text
FORM get_f4help USING p_l_rc LIKE sy-subrc.
DATA : l_v_segment LIKE edsappl-segtyp.
DATA : l_t_help_value LIKE help_value OCCURS 0 WITH HEADER LINE.
Segment name
l_v_segment = p_segnam.
Data fetch : EDI: IDoc Segment Application Structure
SELECT pos fieldname FROM edsappl
INTO CORRESPONDING FIELDS OF TABLE g_t_appl
WHERE segtyp = l_v_segment
ORDER BY pos.
Popup having data
CALL FUNCTION 'POPUP_WITH_TABLE_DISPLAY'
EXPORTING
endpos_col = 110
endpos_row = 16
startpos_col = 90
startpos_row = 1
titletext = text-001
IMPORTING
choise = g_v_tabix
TABLES
valuetab = g_t_appl
EXCEPTIONS
break_off = 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.
Return code
p_l_rc = sy-subrc.
ENDFORM. " GET_F4HELP
*& Form GET_DOMAIN_VALUE
text
-->P_L_RC text
FORM get_domain_value.
DD: Domain header with text
DATA : l_s_dd01v LIKE dd01v.
Value table
DATA : l_v_valuetab LIKE l_s_dd01v-entitytab.
RFC Table Read: Description of Fields to Retrieve
DATA : l_t_db_fld LIKE rfc_db_fld OCCURS 0 WITH HEADER LINE.
RFC Table Read: Select Options / WHERE Clause
DATA : l_t_options LIKE rfc_db_opt OCCURS 0 WITH HEADER LINE.
Table with a 512 byte field
DATA : l_t_valuetab LIKE tab512 OCCURS 0 WITH HEADER LINE.
*Data Dictionary access routines
CALL FUNCTION 'G_DOMAIN_READ'
EXPORTING
domain = p_fldnam
langu = sy-langu
IMPORTING
domain_attr = l_s_dd01v
EXCEPTIONS
not_found = 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.
l_v_valuetab = l_s_dd01v-entitytab.
l_t_db_fld-fieldname = p_fldnam.
APPEND l_t_db_fld.
External access to R/3 tables via RFC
CALL FUNCTION 'RFC_READ_TABLE'
EXPORTING
query_table = l_v_valuetab
DELIMITER = ' '
NO_DATA = ' '
ROWSKIPS = 0
ROWCOUNT = 0
TABLES
options = l_t_options
fields = l_t_db_fld
data = l_t_valuetab
EXCEPTIONS
table_not_available = 1
table_without_data = 2
option_not_valid = 3
field_not_valid = 4
not_authorized = 5
data_buffer_exceeded = 6
OTHERS = 7
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CLEAR g_v_tabix.
IF NOT l_t_valuetab[] IS INITIAL.
Popup having data
CALL FUNCTION 'POPUP_WITH_TABLE_DISPLAY'
EXPORTING
endpos_col = 110
endpos_row = 16
startpos_col = 90
startpos_row = 1
titletext = text-001
IMPORTING
choise = g_v_tabix
TABLES
valuetab = l_t_valuetab
EXCEPTIONS
break_off = 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.
READ TABLE l_t_valuetab INDEX g_v_tabix.
CHECK sy-subrc = 0.
Fill the select-options of Fieldvalue
s_fldval-low = l_t_valuetab-wa.
s_fldval-sign = 'I'.
s_fldval-option = 'EQ'.
APPEND s_fldval.
ENDIF.
ENDFORM. " GET_DOMAIN_VALUE
INCLUDE Y16S_VIEW_IDOC_CONTENT_F01I *
*& Module STATUS_0100 OUTPUT
ALV grid output
MODULE status_0100 OUTPUT.
*set the screen elements
SET PF-STATUS 'MAIN100'.
SET TITLEBAR 'TITLE100'.
*instantiation
IF g_custom_container IS INITIAL.
g_v_layout-zebra = 'X'.
g_v_layout-sel_mode = 'A'.
Create custom container
CREATE OBJECT g_custom_container
EXPORTING container_name = g_container.
Create ALV grid
CREATE OBJECT grid1
EXPORTING i_parent = g_custom_container.
CREATE OBJECT g_v_recv EXPORTING grid_name = grid1.
Display ALV grid
CALL METHOD grid1->set_table_for_first_display
EXPORTING
i_save = g_c_save
is_layout = g_v_layout
is_print = g_f_print
is_variant = g_f_variant
CHANGING
it_fieldcatalog = g_t_fieldcat
it_outtab = refresh_table_display.
ENDIF.
User command
SET HANDLER g_v_recv->handle_user_command FOR grid1.
CALL METHOD grid1->set_toolbar_interactive.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
User actions on grid
MODULE user_command_0100 INPUT.
Dispatch the okcode
CALL METHOD cl_gui_cfw=>dispatch.
CASE g_f_okcode.
WHEN g_c_exit.
PERFORM exit_program.
WHEN OTHERS.
*do nothing
ENDCASE.
CLEAR g_f_okcode.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form EXIT_PROGRAM
Exit from the Grid
--> p1 text
<-- p2 text
FORM exit_program.
Container for Custom Controls in the Screen Area
CALL METHOD g_custom_container->free.
*Control Framework Basic Class
CALL METHOD cl_gui_cfw=>flush.
Call the selection screen
SET SCREEN 0.
LEAVE SCREEN.
ENDFORM. " EXIT_PROGRAM
*& Form GET_FCAT
Field catalog fill
--> p1 text
<-- p2 text
FORM get_fcat.
*Segment details regarding fields
PERFORM get_segment_details.
Populate the Fieldcatalog
PERFORM fill_fieldcat.
IF g_f_variant-variant IS INITIAL.
Get the default variant
g_f_repid = sy-repid.
CLEAR : g_f_variant.
g_f_variant-report = g_f_repid.
g_r_x_variant = g_f_variant.
Get default variant
CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
EXPORTING
i_save = g_c_save
CHANGING
cs_variant = g_r_x_variant
EXCEPTIONS
not_found = 2.
g_f_variant = g_r_x_variant.
g_f_variant-variant = 'X'.
ENDIF.
ENDFORM. " GET_FCAT
*& Form FILL_DATA
Fill the output internal table
--> p1 text
<-- p2 text
FORM fill_data.
FIELD-SYMBOLS TYPE ANY.
DATA : l_rc LIKE sy-subrc.
*Get the IDoc data
PERFORM get_data.
LOOP AT g_t_edid.
*Check for filtering the values
IF ( NOT ( p_fldnam IS INITIAL AND s_fldval[] IS INITIAL ) ).
Field value check
PERFORM check_fieldvalue USING l_rc.
IF l_rc NE 0.
CONTINUE.
ENDIF.
ENDIF.
ASSIGN LOCAL COPY OF g_t_edid TO .
ENDLOOP.
ENDFORM. " FILL_DATA
*& Form DISPLAY_GRID
Display ALV grid
--> p1 text
<-- p2 text
FORM display_grid.
Call ALV grid
CALL SCREEN 100.
ENDFORM. " DISPLAY_GRID
*& Form CHECK_FIELDVALUE
Check the fieldvalue
-->P_L_RC text
FORM check_fieldvalue USING p_l_rc LIKE sy-subrc.
Segment data
ASSIGN g_t_edid-sdata TO CASTING TYPE (p_segnam).
Segment fields
LOOP AT g_t_segment WHERE fieldname = p_fldnam.
ASSIGN COMPONENT g_t_segment-fieldname
OF STRUCTURE IN s_fldval.
p_l_rc = 0.
ELSE.
p_l_rc = 4.
ENDIF.
ENDLOOP.
ENDFORM. " CHECK_FIELDVALUE
*& Form GET_DATA
Get the IDoc data
--> p1 text
<-- p2 text
FORM get_data.
*Clear the header line of the internal table
CLEAR : g_t_edid,
g_t_edidc.
Clear the body of the internal table
REFRESH : g_t_edid,
g_t_edidc.
*Data fetch : Control record (IDoc)
SELECT docnum credat mestyp FROM edidc
INTO TABLE g_t_edidc
WHERE docnum IN s_idocnm AND
credat IN s_date AND
mestyp IN s_mestyp AND
idoctp IN s_idoctp.
*Date/Message type if not initial
IF ( ( NOT ( s_date[] IS INITIAL ) )
OR ( NOT ( s_mestyp[] IS INITIAL ) )
OR ( NOT ( s_idoctp[] IS INITIAL ) ) ).
Check the control record of the IDoc
PERFORM check_control_data.
ELSE.
Data fetch : IDoc Data Records from 4.0 onwards
SELECT docnum segnum sdata FROM edid4 INTO TABLE g_t_edid
WHERE docnum IN s_idocnm AND
segnam EQ p_segnam.
ENDIF.
ENDFORM. " GET_DATA
*& Form CHECK_CONTROL_DATA
Check the control data of IDoc
--> p1 text
<-- p2 text
FORM check_control_data.
CHECK NOT g_t_edidc[] IS INITIAL.
Data fetch : IDoc Data Records from 4.0 onwards
SELECT docnum segnum sdata FROM edid4 INTO TABLE g_t_edid
WHERE docnum IN s_idocnm AND
segnam EQ p_segnam.
LOOP AT g_t_edid.
READ TABLE g_t_edidc WITH KEY docnum = g_t_edid-docnum.
*Check for the correct MT
IF sy-subrc = 0.
CONTINUE.
ELSE.
*Delete, if unsuccessful
DELETE g_t_edid.
ENDIF.
ENDLOOP.
ENDFORM. " CHECK_CONTROL_DATA
*& Form GET_SEGMENT_DETAILS
Segment details regarding fields
--> p1 text
<-- p2 text
FORM get_segment_details.
Segment name
g_f_segment = p_segnam.
CALL FUNCTION 'NAMETAB_GET'
EXPORTING
langu = sy-langu
tabname = g_f_segment
TABLES
nametab = g_t_segment
EXCEPTIONS
internal_error = 1
table_has_no_fields = 2
table_not_activ = 3
no_texts_found = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " GET_SEGMENT_DETAILS
*& Form FILL_FIELDCAT
Populate the Fieldcatalog
--> p1 text
<-- p2 text
FORM fill_fieldcat.
DATA : lv_pos TYPE i.
IDoc number in the catalog
lv_pos = 1.
g_r_fieldcat-fieldname = 'DOCNUM'.
g_r_fieldcat-ref_table = 'EDID4'.
g_r_fieldcat-ref_field = 'DOCNUM'.
g_r_fieldcat-key = 'X'.
g_r_fieldcat-col_pos = lv_pos.
g_r_fieldcat-outputlen = '10'.
APPEND g_r_fieldcat TO g_t_fieldcat.
Segment number in the catalog
ADD 1 TO lv_pos.
g_r_fieldcat-fieldname = 'SEGNUM'.
g_r_fieldcat-ref_table = 'EDID4'.
g_r_fieldcat-ref_field = 'SEGNUM'.
g_r_fieldcat-key = 'X'.
g_r_fieldcat-col_pos = lv_pos.
g_r_fieldcat-outputlen = '10'.
g_r_fieldcat-colddictxt = 'X'.
g_r_fieldcat-reptext = text-002.
APPEND g_r_fieldcat TO g_t_fieldcat.
**Populating fieldcatalog with segment field
LOOP AT g_t_segment .
ADD 1 TO lv_pos.
CLEAR g_r_fieldcat.
g_r_fieldcat-fieldname = g_t_segment-fieldname .
g_r_fieldcat-ref_table = p_segnam.
g_r_fieldcat-ref_field = g_t_segment-fieldname .
g_r_fieldcat-key = 'X'.
g_r_fieldcat-col_pos = lv_pos.
g_r_fieldcat-outputlen = '10'.
Check for given fields on the selection screen
IF NOT g_t_segment-fieldname IN s_fldnam.
g_r_fieldcat-no_out = 'X'.
ENDIF.
*Column text
IF g_t_segment-fieldtext IS INITIAL.
*Get the DDIC texts for columns
PERFORM get_ddic_texts.
ENDIF.
APPEND g_r_fieldcat TO g_t_fieldcat.
ENDLOOP.
ENDFORM. " FILL_FIELDCAT
*& Form GET_DDIC_TEXTS
Get the DDIC texts
--> p1 text
<-- p2 text
FORM get_ddic_texts.
DATA : l_f_descr TYPE string.
Get the texts for the data element
CALL FUNCTION 'TB_DATAELEMENT_GET_TEXTS'
EXPORTING
name = g_t_segment-fieldname
IMPORTING
description = l_f_descr
LENGTH_FIELD =
LENGTH_HEADER =
LENGTH_LONG =
LENGTH_MIDDLE =
LENGTH_SHORT =
TEXT_HEADER =
TEXT_LONG =
TEXT_MIDDLE =
TEXT_SHORT =
EXCEPTIONS
not_found = 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.
*Add DDIC text..
g_r_fieldcat-colddictxt = 'X'.
g_r_fieldcat-reptext = l_f_descr.
ENDFORM. " GET_DDIC_TEXTS -
Need a perfect example program for ALV GRID LIST
first hi to all,i am new to this community.i am still in learning process of SAP.one of my friend suggeted this community and i think this is the perfect place to learn and excel my skill in SAP.so my requirement is a perfect example program for ALV GRID LIST DISPLAY.while i am trying another program,the sysntax is ok but i am not getting any output and it is not showing any error also.hope i will get an answer asap.thank you.
Check [OO ALV Guide Simple|http://wiki.sdn.sap.com/wiki/display/ABAP/OBJECTORIENTEDALV+Guide] and [Easy Reference to ALV|http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d9719a415907]
-
F.01 Summary Report for ALV grid
Hi all,
We have defined our financial statement version (FSV). We have been running tests in transaction F.01, when we choose ALV Tree output the transaction works perfectly.
However, if we choose ALV grid output and then choose "1" in the Summary Report field (highest summary level, only main points of Balance sheet P&L statement should be displayed) the output is not summarized at all.
In short, no matter what number we put in the Summary Report field we always get the same output.
What needs to be done in order to be able to use this summarization control?
Any help will be appreciated.
Juan
Edited by: Juan Carlos Mier Giraud on Jul 8, 2008 4:50 PMRenata,
Thanks for your help. I am going to need a bit of help to develop the solutions described in the notes you pointed out.
Have you successfully created a summarization for ALV grid output?
I just want to know if it is worthy to devote time to it or just use classic list or ALV tree when appropiate.
Regards -
Simple example of alv report.
hi.
can anyone have simple example of ALV report?Hi Puru,
Check out this simple ALV report,
TABLES : vbak,vbap.
TYPE-POOLS : slis.
DATA: repid LIKE sy-repid, "Report ID
is_layout TYPE slis_layout_alv, "Layout For ALV
it_fieldcat TYPE slis_t_fieldcat_alv, "ITAB for field
it_events TYPE slis_t_event, "ITAB for event
it_sub TYPE slis_layout_alv_spec1, "subtotals
i_header TYPE slis_t_listheader, "Itab for listheader
lt_sort TYPE slis_t_sortinfo_alv, "itab for sorting
wa_sort LIKE LINE OF lt_sort." slis_t_sortinfo_alv.
DATA : BEGIN OF itab OCCURS 0,
vbeln LIKE vbak-vbeln,
erdat LIKE vbak-erdat,
kunag LIKE vbak-kunnr,
ernam LIKE vbak-ernam,
END OF itab.
DATA : BEGIN OF it_disp OCCURS 0,
vbeln LIKE vbak-vbeln,
erdat LIKE vbak-erdat,
kunag LIKE vbak-kunnr,
ernam LIKE vbak-ernam,
posnr LIKE vbap-posnr,
matnr LIKE vbap-matnr,
END OF it_disp.
****selection-screen
SELECTION-SCREEN BEGIN OF BLOCK b1.
SELECT-OPTIONS : s_vbeln FOR vbak-vbeln,
s_date FOR vbak-erdat.
SELECTION-SCREEN END OF BLOCK b1.
AT SELECTION-SCREEN.
START-OF-SELECTION.
PERFORM get_data.
PERFORM modify_data.
PERFORM disp_data .
END-OF-SELECTION.
*& Form get_data
text
--> p1 text
<-- p2 text
FORM get_data .
SELECT avbeln aerdat akunnr aernam bposnr bmatnr
INTO TABLE it_disp FROM vbak AS a
INNER JOIN vbap AS b ON
avbeln = bvbeln
WHERE a~vbeln IN s_vbeln.
ENDFORM. " get_data
*& Form modify_data
text
--> p1 text
<-- p2 text
FORM modify_data .
MOVE-CORRESPONDING itab TO it_disp.
APPEND it_disp.
CLEAR it_disp.
ENDFORM. " modify_data
*& Form Disp_data
text
--> p1 text
<-- p2 text
FORM disp_data .
PERFORM fill_layout_structure.
PERFORM fill_field_catalog_table.
PERFORM alv_header USING i_header.
PERFORM call_alv_function.
ENDFORM. " Disp_data
*& Form fill_layout_structure
text
--> p1 text
<-- p2 text
FORM fill_layout_structure .
CLEAR is_layout.
is_layout-colwidth_optimize = 'X'.
is_layout-zebra = 'X'.
is_layout-no_input = 'X'.
is_layout-colwidth_optimize = 'X'.
is_layout-totals_text = 'Totals'(201).
is_layout-totals_only = 'X'.
is_layout-zebra = 'X'.
is_layout-group_change_edit = 'X'.
is_layout-header_text = 'helllllo'.
ENDFORM. " fill_layout_structure
*& Form fill_field_catalog_table
text
--> p1 text
<-- p2 text
FORM fill_field_catalog_table .
DATA : gls1(10).
BREAK-POINT.
PERFORM fill_field_catalog USING :
'VBELN' 'SALES DOC NO.' '10' 'IT_FINAL' space space 'C11' ' ' ' ',
'ERDAT' 'DATE' '40' 'IT_FINAL' space space 'C11' ' ' ' ',
'KUNAG' 'CUSTOMER' '6' 'IT_FINAL' space space 'C11' 'X ' ' ',
'ERNAM' 'NAME' '20' 'IT_FINAL' space space 'C11' 'X' ' ',
'POSNR' 'ITEM' '10' 'IT_FINAL' space space 'C11' ' ' ' ',
'MATNR' 'MATERIAL' '20' 'IT_FINAL' space space 'C11' ' ' ' '.
ENDFORM. " fill_field_catalog_table
*& Form fill_field_catalog
text
FORM fill_field_catalog USING f d l t s z y a b.
DATA t_fld TYPE slis_fieldcat_alv.
STATICS pos LIKE sy-index VALUE 0.
pos = pos + 1.
CLEAR t_fld.
MOVE 1 TO t_fld-row_pos.
MOVE pos TO t_fld-col_pos.
MOVE f TO t_fld-fieldname.
MOVE d TO t_fld-seltext_m.
MOVE l TO t_fld-outputlen.
MOVE t TO t_fld-tabname.
MOVE s TO t_fld-do_sum.
MOVE z TO t_fld-no_zero.
MOVE y TO t_fld-emphasize.
MOVE a TO t_fld-no_out.
MOVE b TO t_fld-no_sum.
APPEND t_fld TO it_fieldcat.
ENDFORM. " fill_field_catalog
*& Form alv_header
text
-->P_I_HEADER text
FORM alv_header USING p_i_header.
DATA: wa_line TYPE slis_listheader.
CLEAR wa_line.
wa_line-typ = 'H'.
wa_line-info = 'Walvoil Fluid Power India Limited'.
APPEND wa_line TO i_header.
ENDFORM. " alv_header
*& Form call_alv_function
text
--> p1 text
<-- p2 text
FORM call_alv_function .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = REPID
I_CALLBACK_PF_STATUS_SET = ' '
IS_LAYOUT = IS_LAYOUT
IT_FIELDCAT = IT_FIELDCAT
TABLES
t_outtab = IT_DISP.
IF sy-subrc <> 0.
ENDIF.
ENDFORM. " call_alv_function
reward it it useful to u,
Best Wishes,
regards
Guna.. -
Need Simple Example of Notifier and Occurance
hi friends
i need to know the exact funtion of notifiers and occurances. So can you send me the simple example for both..
Thanks in advance...Open your example finder (help..find examples...") and search for these two terms.
I recommend looking at "General Notifier example.vi" and "Generate Occurrences.vi".
Is there anything in the online help that is not clear? What are you trying to do?
Message Edited by altenbach on 09-26-2008 11:22 PM
LabVIEW Champion . Do more with less code and in less time . -
Could u plz help me to find simple example for how to save data file in a spread sheet or any other way in the real time controller for Sbrio 9642 using memory or usb flash memory
Here are a few Links to a helpful Knowledge Base article and a White Paper that should help you out: http://digital.ni.com/public.nsf/allkb/BBCAD1AB08F1B6BB8625741F0082C2AF and http://www.ni.com/white-paper/10435/en/ . The methods for File IO in Real Time are the same for all of the Real Time Targets. The White Paper has best practices for the File IO and goes over how to do it.
Alex D
Applications Engineer
National Instruments -
Need an example for work flow based on multistep activity
hi,
i need an example for work flow based on multistep activity for practicing.please do the need.
thanksHi,
Workflow document information:
Check these links.
http://www.sapgenie.com/workflow/index.htm
/people/ginger.gatling/blog/2005/12/01/link-workflow-business-objects-to-your-collaboration-tasks
http://help.sap.com/saphelp_nw04/helpdata/en/92/bc26a6ec2b11d2b4b5006094b9ea0d/content.htm
http://help.sap.com/saphelp_bw33/helpdata/en/92/bc26a6ec2b11d2b4b5006094b9ea0d/content.htm
http://help.sap.com/saphelp_bw31/helpdata/en/8d/25f94b454311d189430000e829fbbd/content.htm
http://www.sap-press.com/product.cfm?account=&product=H950
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/PSWFL/PSWFL.pdf
http://www.workflowing.com/id18.htm
http://www.e-workflow.org/
http://www.sap-img.com/workflow/sap-workflow.htm
http://help.sap.com/saphelp_47x200/helpdata/en/a5/172437130e0d09e10000009b38f839/frameset.htm
http://www.sap-img.com/workflow/sap-workflow.htm
http://help.sap.com/saphelp_47x200/helpdata/en/a5/172437130e0d09e10000009b38f839/frameset.htm
&**********Reward points if helpful**************& -
Provide simple example for Arbitrary data sending through NI4551(DSA)
We Converted NI-DSA function palette
in LabVIEW under Application
Examples>>Advanced>>Arbitrary Output Example.
But, We not exactly getting arbitrary wave. Our arbitrary data is correct. I think there is a problem with FFT settings. So Please Provide simple example for Arbitrary data sending through NI4551(DSA)Hello Sateesh!
First, what versions of LabVIEW and NI-DSA are you using. I have been searching around for the example you are refering too and I am not able to find it. Are you creating and arb. wave in the frequency domain and then performing an FFT to get it to the time domain? Next, remember your wave will only be as exact as the AO specs. of the hardware...
The output conversions occur simultaneously at software-programmable rates from 1.25 to 51.2 kS/s in increments of 47.684 µS/s. The analog output circuitry uses eight-times oversampling interpolators with 64-times oversampling delta-sigma modulators to generate high-quality signals. Software-programmable attenuation of 0, -20, or -40 dB is available on the output channels. The PCI-4451 has excellent amplitude flatness of ±0.2 dB within DC to 23 kHz, and a THD of -90 dB at 1 kHz.
Now, as far as obtaining other examples If you use the LabVIEW example finder and goto Hardware Input and Output>>Traditional DAQ>>Analog Output. I would also in the lower right hand corner of the Example Finder select your 4451 this will show you all examples that work with your hardware. I hope this helps a little but please give me more details we will go from there. Have a great day!
Allan S.
National Instruments -
Need to display two ALV GRIDs in a single screen
Hi,
I have a question, i'm using version 4.6. I want to display 2 ALVs in a single screen or by calling.
Step 1 : The internal table (which holds the data for the ALVs has to be populated before calling ALV1 or ALV2)
Step 2 : Display In a single report
ALV1 report (Editable ,Has to be a GRID)
ALV2 report (Non Editable, Has to be a GRID)
(or)
Step 1 : The internal table (which holds the data for the ALVs has to be populated before calling ALV1 or ALV2)
Step 2 :
ALV1 report (Editable ,Has to be a GRID, with a custom button to call ALV2 hiding the ALV1 ie not visible to user)
ALV2 report (Non Editable ,Has to be a GRID, with a custom button to call ALV1 hiding the ALV2 ie not visible to user)
Please help me <b><REMOVED BY MODERATOR></b>
Message was edited by:
Alvaro Tejada GalindoHi
ABAP List Viewer
Simple ALV report
http://www.sapgenie.com/abap/controls/alvgrid.htm
http://wiki.ittoolbox.com/index.php/Code:Ultimate_ALV_table_toolbox
ALV
1. Please give me general info on ALV.
http://www.sapfans.com/forums/viewtopic.php?t=58286
http://www.sapfans.com/forums/viewtopic.php?t=76490
http://www.sapfans.com/forums/viewtopic.php?t=20591
http://www.sapfans.com/forums/viewtopic.php?t=66305 - this one discusses which way should you use - ABAP Objects calls or simple function modules.
2. How do I program double click in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=11601
http://www.sapfans.com/forums/viewtopic.php?t=23010
Check the program in the following link:
http://sap-img.com/abap/display-secondary-list-using-alv-grid.htm
3. How do I add subtotals (I have problem to add them)...
http://www.sapfans.com/forums/viewtopic.php?t=20386
http://www.sapfans.com/forums/viewtopic.php?t=85191
http://www.sapfans.com/forums/viewtopic.php?t=88401
http://www.sapfans.com/forums/viewtopic.php?t=17335
http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_basic.htm
4. How to add list heading like top-of-page in ABAP lists?
http://www.sapfans.com/forums/viewtopic.php?t=58775
http://www.sapfans.com/forums/viewtopic.php?t=60550
http://www.sapfans.com/forums/viewtopic.php?t=16629
5. How to print page number / total number of pages X/XX in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=29597 (no direct solution)
6. ALV printing problems. The favourite is: The first page shows the number of records selected but I don't need this.
http://www.sapfans.com/forums/viewtopic.php?t=64320
http://www.sapfans.com/forums/viewtopic.php?t=44477
7. How can I set the cell color in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=52107
8. How do I print a logo/graphics in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=81149
http://www.sapfans.com/forums/viewtopic.php?t=35498
http://www.sapfans.com/forums/viewtopic.php?t=5013
9. How do I create and use input-enabled fields in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=84933
http://www.sapfans.com/forums/viewtopic.php?t=69878
10. How can I use ALV for reports that are going to be run in background?
http://www.sapfans.com/forums/viewtopic.php?t=83243
http://www.sapfans.com/forums/viewtopic.php?t=19224
11. How can I display an icon in ALV? (Common requirement is traffic light icon).
http://www.sapfans.com/forums/viewtopic.php?t=79424
http://www.sapfans.com/forums/viewtopic.php?t=24512
12. How can I display a checkbox in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=88376
http://www.sapfans.com/forums/viewtopic.php?t=40968
http://www.sapfans.com/forums/viewtopic.php?t=6919
13. Top-of-page in ALV
selection-screen and top-of-page in ALV
14. ALV Group Heading
http://www.sap-img.com/fu037.htm
How to add list heading like top-of-page in ABAP lists?
http://www.sapfans.com/forums/viewtopic.php?t=58775
http://www.sapfans.com/forums/viewtopic.php?t=60550
http://www.sapfans.com/forums/viewtopic.php?t=16629
15. ALV output to PDF conversion
It has an example code for PDF Conversion.
http://www.erpgenie.com/abap/code/abap51.htm
converting the output of alv in pdf
Go thru these programs they may help u to try on some hands on
ALV Demo program
BCALV_DEMO_HTML
BCALV_FULLSCREEN_DEMO ALV Demo: Fullscreen Mode
BCALV_FULLSCREEN_DEMO_CLASSIC ALV demo: Fullscreen mode
BCALV_GRID_DEMO Simple ALV Control Call Demo Program
BCALV_TREE_DEMO Demo for ALV tree control
BCALV_TREE_SIMPLE_DEMO
BC_ALV_DEMO_HTML_D0100
The common features of report are column alignment, sorting, filtering, subtotals, totals etc. To implement these, a lot of coding and logic is to be put. To avoid that we can use a concept called ABAP List Viewer (ALV).
This helps us to implement all the features mentioned very effectively.
Using ALV, We can have three types of reports:
1. Simple Report
2. Block Report
3. Hierarchical Sequential Report
There are some function modules which will enable to produce the above reports without much effort.
All the definitions of internal tables, structures and constants are declared in a type-pool called SLIS.
1. SIMPLE REPORT.
The important function modules are
a. Reuse_alv_list_display
b. Reuse_alv_fieldcatalog_merge
c. Reuse_alv_events_get
d. Reuse_alv_commentary_write
e. Reuse_alv_grid_display
A. REUSE_ALV_LIST_DISPLAY : This is the function module which prints the data.
The important parameters are :
I. Export :
i. I_callback_program : report id
ii. I_callback_pf_status_set : routine where a user can set his own pf status or change the functionality of the existing pf status
iii. I_callback_user_command : routine where the function codes are handled
iv. I_structure name : name of the dictionary table
v. Is_layout : structure to set the layout of the report
vi. It_fieldcat : internal table with the list of all fields and their attributes which are to be printed (this table can be populated automatically by the function module REUSE_ALV_FIELDCATALOG_MERGE
vii. It_events : internal table with a list of all possible events of ALV and their corresponding form names.
II. Tables :
i. t_outtab : internal table with the data to be output
B. REUSE_ALV_FIELDCATALOG_MERGE : This function module is used to populate a fieldcatalog which is essential to display the data in ALV. If the output data is from a single dictionary table and all the columns are selected, then we need not exclusively create the field catalog. Its enough to mention the table name as a parameter(I_structure name) in the REUSE_ALV_LIST_DISPLAY. But in other cases we need to create it.
The Important Parameters are :
I. Export :
i. I_program_name : report id
ii. I_internal_tabname : the internal output table
iii. I_inclname : include or the report name where all the dynamic forms are handled.
II Changing
ct_fieldcat : an internal table with the type SLIS_T_FIELDCAT_ALV which is
declared in the type pool SLIS.
C. REUSE_ALV_EVENTS_GET : Returns table of possible events for a list type
Parameters :
I. Import :
Et_Events : The event table is returned with all possible CALLBACK events
for the specified list type (column 'NAME'). For events to be processed by Callback, their 'FORM' field must be filled. If the field is initialized, the event is ignored. The entry can be read from the event table, the field 'FORM' filled and the entry modified using constants from the type pool SALV.
II. Export :
I_List_type :
0 = simple list REUSE_ALV_LIST_DISPLAY
1 = hierarchcal-sequential list REUSE_ALV_HIERSEQ_LIST_DISPLAY
2 = simple block list REUSE_ALV_BLOCK_LIST_APPEND
3 = hierarchical-sequential block list
REUSE_ALV_BLOCK_LIST_HS_APPEND
D. REUSE_ALV_COMMENTARY_WRITE : This is used in the Top-of-page event to print the headings and other comments for the list.
Parameters :
I. it_list_commentary : internal table with the headings of the type slis_t_listheader.
This internal table has three fields :
Typ : H header, S selection , A - action
Key : only when typ is S.
Info : the text to be printed
E. REUSE_ALV_GRID_DISPLAY : A new function in 4.6 version, to display the results in grid rather than as a preview.
Parameters : same as reuse_alv_list_display
This is an example for simple list.
2. BLOCK REPORT
This is used to have multiple lists continuously.
The important functions used in this report are:
A. REUSE_ALV_BLOCK_LIST_INIT
B. REUSE_ALV_BLOCK_LIST_APPEND
C. REUSE_ALV_BLOCK_LIST_HS_APPEND
D. REUSE_ALV_BLOCK_LIST_DISPLAY
A. REUSE_ALV_BLOCK_LIST_INIT
Parameters:
I. I_CALLBACK_PROGRAM
II. I_CALLBACK_PF_STATUS_SET
III. I_CALLBACK_USER_COMMAND
This function module is used to set the default gui status etc.
B. REUSE_ALV_BLOCK_LIST_APPEND
Parameters :
Export :
I. is_layout : layout settings for block
II. it_fieldcat : field catalog
III. i_tabname : internal table name with output data
IV. it_events : internal table with all possible events
Tables :
i. t_outtab : internal table with output data.
This function module adds the data to the block.
Repeat this function for all the different blocks to be displayed one after the other.
C. REUSE_ALV_BLOCK_LIST_HS_APPEND
This function module is used for hierarchical sequential blocks.
D. REUSE_ALV_BLOCK_LIST_DISPLAY
Parameters : All the parameters are optional.
This function module display the list with data appended by the above function.
Here the functions REUSE_ALV_FIELDCATALOG_MERGE, REUSE_ALV_EVENTS_GET, REUSE_ALV_COMMENTARY_WRITE can be used.
3. Hierarchical reports :
Hierarchical sequential list output.
The function module is
A. REUSE_ALV_HIERSEQ_LIST_DISPLAY
Parameters:
I. Export:
i. I_CALLBACK_PROGRAM
ii. I_CALLBACK_PF_STATUS_SET
iii. I_CALLBACK_USER_COMMAND
iv. IS_LAYOUT
v. IT_FIELDCAT
vi. IT_EVENTS
vii. i_tabname_header : Name of the internal table in the program containing the
output data of the highest hierarchy level.
viii. i_tabname_item : Name of the internal table in the program containing the
output data of the lowest hierarchy level.
ix. is_keyinfo : This structure contains the header and item table field
names which link the two tables (shared key).
II. Tables
i. t_outtab_header : Header table with data to be output
ii. t_outtab_item : Name of the internal table in the program containing the
output data of the lowest hierarchy level.
slis_t_fieldcat_alv : This internal table contains the field attributes. This internal table can be populated automatically by using REUSE_ALV_FIELDCATALOG_MERGE.
Important Attributes :
A. col_pos : position of the column
B. fieldname : internal fieldname
C. tabname : internal table name
D. ref_fieldname : fieldname (dictionary)
E. ref_tabname : table (dictionary)
F. key(1) : column with key-color
G. icon(1) : icon
H. symbol(1) : symbol
I. checkbox(1) : checkbox
J. just(1) : (R)ight (L)eft (C)ent.
K. do_sum(1) : sum up
L. no_out(1) : (O)blig.(X)no out
M. outputlen : output length
N. seltext_l : long key word
O. seltext_m : middle key word
P. seltext_s : short key word
Q. reptext_ddic : heading (ddic)
R. ddictxt(1) : (S)hort (M)iddle (L)ong
S. datatype : datatype
T. hotspot(1) : hotspot
Regards
Anji -
List header for alv grid using abap objects
Hai all,
I have displayed alv grid in container control using abap objects i.e. using method set_table_for_first_display.
now i need to display list header for this alv grid.
please help me how to create with a sample coding.
Thanks and regards,
Prabu S.Create a splitter using CL_GUI_EASY_SPLITTER_CONTAINER with a top and bottom half. Put the alv grid in the bottom half. Use cl_dd_document (documented in help.sap.com ) to build the header in the top half. Use events on CL_GUI_ALV_GRID to handle the top-of-list printing.
Or, if available, use CL_SALV_TABLE, and read the documentation on that. When I needed a header for my report, that's what I did. There's plenty of good documentation about if you'll search for it.
matt -
Need simple example of flex2 to webservice
Hello,
I understand that so long as you don't use remote objects,
you don't have to buy the FDS! So how do I bypass using FDS and
just use HTTPS or webservices?
Can someone point me in the right direction with a
good/simple example of using flex 2.0 with https and/or
webservices?
Thanks,
K.OK - I finally get this. I guess that SAP Business One is the entry level, least expensive license. If my company buys SAP Business One, will that provide the R/3 system and BAPIs to build some demos? And can I hook up SAP Business One to the Sneak Preview SAP NewWeaver 6.40 in order to invoke the BAPIs using Java?
And I guess that if we buy SAP Busienss One, then I don't need 6.40 ABAP stack to invoke the BAPIS - or do I?
Thanks for your help. -
Need some examples for smartforms and scripts
hi
now i am working in scripts and smartforms. so i need some examples and some information for scripts and smartforms. where i can find that information.hi jyothsna,
i have given below a simple example
this is the report program,
*& Report ZSCRIPT1 *
REPORT ZSCRIPT1 .
TABLES : EKKO,
EKPO,
KNA1,
USR01,
MARA,
MAKT.
DATA : BEGIN OF ZOPTION.
INCLUDE STRUCTURE ITCPO.
DATA : END OF ZOPTION.
PARAMETERS: P_EBELN LIKE EKKO-EBELN,
P_EBELP LIKE EKPO-EBELP.
CLEAR EKPO.
SELECT SINGLE * FROM EKPO
WHERE EBELN = P_EBELN AND
EBELP = P_EBELP.
CLEAR KNA1.
SELECT SINGLE NAME1 FROM KNA1
INTO KNA1-NAME1
WHERE KUNNR = EKPO-KUNNR.
CLEAR MAKT.
SELECT SINGLE MAKTX FROM MAKT
INTO MAKT-MAKTX
WHERE MATNR = EKPO-MATNR AND
SPRAS = SY-LANGU.
CLEAR USR01.
SELECT SINGLE * FROM USR01 WHERE BNAME = SY-UNAME.
ZOPTION-TDDEST = USR01-SPLD. "Output device (printer)
ZOPTION-TDIMMED = 'X'. "Print immediately
ZOPTION-TDDELETE = 'X'. "Delete after printing
ZOPTION-TDPROGRAM = 'ZPQRPRNT'. "Program Name
CALL FUNCTION 'OPEN_FORM'
EXPORTING
APPLICATION = 'TX'
ARCHIVE_INDEX = ' '
ARCHIVE_PARAMS = ' '
DEVICE = 'PRINTER'
DIALOG = ' '
FORM = 'ZFORM1'
LANGUAGE = SY-LANGU
OPTIONS = ZOPTION
IMPORTING
LANGUAGE = SY-LANGU
EXCEPTIONS
OTHERS = 1.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'HEADER'
FUNCTION = 'SET'
TYPE = 'BODY'
WINDOW = 'HEADER'
EXCEPTIONS
ELEMENT = 1.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'MAIN'
FUNCTION = 'SET'
TYPE = 'BODY'
WINDOW = 'MAIN'
EXCEPTIONS
ELEMENT = 1.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'FOOTER'
FUNCTION = 'SET'
TYPE = 'BODY'
WINDOW = 'FOOTER'
EXCEPTIONS
ELEMENT = 1.
CALL FUNCTION 'CLOSE_FORM'
EXCEPTIONS
UNOPENED = 1
OTHERS = 2.
This is the layout Set
Layout set Z_TESTSCRIPT
Description Test SAP script
Standard attributes
First page FIRST
Default paragraph P1
Tab-stop 1.00 CH
Page format DINA4
Orientation Landscape
Lines/inch 6.00
Characters/inch 10.00
Font attributes
Font family COURIER
Font size 12.0 Point
Bold No
Italic No
Underlined No
Characters Attributes
B Character String Bold
Standard attributes
Marker No
Font attributes
Bold Yes
Paragraphs Attributes
P1 Default Paragraph
Standard attributes
Line spacing 1.00 LN
Left margin 1.00 CM
Alignment Left-aligned
Font attributes
Font family TIMES
Font size 12.0 Point
P2 Header Paragraph
Standard attributes
Line spacing 1.00 LN
Left margin 4.50 CM
Alignment Left-aligned
Font attributes
Font family TIMES
Font size 18.0 Point
Bold Yes
P3 Undelined paragraph
Standard attributes
Line spacing 1.00 LN
Alignment Left-aligned
Font attributes
Font family TIMES
Font size 12.0 Point
Underlined Yes
Windows Attributes
MAIN Main window
Window type MAIN
HEADER Main window
Window type CONSTANT
FOOTER Main window
Window type CONSTANT
Pages Attributes
FIRST First Page
Standard attributes
Next page FIRST
Page counter
Mode START
Numbering type Arabic numerals
Page window
HEADER Left margin 00.00 CM
Upper margin 00.00 CM
Window width 20.00 CM
Window height 04.00 CM
MAIN Left margin 00.00 CM
Upper margin 05.00 CM
Window width 20.00 CM
Window height 20.00 CM
FOOTER Left margin 00.00 CM
Upper margin 25.00 CM
Window width 20.00 CM
Window height 04.00 CM
Text elements for following windows:
HEADER
Element HEADER
/: POSITION XORIGIN 2 CM YORIGIN '-0.5 CM'
/: BOX XPOS 1 CM YPOS 1 CM WIDTH 18 CM HEIGHT 1 CM FRAME 10 TW INTENSITY 10
P2 ,,<B>TEST PURCHASE ORDER</>
MAIN
Element MAIN
P1 <B>Customer/Supplier:</>,,&KNA1-NAME1&
P1 <B>PO No:</>,,&EKPO-EBELN&
P1 <B>Part No:</>,,&MAKT-MATNR&
P1 <B>Description:</>,,&MAKT-MAKTX&
P1 <B>Quantity:,,</>&EKPO-MENGE&
P1 <B>Sign:</>&uline(81)&
P1 <B>Date:</>&EKKO-AEDAT&
FOOTER
Element FOOTER
/: POSITION XORIGIN 2 CM YORIGIN '-0.5 CM'
/: BOX XPOS 1 CM YPOS 1 CM WIDTH 18 CM HEIGHT 1 CM FRAME 10 TW INTENSITY 10
P2 ,,<B>PLEASE SIGN THE PO BEFORE DISPATCH</>
<b>reward if useful :)</b> -
BDC Recording for ALV Grid in containers
Hi All,
I have to record for BDC on an ALV Grid (OOABAP). I am not able to record selection of rows in ALV grid.How do i select rows in the grid dynamically that is while recording.
Thanks n Regards,
Santosh Kotra.Usually it is not a good idea to do recording over a transaction which includes frontend gui controls, such as, tree controls and ALV controls, for this exact reason, among others. Try to use a older version of the transactoin if possible or a BAPI. For example, if you are trying to do a recording over say ME21N, it is recommended to do the recording over the non-enjoy transaction, ME21, or simply use the BAPI.
Regards,
Rich Heilman -
How to upload logo for alv grid when we are using classes
Hi am using cl_gui_alv_tree for displaying alv grid. i want to upload logo in the heade section. as we do in simple alvs using resuse_alv_commentary_write.
plz update me in this regard.
regards
venkatWelcome to SDN.
Check the following threads -
How To use TOP OF PAGE event in OOPS ALV?
Logo & TOP_OF_PAGE in OO ALV
Regards,
Amit
Reward all helpful replies.
Maybe you are looking for
-
I messed up in boot camp.
Okay, admittedly this one is probably my fault, but I was trying to fix boot camp, which was loading slowly, and now it doesn't work at all. So I try to delete that partition and start over again, but it comes up with a message of "The startup disk c
-
Mac OS 10.5 - Package unavailable on peer
I have AnyConnect client version v2.2 - when I connect I get the message AnyConnect package unavailable on the peer. (It does authenticate me, b/c if I enter an incorrect password I get password failure.) Once connected the message comes up and then
-
(Please Help) making buttons clickable (layout done in photoshop)
I am a newbie to all of this. I been trying to learn html/css and I am still learning it but I needed a quick way to get my website up and running. So, I created my layout in photoshop, I sliced it and imported it anything dreamweaver. I made the con
-
Hello, I'm looking for some tutorials to best get a grasp of Mainstage. Can anyone recommend one or some? Thanks
-
Printer wmail address or IP address
Hi I'm trying to use ePrint in my ipad but it can't detect my printer which is an HP Deskjet Ink Advantage 2545. When I tried adding a printer, it asked for the printer wmail address or IP address. Where can I find these? Thanks.